GitLab will continue to be upgraded from 11.4.5-ce.0 on November 25th 2019 at 4.00pm (AEDT) to 5.00pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available.

Commit 0ef55d45 authored by qinsoon's avatar qinsoon

[wip] revert all changes about register alias, simple_spill works fine

now
parent 8af66a04
Pipeline #78 failed with stage
in 19 minutes and 15 seconds
......@@ -625,7 +625,7 @@ impl ASMInst {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
struct ASMLocation {
line: usize,
index: usize,
......@@ -1282,7 +1282,8 @@ macro_rules! emit_mov_mem_r {
// the register we used for the memory location is counted as 'use'
// use the vec from mem as 'use' (push use reg from src to it)
if uses.contains_key(&id1) {
uses.get_mut(&id1).unwrap().push(loc1);
let mut locs = uses.get_mut(&id1).unwrap();
vec_utils::add_unique(locs, loc1);
} else {
uses.insert(id1, vec![loc1]);
}
......@@ -1488,7 +1489,7 @@ impl CodeGenerator for ASMCodeGen {
self.add_asm_symbolic(directive_globl(func_symbol.clone()));
self.add_asm_symbolic(format!("{}:", func_symbol.clone()));
ValueLocation::Relocatable(RegGroup::GPR64, func_name)
ValueLocation::Relocatable(RegGroup::GPR, func_name)
}
fn finish_code(&mut self, func_name: MuName) -> (Box<MachineCode + Sync + Send>, ValueLocation) {
......@@ -1504,7 +1505,7 @@ impl CodeGenerator for ASMCodeGen {
(
self.cur.take().unwrap(),
ValueLocation::Relocatable(RegGroup::GPR64, func_end)
ValueLocation::Relocatable(RegGroup::GPR, func_end)
)
}
......@@ -1554,7 +1555,7 @@ impl CodeGenerator for ASMCodeGen {
self.start_block(block_name.clone());
ValueLocation::Relocatable(RegGroup::GPR64, mangled_name)
ValueLocation::Relocatable(RegGroup::GPR, mangled_name)
}
fn end_block(&mut self, block_name: MuName) {
......@@ -2293,7 +2294,7 @@ impl CodeGenerator for ASMCodeGen {
self.add_asm_symbolic(directive_globl(callsite_symbol.clone()));
self.add_asm_symbolic(format!("{}:", callsite_symbol.clone()));
ValueLocation::Relocatable(RegGroup::GPR64, callsite)
ValueLocation::Relocatable(RegGroup::GPR, callsite)
}
fn emit_call_near_r64(&mut self, callsite: String, func: &P<Value>) -> ValueLocation {
......
This diff is collapsed.
......@@ -170,16 +170,16 @@ pub struct BackendTypeInfo {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum RegGroup {GPR8, GPR16, GPR32, GPR64, FPR32, FPR64}
pub enum RegGroup {GPR, FPR}
impl RegGroup {
pub fn get(ty: &P<MuType>) -> RegGroup {
match ty.v {
// for now, only use 64bits registers
MuType_::Int(len) if len == 8 => RegGroup::GPR64,
MuType_::Int(len) if len == 16 => RegGroup::GPR64,
MuType_::Int(len) if len == 32 => RegGroup::GPR64,
MuType_::Int(len) if len == 64 => RegGroup::GPR64,
MuType_::Int(len) if len == 8 => RegGroup::GPR,
MuType_::Int(len) if len == 16 => RegGroup::GPR,
MuType_::Int(len) if len == 32 => RegGroup::GPR,
MuType_::Int(len) if len == 64 => RegGroup::GPR,
MuType_::Ref(_)
| MuType_::IRef(_)
......@@ -189,10 +189,10 @@ impl RegGroup {
| MuType_::StackRef
| MuType_::Tagref64
| MuType_::FuncRef(_)
| MuType_::UFuncPtr(_) => RegGroup::GPR64,
| MuType_::UFuncPtr(_) => RegGroup::GPR,
MuType_::Float => RegGroup::FPR32,
MuType_::Double => RegGroup::FPR64,
MuType_::Float => RegGroup::FPR,
MuType_::Double => RegGroup::FPR,
_ => unimplemented!()
}
......
......@@ -64,12 +64,8 @@ impl <'a> GraphColoring<'a> {
precolored: LinkedHashSet::new(),
colors: {
let mut map = HashMap::new();
map.insert(backend::RegGroup::GPR8, LinkedHashSet::new());
map.insert(backend::RegGroup::GPR16, LinkedHashSet::new());
map.insert(backend::RegGroup::GPR32, LinkedHashSet::new());
map.insert(backend::RegGroup::GPR64, LinkedHashSet::new());
map.insert(backend::RegGroup::FPR32, LinkedHashSet::new());
map.insert(backend::RegGroup::FPR64, LinkedHashSet::new());
map.insert(backend::RegGroup::GPR, LinkedHashSet::new());
map.insert(backend::RegGroup::FPR, LinkedHashSet::new());
map
},
colored_nodes: Vec::new(),
......
......@@ -25,7 +25,7 @@ lazy_static! {
ret_tys: vec![ADDRESS_TYPE.clone()],
arg_tys: vec![]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_get_thread_local")),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_get_thread_local")),
jit: RwLock::new(None),
};
......@@ -37,7 +37,7 @@ lazy_static! {
ret_tys: vec![],
arg_tys: vec![ADDRESS_TYPE.clone()]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_swap_back_to_native_stack")),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_swap_back_to_native_stack")),
jit: RwLock::new(None),
};
......@@ -48,7 +48,7 @@ lazy_static! {
ret_tys: vec![ADDRESS_TYPE.clone()],
arg_tys: vec![UINT64_TYPE.clone(), UINT64_TYPE.clone()]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_alloc_slow")),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_alloc_slow")),
jit: RwLock::new(None),
};
......@@ -59,7 +59,7 @@ lazy_static! {
ret_tys: vec![],
arg_tys: vec![ADDRESS_TYPE.clone()]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR64, String::from("muentry_throw_exception")),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_throw_exception")),
jit: RwLock::new(None),
};
}
\ No newline at end of file
......@@ -153,9 +153,9 @@ impl ValueLocation {
#[allow(unused_variables)]
pub fn from_constant(c: Constant) -> ValueLocation {
match c {
Constant::Int(int_val) => ValueLocation::Constant(RegGroup::GPR64, utils::mem::u64_to_raw(int_val)),
Constant::Float(f32_val) => ValueLocation::Constant(RegGroup::FPR32, utils::mem::f32_to_raw(f32_val)),
Constant::Double(f64_val) => ValueLocation::Constant(RegGroup::FPR64, utils::mem::f64_to_raw(f64_val)),
Constant::Int(int_val) => ValueLocation::Constant(RegGroup::GPR, utils::mem::u64_to_raw(int_val)),
Constant::Float(f32_val) => ValueLocation::Constant(RegGroup::FPR, utils::mem::f32_to_raw(f32_val)),
Constant::Double(f64_val) => ValueLocation::Constant(RegGroup::FPR, utils::mem::f64_to_raw(f64_val)),
_ => unimplemented!()
}
......
......@@ -123,12 +123,8 @@ impl MuStack {
let (reg_group, word) = val.load_value();
match reg_group {
RegGroup::GPR8
| RegGroup::GPR16
| RegGroup::GPR32
| RegGroup::GPR64 => gpr_used.push(word),
RegGroup::FPR32
| RegGroup::FPR64 => fpr_used.push(word),
RegGroup::GPR => gpr_used.push(word),
RegGroup::FPR => fpr_used.push(word),
}
}
......
......@@ -642,7 +642,7 @@ impl <'a> VM {
if self.is_running() {
unimplemented!()
} else {
ValueLocation::Relocatable(backend::RegGroup::GPR64, func.name().unwrap())
ValueLocation::Relocatable(backend::RegGroup::GPR, func.name().unwrap())
}
}
......
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