Browse Source

Merge pull request #2400 from MattX/improve-finalize-msg

Specify unsealed / unfilled blocks
pull/2445/head
Nick Fitzgerald 4 years ago
committed by GitHub
parent
commit
1dd20b4371
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      cranelift/frontend/src/frontend.rs

28
cranelift/frontend/src/frontend.rs

@ -459,19 +459,21 @@ impl<'a> FunctionBuilder<'a> {
/// for another function.
pub fn finalize(&mut self) {
// Check that all the `Block`s are filled and sealed.
debug_assert!(
self.func_ctx.blocks.iter().all(
|(block, block_data)| block_data.pristine || self.func_ctx.ssa.is_sealed(block)
),
"all blocks should be sealed before dropping a FunctionBuilder"
);
debug_assert!(
self.func_ctx
.blocks
.values()
.all(|block_data| block_data.pristine || block_data.filled),
"all blocks should be filled before dropping a FunctionBuilder"
);
#[cfg(debug_assertions)]
{
for (block, block_data) in self.func_ctx.blocks.iter() {
assert!(
block_data.pristine || self.func_ctx.ssa.is_sealed(block),
"FunctionBuilder finalized, but block {} is not sealed",
block,
);
assert!(
block_data.pristine || block_data.filled,
"FunctionBuilder finalized, but block {} is not filled",
block,
);
}
}
// In debug mode, check that all blocks are valid basic blocks.
#[cfg(debug_assertions)]

Loading…
Cancel
Save