Cranelift: add debug logs counting how many vcode instructions and blocks we lower to (#5332)

This commit is contained in:
Nick Fitzgerald
2022-11-28 10:57:02 -08:00
committed by GitHub
parent 54a6d2f79a
commit 6fe69d00ca
2 changed files with 10 additions and 0 deletions

View File

@@ -39,6 +39,11 @@ pub fn compile<B: LowerBackend + TargetIsa>(
lower.lower(b)?
};
log::debug!(
"Number of lowered vcode instructions: {}",
vcode.num_insts()
);
log::debug!("Number of lowered vcode blocks: {}", vcode.num_blocks());
trace!("vcode from lowering: \n{:?}", vcode);
// Perform register allocation.

View File

@@ -665,6 +665,11 @@ impl<I: VCodeInst> VCode<I> {
self.block_ranges.len()
}
/// The number of lowered instructions.
pub fn num_insts(&self) -> usize {
self.insts.len()
}
/// Get the successors for a block.
pub fn succs(&self, block: BlockIndex) -> &[BlockIndex] {
let (start, end) = self.block_succ_range[block.index()];