luaur-code-gen 0.1.3

Native (A64/X64) code generation for Luau (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::macros::codegen_assert::CODEGEN_ASSERT;
use crate::records::ir_reg_alloc_a_64::IrRegAllocA64;
use crate::records::register_a_64::RegisterA64;

impl IrRegAllocA64 {
    pub fn free_reg(&mut self, reg: RegisterA64) {
        let set = self.get_set(reg.kind());

        let bit = 1u32 << reg.index();

        CODEGEN_ASSERT!((set.base & bit) != 0);
        CODEGEN_ASSERT!((set.free & bit) == 0);
        CODEGEN_ASSERT!((set.temp & bit) == 0);

        set.free |= bit;
        set.defs[reg.index() as usize] = Self::kInvalidInstIdx;
    }
}