Commit 89dcb164 authored by qinsoon's avatar qinsoon

aarch64 generates epilogue the same way as x64

parent b7135579
Pipeline #728 passed with stages
in 28 minutes and 54 seconds
......@@ -77,7 +77,7 @@ impl <'a> InstructionSelection {
#[cfg(feature = "aot")]
pub fn new() -> InstructionSelection {
InstructionSelection {
name: "Instruction Selection (x64)",
name: "Instruction Selection (aarch64)",
backend: Box::new(ASMCodeGen::new()),
current_fv_id: 0,
......@@ -450,8 +450,7 @@ impl <'a> InstructionSelection {
}
}
let epilogue_block = format!("{}:{}", self.current_fv_name, EPILOGUE_BLOCK_NAME);
self.backend.emit_b(epilogue_block);
self.emit_common_epilogue(f_context, vm);
},
Instruction_::BinOp(op, op1, op2) => {
......@@ -3722,9 +3721,6 @@ impl <'a> InstructionSelection {
// Todo: Don't emit this if the function never returns
fn emit_common_epilogue(&mut self, f_context: &mut FunctionContext, vm: &VM) {
let epilogue_block = format!("{}:{}", self.current_fv_name, EPILOGUE_BLOCK_NAME);
self.start_block(epilogue_block);
// pop all callee-saved registers
for i in (0..CALLEE_SAVED_FPRS.len()).rev() {
let ref reg = CALLEE_SAVED_FPRS[i];
......@@ -3748,7 +3744,6 @@ impl <'a> InstructionSelection {
// Note: the stack pointer should now be what it was when the function was called
self.backend.emit_ret(&LR); // return to the Link Register
self.finish_block();
}
fn match_cmp_res(&mut self, op: &TreeNode) -> bool {
......@@ -4516,8 +4511,6 @@ impl CompilerPass for InstructionSelection {
}
fn finish_function(&mut self, vm: &VM, func: &mut MuFunctionVersion) {
self.emit_common_epilogue( &mut func.context, vm);
self.backend.print_cur_code();
let func_name = {
......
......@@ -12,12 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![allow(dead_code)]
// TODO: CHECK THAT THE TYPE OF EVERY MEMORY LOCATION HAS THE CORRECT SIZE
// (the size should be size of the area in memory that it is referring to, and will indicate
// how much data any load/store instructions that uses it will operate on
// (so it should be [1], 8, 16, 32, 64, or 128 bits in size (when using emit_mem, it can have other sizes before this))
#![allow(non_upper_case_globals)]
// TODO: Move architecture independent codes in here, inst_sel and asm_backend to somewhere else...
pub mod inst_sel;
......@@ -332,7 +333,6 @@ pub fn primitive_byte_size(ty : &P<MuType>) -> usize
}
}
#[allow(dead_code)]
lazy_static! {
// Note: these are the same as the ARGUMENT_GPRS
pub static ref RETURN_GPRS : [P<Value>; 8] = [
......@@ -396,7 +396,6 @@ lazy_static! {
//X18.clone(), // Platform Register
];
#[allow(dead_code)]
static ref ALL_GPRS : [P<Value>; 30] = [
X0.clone(),
X1.clone(),
......@@ -586,7 +585,6 @@ lazy_static!{
D31.clone()
];
#[allow(dead_code)]
static ref ALL_FPRS : [P<Value>; 32] = [
D0.clone(),
D1.clone(),
......
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