Commit 2bab0a04 authored by qinsoon's avatar qinsoon

[wip] make backend aware of operand length

parent 2b612385
Pipeline #66 failed with stage
in 19 minutes and 19 seconds
......@@ -22,24 +22,68 @@ pub trait CodeGenerator {
fn emit_nop(&mut self, bytes: usize);
fn emit_cmp_r64_r64(&mut self, op1: &P<Value>, op2: &P<Value>);
// comparison
fn emit_cmp_r64_r64 (&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r64_imm32(&mut self, op1: &P<Value>, op2: i32);
fn emit_cmp_r64_mem64(&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r32_r32 (&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r32_imm32(&mut self, op1: &P<Value>, op2: i32);
fn emit_cmp_r32_mem32(&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r16_r16 (&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r16_imm16(&mut self, op1: &P<Value>, op2: i16);
fn emit_cmp_r16_mem16(&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r8_r8 (&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r8_imm8 (&mut self, op1: &P<Value>, op2: i8);
fn emit_cmp_r8_mem8 (&mut self, op1: &P<Value>, op2: &P<Value>);
// gpr move
fn emit_mov_r64_imm32 (&mut self, dest: &P<Value>, src: i32);
fn emit_mov_r64_mem64 (&mut self, dest: &P<Value>, src: &P<Value>); // load
fn emit_mov_r64_r64 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_mov_mem64_r64 (&mut self, dest: &P<Value>, src: &P<Value>); // store
fn emit_mov_mem64_imm32(&mut self, dest: &P<Value>, src: i32);
fn emit_movsd_f64_f64 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_movsd_f64_mem64(&mut self, dest: &P<Value>, src: &P<Value>); // load
fn emit_movsd_mem64_f64(&mut self, dest: &P<Value>, src: &P<Value>); // store
fn emit_mov_r32_imm32 (&mut self, dest: &P<Value>, src: i32);
fn emit_mov_r32_mem32 (&mut self, dest: &P<Value>, src: &P<Value>); // load
fn emit_mov_r32_r32 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_mov_mem32_r32 (&mut self, dest: &P<Value>, src: &P<Value>); // store
fn emit_mov_mem32_imm32(&mut self, dest: &P<Value>, src: i32);
fn emit_mov_r16_imm16 (&mut self, dest: &P<Value>, src: i16);
fn emit_mov_r16_mem16 (&mut self, dest: &P<Value>, src: &P<Value>); // load
fn emit_mov_r16_r16 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_mov_mem16_r16 (&mut self, dest: &P<Value>, src: &P<Value>); // store
fn emit_mov_mem16_imm16(&mut self, dest: &P<Value>, src: i16);
fn emit_mov_r8_imm8 (&mut self, dest: &P<Value>, src: i8);
fn emit_mov_r8_mem8 (&mut self, dest: &P<Value>, src: &P<Value>); // load
fn emit_mov_r8_r8 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_mov_mem8_r8 (&mut self, dest: &P<Value>, src: &P<Value>); // store
fn emit_mov_mem8_imm8 (&mut self, dest: &P<Value>, src: i8);
// lea
fn emit_lea_r64(&mut self, dest: &P<Value>, src: &P<Value>);
// and
fn emit_and_r64_imm32(&mut self, dest: &P<Value>, src: i32);
fn emit_and_r64_r64 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_and_r64_mem64(&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_and_r32_imm32(&mut self, dest: &P<Value>, src: i32);
fn emit_and_r32_r32 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_and_r32_mem32(&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_and_r16_imm16(&mut self, dest: &P<Value>, src: i16);
fn emit_and_r16_r16 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_and_r16_mem16(&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_and_r8_imm8 (&mut self, dest: &P<Value>, src: i8);
fn emit_and_r8_r8 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_and_r8_mem8 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_xor_r64_r64 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_xor_r64_mem64(&mut self, dest: &P<Value>, src: &P<Value>);
......@@ -102,4 +146,10 @@ pub trait CodeGenerator {
fn emit_push_r64(&mut self, src: &P<Value>);
fn emit_push_imm32(&mut self, src: i32);
fn emit_pop_r64(&mut self, dest: &P<Value>);
// fpr move
fn emit_movsd_f64_f64 (&mut self, dest: &P<Value>, src: &P<Value>);
fn emit_movsd_f64_mem64(&mut self, dest: &P<Value>, src: &P<Value>); // load
fn emit_movsd_mem64_f64(&mut self, dest: &P<Value>, src: &P<Value>); // store
}
\ No newline at end of file
......@@ -330,6 +330,21 @@ lazy_static! {
ret.append(&mut pick_regs_of_alias!(R14_ALIAS));
ret.append(&mut pick_regs_of_alias!(R15_ALIAS));
// ret.push(RAX.clone());
// ret.push(RCX.clone());
// ret.push(RDX.clone());
// ret.push(RBX.clone());
// ret.push(RSI.clone());
// ret.push(RDI.clone());
// ret.push(R8.clone());
// ret.push(R9.clone());
// ret.push(R10.clone());
// ret.push(R11.clone());
// ret.push(R12.clone());
// ret.push(R13.clone());
// ret.push(R14.clone());
// ret.push(R15.clone());
ret.push(XMM0.clone());
ret.push(XMM1.clone());
ret.push(XMM2.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