Skip to content

Commit 64df42b

Browse files
authored
Handle dedicated scratch registers in the redundant move eliminator (#138)
When a dedicated scratch register is provided by the environment, the redundant move eliminator needs to assume that this register can be clobbered by any instruction. This register can't be specified as a clobber because it is also used by jump instructions which cannot have operands.
1 parent d3a4ee9 commit 64df42b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ion/moves.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,13 @@ impl<'a, F: Function> Env<'a, F> {
828828
for reg in this.func.inst_clobbers(inst) {
829829
redundant_moves.clear_alloc(Allocation::reg(reg));
830830
}
831+
// The dedicated scratch registers may be clobbered by any
832+
// instruction.
833+
for reg in this.env.scratch_by_class {
834+
if let Some(reg) = reg {
835+
redundant_moves.clear_alloc(Allocation::reg(reg));
836+
}
837+
}
831838
}
832839
}
833840

0 commit comments

Comments
 (0)