Checks that no instructions were skipped and that instructions are processed in order. An exception is made for pure instructions which are allowed to be eliminated if their outputs are unused.
(&mut self, current_inst: Inst)
| 559 | /// An exception is made for pure instructions which are allowed to be |
| 560 | /// eliminated if their outputs are unused. |
| 561 | fn check_skipped_inst(&mut self, current_inst: Inst) -> Result<()> { |
| 562 | ensure!( |
| 563 | self.next_inst <= current_inst, |
| 564 | "Output instructions in wrong order: expected {}, got {current_inst}", |
| 565 | self.next_inst |
| 566 | ); |
| 567 | while self.next_inst != current_inst { |
| 568 | ensure!( |
| 569 | self.output |
| 570 | .function() |
| 571 | .can_eliminate_dead_inst(self.next_inst), |
| 572 | "Output skipped non-pure {}", |
| 573 | self.next_inst |
| 574 | ); |
| 575 | self.next_inst = self.next_inst.next(); |
| 576 | } |
| 577 | self.next_inst = current_inst.next(); |
| 578 | Ok(()) |
| 579 | } |
| 580 | |
| 581 | /// Checks that the allocation can hold values of the given bank. |
| 582 | fn check_bank(&self, alloc: Allocation, bank: RegBank) -> Result<()> { |
no test coverage detected