add the notion of unbound variables to register allocators.
This commit is contained in:
@@ -48,7 +48,11 @@ pub trait Allocator<'a>
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get(&self, var: Rc<Var>) -> RegType {
|
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) {
|
fn record_register(&mut self, var: Rc<Var>, r: RegType) {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
extern crate num;
|
extern crate num;
|
||||||
extern crate ordered_float;
|
extern crate ordered_float;
|
||||||
|
|
||||||
pub mod allocator;
|
|
||||||
pub mod and_stack;
|
pub mod and_stack;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod macros;
|
pub mod macros;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod ast;
|
pub mod ast;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
pub mod allocator;
|
||||||
pub mod arithmetic;
|
pub mod arithmetic;
|
||||||
pub mod builtins;
|
pub mod builtins;
|
||||||
pub mod codegen;
|
pub mod codegen;
|
||||||
|
|||||||
Reference in New Issue
Block a user