Add a ValueLoc type and the locations table.

This table holds the result of register allocation.
This commit is contained in:
Jakob Stoklund Olesen
2016-12-08 13:57:28 -10:00
parent a08a470a18
commit e1c5abaff5
4 changed files with 43 additions and 2 deletions

View File

@@ -98,6 +98,17 @@ impl Default for Inst {
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct Value(u32);
impl EntityRef for Value {
fn new(index: usize) -> Value {
assert!(index < (u32::MAX as usize));
Value(index as u32)
}
fn index(self) -> usize {
self.0 as usize
}
}
/// Value references can either reference an instruction directly, or they can refer to the
/// extended value table.
pub enum ExpandedValue {