Skip to main content

luaur_code_gen/functions/
get_live_out_value_count.rs

1use crate::records::ir_block::IrBlock;
2use crate::records::ir_function::IrFunction;
3
4pub fn get_live_out_value_count(function: &mut IrFunction, block: &mut IrBlock) -> u32 {
5    // The dependency get_live_in_out_value_count is currently a stub with signature fn().
6    // We must transmute it to the real signature (matching the C++ std::pair<uint32_t, uint32_t> return)
7    // to allow this code to compile and function correctly once the dependency is implemented.
8    let get_live_in_out: fn(&mut IrFunction, &mut IrBlock, bool) -> (u32, u32) = unsafe {
9        core::mem::transmute(
10            crate::functions::get_live_in_out_value_count::get_live_in_out_value_count as *const (),
11        )
12    };
13
14    let (_, live_out) = get_live_in_out(function, block, false);
15    live_out
16}