Checks the stack layout and spill slot definitions.
(&self)
| 215 | |
| 216 | /// Checks the stack layout and spill slot definitions. |
| 217 | fn check_stack(&self) -> Result<()> { |
| 218 | let stack_layout = self.output.stack_layout(); |
| 219 | for slot in stack_layout.spillslots() { |
| 220 | let Some((offset, size)) = stack_layout.spillslot_layout(slot) else { |
| 221 | continue; |
| 222 | }; |
| 223 | ensure!( |
| 224 | offset.is_multiple_of(size.bytes()), |
| 225 | "{slot} offset {offset} is not aligned to size {size}" |
| 226 | ); |
| 227 | let end = offset + size.bytes(); |
| 228 | ensure!( |
| 229 | end <= stack_layout.spillslot_area_size(), |
| 230 | "{slot} ends at {end} which exceeds spill area size {}", |
| 231 | stack_layout.spillslot_area_size() |
| 232 | ); |
| 233 | } |
| 234 | Ok(()) |
| 235 | } |
| 236 | |
| 237 | /// Checks the allocation result for a block and then propagates the end |
| 238 | /// state to any successor blocks. |
no test coverage detected