End the current basic block. Must be called after emitting vcode insts for IR insts and prior to ending the function (building the VCode).
(&mut self)
| 331 | /// End the current basic block. Must be called after emitting vcode insts |
| 332 | /// for IR insts and prior to ending the function (building the VCode). |
| 333 | pub fn end_bb(&mut self) { |
| 334 | let end_idx = self.vcode.insts.len(); |
| 335 | // Add the instruction index range to the list of blocks. |
| 336 | self.vcode.block_ranges.push_end(end_idx); |
| 337 | // End the successors list. |
| 338 | let succ_end = self.vcode.block_succs.len(); |
| 339 | self.vcode.block_succ_range.push_end(succ_end); |
| 340 | // End the blockparams list. |
| 341 | let block_params_end = self.vcode.block_params.len(); |
| 342 | self.vcode.block_params_range.push_end(block_params_end); |
| 343 | // End the branch blockparam args list. |
| 344 | let branch_block_arg_succ_end = self.vcode.branch_block_arg_range.len(); |
| 345 | self.vcode |
| 346 | .branch_block_arg_succ_range |
| 347 | .push_end(branch_block_arg_succ_end); |
| 348 | } |
| 349 | |
| 350 | pub fn add_block_param(&mut self, param: VirtualReg) { |
| 351 | self.vcode.block_params.push(param.into()); |