Generalize rpo_cmp to handle all program points.

When comparing instructions in the same EBB, behave like the RPO visits
instructions in program order.

- Add a Layout::pp_ebb() method for convenience. It gets the EBB
  containing any program point.
- Add a conversion from ValueDef to ExpandedProgramPoint so it can be
  used with the rpo_cmp method.
This commit is contained in:
Jakob Stoklund Olesen
2017-06-12 13:53:12 -07:00
parent 706eef23d3
commit 4f9ff548bd
3 changed files with 48 additions and 5 deletions

View File

@@ -63,6 +63,15 @@ impl From<Ebb> for ExpandedProgramPoint {
}
}
impl From<ValueDef> for ExpandedProgramPoint {
fn from(def: ValueDef) -> ExpandedProgramPoint {
match def {
ValueDef::Res(inst, _) => inst.into(),
ValueDef::Arg(ebb, _) => ebb.into(),
}
}
}
impl From<ProgramPoint> for ExpandedProgramPoint {
fn from(pp: ProgramPoint) -> ExpandedProgramPoint {
if pp.0 & 1 == 0 {