Only color EBB arguments that have register affinity.
It is possible to pass a register value as an argument to an EBB that expects a "None" affinity. In that case, the destination EBB value should not be colored.
This commit is contained in:
@@ -200,13 +200,13 @@ impl<'a> Context<'a> {
|
|||||||
.get(value)
|
.get(value)
|
||||||
.expect("No live range for live-in")
|
.expect("No live range for live-in")
|
||||||
.affinity;
|
.affinity;
|
||||||
|
dbg!("Live-in: {}:{} in {}",
|
||||||
|
value,
|
||||||
|
affinity.display(&self.reginfo),
|
||||||
|
func.locations[value].display(&self.reginfo));
|
||||||
if let Affinity::Reg(rci) = affinity {
|
if let Affinity::Reg(rci) = affinity {
|
||||||
let rc = self.reginfo.rc(rci);
|
let rc = self.reginfo.rc(rci);
|
||||||
let loc = func.locations[value];
|
let loc = func.locations[value];
|
||||||
dbg!("Live-in: {}:{} in {}",
|
|
||||||
lv.value,
|
|
||||||
rc,
|
|
||||||
loc.display(&self.reginfo));
|
|
||||||
match loc {
|
match loc {
|
||||||
ValueLoc::Reg(reg) => regs.take(rc, reg),
|
ValueLoc::Reg(reg) => regs.take(rc, reg),
|
||||||
ValueLoc::Unassigned => panic!("Live-in {} wasn't assigned", value),
|
ValueLoc::Unassigned => panic!("Live-in {} wasn't assigned", value),
|
||||||
@@ -471,7 +471,12 @@ impl<'a> Context<'a> {
|
|||||||
// This is the first branch to `dest`, so we should color `dest_arg` instead of
|
// This is the first branch to `dest`, so we should color `dest_arg` instead of
|
||||||
// `br_arg`. However, we don't know where `br_arg` will end up until
|
// `br_arg`. However, we don't know where `br_arg` will end up until
|
||||||
// after `shuffle_inputs`. See `color_ebb_arguments` below.
|
// after `shuffle_inputs`. See `color_ebb_arguments` below.
|
||||||
return true;
|
//
|
||||||
|
// It is possible for `dest_arg` to have no affinity, and then it should simply
|
||||||
|
// be ignored.
|
||||||
|
if self.liveness.get(dest_arg).unwrap().affinity.is_reg() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ValueLoc::Reg(dest_reg) => {
|
ValueLoc::Reg(dest_reg) => {
|
||||||
// We've branched to `dest` before. Make sure we use the correct argument
|
// We've branched to `dest` before. Make sure we use the correct argument
|
||||||
@@ -513,8 +518,10 @@ impl<'a> Context<'a> {
|
|||||||
for (&dest_arg, &br_arg) in dest_args.iter().zip(br_args) {
|
for (&dest_arg, &br_arg) in dest_args.iter().zip(br_args) {
|
||||||
match locations[dest_arg] {
|
match locations[dest_arg] {
|
||||||
ValueLoc::Unassigned => {
|
ValueLoc::Unassigned => {
|
||||||
let br_reg = self.divert.reg(br_arg, locations);
|
if self.liveness.get(dest_arg).unwrap().affinity.is_reg() {
|
||||||
locations[dest_arg] = ValueLoc::Reg(br_reg);
|
let br_reg = self.divert.reg(br_arg, locations);
|
||||||
|
locations[dest_arg] = ValueLoc::Reg(br_reg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ValueLoc::Reg(_) => panic!("{} arg {} already colored", dest, dest_arg),
|
ValueLoc::Reg(_) => panic!("{} arg {} already colored", dest, dest_arg),
|
||||||
// Spilled value consistency is verified by `program_ebb_arguments()` above.
|
// Spilled value consistency is verified by `program_ebb_arguments()` above.
|
||||||
|
|||||||
Reference in New Issue
Block a user