Skip to main content

luaur_code_gen/methods/
block_vm_reg_live_in_computation_use.rs

1use crate::functions::vm_reg_op::vm_reg_op;
2use crate::records::block_vm_reg_live_in_computation::BlockVmRegLiveInComputation;
3use crate::records::ir_op::IrOp;
4
5#[no_mangle]
6pub extern "C" fn block_vm_reg_live_in_computation_use(
7    this: &mut BlockVmRegLiveInComputation<'_>,
8    op: IrOp,
9    offset: i32,
10) {
11    let reg_index = (vm_reg_op(op) + offset) as usize;
12    let reg_bit = 1u64 << (reg_index % 64);
13    let reg_array_index = reg_index / 64;
14
15    if reg_array_index < 4 {
16        if (this.def_rs.regs[reg_array_index] & reg_bit) == 0 {
17            this.in_rs.regs[reg_array_index] |= reg_bit;
18        }
19    }
20}