Commit d9726d1a authored by Georg Neis's avatar Georg Neis Committed by V8 LUCI CQ

[compiler] Improve --trace-turbo-scheduler printing of blocks

The output was utterly confusing because block identities were printed
in different ways:

- "id:5" for a block with id 5
- "B5" for a block with rpo number 5
- also (!!!) "B5" for a block with id 5


With this CL, the last case above is eliminated such that there is no
ambiguity. I originally wanted to unify the prefix syntax as well (e.g.
"id:5" and "rpo:5"), but the prefixes are hard-coded in countless
places including CodeGenerator, Turbolizer, and Verifier. Many of these
are format strings that are painful to write more generically.

Change-Id: I0eb70731c7b1ef9a9999e0bcb58b673288932e93
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2940890
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75092}
parent 118b1b00
......@@ -107,7 +107,7 @@ BasicBlock* BasicBlock::GetCommonDominator(BasicBlock* b1, BasicBlock* b2) {
void BasicBlock::Print() { StdoutStream{} << *this << "\n"; }
std::ostream& operator<<(std::ostream& os, const BasicBlock& block) {
os << "B" << block.id();
os << "id:" << block.id();
#if DEBUG
AssemblerDebugInfo info = block.debug_info();
if (info.name) os << info;
......@@ -117,7 +117,7 @@ std::ostream& operator<<(std::ostream& os, const BasicBlock& block) {
const BasicBlock* current_block = &block;
while (current_block->PredecessorCount() > 0 && i++ < kMaxDisplayedBlocks) {
current_block = current_block->predecessors().front();
os << " <= B" << current_block->id();
os << " <= id:" << current_block->id();
info = current_block->debug_info();
if (info.name) os << info;
}
......@@ -200,8 +200,8 @@ BasicBlock* Schedule::NewBasicBlock() {
void Schedule::PlanNode(BasicBlock* block, Node* node) {
if (FLAG_trace_turbo_scheduler) {
StdoutStream{} << "Planning #" << node->id() << ":"
<< node->op()->mnemonic() << " for future add to B"
<< block->id() << "\n";
<< node->op()->mnemonic()
<< " for future add to id:" << block->id() << "\n";
}
DCHECK_NULL(this->block(node));
SetBlockForNode(block, node);
......@@ -210,7 +210,7 @@ void Schedule::PlanNode(BasicBlock* block, Node* node) {
void Schedule::AddNode(BasicBlock* block, Node* node) {
if (FLAG_trace_turbo_scheduler) {
StdoutStream{} << "Adding #" << node->id() << ":" << node->op()->mnemonic()
<< " to B" << block->id() << "\n";
<< " to id:" << block->id() << "\n";
}
DCHECK(this->block(node) == nullptr || this->block(node) == block);
block->AddNode(node);
......@@ -465,7 +465,7 @@ std::ostream& operator<<(std::ostream& os, const Schedule& s) {
((s.RpoBlockCount() == 0) ? *s.all_blocks() : *s.rpo_order())) {
if (block == nullptr) continue;
if (block->rpo_number() == -1) {
os << "--- BLOCK id:" << block->id().ToInt();
os << "--- BLOCK id:" << block->id();
} else {
os << "--- BLOCK B" << block->rpo_number();
}
......@@ -476,7 +476,7 @@ std::ostream& operator<<(std::ostream& os, const Schedule& s) {
if (comma) os << ", ";
comma = true;
if (predecessor->rpo_number() == -1) {
os << "id:" << predecessor->id().ToInt();
os << "id:" << predecessor->id();
} else {
os << "B" << predecessor->rpo_number();
}
......@@ -503,7 +503,7 @@ std::ostream& operator<<(std::ostream& os, const Schedule& s) {
if (comma) os << ", ";
comma = true;
if (successor->rpo_number() == -1) {
os << "id:" << successor->id().ToInt();
os << "id:" << successor->id();
} else {
os << "B" << successor->rpo_number();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment