Renumber instructions starting from `inst` until the end of the block or until numbers catch up. If sequence numbers exceed `limit`, switch to a full block renumbering.
(&mut self, inst: Inst, seq: SequenceNumber, limit: SequenceNumber)
| 157 | /// |
| 158 | /// If sequence numbers exceed `limit`, switch to a full block renumbering. |
| 159 | fn renumber_insts(&mut self, inst: Inst, seq: SequenceNumber, limit: SequenceNumber) { |
| 160 | let mut inst = inst; |
| 161 | let mut seq = seq; |
| 162 | |
| 163 | loop { |
| 164 | self.insts[inst].seq = seq; |
| 165 | |
| 166 | // Next instruction. |
| 167 | inst = match self.insts[inst].next.expand() { |
| 168 | None => return, |
| 169 | Some(next) => next, |
| 170 | }; |
| 171 | |
| 172 | if seq < self.insts[inst].seq { |
| 173 | // Sequence caught up. |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | if seq > limit { |
| 178 | // We're pushing too many instructions in front of us. |
| 179 | // Switch to a full block renumbering to make some space. |
| 180 | self.full_block_renumber( |
| 181 | self.inst_block(inst) |
| 182 | .expect("inst must be inserted before assigning an seq"), |
| 183 | ); |
| 184 | return; |
| 185 | } |
| 186 | |
| 187 | seq += MINOR_STRIDE; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | /// Renumber all instructions in a block. |
| 192 | /// |
no test coverage detected