machinst x64: have cmov modify its destination operand;

This is tricky: the control flow implicitly implied by the operand makes
it so that the output register may be undefined, if we mark it only as a
"def". Make it a "mod" instead, which matches our usage in the codebase,
and will make it crash if the output operand isn't unconditionally
defined before the instruction.
This commit is contained in:
Benjamin Bouvier
2020-07-06 15:42:31 +02:00
parent aa7db7fd7b
commit 33e0d05645

View File

@@ -905,7 +905,7 @@ fn x64_get_regs(inst: &Inst, collector: &mut RegUsageCollector) {
} }
Inst::Cmove { src, dst, .. } => { Inst::Cmove { src, dst, .. } => {
src.get_regs_as_uses(collector); src.get_regs_as_uses(collector);
collector.add_def(*dst); collector.add_mod(*dst);
} }
Inst::Push64 { src } => { Inst::Push64 { src } => {
src.get_regs_as_uses(collector); src.get_regs_as_uses(collector);
@@ -1126,7 +1126,7 @@ fn x64_map_regs<RUM: RegUsageMapper>(inst: &mut Inst, mapper: &RUM) {
.. ..
} => { } => {
src.map_uses(mapper); src.map_uses(mapper);
map_def(mapper, dst) map_mod(mapper, dst)
} }
Inst::Push64 { ref mut src } => src.map_uses(mapper), Inst::Push64 { ref mut src } => src.map_uses(mapper),
Inst::Pop64 { ref mut dst } => { Inst::Pop64 { ref mut dst } => {