luaur_code_gen/functions/
save_block_exit_state.rs1use crate::records::const_prop_state::ConstPropState;
2use crate::records::ir_block::IrBlock;
3use crate::records::ir_function::IrFunction;
4
5pub fn save_block_exit_state(
6 function: &mut IrFunction,
7 block: &IrBlock,
8 state: &mut ConstPropState,
9) {
10 let mut tags: alloc::vec::Vec<u8> =
11 alloc::vec::Vec::with_capacity((state.max_reg as usize) + 1);
12
13 for i in 0..=(state.max_reg as usize) {
14 tags.push(state.regs[i].tag);
15 }
16
17 let block_idx = function.get_block_index(block);
18 function.block_exit_tags[block_idx as usize] = tags;
19}