luaur_bytecode/methods/
bytecode_graph_parser_add_vm_reg_input.rs1use crate::enums::bc_op_kind::BcOpKind;
2use crate::records::bc_inst::BcInst;
3use crate::records::bc_op::BcOp;
4use crate::records::bytecode_graph_parser::BytecodeGraphParser;
5use crate::type_aliases::reg::Reg;
6use luaur_common::macros::luau_assert::LUAU_ASSERT;
7
8impl<'a> BytecodeGraphParser<'a> {
9 pub fn add_vm_reg_input(&mut self, inst: *mut BcInst, reg: Reg) {
10 let inst = unsafe { &mut *inst };
11 let source = self.find_producer_bc_op_reg(self.current_block, reg);
12 if source.is_none() && crate::methods::bytecode_graph_parser_is_unreachable::bytecode_graph_parser_is_unreachable(self, self.current_block) {
13 inst.ops.push_back(BcOp::bc_op_bc_op_kind_u32(BcOpKind::VmReg, reg as u32));
14 return;
15 }
16 LUAU_ASSERT!(source.is_some());
17 inst.ops.push_back(source.unwrap());
18 }
19}