Commit 9c9c9b2b authored by qinsoon's avatar qinsoon

[wip] small fixes

parent e53f5d4f
......@@ -684,7 +684,7 @@ pub enum TreeNode_ {
}
/// always use with P<Value>
#[derive(Debug, PartialEq, RustcEncodable, RustcDecodable)]
#[derive(PartialEq, RustcEncodable, RustcDecodable)]
pub struct Value {
pub hdr: MuEntityHeader,
pub ty: P<MuType>,
......@@ -769,6 +769,12 @@ impl Value {
const DISPLAY_TYPE : bool = false;
impl fmt::Debug for Value {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self)
}
}
impl fmt::Display for Value {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if DISPLAY_TYPE {
......@@ -792,7 +798,7 @@ impl fmt::Display for Value {
write!(f, "%{}", self.hdr)
},
Value_::Constant(ref c) => {
write!(f, "{} @{}", c, self.hdr)
write!(f, "{}", c)
},
Value_::Global(_) => {
write!(f, "GLOBAL @{}", self.hdr)
......@@ -921,7 +927,7 @@ pub enum Constant {
impl fmt::Display for Constant {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&Constant::Int(v) => write!(f, "{}", v),
&Constant::Int(v) => write!(f, "{}", v as i64),
&Constant::Float(v) => write!(f, "{}", v),
&Constant::Double(v) => write!(f, "{}", v),
// &Constant::IRef(v) => write!(f, "{}", v),
......
......@@ -173,7 +173,7 @@ impl AliveEntries {
}
pub fn add_temp_in_mem(&mut self, temp: MuID, mem: P<Value>) {
debug!("alive alive temp in mem: {} in {}", temp, mem);
debug!("adding alive temp in mem: {} in {}", temp, mem);
let entry_exists = self.has_entries_for_temp(temp);
......
......@@ -46,9 +46,10 @@ pub fn validate_regalloc(cf: &CompiledFunction,
for (_, reg) in frame.argument_by_reg.iter() {
alive.new_alive_reg(alias(reg.id()));
}
for (_, stack) in frame.argument_by_stack.iter() {
alive.new_alive_mem(stack.clone());
}
// we do not consider mem loc for arguments - we do consider mem loc for spilling
// for (_, stack) in frame.argument_by_stack.iter() {
// alive.new_alive_mem(stack.clone());
// }
debug!("alive entries in the beginning");
debug!("{}", alive);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment