Skip to main content

luaur_code_gen/methods/
ir_lowering_a_64_temp_uint.rs

1use crate::enums::ir_op_kind::IrOpKind;
2use crate::enums::kind_a_64::KindA64;
3use crate::macros::codegen_assert::CODEGEN_ASSERT;
4use crate::records::ir_lowering_a_64::IrLoweringA64;
5use crate::records::ir_op::IrOp;
6use crate::records::register_a_64::RegisterA64;
7
8impl IrLoweringA64 {
9    pub fn ir_lowering_a_64_temp_uint(&mut self, op: IrOp) -> RegisterA64 {
10        match op.kind() {
11            IrOpKind::Inst => self.ir_lowering_a_64_reg_op(op),
12            IrOpKind::Constant => {
13                let temp = self.regs.alloc_temp(KindA64::w);
14                let value = self.ir_lowering_a_64_int_op(op) as u32;
15                unsafe { (*self.build).mov_register_a_64_i32(temp, value as i32) };
16                temp
17            }
18            _ => {
19                CODEGEN_ASSERT!(false, "Unsupported instruction form");
20                RegisterA64::noreg
21            }
22        }
23    }
24}