mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Revert "[NFC][ScheduleDAG] Remove unused EntrySU SUnit"
This reverts commit 0345d88de654259ae90494bf9b015416e2cccacb. Google internal backend uses EntrySU, we are looking into removing dependency on it. Differential Revision: https://reviews.llvm.org/D88018
This commit is contained in:
parent
77b449d743
commit
da4afc0c02
@ -234,7 +234,7 @@ public:
|
|||||||
virtual void leaveMBB() {};
|
virtual void leaveMBB() {};
|
||||||
|
|
||||||
/// Notify this strategy that all roots have been released (including those
|
/// Notify this strategy that all roots have been released (including those
|
||||||
/// that depend on ExitSU).
|
/// that depend on EntrySU or ExitSU).
|
||||||
virtual void registerRoots() {}
|
virtual void registerRoots() {}
|
||||||
|
|
||||||
/// Pick the next node to schedule, or return NULL. Set IsTopNode to true to
|
/// Pick the next node to schedule, or return NULL. Set IsTopNode to true to
|
||||||
|
@ -560,6 +560,7 @@ class TargetRegisterInfo;
|
|||||||
MachineFunction &MF; ///< Machine function
|
MachineFunction &MF; ///< Machine function
|
||||||
MachineRegisterInfo &MRI; ///< Virtual/real register map
|
MachineRegisterInfo &MRI; ///< Virtual/real register map
|
||||||
std::vector<SUnit> SUnits; ///< The scheduling units.
|
std::vector<SUnit> SUnits; ///< The scheduling units.
|
||||||
|
SUnit EntrySU; ///< Special node for the region entry.
|
||||||
SUnit ExitSU; ///< Special node for the region exit.
|
SUnit ExitSU; ///< Special node for the region exit.
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
@ -680,7 +680,7 @@ void ScheduleDAGMI::releasePred(SUnit *SU, SDep *PredEdge) {
|
|||||||
PredSU->BotReadyCycle = SU->BotReadyCycle + PredEdge->getLatency();
|
PredSU->BotReadyCycle = SU->BotReadyCycle + PredEdge->getLatency();
|
||||||
|
|
||||||
--PredSU->NumSuccsLeft;
|
--PredSU->NumSuccsLeft;
|
||||||
if (PredSU->NumSuccsLeft == 0)
|
if (PredSU->NumSuccsLeft == 0 && PredSU != &EntrySU)
|
||||||
SchedImpl->releaseBottomNode(PredSU);
|
SchedImpl->releaseBottomNode(PredSU);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,7 +853,7 @@ void ScheduleDAGMI::initQueues(ArrayRef<SUnit*> TopRoots,
|
|||||||
NextClusterSucc = nullptr;
|
NextClusterSucc = nullptr;
|
||||||
NextClusterPred = nullptr;
|
NextClusterPred = nullptr;
|
||||||
|
|
||||||
// Release all DAG roots for scheduling, not including ExitSU.
|
// Release all DAG roots for scheduling, not including EntrySU/ExitSU.
|
||||||
//
|
//
|
||||||
// Nodes with unreleased weak edges can still be roots.
|
// Nodes with unreleased weak edges can still be roots.
|
||||||
// Release top roots in forward order.
|
// Release top roots in forward order.
|
||||||
@ -867,6 +867,7 @@ void ScheduleDAGMI::initQueues(ArrayRef<SUnit*> TopRoots,
|
|||||||
SchedImpl->releaseBottomNode(*I);
|
SchedImpl->releaseBottomNode(*I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
releaseSuccessors(&EntrySU);
|
||||||
releasePredecessors(&ExitSU);
|
releasePredecessors(&ExitSU);
|
||||||
|
|
||||||
SchedImpl->registerRoots();
|
SchedImpl->registerRoots();
|
||||||
@ -1167,6 +1168,8 @@ void ScheduleDAGMILive::updatePressureDiffs(
|
|||||||
|
|
||||||
void ScheduleDAGMILive::dump() const {
|
void ScheduleDAGMILive::dump() const {
|
||||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||||
|
if (EntrySU.getInstr() != nullptr)
|
||||||
|
dumpNodeAll(EntrySU);
|
||||||
for (const SUnit &SU : SUnits) {
|
for (const SUnit &SU : SUnits) {
|
||||||
dumpNodeAll(SU);
|
dumpNodeAll(SU);
|
||||||
if (ShouldTrackPressure) {
|
if (ShouldTrackPressure) {
|
||||||
|
@ -109,21 +109,23 @@ static bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
|
|||||||
|
|
||||||
// Make the FirstSU also dependent on the dependencies of the SecondSU to
|
// Make the FirstSU also dependent on the dependencies of the SecondSU to
|
||||||
// prevent them from being scheduled between the FirstSU and the SecondSU.
|
// prevent them from being scheduled between the FirstSU and the SecondSU.
|
||||||
for (const SDep &SI : SecondSU.Preds) {
|
if (&FirstSU != &DAG.EntrySU) {
|
||||||
SUnit *SU = SI.getSUnit();
|
for (const SDep &SI : SecondSU.Preds) {
|
||||||
if (SI.isWeak() || isHazard(SI) || &FirstSU == SU || FirstSU.isSucc(SU))
|
SUnit *SU = SI.getSUnit();
|
||||||
continue;
|
if (SI.isWeak() || isHazard(SI) || &FirstSU == SU || FirstSU.isSucc(SU))
|
||||||
LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(*SU); dbgs() << " - ";
|
continue;
|
||||||
DAG.dumpNodeName(FirstSU); dbgs() << '\n';);
|
LLVM_DEBUG(dbgs() << " Bind "; DAG.dumpNodeName(*SU); dbgs() << " - ";
|
||||||
DAG.addEdge(&FirstSU, SDep(SU, SDep::Artificial));
|
DAG.dumpNodeName(FirstSU); dbgs() << '\n';);
|
||||||
}
|
DAG.addEdge(&FirstSU, SDep(SU, SDep::Artificial));
|
||||||
// ExitSU comes last by design, which acts like an implicit dependency
|
}
|
||||||
// between ExitSU and any bottom root in the graph. We should transfer
|
// ExitSU comes last by design, which acts like an implicit dependency
|
||||||
// this to FirstSU as well.
|
// between ExitSU and any bottom root in the graph. We should transfer
|
||||||
if (&SecondSU == &DAG.ExitSU) {
|
// this to FirstSU as well.
|
||||||
for (SUnit &SU : DAG.SUnits) {
|
if (&SecondSU == &DAG.ExitSU) {
|
||||||
if (SU.Succs.empty())
|
for (SUnit &SU : DAG.SUnits) {
|
||||||
DAG.addEdge(&FirstSU, SDep(&SU, SDep::Artificial));
|
if (SU.Succs.empty())
|
||||||
|
DAG.addEdge(&FirstSU, SDep(&SU, SDep::Artificial));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,6 +527,9 @@ void SchedulePostRATDList::ListScheduleTopDown() {
|
|||||||
// blocks are a single region).
|
// blocks are a single region).
|
||||||
HazardRec->Reset();
|
HazardRec->Reset();
|
||||||
|
|
||||||
|
// Release any successors of the special Entry node.
|
||||||
|
ReleaseSuccessors(&EntrySU);
|
||||||
|
|
||||||
// Add all leaves to Available queue.
|
// Add all leaves to Available queue.
|
||||||
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
|
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
|
||||||
// It is available if it has no predecessors.
|
// It is available if it has no predecessors.
|
||||||
|
@ -63,6 +63,7 @@ ScheduleDAG::~ScheduleDAG() = default;
|
|||||||
|
|
||||||
void ScheduleDAG::clearDAG() {
|
void ScheduleDAG::clearDAG() {
|
||||||
SUnits.clear();
|
SUnits.clear();
|
||||||
|
EntrySU = SUnit();
|
||||||
ExitSU = SUnit();
|
ExitSU = SUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +352,9 @@ LLVM_DUMP_METHOD void SUnit::dumpAttributes() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeName(const SUnit &SU) const {
|
LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeName(const SUnit &SU) const {
|
||||||
if (&SU == &ExitSU)
|
if (&SU == &EntrySU)
|
||||||
|
dbgs() << "EntrySU";
|
||||||
|
else if (&SU == &ExitSU)
|
||||||
dbgs() << "ExitSU";
|
dbgs() << "ExitSU";
|
||||||
else
|
else
|
||||||
dbgs() << "SU(" << SU.NodeNum << ")";
|
dbgs() << "SU(" << SU.NodeNum << ")";
|
||||||
@ -653,7 +656,7 @@ std::vector<int> ScheduleDAGTopologicalSort::GetSubGraph(const SUnit &StartSU,
|
|||||||
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. ExitSU).
|
// Edges to non-SUnits are allowed but ignored (e.g. EntrySU).
|
||||||
if (Pred->isBoundaryNode())
|
if (Pred->isBoundaryNode())
|
||||||
continue;
|
continue;
|
||||||
if (Node2Index[s] == LowerBound) {
|
if (Node2Index[s] == LowerBound) {
|
||||||
|
@ -1167,6 +1167,8 @@ void ScheduleDAGInstrs::dumpNode(const SUnit &SU) const {
|
|||||||
|
|
||||||
void ScheduleDAGInstrs::dump() const {
|
void ScheduleDAGInstrs::dump() const {
|
||||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||||
|
if (EntrySU.getInstr() != nullptr)
|
||||||
|
dumpNodeAll(EntrySU);
|
||||||
for (const SUnit &SU : SUnits)
|
for (const SUnit &SU : SUnits)
|
||||||
dumpNodeAll(SU);
|
dumpNodeAll(SU);
|
||||||
if (ExitSU.getInstr() != nullptr)
|
if (ExitSU.getInstr() != nullptr)
|
||||||
@ -1177,7 +1179,9 @@ void ScheduleDAGInstrs::dump() const {
|
|||||||
std::string ScheduleDAGInstrs::getGraphNodeLabel(const SUnit *SU) const {
|
std::string ScheduleDAGInstrs::getGraphNodeLabel(const SUnit *SU) const {
|
||||||
std::string s;
|
std::string s;
|
||||||
raw_string_ostream oss(s);
|
raw_string_ostream oss(s);
|
||||||
if (SU == &ExitSU)
|
if (SU == &EntrySU)
|
||||||
|
oss << "<entry>";
|
||||||
|
else if (SU == &ExitSU)
|
||||||
oss << "<exit>";
|
oss << "<exit>";
|
||||||
else
|
else
|
||||||
SU->getInstr()->print(oss, /*IsStandalone=*/true);
|
SU->getInstr()->print(oss, /*IsStandalone=*/true);
|
||||||
|
@ -150,8 +150,8 @@ void ScheduleDAGFast::ReleasePred(SUnit *SU, SDep *PredEdge) {
|
|||||||
--PredSU->NumSuccsLeft;
|
--PredSU->NumSuccsLeft;
|
||||||
|
|
||||||
// If all the node's successors are scheduled, this node is ready
|
// If all the node's successors are scheduled, this node is ready
|
||||||
// to be scheduled.
|
// to be scheduled. Ignore the special EntrySU node.
|
||||||
if (PredSU->NumSuccsLeft == 0) {
|
if (PredSU->NumSuccsLeft == 0 && PredSU != &EntrySU) {
|
||||||
PredSU->isAvailable = true;
|
PredSU->isAvailable = true;
|
||||||
AvailableQueue.push(PredSU);
|
AvailableQueue.push(PredSU);
|
||||||
}
|
}
|
||||||
|
@ -415,8 +415,8 @@ void ScheduleDAGRRList::ReleasePred(SUnit *SU, const SDep *PredEdge) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If all the node's successors are scheduled, this node is ready
|
// If all the node's successors are scheduled, this node is ready
|
||||||
// to be scheduled.
|
// to be scheduled. Ignore the special EntrySU node.
|
||||||
if (PredSU->NumSuccsLeft == 0) {
|
if (PredSU->NumSuccsLeft == 0 && PredSU != &EntrySU) {
|
||||||
PredSU->isAvailable = true;
|
PredSU->isAvailable = true;
|
||||||
|
|
||||||
unsigned Height = PredSU->getHeight();
|
unsigned Height = PredSU->getHeight();
|
||||||
|
@ -696,6 +696,8 @@ void ScheduleDAGSDNodes::dumpNode(const SUnit &SU) const {
|
|||||||
|
|
||||||
void ScheduleDAGSDNodes::dump() const {
|
void ScheduleDAGSDNodes::dump() const {
|
||||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||||
|
if (EntrySU.getNode() != nullptr)
|
||||||
|
dumpNodeAll(EntrySU);
|
||||||
for (const SUnit &SU : SUnits)
|
for (const SUnit &SU : SUnits)
|
||||||
dumpNodeAll(SU);
|
dumpNodeAll(SU);
|
||||||
if (ExitSU.getNode() != nullptr)
|
if (ExitSU.getNode() != nullptr)
|
||||||
|
@ -166,6 +166,9 @@ void ScheduleDAGVLIW::scheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
|
|||||||
void ScheduleDAGVLIW::listScheduleTopDown() {
|
void ScheduleDAGVLIW::listScheduleTopDown() {
|
||||||
unsigned CurCycle = 0;
|
unsigned CurCycle = 0;
|
||||||
|
|
||||||
|
// Release any successors of the special Entry node.
|
||||||
|
releaseSuccessors(&EntrySU);
|
||||||
|
|
||||||
// All leaves to AvailableQueue.
|
// All leaves to AvailableQueue.
|
||||||
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
|
for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
|
||||||
// It is available if it has no predecessors.
|
// It is available if it has no predecessors.
|
||||||
|
@ -248,6 +248,7 @@ GCNMinRegScheduler::schedule(ArrayRef<const SUnit*> TopRoots,
|
|||||||
for (auto SU : TopRoots) {
|
for (auto SU : TopRoots) {
|
||||||
RQ.push_back(*new (Alloc.Allocate()) Candidate(SU, StepNo));
|
RQ.push_back(*new (Alloc.Allocate()) Candidate(SU, StepNo));
|
||||||
}
|
}
|
||||||
|
releaseSuccessors(&DAG.EntrySU, StepNo);
|
||||||
|
|
||||||
while (!RQ.empty()) {
|
while (!RQ.empty()) {
|
||||||
LLVM_DEBUG(dbgs() << "\n=== Picking candidate, Step = " << StepNo
|
LLVM_DEBUG(dbgs() << "\n=== Picking candidate, Step = " << StepNo
|
||||||
|
@ -455,6 +455,7 @@ public:
|
|||||||
MachineRegisterInfo *getMRI() { return &MRI; }
|
MachineRegisterInfo *getMRI() { return &MRI; }
|
||||||
const TargetRegisterInfo *getTRI() { return TRI; }
|
const TargetRegisterInfo *getTRI() { return TRI; }
|
||||||
ScheduleDAGTopologicalSort *GetTopo() { return &Topo; }
|
ScheduleDAGTopologicalSort *GetTopo() { return &Topo; }
|
||||||
|
SUnit &getEntrySU() { return EntrySU; }
|
||||||
SUnit& getExitSU() { return ExitSU; }
|
SUnit& getExitSU() { return ExitSU; }
|
||||||
|
|
||||||
void restoreSULinksLeft();
|
void restoreSULinksLeft();
|
||||||
|
Loading…
Reference in New Issue
Block a user