luaur-code-gen 0.1.0

Native (A64/X64) code generation for Luau (Rust).
Documentation
use crate::enums::ir_op_kind::IrOpKind;
use crate::functions::vm_exit_op::vm_exit_op;
use crate::records::ir_lowering_x_64::IrLoweringX64;
use crate::records::ir_op::IrOp;
use crate::records::label::Label;

impl IrLoweringX64 {
    pub fn get_target_label<'a>(
        &'a mut self,
        op: IrOp,
        _index: u32,
        fresh: &'a mut Label,
    ) -> &'a mut Label {
        if op.kind() == IrOpKind::Undef {
            return fresh;
        }

        if op.kind() == IrOpKind::VmExit {
            if let Some(index) = self.exit_handler_map.find(&vm_exit_op(op)) {
                return &mut self.exit_handlers[*index as usize].self_;
            }

            return fresh;
        }

        self.label_op(op)
    }
}