|
| 1 | +use crate::ir::IrInstruction; |
| 2 | +use dynasmrt::{dynasm, DynasmApi, DynasmLabelApi}; |
| 3 | + |
| 4 | +pub fn compile(code : &[IrInstruction]) { |
| 5 | + let mut ops = dynasmrt::x64::Assembler::new().unwrap(); |
| 6 | + for instr in code { |
| 7 | + match instr { |
| 8 | + IrInstruction::Nop => todo!("IR Nop"), |
| 9 | + IrInstruction::SetConstant => todo!("IR SetConstant"), |
| 10 | + IrInstruction::SetFloatConstant => todo!("IR SetFloatConstant"), |
| 11 | + IrInstruction::Or(_, _) => todo!("IR Or"), |
| 12 | + IrInstruction::Xor(_, _) => todo!("IR Xor"), |
| 13 | + IrInstruction::And(_, _) => todo!("IR And"), |
| 14 | + IrInstruction::Sub => todo!("IR Sub"), |
| 15 | + IrInstruction::Not => todo!("IR Not"), |
| 16 | + IrInstruction::Add(_, _) => todo!("IR Add"), |
| 17 | + IrInstruction::Shift => todo!("IR Shift"), |
| 18 | + IrInstruction::Store => todo!("IR Store"), |
| 19 | + IrInstruction::Load => todo!("IR Load"), |
| 20 | + IrInstruction::GetPtr(address, size) => { |
| 21 | + dynasm!(ops |
| 22 | + ; .arch x64 |
| 23 | + ; mov rax, rcx |
| 24 | + // ; push [rsp + rsp] |
| 25 | + ) |
| 26 | + }, |
| 27 | + IrInstruction::SetPtr(_, _) => todo!("IR SetPtr"), |
| 28 | + IrInstruction::MaskAndCast => todo!("IR MaskAndCast"), |
| 29 | + IrInstruction::CheckCondition => todo!("IR CheckCondition"), |
| 30 | + IrInstruction::SetCondBlockExitPc => todo!("IR SetCondBlockExitPc"), |
| 31 | + IrInstruction::SetBlockExitPc => todo!("IR SetBlockExitPc"), |
| 32 | + IrInstruction::CondBlockExit => todo!("IR CondBlockExit"), |
| 33 | + IrInstruction::TlbLookup => todo!("IR TlbLookup"), |
| 34 | + IrInstruction::LoadGuestReg => todo!("IR LoadGuestReg"), |
| 35 | + IrInstruction::FlushGuestReg => todo!("IR FlushGuestReg"), |
| 36 | + IrInstruction::Multiply => todo!("IR Multiply"), |
| 37 | + IrInstruction::Divide => todo!("IR Divide"), |
| 38 | + IrInstruction::Eret => todo!("IR Eret"), |
| 39 | + IrInstruction::Call => todo!("IR Call"), |
| 40 | + IrInstruction::MovRegType => todo!("IR MovRegType"), |
| 41 | + IrInstruction::FloatConvert => todo!("IR FloatConvert"), |
| 42 | + IrInstruction::FloatMultiply => todo!("IR FloatMultiply"), |
| 43 | + IrInstruction::FloatDivide => todo!("IR FloatDivide"), |
| 44 | + IrInstruction::FloatAdd => todo!("IR FloatAdd"), |
| 45 | + IrInstruction::FloatSub => todo!("IR FloatSub"), |
| 46 | + IrInstruction::FloatSqrt => todo!("IR FloatSqrt"), |
| 47 | + IrInstruction::FloatAbs => todo!("IR FloatAbs"), |
| 48 | + IrInstruction::FloatNeg => todo!("IR FloatNeg"), |
| 49 | + IrInstruction::FloatCheckCondition => todo!("IR FloatCheckCondition"), |
| 50 | + IrInstruction::InterpreterFallback => todo!("IR InterpreterFallback"), |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | +} |
0 commit comments