To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 615a1344 authored by qinsoon's avatar qinsoon
Browse files

[wip] clean up x64 backend

parent b7d7851a
...@@ -1022,27 +1022,27 @@ impl ASMCodeGen { ...@@ -1022,27 +1022,27 @@ impl ASMCodeGen {
let (id, loc) = target.unwrap(); let (id, loc) = target.unwrap();
uses.insert(id, vec![loc]); uses.insert(id, vec![loc]);
} }
// for reg in ARGUMENT_GPRs.iter() { // for reg in ARGUMENT_GPRS.iter() {
// uses.insert(reg.id(), vec![]); // uses.insert(reg.id(), vec![]);
// } // }
// for reg in ARGUMENT_FPRs.iter() { // for reg in ARGUMENT_FPRS.iter() {
// uses.insert(reg.id(), vec![]); // uses.insert(reg.id(), vec![]);
// } // }
// defines: return registers // defines: return registers
let mut defines: LinkedHashMap<MuID, Vec<ASMLocation>> = LinkedHashMap::new(); let mut defines: LinkedHashMap<MuID, Vec<ASMLocation>> = LinkedHashMap::new();
for reg in RETURN_GPRs.iter() { for reg in RETURN_GPRS.iter() {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
for reg in RETURN_FPRs.iter() { for reg in RETURN_FPRS.iter() {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
for reg in CALLER_SAVED_GPRs.iter() { for reg in CALLER_SAVED_GPRS.iter() {
if !defines.contains_key(&reg.id()) { if !defines.contains_key(&reg.id()) {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
} }
for reg in CALLER_SAVED_FPRs.iter() { for reg in CALLER_SAVED_FPRS.iter() {
if !defines.contains_key(&reg.id()) { if !defines.contains_key(&reg.id()) {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
......
...@@ -2045,23 +2045,23 @@ impl <'a> InstructionSelection { ...@@ -2045,23 +2045,23 @@ impl <'a> InstructionSelection {
match t.v { match t.v {
Vector(_, _) | Tagref64 => unimplemented!(), Vector(_, _) | Tagref64 => unimplemented!(),
Float | Double => Float | Double =>
vec![get_alias_for_length(RETURN_FPRs[0].id(), get_bit_size(&t, vm))], vec![get_alias_for_length(RETURN_FPRS[0].id(), get_bit_size(&t, vm))],
Hybrid(_) => panic!("cant return a hybrid"), Hybrid(_) => panic!("cant return a hybrid"),
Struct(_) | Array(_, _) => { Struct(_) | Array(_, _) => {
let hfa_n = hfa_length(t.clone()); let hfa_n = hfa_length(t.clone());
if hfa_n > 0 { if hfa_n > 0 {
let mut res = vec![get_alias_for_length(RETURN_FPRs[0].id(), get_bit_size(&t, vm)/hfa_n)]; let mut res = vec![get_alias_for_length(RETURN_FPRS[0].id(), get_bit_size(&t, vm)/hfa_n)];
for i in 1..hfa_n { for i in 1..hfa_n {
res.push(get_alias_for_length(RETURN_FPRs[0].id(), get_bit_size(&t, vm)/hfa_n)); res.push(get_alias_for_length(RETURN_FPRS[0].id(), get_bit_size(&t, vm)/hfa_n));
} }
res res
} else if size <= 8 { } else if size <= 8 {
// Return in a single GRP // Return in a single GRP
vec![get_alias_for_length(RETURN_GPRs[0].id(), get_bit_size(&t, vm))] vec![get_alias_for_length(RETURN_GPRS[0].id(), get_bit_size(&t, vm))]
} else if size <= 16 { } else if size <= 16 {
// Return in 2 GPRs // Return in 2 GPRs
vec![RETURN_GPRs[0].clone(), RETURN_GPRs[0].clone()] vec![RETURN_GPRS[0].clone(), RETURN_GPRS[0].clone()]
} else { } else {
// Returned on the stack // Returned on the stack
...@@ -2073,7 +2073,7 @@ impl <'a> InstructionSelection { ...@@ -2073,7 +2073,7 @@ impl <'a> InstructionSelection {
// Integral or pointer type // Integral or pointer type
Int(_) | Ref(_) | IRef(_) | WeakRef(_) | UPtr(_) | ThreadRef | StackRef | FuncRef(_) | UFuncPtr(_) => Int(_) | Ref(_) | IRef(_) | WeakRef(_) | UPtr(_) | ThreadRef | StackRef | FuncRef(_) | UFuncPtr(_) =>
// can return in GPR // can return in GPR
vec![get_alias_for_length(RETURN_GPRs[0].id(), get_bit_size(&t, vm))] vec![get_alias_for_length(RETURN_GPRS[0].id(), get_bit_size(&t, vm))]
} }
} }
...@@ -2083,19 +2083,19 @@ impl <'a> InstructionSelection { ...@@ -2083,19 +2083,19 @@ impl <'a> InstructionSelection {
let size = round_up(vm.get_type_size(t.id()), 8); let size = round_up(vm.get_type_size(t.id()), 8);
match t.v { match t.v {
Vector(_, _) | Tagref64 => unimplemented!(), Vector(_, _) | Tagref64 => unimplemented!(),
Float | Double => get_alias_for_length(RETURN_FPRs[0].id(), get_bit_size(t, vm)), Float | Double => get_alias_for_length(RETURN_FPRS[0].id(), get_bit_size(t, vm)),
Hybrid(_) => panic!("cant return a hybrid"), Hybrid(_) => panic!("cant return a hybrid"),
Struct(_) | Array(_, _) => { Struct(_) | Array(_, _) => {
let hfa_n = hfa_length(t.clone()); let hfa_n = hfa_length(t.clone());
if hfa_n > 0 { if hfa_n > 0 {
// Return in a sequence of FPRs // Return in a sequence of FPRs
get_alias_for_length(RETURN_FPRs[0].id(), get_bit_size(t, vm)/hfa_n) get_alias_for_length(RETURN_FPRS[0].id(), get_bit_size(t, vm)/hfa_n)
} else if size <= 8 { } else if size <= 8 {
// Return in a singe GRPs // Return in a singe GRPs
get_alias_for_length(RETURN_GPRs[0].id(), get_bit_size(t, vm)) get_alias_for_length(RETURN_GPRS[0].id(), get_bit_size(t, vm))
} else if size <= 16 { } else if size <= 16 {
// Return in 2 GPRS // Return in 2 GPRS
RETURN_GPRs[0].clone() RETURN_GPRS[0].clone()
} else { } else {
// Return at the location pointed to by loc // Return at the location pointed to by loc
self.make_value_base_offset(&loc, 0, &t, vm) self.make_value_base_offset(&loc, 0, &t, vm)
...@@ -2106,7 +2106,7 @@ impl <'a> InstructionSelection { ...@@ -2106,7 +2106,7 @@ impl <'a> InstructionSelection {
// Integral or pointer type // Integral or pointer type
Int(_) | Ref(_) | IRef(_) | WeakRef(_) | UPtr(_) | ThreadRef | StackRef | FuncRef(_) | UFuncPtr(_) => Int(_) | Ref(_) | IRef(_) | WeakRef(_) | UPtr(_) | ThreadRef | StackRef | FuncRef(_) | UFuncPtr(_) =>
// can return in GPR // can return in GPR
get_alias_for_length(RETURN_GPRs[0].id(), get_bit_size(t, vm)) get_alias_for_length(RETURN_GPRS[0].id(), get_bit_size(t, vm))
} }
} }
// TODO: Thoroughly test this (compare with code generated by GCC with variouse different types???) // TODO: Thoroughly test this (compare with code generated by GCC with variouse different types???)
...@@ -2151,7 +2151,7 @@ impl <'a> InstructionSelection { ...@@ -2151,7 +2151,7 @@ impl <'a> InstructionSelection {
Vector(_, _) | Tagref64 => unimplemented!(), Vector(_, _) | Tagref64 => unimplemented!(),
Float | Double => { Float | Double => {
if nsrn < 8 { if nsrn < 8 {
locations.push(get_alias_for_length(ARGUMENT_FPRs[nsrn].id(), get_bit_size(&t, vm))); locations.push(get_alias_for_length(ARGUMENT_FPRS[nsrn].id(), get_bit_size(&t, vm)));
nsrn += 1; nsrn += 1;
} else { } else {
nsrn = 8; nsrn = 8;
...@@ -2164,7 +2164,7 @@ impl <'a> InstructionSelection { ...@@ -2164,7 +2164,7 @@ impl <'a> InstructionSelection {
if hfa_n > 0 { if hfa_n > 0 {
if nsrn + hfa_n <= 8 { if nsrn + hfa_n <= 8 {
// Note: the argument will occupy succesiv registers (one for each element) // Note: the argument will occupy succesiv registers (one for each element)
locations.push(get_alias_for_length(ARGUMENT_FPRs[nsrn].id(), get_bit_size(&t, vm)/hfa_n)); locations.push(get_alias_for_length(ARGUMENT_FPRS[nsrn].id(), get_bit_size(&t, vm)/hfa_n));
nsrn += hfa_n; nsrn += hfa_n;
} else { } else {
nsrn = 8; nsrn = 8;
...@@ -2180,7 +2180,7 @@ impl <'a> InstructionSelection { ...@@ -2180,7 +2180,7 @@ impl <'a> InstructionSelection {
// The struct should be packed, starting here // The struct should be packed, starting here
// (note: this may result in multiple struct fields in the same regsiter // (note: this may result in multiple struct fields in the same regsiter
// or even floating points in a GPR) // or even floating points in a GPR)
locations.push(ARGUMENT_GPRs[ngrn].clone()); locations.push(ARGUMENT_GPRS[ngrn].clone());
// How many GPRS are taken up by t // How many GPRS are taken up by t
ngrn += if size % 8 != 0 { size/8 + 1 } else { size/8 }; ngrn += if size % 8 != 0 { size/8 + 1 } else { size/8 };
} else { } else {
...@@ -2199,7 +2199,7 @@ impl <'a> InstructionSelection { ...@@ -2199,7 +2199,7 @@ impl <'a> InstructionSelection {
ThreadRef | StackRef | FuncRef(_) | UFuncPtr(_) => { ThreadRef | StackRef | FuncRef(_) | UFuncPtr(_) => {
if size <= 8 { if size <= 8 {
if ngrn < 8 { if ngrn < 8 {
locations.push(get_alias_for_length(ARGUMENT_GPRs[ngrn].id(), get_bit_size(&t, vm))); locations.push(get_alias_for_length(ARGUMENT_GPRS[ngrn].id(), get_bit_size(&t, vm)));
ngrn += 1; ngrn += 1;
} else { } else {
nsaa = round_up(nsaa, round_up(align, 8)); nsaa = round_up(nsaa, round_up(align, 8));
...@@ -2703,16 +2703,16 @@ impl <'a> InstructionSelection { ...@@ -2703,16 +2703,16 @@ impl <'a> InstructionSelection {
} }
// push all callee-saved registers // push all callee-saved registers
for i in 0..CALLEE_SAVED_FPRs.len() { for i in 0..CALLEE_SAVED_FPRS.len() {
let ref reg = CALLEE_SAVED_FPRs[i]; let ref reg = CALLEE_SAVED_FPRS[i];
trace!("allocate frame slot for reg {}", reg); trace!("allocate frame slot for reg {}", reg);
let loc = self.current_frame.as_mut().unwrap().alloc_slot_for_callee_saved_reg(reg.clone(), vm); let loc = self.current_frame.as_mut().unwrap().alloc_slot_for_callee_saved_reg(reg.clone(), vm);
let loc = emit_mem(self.backend.as_mut(), &loc, f_context, vm); let loc = emit_mem(self.backend.as_mut(), &loc, f_context, vm);
self.backend.emit_str_callee_saved(&loc, &reg); self.backend.emit_str_callee_saved(&loc, &reg);
} }
for i in 0..CALLEE_SAVED_GPRs.len() { for i in 0..CALLEE_SAVED_GPRS.len() {
let ref reg = CALLEE_SAVED_GPRs[i]; let ref reg = CALLEE_SAVED_GPRS[i];
trace!("allocate frame slot for regs {}", reg); trace!("allocate frame slot for regs {}", reg);
let loc = self.current_frame.as_mut().unwrap().alloc_slot_for_callee_saved_reg(reg.clone(), vm); let loc = self.current_frame.as_mut().unwrap().alloc_slot_for_callee_saved_reg(reg.clone(), vm);
...@@ -2779,15 +2779,15 @@ impl <'a> InstructionSelection { ...@@ -2779,15 +2779,15 @@ impl <'a> InstructionSelection {
self.start_block(EPILOGUE_BLOCK_NAME.to_string(), &livein); self.start_block(EPILOGUE_BLOCK_NAME.to_string(), &livein);
// pop all callee-saved registers // pop all callee-saved registers
for i in (0..CALLEE_SAVED_GPRs.len()).rev() { for i in (0..CALLEE_SAVED_GPRS.len()).rev() {
let ref reg = CALLEE_SAVED_GPRs[i]; let ref reg = CALLEE_SAVED_GPRS[i];
let reg_id = reg.extract_ssa_id().unwrap(); let reg_id = reg.extract_ssa_id().unwrap();
let loc = self.current_frame.as_mut().unwrap().allocated.get(&reg_id).unwrap().make_memory_op(reg.ty.clone(), vm); let loc = self.current_frame.as_mut().unwrap().allocated.get(&reg_id).unwrap().make_memory_op(reg.ty.clone(), vm);
let loc = emit_mem(self.backend.as_mut(), &loc, f_context, vm); let loc = emit_mem(self.backend.as_mut(), &loc, f_context, vm);
self.backend.emit_ldr_callee_saved(reg, &loc); self.backend.emit_ldr_callee_saved(reg, &loc);
} }
for i in (0..CALLEE_SAVED_FPRs.len()).rev() { for i in (0..CALLEE_SAVED_FPRS.len()).rev() {
let ref reg = CALLEE_SAVED_FPRs[i]; let ref reg = CALLEE_SAVED_FPRS[i];
let reg_id = reg.extract_ssa_id().unwrap(); let reg_id = reg.extract_ssa_id().unwrap();
let loc = self.current_frame.as_mut().unwrap().allocated.get(&reg_id).unwrap().make_memory_op(reg.ty.clone(), vm); let loc = self.current_frame.as_mut().unwrap().allocated.get(&reg_id).unwrap().make_memory_op(reg.ty.clone(), vm);
......
...@@ -301,8 +301,8 @@ pub fn primitive_byte_size(ty : &P<MuType>) -> usize ...@@ -301,8 +301,8 @@ pub fn primitive_byte_size(ty : &P<MuType>) -> usize
} }
lazy_static! { lazy_static! {
// Note: these are the same as the ARGUMENT_GPRs // Note: these are the same as the ARGUMENT_GPRS
pub static ref RETURN_GPRs : [P<Value>; 8] = [ pub static ref RETURN_GPRS : [P<Value>; 8] = [
X0.clone(), X0.clone(),
X1.clone(), X1.clone(),
X2.clone(), X2.clone(),
...@@ -313,7 +313,7 @@ lazy_static! { ...@@ -313,7 +313,7 @@ lazy_static! {
X7.clone() X7.clone()
]; ];
pub static ref ARGUMENT_GPRs : [P<Value>; 8] = [ pub static ref ARGUMENT_GPRS : [P<Value>; 8] = [
X0.clone(), X0.clone(),
X1.clone(), X1.clone(),
X2.clone(), X2.clone(),
...@@ -324,7 +324,7 @@ lazy_static! { ...@@ -324,7 +324,7 @@ lazy_static! {
X7.clone() X7.clone()
]; ];
pub static ref CALLEE_SAVED_GPRs : [P<Value>; 10] = [ pub static ref CALLEE_SAVED_GPRS : [P<Value>; 10] = [
X19.clone(), X19.clone(),
X20.clone(), X20.clone(),
X21.clone(), X21.clone(),
...@@ -341,7 +341,7 @@ lazy_static! { ...@@ -341,7 +341,7 @@ lazy_static! {
//X30.clone() // Link Register //X30.clone() // Link Register
]; ];
pub static ref CALLER_SAVED_GPRs : [P<Value>; 18] = [ pub static ref CALLER_SAVED_GPRS : [P<Value>; 18] = [
X0.clone(), X0.clone(),
X1.clone(), X1.clone(),
X2.clone(), X2.clone(),
...@@ -363,7 +363,7 @@ lazy_static! { ...@@ -363,7 +363,7 @@ lazy_static! {
//X18.clone(), // Platform Register //X18.clone(), // Platform Register
]; ];
static ref ALL_GPRs : [P<Value>; 30] = [ static ref ALL_GPRS : [P<Value>; 30] = [
X0.clone(), X0.clone(),
X1.clone(), X1.clone(),
X2.clone(), X2.clone(),
...@@ -490,8 +490,8 @@ lazy_static! { ...@@ -490,8 +490,8 @@ lazy_static! {
} }
lazy_static!{ lazy_static!{
// Same as ARGUMENT_FPRs // Same as ARGUMENT_FPRS
pub static ref RETURN_FPRs : [P<Value>; 8] = [ pub static ref RETURN_FPRS : [P<Value>; 8] = [
D0.clone(), D0.clone(),
D1.clone(), D1.clone(),
D2.clone(), D2.clone(),
...@@ -502,7 +502,7 @@ lazy_static!{ ...@@ -502,7 +502,7 @@ lazy_static!{
D7.clone() D7.clone()
]; ];
pub static ref ARGUMENT_FPRs : [P<Value>; 8] = [ pub static ref ARGUMENT_FPRS : [P<Value>; 8] = [
D0.clone(), D0.clone(),
D1.clone(), D1.clone(),
D2.clone(), D2.clone(),
...@@ -513,7 +513,7 @@ lazy_static!{ ...@@ -513,7 +513,7 @@ lazy_static!{
D7.clone(), D7.clone(),
]; ];
pub static ref CALLEE_SAVED_FPRs : [P<Value>; 8] = [ pub static ref CALLEE_SAVED_FPRS : [P<Value>; 8] = [
D8.clone(), D8.clone(),
D9.clone(), D9.clone(),
D10.clone(), D10.clone(),
...@@ -524,7 +524,7 @@ lazy_static!{ ...@@ -524,7 +524,7 @@ lazy_static!{
D15.clone() D15.clone()
]; ];
pub static ref CALLER_SAVED_FPRs : [P<Value>; 24] = [ pub static ref CALLER_SAVED_FPRS : [P<Value>; 24] = [
D0.clone(), D0.clone(),
D1.clone(), D1.clone(),
D2.clone(), D2.clone(),
...@@ -552,7 +552,7 @@ lazy_static!{ ...@@ -552,7 +552,7 @@ lazy_static!{
D31.clone() D31.clone()
]; ];
static ref ALL_FPRs : [P<Value>; 32] = [ static ref ALL_FPRS : [P<Value>; 32] = [
D0.clone(), D0.clone(),
D1.clone(), D1.clone(),
D2.clone(), D2.clone(),
...@@ -591,7 +591,7 @@ lazy_static!{ ...@@ -591,7 +591,7 @@ lazy_static!{
} }
lazy_static! { lazy_static! {
pub static ref ALL_MACHINE_REGs : LinkedHashMap<MuID, P<Value>> = { pub static ref ALL_MACHINE_REGS : LinkedHashMap<MuID, P<Value>> = {
let mut map = LinkedHashMap::new(); let mut map = LinkedHashMap::new();
for vec in GPR_ALIAS_TABLE.values() { for vec in GPR_ALIAS_TABLE.values() {
...@@ -609,7 +609,7 @@ lazy_static! { ...@@ -609,7 +609,7 @@ lazy_static! {
map map
}; };
pub static ref CALLEE_SAVED_REGs : [P<Value>; 18] = [ pub static ref CALLEE_SAVED_REGS : [P<Value>; 18] = [
X19.clone(), X19.clone(),
X20.clone(), X20.clone(),
X21.clone(), X21.clone(),
...@@ -637,7 +637,7 @@ lazy_static! { ...@@ -637,7 +637,7 @@ lazy_static! {
// put caller saved regs first (they imposes no overhead if there is no call instruction) // put caller saved regs first (they imposes no overhead if there is no call instruction)
pub static ref ALL_USABLE_MACHINE_REGs : Vec<P<Value>> = vec![ pub static ref ALL_USABLE_MACHINE_REGS : Vec<P<Value>> = vec![
X19.clone(), X19.clone(),
X20.clone(), X20.clone(),
X21.clone(), X21.clone(),
...@@ -709,7 +709,7 @@ lazy_static! { ...@@ -709,7 +709,7 @@ lazy_static! {
} }
pub fn init_machine_regs_for_func (func_context: &mut FunctionContext) { pub fn init_machine_regs_for_func (func_context: &mut FunctionContext) {
for reg in ALL_MACHINE_REGs.values() { for reg in ALL_MACHINE_REGS.values() {
let reg_id = reg.extract_ssa_id().unwrap(); let reg_id = reg.extract_ssa_id().unwrap();
let entry = SSAVarEntry::new(reg.clone()); let entry = SSAVarEntry::new(reg.clone());
...@@ -719,21 +719,21 @@ pub fn init_machine_regs_for_func (func_context: &mut FunctionContext) { ...@@ -719,21 +719,21 @@ pub fn init_machine_regs_for_func (func_context: &mut FunctionContext) {
pub fn number_of_regs_in_group(group: RegGroup) -> usize { pub fn number_of_regs_in_group(group: RegGroup) -> usize {
match group { match group {
RegGroup::GPR => ALL_GPRs.len(), RegGroup::GPR => ALL_GPRS.len(),
RegGroup::FPR => ALL_FPRs.len() RegGroup::FPR => ALL_FPRS.len()
} }
} }
pub fn number_of_all_regs() -> usize { pub fn number_of_all_regs() -> usize {
ALL_MACHINE_REGs.len() ALL_MACHINE_REGS.len()
} }
pub fn all_regs() -> &'static LinkedHashMap<MuID, P<Value>> { pub fn all_regs() -> &'static LinkedHashMap<MuID, P<Value>> {
&ALL_MACHINE_REGs &ALL_MACHINE_REGS
} }
pub fn all_usable_regs() -> &'static Vec<P<Value>> { pub fn all_usable_regs() -> &'static Vec<P<Value>> {
&ALL_USABLE_MACHINE_REGs &ALL_USABLE_MACHINE_REGS
} }
pub fn pick_group_for_reg(reg_id: MuID) -> RegGroup { pub fn pick_group_for_reg(reg_id: MuID) -> RegGroup {
...@@ -749,13 +749,13 @@ pub fn pick_group_for_reg(reg_id: MuID) -> RegGroup { ...@@ -749,13 +749,13 @@ pub fn pick_group_for_reg(reg_id: MuID) -> RegGroup {
pub fn is_callee_saved(reg_id: MuID) -> bool { pub fn is_callee_saved(reg_id: MuID) -> bool {
for reg in CALLEE_SAVED_GPRs.iter() { for reg in CALLEE_SAVED_GPRS.iter() {
if reg_id == reg.extract_ssa_id().unwrap() { if reg_id == reg.extract_ssa_id().unwrap() {
return true; return true;
} }
} }
for reg in CALLEE_SAVED_FPRs.iter() { for reg in CALLEE_SAVED_FPRS.iter() {
if reg_id == reg.extract_ssa_id().unwrap() { if reg_id == reg.extract_ssa_id().unwrap() {
return true; return true;
} }
......
...@@ -1013,19 +1013,19 @@ impl ASMCodeGen { ...@@ -1013,19 +1013,19 @@ impl ASMCodeGen {
// defines // defines
let mut defines : LinkedHashMap<MuID, Vec<ASMLocation>> = LinkedHashMap::new(); let mut defines : LinkedHashMap<MuID, Vec<ASMLocation>> = LinkedHashMap::new();
// return registers get defined // return registers get defined
for reg in x86_64::RETURN_GPRs.iter() { for reg in x86_64::RETURN_GPRS.iter() {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
for reg in x86_64::RETURN_FPRs.iter() { for reg in x86_64::RETURN_FPRS.iter() {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
// caller saved register will be destroyed // caller saved register will be destroyed
for reg in x86_64::CALLER_SAVED_GPRs.iter() { for reg in x86_64::CALLER_SAVED_GPRS.iter() {
if !defines.contains_key(&reg.id()) { if !defines.contains_key(&reg.id()) {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
} }
for reg in x86_64::CALLER_SAVED_FPRs.iter() { for reg in x86_64::CALLER_SAVED_FPRS.iter() {
if !defines.contains_key(&reg.id()) { if !defines.contains_key(&reg.id()) {
defines.insert(reg.id(), vec![]); defines.insert(reg.id(), vec![]);
} }
......
...@@ -14,7 +14,6 @@ use runtime::entrypoints; ...@@ -14,7 +14,6 @@ use runtime::entrypoints;
use runtime::entrypoints::RuntimeEntrypoint; use runtime::entrypoints::RuntimeEntrypoint;
use compiler::CompilerPass; use compiler::CompilerPass;
use compiler::backend;
use compiler::backend::BackendType; use compiler::backend::BackendType;
use compiler::backend::RegGroup; use compiler::backend::RegGroup;
use compiler::backend::PROLOGUE_BLOCK_NAME; use compiler::backend::PROLOGUE_BLOCK_NAME;
...@@ -2907,9 +2906,9 @@ impl <'a> InstructionSelection { ...@@ -2907,9 +2906,9 @@ impl <'a> InstructionSelection {
let arg_reg_group = RegGroup::get_from_value(&arg); let arg_reg_group = RegGroup::get_from_value(&arg);
if arg_reg_group == RegGroup::GPR && arg.is_reg() { if arg_reg_group == RegGroup::GPR && arg.is_reg() {
if gpr_arg_count < x86_64::ARGUMENT_GPRs.len() { if gpr_arg_count < x86_64::ARGUMENT_GPRS.len() {
let arg_gpr = { let arg_gpr = {
let ref reg64 = x86_64::ARGUMENT_GPRs[gpr_arg_count]; let ref reg64 = x86_64::ARGUMENT_GPRS[gpr_arg_count];
let expected_len = arg.ty.get_int_length().unwrap(); let expected_len = arg.ty.get_int_length().unwrap();
x86_64::get_alias_for_length(reg64.id(), expected_len) x86_64::get_alias_for_length(reg64.id(), expected_len)
}; };
...@@ -2923,9 +2922,9 @@ impl <'a> InstructionSelection {