Commit 32153973 authored by qinsoon's avatar qinsoon

[wip] fix bugs

parent c22425e4
......@@ -2873,7 +2873,7 @@ impl CodeGenerator for ASMCodeGen {
true
)
}
fn emit_movapd_f64_f64 (&mut self, dest: Reg, src: Mem) {
fn emit_movapd_f64_f64 (&mut self, dest: Reg, src: Reg) {
trace!("emit movapd {} -> {}", src, dest);
let (reg1, id1, loc1) = self.prepare_fpreg(src, 6 + 1);
......@@ -2886,15 +2886,8 @@ impl CodeGenerator for ASMCodeGen {
linked_hashmap!{
id2 => vec![loc2.clone()]
},
{
if id1 == id2 {
linked_hashmap!{id1 => vec![loc1, loc2]}
} else {
linked_hashmap!{
id1 => vec![loc1],
id2 => vec![loc2]
}
}
linked_hashmap!{
id1 => vec![loc1.clone()]
},
false
)
......
......@@ -177,7 +177,10 @@ fn add_def(reg: MuID, reg_assigned: &LinkedHashMap<MuID, MuID>, reg_coalesced: &
// if the register is holding a temporary, it needs to be coalesced with new temp
let old_temp: MuID = entry.get_temp().unwrap();
if (reg_coalesced.contains_key(&old_temp) && *reg_coalesced.get(&old_temp).unwrap() == temp)
if old_temp == temp {
// the register that is used at this instruction, and also defined here
// safe
} else if (reg_coalesced.contains_key(&old_temp) && *reg_coalesced.get(&old_temp).unwrap() == temp)
|| (reg_coalesced.contains_key(&temp) && *reg_coalesced.get(&temp).unwrap() == old_temp)
{
// coalesced, safe
......
......@@ -11,7 +11,7 @@ use mu::utils::LinkedHashMap;
use std::sync::RwLock;
#[test]
fn test_inline_add() {
fn test_inline_add_simple() {
let lib = testutil::compile_fncs("add_trampoline", vec!["add_trampoline", "add"], &inline_add);
unsafe {
......
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