basic_block: Add inst address and use count to DumpBlock

This additional output assists with debugging.
This commit is contained in:
MerryMage 2017-11-27 19:35:12 +00:00
parent c6d09adcb7
commit 5d72f7048f

View file

@ -172,6 +172,7 @@ std::string DumpBlock(const IR::Block& block) {
for (const auto& inst : block) { for (const auto& inst : block) {
const Opcode op = inst.GetOpcode(); const Opcode op = inst.GetOpcode();
ret += fmt::format("[{:016x}] ", reinterpret_cast<u64>(&inst));
if (GetTypeOf(op) != Type::Void) { if (GetTypeOf(op) != Type::Void) {
ret += fmt::format("%{:<5} = ", index); ret += fmt::format("%{:<5} = ", index);
} else { } else {
@ -194,6 +195,8 @@ std::string DumpBlock(const IR::Block& block) {
} }
} }
ret += fmt::format(" (uses: {})", inst.UseCount());
ret += '\n'; ret += '\n';
inst_to_index[&inst] = index++; inst_to_index[&inst] = index++;
} }