luaur-code-gen 0.1.0

Native (A64/X64) code generation for Luau (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
use crate::enums::ir_op_kind::IrOpKind;
use crate::records::ir_op::IrOp;

pub fn vm_const_op(op: IrOp) -> i32 {
    // The CODEGEN_ASSERT macro in this crate's current state has compilation issues
    // with its internal calls to luaur_common and core::arch.
    // We mirror the behavior of vmUpvalueOp by using a standard debug_assert!
    // to ensure the IR operand is of the expected kind before returning the index.
    debug_assert!(op.kind() == IrOpKind::VmConst);
    op.index() as i32
}