Finalizes the function by assigning instruction numbers to each instruction, in block order.
(&mut self)
| 836 | /// Finalizes the function by assigning instruction numbers to each |
| 837 | /// instruction, in block order. |
| 838 | fn finalize(&mut self) -> Result<()> { |
| 839 | for (block, blockdata) in &mut self.func.blocks { |
| 840 | // Instructions were generated in reverse, un-reverse them and add them |
| 841 | // to the block. |
| 842 | let from = self.func.insts.next_key(); |
| 843 | for inst_data in self.block_insts[block].drain(..).rev() { |
| 844 | self.func.insts.push(inst_data); |
| 845 | } |
| 846 | let to = self.func.insts.next_key(); |
| 847 | blockdata.insts = InstRange::new(from, to); |
| 848 | } |
| 849 | Ok(()) |
| 850 | } |
| 851 | } |
no test coverage detected