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 3d1b37f7 authored by qinsoon's avatar qinsoon

prioritize using callee-saved regs. If any caller-saved reg is used, panic

parent 9ebbb02c
......@@ -194,21 +194,23 @@ lazy_static! {
XMM15.clone()
];
// put callee saved regs first
pub static ref ALL_USABLE_MACHINE_REGs : Vec<P<Value>> = vec![
RBX.clone(),
R12.clone(),
R13.clone(),
R14.clone(),
R15.clone(),
RAX.clone(),
RCX.clone(),
RDX.clone(),
RBX.clone(),
RSI.clone(),
RDI.clone(),
R8.clone(),
R9.clone(),
R10.clone(),
R11.clone(),
R12.clone(),
R13.clone(),
R14.clone(),
R15.clone(),
XMM0.clone(),
XMM1.clone(),
XMM2.clone(),
......@@ -273,6 +275,16 @@ pub fn pick_group_for_reg(reg_id: MuID) -> RegGroup {
}
}
pub fn is_callee_saved(reg_id: MuID) -> bool {
for reg in CALLEE_SAVED_GPRs.iter() {
if reg_id == reg.extract_ssa_id().unwrap() {
return true;
}
}
false
}
pub fn is_valid_x86_imm(op: &P<Value>) -> bool {
use std::u32;
match op.v {
......
......@@ -22,6 +22,8 @@ pub use compiler::backend::x86_64::all_regs;
pub use compiler::backend::x86_64::all_usable_regs;
#[cfg(target_arch = "x86_64")]
pub use compiler::backend::x86_64::pick_group_for_reg;
#[cfg(target_arch = "x86_64")]
pub use compiler::backend::x86_64::is_callee_saved;
#[cfg(target_arch = "arm")]
#[path = "arch/arm/mod.rs"]
......
......@@ -559,6 +559,11 @@ impl GraphColoring {
} else {
let first_available_color = ok_colors.pop_front().unwrap();
trace!("Color {} as {}", self.node_info(n), first_available_color);
if !backend::is_callee_saved(first_available_color) {
panic!("using a non-callee-saved register. need to go to compiler slowpath. Unimplemented");
}
self.colored_nodes.push(n);
self.ig.color_node(n, first_available_color);
}
......
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