Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/ScheduleDAG.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | #ifndef NDEBUG | ||||
StressSched = StressSchedOpt; | StressSched = StressSchedOpt; | ||||
#endif | #endif | ||||
} | } | ||||
ScheduleDAG::~ScheduleDAG() = default; | ScheduleDAG::~ScheduleDAG() = default; | ||||
void ScheduleDAG::clearDAG() { | void ScheduleDAG::clearDAG() { | ||||
SUnits.clear(); | SUnits.clear(); | ||||
EntrySU = SUnit(); | |||||
ExitSU = SUnit(); | ExitSU = SUnit(); | ||||
} | } | ||||
const MCInstrDesc *ScheduleDAG::getNodeDesc(const SDNode *Node) const { | const MCInstrDesc *ScheduleDAG::getNodeDesc(const SDNode *Node) const { | ||||
if (!Node || !Node->isMachineOpcode()) return nullptr; | if (!Node || !Node->isMachineOpcode()) return nullptr; | ||||
return &TII->get(Node->getMachineOpcode()); | return &TII->get(Node->getMachineOpcode()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 272 Lines • ▼ Show 20 Lines | if (WeakSuccsLeft) | ||||
dbgs() << " # weak succs left : " << WeakSuccsLeft << "\n"; | dbgs() << " # weak succs left : " << WeakSuccsLeft << "\n"; | ||||
dbgs() << " # rdefs left : " << NumRegDefsLeft << "\n"; | dbgs() << " # rdefs left : " << NumRegDefsLeft << "\n"; | ||||
dbgs() << " Latency : " << Latency << "\n"; | dbgs() << " Latency : " << Latency << "\n"; | ||||
dbgs() << " Depth : " << getDepth() << "\n"; | dbgs() << " Depth : " << getDepth() << "\n"; | ||||
dbgs() << " Height : " << getHeight() << "\n"; | dbgs() << " Height : " << getHeight() << "\n"; | ||||
} | } | ||||
LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeName(const SUnit &SU) const { | LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeName(const SUnit &SU) const { | ||||
if (&SU == &EntrySU) | if (&SU == &ExitSU) | ||||
dbgs() << "EntrySU"; | |||||
else if (&SU == &ExitSU) | |||||
dbgs() << "ExitSU"; | dbgs() << "ExitSU"; | ||||
else | else | ||||
dbgs() << "SU(" << SU.NodeNum << ")"; | dbgs() << "SU(" << SU.NodeNum << ")"; | ||||
} | } | ||||
LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeAll(const SUnit &SU) const { | LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeAll(const SUnit &SU) const { | ||||
dumpNode(SU); | dumpNode(SU); | ||||
SU.dumpAttributes(); | SU.dumpAttributes(); | ||||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | std::vector<int> ScheduleDAGTopologicalSort::GetSubGraph(const SUnit &StartSU, | ||||
// passes are added to Nodes. | // passes are added to Nodes. | ||||
WorkList.push_back(&TargetSU); | WorkList.push_back(&TargetSU); | ||||
do { | do { | ||||
const SUnit *SU = WorkList.back(); | const SUnit *SU = WorkList.back(); | ||||
WorkList.pop_back(); | WorkList.pop_back(); | ||||
for (int I = SU->Preds.size()-1; I >= 0; --I) { | for (int I = SU->Preds.size()-1; I >= 0; --I) { | ||||
const SUnit *Pred = SU->Preds[I].getSUnit(); | const SUnit *Pred = SU->Preds[I].getSUnit(); | ||||
unsigned s = Pred->NodeNum; | unsigned s = Pred->NodeNum; | ||||
// Edges to non-SUnits are allowed but ignored (e.g. EntrySU). | // Edges to non-SUnits are allowed but ignored (e.g. ExitSU). | ||||
if (Pred->isBoundaryNode()) | if (Pred->isBoundaryNode()) | ||||
continue; | continue; | ||||
if (Node2Index[s] == LowerBound) { | if (Node2Index[s] == LowerBound) { | ||||
Found = true; | Found = true; | ||||
continue; | continue; | ||||
} | } | ||||
if (!VisitedBack.test(s) && Visited.test(s)) { | if (!VisitedBack.test(s) && Visited.test(s)) { | ||||
VisitedBack.set(s); | VisitedBack.set(s); | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |