mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Move the code for printing a graph node label for an SUnit into
a virtual method of SelectionDAG. llvm-svn: 59667
This commit is contained in:
parent
b5ce3ebed1
commit
32a8ee5c90
@ -396,6 +396,10 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
virtual void Schedule() = 0;
|
virtual void Schedule() = 0;
|
||||||
|
|
||||||
|
/// getGraphpNodeLabel - Return a label for an SUnit node in a Graphviz or similar
|
||||||
|
/// graph visualization.
|
||||||
|
virtual std::string getGraphNodeLabel(const SUnit *SU) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// EmitSubregNode - Generate machine code for subreg nodes.
|
/// EmitSubregNode - Generate machine code for subreg nodes.
|
||||||
///
|
///
|
||||||
|
@ -468,7 +468,7 @@ void SUnit::print(raw_ostream &O, const ScheduleDAG *G) const {
|
|||||||
FlaggedNodes.push_back(N);
|
FlaggedNodes.push_back(N);
|
||||||
while (!FlaggedNodes.empty()) {
|
while (!FlaggedNodes.empty()) {
|
||||||
O << " ";
|
O << " ";
|
||||||
FlaggedNodes.back()->dump(G->DAG);
|
FlaggedNodes.back()->print(O, G->DAG);
|
||||||
O << "\n";
|
O << "\n";
|
||||||
FlaggedNodes.pop_back();
|
FlaggedNodes.pop_back();
|
||||||
}
|
}
|
||||||
|
@ -444,31 +444,28 @@ namespace llvm {
|
|||||||
|
|
||||||
std::string DOTGraphTraits<ScheduleDAG*>::getNodeLabel(const SUnit *SU,
|
std::string DOTGraphTraits<ScheduleDAG*>::getNodeLabel(const SUnit *SU,
|
||||||
const ScheduleDAG *G) {
|
const ScheduleDAG *G) {
|
||||||
std::string Op;
|
return G->getGraphNodeLabel(SU);
|
||||||
|
|
||||||
if (G->DAG) {
|
|
||||||
if (!SU->getNode())
|
|
||||||
Op = "<CROSS RC COPY>";
|
|
||||||
else {
|
|
||||||
SmallVector<SDNode *, 4> FlaggedNodes;
|
|
||||||
for (SDNode *N = SU->getNode(); N; N = N->getFlaggedNode())
|
|
||||||
FlaggedNodes.push_back(N);
|
|
||||||
while (!FlaggedNodes.empty()) {
|
|
||||||
Op += DOTGraphTraits<SelectionDAG*>::getNodeLabel(FlaggedNodes.back(),
|
|
||||||
G->DAG) + "\n";
|
|
||||||
FlaggedNodes.pop_back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
std::string s;
|
|
||||||
raw_string_ostream oss(s);
|
|
||||||
SU->getInstr()->print(oss);
|
|
||||||
Op += oss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Op;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ScheduleDAG::getGraphNodeLabel(const SUnit *SU) const {
|
||||||
|
std::string s;
|
||||||
|
raw_string_ostream O(s);
|
||||||
|
O << "SU(" << SU->NodeNum << "): ";
|
||||||
|
if (SU->getNode()) {
|
||||||
|
SmallVector<SDNode *, 4> FlaggedNodes;
|
||||||
|
for (SDNode *N = SU->getNode(); N; N = N->getFlaggedNode())
|
||||||
|
FlaggedNodes.push_back(N);
|
||||||
|
while (!FlaggedNodes.empty()) {
|
||||||
|
O << DOTGraphTraits<SelectionDAG*>::getNodeLabel(FlaggedNodes.back(), DAG);
|
||||||
|
FlaggedNodes.pop_back();
|
||||||
|
if (!FlaggedNodes.empty())
|
||||||
|
O << "\n ";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
O << "CROSS RC COPY";
|
||||||
|
}
|
||||||
|
return O.str();
|
||||||
|
}
|
||||||
|
|
||||||
/// viewGraph - Pop up a ghostview window with the reachable parts of the DAG
|
/// viewGraph - Pop up a ghostview window with the reachable parts of the DAG
|
||||||
/// rendered using 'dot'.
|
/// rendered using 'dot'.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user