add the notion of unbound variables to register allocators.

This commit is contained in:
Mark Thom
2018-04-05 14:02:20 -06:00
parent 31e07420e7
commit 7c4af6f311
2 changed files with 6 additions and 2 deletions

View File

@@ -48,7 +48,11 @@ pub trait Allocator<'a>
}
fn get(&self, var: Rc<Var>) -> RegType {
self.bindings().get(&var).unwrap().as_reg_type()
self.bindings().get(&var).map_or(temp_v!(0), |v| v.as_reg_type())
}
fn is_unbound(&self, var: Rc<Var>) -> bool {
self.get(var) == temp_v!(0)
}
fn record_register(&mut self, var: Rc<Var>, r: RegType) {