better vcode printing
This commit is contained in:
@@ -758,6 +758,7 @@ impl<I: VCodeInst> VCode<I> {
|
|||||||
{
|
{
|
||||||
// To write into disasm string.
|
// To write into disasm string.
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
|
let want_disasm = true;
|
||||||
|
|
||||||
let _tt = timing::vcode_emit();
|
let _tt = timing::vcode_emit();
|
||||||
let mut buffer = MachBuffer::new();
|
let mut buffer = MachBuffer::new();
|
||||||
@@ -1323,12 +1324,39 @@ impl<I: VCodeInst> fmt::Debug for VCode<I> {
|
|||||||
|
|
||||||
for block in 0..self.num_blocks() {
|
for block in 0..self.num_blocks() {
|
||||||
let block = BlockIndex::new(block);
|
let block = BlockIndex::new(block);
|
||||||
writeln!(f, "Block {}:", block.index())?;
|
write!(f, "Block {}(", block.index())?;
|
||||||
|
{
|
||||||
|
let mut first = true;
|
||||||
|
for vreg in self.block_params(block) {
|
||||||
|
if !first {
|
||||||
|
write!(f, ", ")?;
|
||||||
|
} else {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
write!(f, "{}", vreg)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeln!(f, "):")?;
|
||||||
if let Some(bb) = self.bindex_to_bb(block) {
|
if let Some(bb) = self.bindex_to_bb(block) {
|
||||||
writeln!(f, " (original IR block: {})", bb)?;
|
writeln!(f, " (original IR block: {})", bb)?;
|
||||||
}
|
}
|
||||||
for succ in self.succs(block) {
|
for (i, succ) in self.succs(block).iter().enumerate() {
|
||||||
writeln!(f, " (successor: Block {})", succ.index())?;
|
let last_inst = self.block_insns(block).last();
|
||||||
|
if self.is_branch(last_inst) {
|
||||||
|
write!(f, " (successor: Block {}(", succ.index())?;
|
||||||
|
let mut first = true;
|
||||||
|
for vreg in self.branch_blockparams(block, last_inst, i) {
|
||||||
|
if !first {
|
||||||
|
write!(f, ", ")?;
|
||||||
|
} else {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
write!(f, "{}", vreg)?;
|
||||||
|
}
|
||||||
|
writeln!(f, "))")?;
|
||||||
|
} else {
|
||||||
|
write!(f, " (successor: Block {})", succ.index())?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let (start, end) = self.block_ranges[block.index()];
|
let (start, end) = self.block_ranges[block.index()];
|
||||||
writeln!(
|
writeln!(
|
||||||
|
|||||||
Reference in New Issue
Block a user