Implement a conversion from ValueDef into ProgramPoint.
A ValueDef is really no more than a program point plus an argument/result number.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Program points.
|
||||
|
||||
use entity_map::EntityRef;
|
||||
use ir::{Ebb, Inst};
|
||||
use ir::{Ebb, Inst, ValueDef};
|
||||
use std::fmt;
|
||||
use std::u32;
|
||||
use std::cmp;
|
||||
@@ -32,6 +32,15 @@ impl From<Ebb> for ProgramPoint {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ValueDef> for ProgramPoint {
|
||||
fn from(def: ValueDef) -> ProgramPoint {
|
||||
match def {
|
||||
ValueDef::Res(inst, _) => inst.into(),
|
||||
ValueDef::Arg(ebb, _) => ebb.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An expanded program point directly exposes the variants, but takes twice the space to
|
||||
/// represent.
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
|
||||
Reference in New Issue
Block a user