diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2010-06-12 00:12:18 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2010-06-12 00:12:18 +0000 |
| commit | e60273fd70cc972ed1de386335b95f9c190cc9de (patch) | |
| tree | ebaad433f06b85c2de5fcf2232823b73ad8d369f /llvm/lib/CodeGen/PostRASchedulerList.cpp | |
| parent | cb1fe56fd9f3a6fa9595151ee8543a0b0ffa25e3 (diff) | |
| download | llvm-e60273fd70cc972ed1de386335b95f9c190cc9de.zip llvm-e60273fd70cc972ed1de386335b95f9c190cc9de.tar.gz llvm-e60273fd70cc972ed1de386335b95f9c190cc9de.tar.bz2 | |
Allow target to provide its own hazard recognizer to post-ra scheduler.
llvm-svn: 105862
Diffstat (limited to 'llvm/lib/CodeGen/PostRASchedulerList.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/PostRASchedulerList.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/PostRASchedulerList.cpp b/llvm/lib/CodeGen/PostRASchedulerList.cpp index 9714ea6..d41463f 100644 --- a/llvm/lib/CodeGen/PostRASchedulerList.cpp +++ b/llvm/lib/CodeGen/PostRASchedulerList.cpp @@ -67,8 +67,8 @@ EnableAntiDepBreaking("break-anti-dependencies", cl::init("none"), cl::Hidden); static cl::opt<bool> EnablePostRAHazardAvoidance("avoid-hazards", - cl::desc("Enable exact hazard avoidance"), - cl::init(true), cl::Hidden); + cl::desc("Enable exact hazard avoidance"), + cl::init(true), cl::Hidden); // If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod static cl::opt<int> @@ -237,10 +237,10 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) { const MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>(); const MachineDominatorTree &MDT = getAnalysis<MachineDominatorTree>(); - const InstrItineraryData &InstrItins = Fn.getTarget().getInstrItineraryData(); - ScheduleHazardRecognizer *HR = EnablePostRAHazardAvoidance ? - (ScheduleHazardRecognizer *)new ExactHazardRecognizer(InstrItins) : - (ScheduleHazardRecognizer *)new SimpleHazardRecognizer(); + const TargetMachine &TM = Fn.getTarget(); + const InstrItineraryData &InstrItins = TM.getInstrItineraryData(); + ScheduleHazardRecognizer *HR = + TM.getInstrInfo()->CreateTargetPostRAHazardRecognizer(InstrItins); AntiDepBreaker *ADB = ((AntiDepMode == TargetSubtarget::ANTIDEP_ALL) ? (AntiDepBreaker *)new AggressiveAntiDepBreaker(Fn, CriticalPathRCs) : @@ -719,6 +719,16 @@ void SchedulePostRATDList::ListScheduleTopDown() { #endif } +// Default implementation of CreateTargetPostRAHazardRecognizer. This should +// be in TargetInstrInfoImpl.cpp except it reference local command line +// option EnablePostRAHazardAvoidance +ScheduleHazardRecognizer *TargetInstrInfoImpl:: +CreateTargetPostRAHazardRecognizer(const InstrItineraryData &II) const { + if (EnablePostRAHazardAvoidance) + return (ScheduleHazardRecognizer *)new ExactHazardRecognizer(II); + return (ScheduleHazardRecognizer *)new SimpleHazardRecognizer(); +} + //===----------------------------------------------------------------------===// // Public Constructor Functions //===----------------------------------------------------------------------===// |
