Commit ef19bc34 authored by qinsoon's avatar qinsoon

[wip] more debugging info

parent 9c0d8d0a
......@@ -763,7 +763,7 @@ impl Value {
}
}
const DISPLAY_TYPE : bool = false;
const DISPLAY_TYPE : bool = true;
const PRINT_ABBREVIATE_NAME: bool = true;
impl fmt::Debug for Value {
......
......@@ -66,22 +66,19 @@ pub fn emit_mu_types(vm: &VM) {
let hybrid_map = HYBRID_TAG_MAP.read().unwrap();
for ty in ty_guard.values() {
match ty.name() {
Some(name) => file.write_fmt(format_args!("{} = ", name)).unwrap(),
None => {}
}
if ty.is_struct() {
file.write_fmt(format_args!("{}", ty)).unwrap();
let struct_ty = struct_map.get(&ty.get_struct_hybrid_tag().unwrap()).unwrap();
file.write_fmt(format_args!(" -> {}\n", struct_ty)).unwrap();
file.write_fmt(format_args!(" {}\n", vm.get_backend_type_info(ty.id()))).unwrap();
} else if ty.is_hybrid() {
file.write_fmt(format_args!("{}", ty)).unwrap();
let hybrid_ty = hybrid_map.get(&ty.get_struct_hybrid_tag().unwrap()).unwrap();
file.write_fmt(format_args!(" -> {}\n", hybrid_ty)).unwrap();
file.write_fmt(format_args!(" {}\n", vm.get_backend_type_info(ty.id()))).unwrap();
} else {
file.write_fmt(format_args!("{}\n", ty)).unwrap();
// we only care about struct
}
}
}
......
......@@ -289,6 +289,21 @@ impl BackendTypeInfo {
}
}
use std::fmt;
impl fmt::Display for BackendTypeInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{} bytes ({} bytes aligned), ", self.size, self.alignment).unwrap();
if self.struct_layout.is_some() {
use utils::vec_utils;
let layout = self.struct_layout.as_ref().unwrap();
write!(f, "field offsets: ({})", vec_utils::as_str(layout)).unwrap();
}
Ok(())
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum RegGroup {GPR, FPR}
......
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