pub fn peephole_fuse_load_imm_alu(
code: &mut [u8],
bitmask: &mut [u8],
jump_table: &[u32],
) -> usizeExpand description
Peephole pass: fuse load_imm(51) + ThreeReg ALU into TwoRegOneImm immediate form.
Scans the PVM code for consecutive pairs where:
- First instruction is
load_imm(opcode 51) - Second instruction is a ThreeReg ALU op with an immediate-form equivalent
- The load destination register equals the ALU output register (dead after ALU)
- The load value fits in i32 (4-byte immediate)
- Neither instruction is a branch target
When fusable, rewrites the pair in-place: the first instruction becomes the TwoRegOneImm form with a 4-byte immediate, and all remaining bytes through the end of the second instruction become bitmask=0 continuation bytes.