[PATCH] D28488: [CodeGen] Implement the SUnit::print() method
Evandro Menezes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 15:02:09 PST 2017
evandro created this revision.
evandro added reviewers: atrick, sunfish, MatzeB.
evandro added a subscriber: llvm-commits.
evandro set the repository for this revision to rL LLVM.
The `print()` method seems to have had a troubled life. This patch proposes that it replaces the recently added helper local function `dumpSUIdentifier()`. This way, the method can be used in other files using the `SUnit` class.
Repository:
rL LLVM
https://reviews.llvm.org/D28488
Files:
llvm/lib/CodeGen/ScheduleDAG.cpp
Index: llvm/lib/CodeGen/ScheduleDAG.cpp
===================================================================
--- llvm/lib/CodeGen/ScheduleDAG.cpp
+++ llvm/lib/CodeGen/ScheduleDAG.cpp
@@ -310,19 +310,19 @@
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-static void dumpSUIdentifier(const ScheduleDAG &DAG, const SUnit &SU) {
- if (&SU == &DAG.ExitSU)
- dbgs() << "ExitSU";
- else if (&SU == &DAG.EntrySU)
- dbgs() << "EntrySU";
+void SUnit::print(raw_ostream &O, const ScheduleDAG *G) const {
+ if (this == &G->ExitSU)
+ O << "ExitSU";
+ else if (this == &G->EntrySU)
+ O << "EntrySU";
else
- dbgs() << "SU(" << SU.NodeNum << ")";
+ O << "SU(" << NodeNum << ")";
}
/// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or
/// a group of nodes flagged together.
void SUnit::dump(const ScheduleDAG *G) const {
- dumpSUIdentifier(*G, *this);
+ print(dbgs(), G);
dbgs() << ": ";
G->dumpNode(this);
}
@@ -352,7 +352,7 @@
case SDep::Output: dbgs() << "out "; break;
case SDep::Order: dbgs() << "ord "; break;
}
- dumpSUIdentifier(*G, *I->getSUnit());
+ I->getSUnit()->print(dbgs(), G);
if (I->isArtificial())
dbgs() << " *";
dbgs() << ": Latency=" << I->getLatency();
@@ -372,7 +372,7 @@
case SDep::Output: dbgs() << "out "; break;
case SDep::Order: dbgs() << "ord "; break;
}
- dumpSUIdentifier(*G, *I->getSUnit());
+ I->getSUnit()->print(dbgs(), G);
if (I->isArtificial())
dbgs() << " *";
dbgs() << ": Latency=" << I->getLatency();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28488.83709.patch
Type: text/x-patch
Size: 1611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170109/ec315946/attachment.bin>
More information about the llvm-commits
mailing list