Add a minimalistic reload pass.

The reload pass inserts spill and fill instructions as needed so
instructions that operate on registers will never see a value with stack
affinity.

This is a very basic implementation, and we can't write good test cases
until we have a spilling pass.
This commit is contained in:
Jakob Stoklund Olesen
2017-05-24 09:28:15 -07:00
parent ac1db6e3c9
commit d94bd8c236
5 changed files with 306 additions and 1 deletions

View File

@@ -323,6 +323,16 @@ pub enum ValueDef {
Arg(Ebb, usize),
}
impl ValueDef {
/// Unwrap the instruction where the value was defined, or panic.
pub fn unwrap_inst(&self) -> Inst {
match self {
&ValueDef::Res(inst, _) => inst,
_ => panic!("Value is not an instruction result"),
}
}
}
// Internal table storage for extended values.
#[derive(Clone, Debug)]
enum ValueData {