diff options
| author | Dan Gohman <gohman@apple.com> | 2009-01-15 22:18:12 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-01-15 22:18:12 +0000 |
| commit | fc54c552963545a81e4ea38e60460590afb2d5ae (patch) | |
| tree | bc07efaf419ac8d6edd959e8ff291c62d8ac6acd /lib/CodeGen | |
| parent | c475c3608a5f0fc0c6bd43da04ae786649690070 (diff) | |
Generalize the HazardRecognizer interface so that it can be used
to support MachineInstr-based scheduling in addition to
SDNode-based scheduling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
| -rw-r--r-- | lib/CodeGen/ScheduleDAG.cpp | 3 | ||||
| -rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp | 29 | ||||
| -rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 5 |
3 files changed, 14 insertions, 23 deletions
diff --git a/lib/CodeGen/ScheduleDAG.cpp b/lib/CodeGen/ScheduleDAG.cpp index 7bad67fde4..e309a4385e 100644 --- a/lib/CodeGen/ScheduleDAG.cpp +++ b/lib/CodeGen/ScheduleDAG.cpp @@ -14,6 +14,7 @@ #define DEBUG_TYPE "pre-RA-sched" #include "llvm/CodeGen/ScheduleDAG.h" +#include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetRegisterInfo.h" @@ -561,3 +562,5 @@ void ScheduleDAGTopologicalSort::Allocate(int n, int index) { ScheduleDAGTopologicalSort::ScheduleDAGTopologicalSort( std::vector<SUnit> &sunits) : SUnits(sunits) {} + +ScheduleHazardRecognizer::~ScheduleHazardRecognizer() {} diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp index 2e2cac4121..1d11c37e34 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp @@ -21,6 +21,7 @@ #define DEBUG_TYPE "pre-RA-sched" #include "llvm/CodeGen/LatencyPriorityQueue.h" #include "llvm/CodeGen/ScheduleDAGSDNodes.h" +#include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include "llvm/CodeGen/SchedulerRegistry.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetRegisterInfo.h" @@ -58,12 +59,12 @@ private: std::vector<SUnit*> PendingQueue; /// HazardRec - The hazard recognizer to use. - HazardRecognizer *HazardRec; + ScheduleHazardRecognizer *HazardRec; public: ScheduleDAGList(MachineFunction &mf, SchedulingPriorityQueue *availqueue, - HazardRecognizer *HR) + ScheduleHazardRecognizer *HR) : ScheduleDAGSDNodes(mf), AvailableQueue(availqueue), HazardRec(HR) { } @@ -82,9 +83,6 @@ private: }; } // end anonymous namespace -HazardRecognizer::~HazardRecognizer() {} - - /// Schedule - Schedule the DAG using list scheduling. void ScheduleDAGList::Schedule() { DOUT << "********** List Scheduling **********\n"; @@ -190,31 +188,20 @@ void ScheduleDAGList::ListScheduleTopDown() { } SUnit *FoundSUnit = 0; - SDNode *FoundNode = 0; bool HasNoopHazards = false; while (!AvailableQueue->empty()) { SUnit *CurSUnit = AvailableQueue->pop(); - // Get the node represented by this SUnit. - FoundNode = CurSUnit->getNode(); - - // If this is a pseudo op, like copyfromreg, look to see if there is a - // real target node flagged to it. If so, use the target node. - while (!FoundNode->isMachineOpcode()) { - SDNode *N = FoundNode->getFlaggedNode(); - if (!N) break; - FoundNode = N; - } - - HazardRecognizer::HazardType HT = HazardRec->getHazardType(FoundNode); - if (HT == HazardRecognizer::NoHazard) { + ScheduleHazardRecognizer::HazardType HT = + HazardRec->getHazardType(CurSUnit); + if (HT == ScheduleHazardRecognizer::NoHazard) { FoundSUnit = CurSUnit; break; } // Remember if this is a noop hazard. - HasNoopHazards |= HT == HazardRecognizer::NoopHazard; + HasNoopHazards |= HT == ScheduleHazardRecognizer::NoopHazard; NotReady.push_back(CurSUnit); } @@ -228,7 +215,7 @@ void ScheduleDAGList::ListScheduleTopDown() { // If we found a node to schedule, do it now. if (FoundSUnit) { ScheduleNodeTopDown(FoundSUnit, CurCycle); - HazardRec->EmitInstruction(FoundNode); + HazardRec->EmitInstruction(FoundSUnit); // If this is a pseudo-op node, we don't want to increment the current // cycle. diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e2a4999af6..3cae888b69 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -34,6 +34,7 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/ScheduleDAGSDNodes.h" +#include "llvm/CodeGen/ScheduleHazardRecognizer.h" #include "llvm/CodeGen/SchedulerRegistry.h" #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/DwarfWriter.h" @@ -1079,8 +1080,8 @@ ScheduleDAG *SelectionDAGISel::Schedule() { } -HazardRecognizer *SelectionDAGISel::CreateTargetHazardRecognizer() { - return new HazardRecognizer(); +ScheduleHazardRecognizer *SelectionDAGISel::CreateTargetHazardRecognizer() { + return new ScheduleHazardRecognizer(); } //===----------------------------------------------------------------------===// |
