Always call reassign_in for register ABI arguments.

Even if an argument is already in the correct register, make sure that
we detect conflicts by registering the no-op move. This also means that
the ABI argument register won't be turned into a variable for the
solver.
This commit is contained in:
Jakob Stoklund Olesen
2017-06-14 12:05:47 -07:00
parent 897c363714
commit 96f1228211
2 changed files with 19 additions and 19 deletions

View File

@@ -430,14 +430,13 @@ impl<'a> Context<'a> {
locations: &EntityMap<Value, ValueLoc>) {
for (abi, &value) in abi_types.iter().zip(dfg.inst_variable_args(inst)) {
if let ArgumentLoc::Reg(reg) = abi.location {
let cur_reg = self.divert.reg(value, locations);
if reg != cur_reg {
if let Affinity::Reg(rci) =
self.liveness
.get(value)
.expect("ABI register must have live range")
.affinity {
let rc = self.reginfo.rc(rci);
let cur_reg = self.divert.reg(value, locations);
self.solver.reassign_in(value, rc, cur_reg, reg);
} else {
panic!("ABI argument {} should be in a register", value);
@@ -445,7 +444,6 @@ impl<'a> Context<'a> {
}
}
}
}
// Find existing live values that conflict with the fixed input register constraints programmed
// into the constraint solver. Convert them to solver variables so they can be diverted.

View File

@@ -364,6 +364,7 @@ impl Solver {
}
self.regs_in.free(rc, from);
self.regs_out.take(rc, to);
if from != to {
self.assignments
.insert(Assignment {
value,
@@ -372,6 +373,7 @@ impl Solver {
to,
});
}
}
/// Add a variable representing an input side value with an existing register assignment.
///