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

@@ -4,8 +4,8 @@
//! instructions.
use std::fmt::{self, Display, Debug, Formatter};
use ir::{FunctionName, Signature, Inst, StackSlot, StackSlotData, JumpTable, JumpTableData,
DataFlowGraph, Layout};
use ir::{FunctionName, Signature, Value, Inst, StackSlot, StackSlotData, JumpTable, JumpTableData,
ValueLoc, DataFlowGraph, Layout};
use isa::Encoding;
use entity_map::{EntityMap, PrimaryEntityData};
use write::write_function;
@@ -37,6 +37,9 @@ pub struct Function {
/// Encoding recipe and bits for the legal instructions.
/// Illegal instructions have the `Encoding::default()` value.
pub encodings: EntityMap<Inst, Encoding>,
/// Location assigned to every value.
pub locations: EntityMap<Value, ValueLoc>,
}
impl PrimaryEntityData for StackSlotData {}
@@ -53,6 +56,7 @@ impl Function {
dfg: DataFlowGraph::new(),
layout: Layout::new(),
encodings: EntityMap::new(),
locations: EntityMap::new(),
}
}