blob: 424181c025496ef951f38977757f2d35426ef15b [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===----- SchedulePostRAList.cpp - list scheduler ------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This implements a top-down list scheduler, using standard algorithms.
11// The basic approach uses a priority queue of available nodes to schedule.
12// One at a time, nodes are taken from the priority queue (thus in priority
13// order), checked for legality to schedule, and emitted if legal.
14//
15// Nodes may not be legal to schedule either due to structural hazards (e.g.
16// pipeline or resource constraints) or because an input to the instruction has
17// not completed execution.
18//
19//===----------------------------------------------------------------------===//
20
21#define DEBUG_TYPE "post-RA-sched"
David Goodwin4a8676e2009-10-28 18:29:54 +000022#include "AntiDepBreaker.h"
David Goodwina8b85962009-10-26 19:32:42 +000023#include "AggressiveAntiDepBreaker.h"
David Goodwinad5789c2009-10-26 16:59:04 +000024#include "CriticalAntiDepBreaker.h"
David Goodwin5ab4fd42009-08-10 15:55:25 +000025#include "ExactHazardRecognizer.h"
26#include "SimpleHazardRecognizer.h"
Dan Gohman98c6cb32009-02-06 17:12:10 +000027#include "ScheduleDAGInstrs.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000028#include "llvm/CodeGen/Passes.h"
Dan Gohmand27a0e02008-11-19 23:18:57 +000029#include "llvm/CodeGen/LatencyPriorityQueue.h"
30#include "llvm/CodeGen/SchedulerRegistry.h"
Dan Gohman6b2ee8f2008-12-16 03:25:46 +000031#include "llvm/CodeGen/MachineDominators.h"
David Goodwincdb56fc2009-10-01 19:45:32 +000032#include "llvm/CodeGen/MachineFrameInfo.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000033#include "llvm/CodeGen/MachineFunctionPass.h"
Dan Gohman6b2ee8f2008-12-16 03:25:46 +000034#include "llvm/CodeGen/MachineLoopInfo.h"
Dan Gohmanc2c90e22008-11-25 00:52:40 +000035#include "llvm/CodeGen/MachineRegisterInfo.h"
Dan Gohman99603bb2009-01-16 01:33:36 +000036#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
Dan Gohman0a4c09e2009-10-09 23:27:56 +000037#include "llvm/Analysis/AliasAnalysis.h"
Dan Gohman75cc17f2009-02-10 23:29:38 +000038#include "llvm/Target/TargetLowering.h"
Dan Gohman96eb47a2009-01-15 19:20:50 +000039#include "llvm/Target/TargetMachine.h"
Dan Gohmanc2c90e22008-11-25 00:52:40 +000040#include "llvm/Target/TargetInstrInfo.h"
41#include "llvm/Target/TargetRegisterInfo.h"
David Goodwincf89a602009-09-30 00:10:16 +000042#include "llvm/Target/TargetSubtarget.h"
David Goodwinaa644ea2009-10-26 22:31:16 +000043#include "llvm/Support/CommandLine.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000044#include "llvm/Support/Debug.h"
Edwin Török675d5622009-07-11 20:10:48 +000045#include "llvm/Support/ErrorHandling.h"
David Goodwin0eeb4512009-08-11 01:44:26 +000046#include "llvm/Support/raw_ostream.h"
David Goodwinad5789c2009-10-26 16:59:04 +000047#include "llvm/ADT/BitVector.h"
Dan Gohmand27a0e02008-11-19 23:18:57 +000048#include "llvm/ADT/Statistic.h"
Dan Gohmanc2c90e22008-11-25 00:52:40 +000049#include <map>
David Goodwina9c16fe2009-08-25 17:03:05 +000050#include <set>
Dan Gohmanf17a25c2007-07-18 16:29:46 +000051using namespace llvm;
52
Dan Gohman99603bb2009-01-16 01:33:36 +000053STATISTIC(NumNoops, "Number of noops inserted");
Dan Gohmand27a0e02008-11-19 23:18:57 +000054STATISTIC(NumStalls, "Number of pipeline stalls");
David Goodwinad5789c2009-10-26 16:59:04 +000055STATISTIC(NumFixedAnti, "Number of fixed anti-dependencies");
Dan Gohmand27a0e02008-11-19 23:18:57 +000056
David Goodwin089aa852009-10-01 21:46:35 +000057// Post-RA scheduling is enabled with
58// TargetSubtarget.enablePostRAScheduler(). This flag can be used to
59// override the target.
60static cl::opt<bool>
61EnablePostRAScheduler("post-RA-scheduler",
62 cl::desc("Enable scheduling after register allocation"),
David Goodwin736fed92009-10-01 22:19:57 +000063 cl::init(false), cl::Hidden);
David Goodwinad5789c2009-10-26 16:59:04 +000064static cl::opt<std::string>
Dan Gohmanc2c90e22008-11-25 00:52:40 +000065EnableAntiDepBreaking("break-anti-dependencies",
David Goodwinad5789c2009-10-26 16:59:04 +000066 cl::desc("Break post-RA scheduling anti-dependencies: "
67 "\"critical\", \"all\", or \"none\""),
68 cl::init("none"), cl::Hidden);
Dan Gohman99603bb2009-01-16 01:33:36 +000069static cl::opt<bool>
70EnablePostRAHazardAvoidance("avoid-hazards",
David Goodwin5ab4fd42009-08-10 15:55:25 +000071 cl::desc("Enable exact hazard avoidance"),
David Goodwin856b38c2009-09-03 22:15:25 +000072 cl::init(true), cl::Hidden);
Dan Gohman99603bb2009-01-16 01:33:36 +000073
David Goodwin4b023dd2009-09-01 18:34:03 +000074// If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod
75static cl::opt<int>
76DebugDiv("postra-sched-debugdiv",
77 cl::desc("Debug control MBBs that are scheduled"),
78 cl::init(0), cl::Hidden);
79static cl::opt<int>
80DebugMod("postra-sched-debugmod",
81 cl::desc("Debug control MBBs that are scheduled"),
82 cl::init(0), cl::Hidden);
83
David Goodwin64948f82009-10-26 19:41:00 +000084AntiDepBreaker::~AntiDepBreaker() { }
85
Dan Gohmanf17a25c2007-07-18 16:29:46 +000086namespace {
Nick Lewycky492d06e2009-10-25 06:33:48 +000087 class PostRAScheduler : public MachineFunctionPass {
Dan Gohman0a4c09e2009-10-09 23:27:56 +000088 AliasAnalysis *AA;
Evan Cheng86e24b02009-10-16 21:06:15 +000089 CodeGenOpt::Level OptLevel;
Dan Gohman0a4c09e2009-10-09 23:27:56 +000090
Dan Gohmanf17a25c2007-07-18 16:29:46 +000091 public:
92 static char ID;
Evan Cheng86e24b02009-10-16 21:06:15 +000093 PostRAScheduler(CodeGenOpt::Level ol) :
94 MachineFunctionPass(&ID), OptLevel(ol) {}
Dan Gohmanc2c90e22008-11-25 00:52:40 +000095
Dan Gohman6b2ee8f2008-12-16 03:25:46 +000096 void getAnalysisUsage(AnalysisUsage &AU) const {
Dan Gohmanecb436f2009-07-31 23:37:33 +000097 AU.setPreservesCFG();
Dan Gohman0a4c09e2009-10-09 23:27:56 +000098 AU.addRequired<AliasAnalysis>();
Dan Gohman6b2ee8f2008-12-16 03:25:46 +000099 AU.addRequired<MachineDominatorTree>();
100 AU.addPreserved<MachineDominatorTree>();
101 AU.addRequired<MachineLoopInfo>();
102 AU.addPreserved<MachineLoopInfo>();
103 MachineFunctionPass::getAnalysisUsage(AU);
104 }
105
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000106 const char *getPassName() const {
Dan Gohmanc2c90e22008-11-25 00:52:40 +0000107 return "Post RA top-down list latency scheduler";
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000108 }
109
110 bool runOnMachineFunction(MachineFunction &Fn);
111 };
Dan Gohmand27a0e02008-11-19 23:18:57 +0000112 char PostRAScheduler::ID = 0;
113
Nick Lewycky492d06e2009-10-25 06:33:48 +0000114 class SchedulePostRATDList : public ScheduleDAGInstrs {
Dan Gohmand27a0e02008-11-19 23:18:57 +0000115 /// AvailableQueue - The priority queue to use for the available SUnits.
Dan Gohmanfb035b42009-10-21 01:44:44 +0000116 ///
Dan Gohmand27a0e02008-11-19 23:18:57 +0000117 LatencyPriorityQueue AvailableQueue;
118
119 /// PendingQueue - This contains all of the instructions whose operands have
120 /// been issued, but their results are not ready yet (due to the latency of
121 /// the operation). Once the operands becomes available, the instruction is
122 /// added to the AvailableQueue.
123 std::vector<SUnit*> PendingQueue;
124
Dan Gohmanc2c90e22008-11-25 00:52:40 +0000125 /// Topo - A topological ordering for SUnits.
126 ScheduleDAGTopologicalSort Topo;
Dan Gohmand27a0e02008-11-19 23:18:57 +0000127
Dan Gohman99603bb2009-01-16 01:33:36 +0000128 /// HazardRec - The hazard recognizer to use.
129 ScheduleHazardRecognizer *HazardRec;
130
David Goodwinad5789c2009-10-26 16:59:04 +0000131 /// AntiDepBreak - Anti-dependence breaking object, or NULL if none
132 AntiDepBreaker *AntiDepBreak;
133
Dan Gohman0a4c09e2009-10-09 23:27:56 +0000134 /// AA - AliasAnalysis for making memory reference queries.
135 AliasAnalysis *AA;
136
Dan Gohmanfb035b42009-10-21 01:44:44 +0000137 /// KillIndices - The index of the most recent kill (proceding bottom-up),
138 /// or ~0u if the register is not live.
Dan Gohmana91eb052009-02-10 23:27:53 +0000139 unsigned KillIndices[TargetRegisterInfo::FirstVirtualRegister];
140
Dan Gohmanc2c90e22008-11-25 00:52:40 +0000141 public:
Dan Gohman96eb47a2009-01-15 19:20:50 +0000142 SchedulePostRATDList(MachineFunction &MF,
Dan Gohman6b2ee8f2008-12-16 03:25:46 +0000143 const MachineLoopInfo &MLI,
Dan Gohman99603bb2009-01-16 01:33:36 +0000144 const MachineDominatorTree &MDT,
Dan Gohman0a4c09e2009-10-09 23:27:56 +0000145 ScheduleHazardRecognizer *HR,
David Goodwinad5789c2009-10-26 16:59:04 +0000146 AntiDepBreaker *ADB,
147 AliasAnalysis *aa)
Dan Gohman96eb47a2009-01-15 19:20:50 +0000148 : ScheduleDAGInstrs(MF, MLI, MDT), Topo(SUnits),
David Goodwinad5789c2009-10-26 16:59:04 +0000149 HazardRec(HR), AntiDepBreak(ADB), AA(aa) {}
Dan Gohman99603bb2009-01-16 01:33:36 +0000150
151 ~SchedulePostRATDList() {
Dan Gohman99603bb2009-01-16 01:33:36 +0000152 }
Dan Gohmand27a0e02008-11-19 23:18:57 +0000153
Dan Gohmana91eb052009-02-10 23:27:53 +0000154 /// StartBlock - Initialize register live-range state for scheduling in
155 /// this block.
156 ///
157 void StartBlock(MachineBasicBlock *BB);
158
159 /// Schedule - Schedule the instruction range using list scheduling.
160 ///
Dan Gohmand27a0e02008-11-19 23:18:57 +0000161 void Schedule();
David Goodwina9c16fe2009-08-25 17:03:05 +0000162
Dan Gohmanfb035b42009-10-21 01:44:44 +0000163 /// Observe - Update liveness information to account for the current
164 /// instruction, which will not be scheduled.
165 ///
166 void Observe(MachineInstr *MI, unsigned Count);
167
168 /// FinishBlock - Clean up register live-range state.
169 ///
170 void FinishBlock();
171
David Goodwinad5789c2009-10-26 16:59:04 +0000172 /// FixupKills - Fix register kill flags that have been made
173 /// invalid due to scheduling
174 ///
175 void FixupKills(MachineBasicBlock *MBB);
176
Dan Gohmand27a0e02008-11-19 23:18:57 +0000177 private:
David Goodwind34903a2009-11-20 19:32:48 +0000178 void ReleaseSucc(SUnit *SU, SDep *SuccEdge);
179 void ReleaseSuccessors(SUnit *SU);
180 void ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle);
181 void ListScheduleTopDown();
David Goodwin856b38c2009-09-03 22:15:25 +0000182 void StartBlockForKills(MachineBasicBlock *BB);
David Goodwin83b6ace2009-09-23 16:35:25 +0000183
184 // ToggleKillFlag - Toggle a register operand kill flag. Other
185 // adjustments may be made to the instruction if necessary. Return
186 // true if the operand has been deleted, false if not.
187 bool ToggleKillFlag(MachineInstr *MI, MachineOperand &MO);
Dan Gohmand27a0e02008-11-19 23:18:57 +0000188 };
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000189}
190
Dan Gohmana91eb052009-02-10 23:27:53 +0000191/// isSchedulingBoundary - Test if the given instruction should be
192/// considered a scheduling boundary. This primarily includes labels
193/// and terminators.
194///
195static bool isSchedulingBoundary(const MachineInstr *MI,
196 const MachineFunction &MF) {
197 // Terminators and labels can't be scheduled around.
198 if (MI->getDesc().isTerminator() || MI->isLabel())
199 return true;
200
Dan Gohman75cc17f2009-02-10 23:29:38 +0000201 // Don't attempt to schedule around any instruction that modifies
202 // a stack-oriented pointer, as it's unlikely to be profitable. This
203 // saves compile time, because it doesn't require every single
204 // stack slot reference to depend on the instruction that does the
205 // modification.
206 const TargetLowering &TLI = *MF.getTarget().getTargetLowering();
207 if (MI->modifiesRegister(TLI.getStackPointerRegisterToSaveRestore()))
208 return true;
209
Dan Gohmana91eb052009-02-10 23:27:53 +0000210 return false;
211}
212
Dan Gohmand27a0e02008-11-19 23:18:57 +0000213bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
Dan Gohman101611d2009-10-10 00:15:38 +0000214 AA = &getAnalysis<AliasAnalysis>();
215
David Goodwin089aa852009-10-01 21:46:35 +0000216 // Check for explicit enable/disable of post-ra scheduling.
David Goodwine56e4a62009-10-22 23:19:17 +0000217 TargetSubtarget::AntiDepBreakMode AntiDepMode = TargetSubtarget::ANTIDEP_NONE;
David Goodwine6e30352009-11-13 19:52:48 +0000218 SmallVector<TargetRegisterClass*, 4> CriticalPathRCs;
David Goodwin089aa852009-10-01 21:46:35 +0000219 if (EnablePostRAScheduler.getPosition() > 0) {
220 if (!EnablePostRAScheduler)
Evan Cheng57796902009-10-16 06:10:34 +0000221 return false;
David Goodwin089aa852009-10-01 21:46:35 +0000222 } else {
Evan Cheng57796902009-10-16 06:10:34 +0000223 // Check that post-RA scheduling is enabled for this target.
David Goodwin089aa852009-10-01 21:46:35 +0000224 const TargetSubtarget &ST = Fn.getTarget().getSubtarget<TargetSubtarget>();
David Goodwine6e30352009-11-13 19:52:48 +0000225 if (!ST.enablePostRAScheduler(OptLevel, AntiDepMode, CriticalPathRCs))
Evan Cheng57796902009-10-16 06:10:34 +0000226 return false;
David Goodwin089aa852009-10-01 21:46:35 +0000227 }
David Goodwincf89a602009-09-30 00:10:16 +0000228
David Goodwine56e4a62009-10-22 23:19:17 +0000229 // Check for antidep breaking override...
230 if (EnableAntiDepBreaking.getPosition() > 0) {
David Goodwinad5789c2009-10-26 16:59:04 +0000231 AntiDepMode = (EnableAntiDepBreaking == "all") ? TargetSubtarget::ANTIDEP_ALL :
232 (EnableAntiDepBreaking == "critical") ? TargetSubtarget::ANTIDEP_CRITICAL :
233 TargetSubtarget::ANTIDEP_NONE;
David Goodwine56e4a62009-10-22 23:19:17 +0000234 }
235
David Greene2ae85ad2010-01-05 01:26:01 +0000236 DEBUG(dbgs() << "PostRAScheduler\n");
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000237
Dan Gohman6b2ee8f2008-12-16 03:25:46 +0000238 const MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>();
239 const MachineDominatorTree &MDT = getAnalysis<MachineDominatorTree>();
David Goodwin5ab4fd42009-08-10 15:55:25 +0000240 const InstrItineraryData &InstrItins = Fn.getTarget().getInstrItineraryData();
Dan Gohman99603bb2009-01-16 01:33:36 +0000241 ScheduleHazardRecognizer *HR = EnablePostRAHazardAvoidance ?
David Goodwin5ab4fd42009-08-10 15:55:25 +0000242 (ScheduleHazardRecognizer *)new ExactHazardRecognizer(InstrItins) :
243 (ScheduleHazardRecognizer *)new SimpleHazardRecognizer();
David Goodwinad5789c2009-10-26 16:59:04 +0000244 AntiDepBreaker *ADB =
David Goodwina8b85962009-10-26 19:32:42 +0000245 ((AntiDepMode == TargetSubtarget::ANTIDEP_ALL) ?
David Goodwine6e30352009-11-13 19:52:48 +0000246 (AntiDepBreaker *)new AggressiveAntiDepBreaker(Fn, CriticalPathRCs) :
David Goodwina8b85962009-10-26 19:32:42 +0000247 ((AntiDepMode == TargetSubtarget::ANTIDEP_CRITICAL) ?
248 (AntiDepBreaker *)new CriticalAntiDepBreaker(Fn) : NULL));
Dan Gohman6b2ee8f2008-12-16 03:25:46 +0000249
David Goodwinad5789c2009-10-26 16:59:04 +0000250 SchedulePostRATDList Scheduler(Fn, MLI, MDT, HR, ADB, AA);
Dan Gohman96eb47a2009-01-15 19:20:50 +0000251
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000252 // Loop over all of the basic blocks
253 for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
Dan Gohmand27a0e02008-11-19 23:18:57 +0000254 MBB != MBBe; ++MBB) {
David Goodwin4b023dd2009-09-01 18:34:03 +0000255#ifndef NDEBUG
256 // If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod
257 if (DebugDiv > 0) {
258 static int bbcnt = 0;
259 if (bbcnt++ % DebugDiv != DebugMod)
260 continue;
David Greene2ae85ad2010-01-05 01:26:01 +0000261 dbgs() << "*** DEBUG scheduling " << Fn.getFunction()->getNameStr() <<
Dan Gohman57b31652009-10-31 20:19:03 +0000262 ":BB#" << MBB->getNumber() << " ***\n";
David Goodwin4b023dd2009-09-01 18:34:03 +0000263 }
264#endif
265
Dan Gohmana91eb052009-02-10 23:27:53 +0000266 // Initialize register live-range state for scheduling in this block.
267 Scheduler.StartBlock(MBB);
268
Dan Gohman14bb9922009-01-16 22:10:20 +0000269 // Schedule each sequence of instructions not interrupted by a label
270 // or anything else that effectively needs to shut down scheduling.
Dan Gohmana91eb052009-02-10 23:27:53 +0000271 MachineBasicBlock::iterator Current = MBB->end();
Dan Gohman7c968a82009-02-11 04:27:20 +0000272 unsigned Count = MBB->size(), CurrentCount = Count;
Dan Gohmana91eb052009-02-10 23:27:53 +0000273 for (MachineBasicBlock::iterator I = Current; I != MBB->begin(); ) {
274 MachineInstr *MI = prior(I);
275 if (isSchedulingBoundary(MI, Fn)) {
Dan Gohman68ade7b2009-03-10 18:10:43 +0000276 Scheduler.Run(MBB, I, Current, CurrentCount);
Evan Chengd7dc9832009-09-18 21:02:19 +0000277 Scheduler.EmitSchedule(0);
Dan Gohmana91eb052009-02-10 23:27:53 +0000278 Current = MI;
Dan Gohman7c968a82009-02-11 04:27:20 +0000279 CurrentCount = Count - 1;
Dan Gohman68ade7b2009-03-10 18:10:43 +0000280 Scheduler.Observe(MI, CurrentCount);
Dan Gohman14bb9922009-01-16 22:10:20 +0000281 }
Dan Gohmana91eb052009-02-10 23:27:53 +0000282 I = MI;
Dan Gohman7c968a82009-02-11 04:27:20 +0000283 --Count;
Dan Gohman0dcda312009-02-03 18:57:45 +0000284 }
Dan Gohman7c968a82009-02-11 04:27:20 +0000285 assert(Count == 0 && "Instruction count mismatch!");
Duncan Sands34468542009-03-11 09:04:34 +0000286 assert((MBB->begin() == Current || CurrentCount != 0) &&
Dan Gohman68ade7b2009-03-10 18:10:43 +0000287 "Instruction count mismatch!");
288 Scheduler.Run(MBB, MBB->begin(), Current, CurrentCount);
Evan Chengd7dc9832009-09-18 21:02:19 +0000289 Scheduler.EmitSchedule(0);
Dan Gohmana91eb052009-02-10 23:27:53 +0000290
291 // Clean up register live-range state.
292 Scheduler.FinishBlock();
David Goodwina9c16fe2009-08-25 17:03:05 +0000293
David Goodwin856b38c2009-09-03 22:15:25 +0000294 // Update register kills
David Goodwina9c16fe2009-08-25 17:03:05 +0000295 Scheduler.FixupKills(MBB);
Dan Gohmand27a0e02008-11-19 23:18:57 +0000296 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000297
David Goodwinad5789c2009-10-26 16:59:04 +0000298 delete HR;
299 delete ADB;
300
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000301 return true;
302}
303
Dan Gohmana91eb052009-02-10 23:27:53 +0000304/// StartBlock - Initialize register live-range state for scheduling in
305/// this block.
Dan Gohmanc2c90e22008-11-25 00:52:40 +0000306///
Dan Gohmana91eb052009-02-10 23:27:53 +0000307void SchedulePostRATDList::StartBlock(MachineBasicBlock *BB) {
308 // Call the superclass.
309 ScheduleDAGInstrs::StartBlock(BB);
Dan Gohmanc2c90e22008-11-25 00:52:40 +0000310
David Goodwinad5789c2009-10-26 16:59:04 +0000311 // Reset the hazard recognizer and anti-dep breaker.
David Goodwin5ab4fd42009-08-10 15:55:25 +0000312 HazardRec->Reset();
David Goodwinad5789c2009-10-26 16:59:04 +0000313 if (AntiDepBreak != NULL)
314 AntiDepBreak->StartBlock(BB);
Dan Gohmana91eb052009-02-10 23:27:53 +0000315}
316
317/// Schedule - Schedule the instruction range using list scheduling.
318///
319void SchedulePostRATDList::Schedule() {
Dan Gohmana91eb052009-02-10 23:27:53 +0000320 // Build the scheduling graph.
Dan Gohman0a4c09e2009-10-09 23:27:56 +0000321 BuildSchedGraph(AA);
Dan Gohmana91eb052009-02-10 23:27:53 +0000322
David Goodwinad5789c2009-10-26 16:59:04 +0000323 if (AntiDepBreak != NULL) {
David Goodwind34903a2009-11-20 19:32:48 +0000324 unsigned Broken =
325 AntiDepBreak->BreakAntiDependencies(SUnits, Begin, InsertPos,
326 InsertPosIndex);
David Goodwin996892b2009-11-03 20:57:50 +0000327
David Goodwind34903a2009-11-20 19:32:48 +0000328 if (Broken != 0) {
Dan Gohmana91eb052009-02-10 23:27:53 +0000329 // We made changes. Update the dependency graph.
330 // Theoretically we could update the graph in place:
331 // When a live range is changed to use a different register, remove
332 // the def's anti-dependence *and* output-dependence edges due to
333 // that register, and add new anti-dependence and output-dependence
334 // edges based on the next live range of the register.
David Goodwind34903a2009-11-20 19:32:48 +0000335 SUnits.clear();
336 Sequence.clear();
337 EntrySU = SUnit();
338 ExitSU = SUnit();
339 BuildSchedGraph(AA);
340
David Goodwinad5789c2009-10-26 16:59:04 +0000341 NumFixedAnti += Broken;
Dan Gohmana91eb052009-02-10 23:27:53 +0000342 }
343 }
344
David Greene2ae85ad2010-01-05 01:26:01 +0000345 DEBUG(dbgs() << "********** List Scheduling **********\n");
David Goodwin5ab4fd42009-08-10 15:55:25 +0000346 DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
347 SUnits[su].dumpAll(this));
348
Dan Gohmana91eb052009-02-10 23:27:53 +0000349 AvailableQueue.initNodes(SUnits);
David Goodwind34903a2009-11-20 19:32:48 +0000350 ListScheduleTopDown();
Dan Gohmana91eb052009-02-10 23:27:53 +0000351 AvailableQueue.releaseState();
352}
353
354/// Observe - Update liveness information to account for the current
355/// instruction, which will not be scheduled.
356///
Dan Gohman7c968a82009-02-11 04:27:20 +0000357void SchedulePostRATDList::Observe(MachineInstr *MI, unsigned Count) {
David Goodwinad5789c2009-10-26 16:59:04 +0000358 if (AntiDepBreak != NULL)
359 AntiDepBreak->Observe(MI, Count, InsertPosIndex);
Dan Gohmana91eb052009-02-10 23:27:53 +0000360}
361
362/// FinishBlock - Clean up register live-range state.
363///
364void SchedulePostRATDList::FinishBlock() {
David Goodwinad5789c2009-10-26 16:59:04 +0000365 if (AntiDepBreak != NULL)
366 AntiDepBreak->FinishBlock();
Dan Gohmana91eb052009-02-10 23:27:53 +0000367
368 // Call the superclass.
369 ScheduleDAGInstrs::FinishBlock();
370}
371
David Goodwin856b38c2009-09-03 22:15:25 +0000372/// StartBlockForKills - Initialize register live-range state for updating kills
373///
374void SchedulePostRATDList::StartBlockForKills(MachineBasicBlock *BB) {
375 // Initialize the indices to indicate that no registers are live.
David Goodwin9b4ae242009-12-09 17:18:22 +0000376 for (unsigned i = 0; i < TRI->getNumRegs(); ++i)
377 KillIndices[i] = ~0u;
David Goodwin856b38c2009-09-03 22:15:25 +0000378
379 // Determine the live-out physregs for this block.
380 if (!BB->empty() && BB->back().getDesc().isReturn()) {
381 // In a return block, examine the function live-out regs.
382 for (MachineRegisterInfo::liveout_iterator I = MRI.liveout_begin(),
383 E = MRI.liveout_end(); I != E; ++I) {
384 unsigned Reg = *I;
385 KillIndices[Reg] = BB->size();
386 // Repeat, for all subregs.
387 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
388 *Subreg; ++Subreg) {
389 KillIndices[*Subreg] = BB->size();
390 }
391 }
392 }
393 else {
394 // In a non-return block, examine the live-in regs of all successors.
395 for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),
396 SE = BB->succ_end(); SI != SE; ++SI) {
397 for (MachineBasicBlock::livein_iterator I = (*SI)->livein_begin(),
398 E = (*SI)->livein_end(); I != E; ++I) {
399 unsigned Reg = *I;
400 KillIndices[Reg] = BB->size();
401 // Repeat, for all subregs.
402 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
403 *Subreg; ++Subreg) {
404 KillIndices[*Subreg] = BB->size();
405 }
406 }
407 }
408 }
409}
410
David Goodwin83b6ace2009-09-23 16:35:25 +0000411bool SchedulePostRATDList::ToggleKillFlag(MachineInstr *MI,
412 MachineOperand &MO) {
413 // Setting kill flag...
414 if (!MO.isKill()) {
415 MO.setIsKill(true);
416 return false;
417 }
418
419 // If MO itself is live, clear the kill flag...
420 if (KillIndices[MO.getReg()] != ~0u) {
421 MO.setIsKill(false);
422 return false;
423 }
424
425 // If any subreg of MO is live, then create an imp-def for that
426 // subreg and keep MO marked as killed.
Benjamin Kramere3901ce2009-10-02 15:59:52 +0000427 MO.setIsKill(false);
David Goodwin83b6ace2009-09-23 16:35:25 +0000428 bool AllDead = true;
429 const unsigned SuperReg = MO.getReg();
430 for (const unsigned *Subreg = TRI->getSubRegisters(SuperReg);
431 *Subreg; ++Subreg) {
432 if (KillIndices[*Subreg] != ~0u) {
433 MI->addOperand(MachineOperand::CreateReg(*Subreg,
434 true /*IsDef*/,
435 true /*IsImp*/,
436 false /*IsKill*/,
437 false /*IsDead*/));
438 AllDead = false;
439 }
440 }
441
Dan Gohmanfb035b42009-10-21 01:44:44 +0000442 if(AllDead)
Benjamin Kramere3901ce2009-10-02 15:59:52 +0000443 MO.setIsKill(true);
David Goodwin83b6ace2009-09-23 16:35:25 +0000444 return false;
445}
446
David Goodwina9c16fe2009-08-25 17:03:05 +0000447/// FixupKills - Fix the register kill flags, they may have been made
448/// incorrect by instruction reordering.
449///
450void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) {
David Greene2ae85ad2010-01-05 01:26:01 +0000451 DEBUG(dbgs() << "Fixup kills for BB#" << MBB->getNumber() << '\n');
David Goodwina9c16fe2009-08-25 17:03:05 +0000452
453 std::set<unsigned> killedRegs;
454 BitVector ReservedRegs = TRI->getReservedRegs(MF);
David Goodwin856b38c2009-09-03 22:15:25 +0000455
456 StartBlockForKills(MBB);
David Goodwine54c0042009-08-29 00:11:13 +0000457
458 // Examine block from end to start...
David Goodwina9c16fe2009-08-25 17:03:05 +0000459 unsigned Count = MBB->size();
460 for (MachineBasicBlock::iterator I = MBB->end(), E = MBB->begin();
461 I != E; --Count) {
462 MachineInstr *MI = --I;
Dale Johannesen999c1882010-03-05 00:02:59 +0000463 if (MI->isDebugValue())
464 continue;
David Goodwina9c16fe2009-08-25 17:03:05 +0000465
David Goodwine54c0042009-08-29 00:11:13 +0000466 // Update liveness. Registers that are defed but not used in this
467 // instruction are now dead. Mark register and all subregs as they
468 // are completely defined.
469 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
470 MachineOperand &MO = MI->getOperand(i);
471 if (!MO.isReg()) continue;
472 unsigned Reg = MO.getReg();
473 if (Reg == 0) continue;
474 if (!MO.isDef()) continue;
475 // Ignore two-addr defs.
476 if (MI->isRegTiedToUseOperand(i)) continue;
477
David Goodwine54c0042009-08-29 00:11:13 +0000478 KillIndices[Reg] = ~0u;
479
480 // Repeat for all subregs.
481 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
482 *Subreg; ++Subreg) {
483 KillIndices[*Subreg] = ~0u;
484 }
485 }
David Goodwina9c16fe2009-08-25 17:03:05 +0000486
David Goodwin83b6ace2009-09-23 16:35:25 +0000487 // Examine all used registers and set/clear kill flag. When a
488 // register is used multiple times we only set the kill flag on
489 // the first use.
David Goodwina9c16fe2009-08-25 17:03:05 +0000490 killedRegs.clear();
491 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
492 MachineOperand &MO = MI->getOperand(i);
493 if (!MO.isReg() || !MO.isUse()) continue;
494 unsigned Reg = MO.getReg();
495 if ((Reg == 0) || ReservedRegs.test(Reg)) continue;
496
David Goodwine54c0042009-08-29 00:11:13 +0000497 bool kill = false;
498 if (killedRegs.find(Reg) == killedRegs.end()) {
499 kill = true;
500 // A register is not killed if any subregs are live...
501 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
502 *Subreg; ++Subreg) {
503 if (KillIndices[*Subreg] != ~0u) {
504 kill = false;
505 break;
506 }
507 }
508
509 // If subreg is not live, then register is killed if it became
510 // live in this instruction
511 if (kill)
512 kill = (KillIndices[Reg] == ~0u);
513 }
514
David Goodwina9c16fe2009-08-25 17:03:05 +0000515 if (MO.isKill() != kill) {
David Greene2ae85ad2010-01-05 01:26:01 +0000516 DEBUG(dbgs() << "Fixing " << MO << " in ");
Jakob Stoklund Olesen26f2fb72009-12-03 01:49:56 +0000517 // Warning: ToggleKillFlag may invalidate MO.
518 ToggleKillFlag(MI, MO);
David Goodwina9c16fe2009-08-25 17:03:05 +0000519 DEBUG(MI->dump());
520 }
David Goodwine54c0042009-08-29 00:11:13 +0000521
David Goodwina9c16fe2009-08-25 17:03:05 +0000522 killedRegs.insert(Reg);
523 }
David Goodwine54c0042009-08-29 00:11:13 +0000524
David Goodwin864c4b82009-08-31 20:47:02 +0000525 // Mark any used register (that is not using undef) and subregs as
526 // now live...
David Goodwine54c0042009-08-29 00:11:13 +0000527 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
528 MachineOperand &MO = MI->getOperand(i);
David Goodwin864c4b82009-08-31 20:47:02 +0000529 if (!MO.isReg() || !MO.isUse() || MO.isUndef()) continue;
David Goodwine54c0042009-08-29 00:11:13 +0000530 unsigned Reg = MO.getReg();
531 if ((Reg == 0) || ReservedRegs.test(Reg)) continue;
532
David Goodwine54c0042009-08-29 00:11:13 +0000533 KillIndices[Reg] = Count;
534
535 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
536 *Subreg; ++Subreg) {
537 KillIndices[*Subreg] = Count;
538 }
539 }
David Goodwina9c16fe2009-08-25 17:03:05 +0000540 }
541}
542
Dan Gohmand27a0e02008-11-19 23:18:57 +0000543//===----------------------------------------------------------------------===//
544// Top-Down Scheduling
545//===----------------------------------------------------------------------===//
546
547/// ReleaseSucc - Decrement the NumPredsLeft count of a successor. Add it to
548/// the PendingQueue if the count reaches zero. Also update its cycle bound.
David Goodwind34903a2009-11-20 19:32:48 +0000549void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge) {
Dan Gohman604394b2008-12-09 22:54:47 +0000550 SUnit *SuccSU = SuccEdge->getSUnit();
Reid Klecknere9b95fd2009-09-30 20:15:38 +0000551
Dan Gohmand27a0e02008-11-19 23:18:57 +0000552#ifndef NDEBUG
Reid Klecknere9b95fd2009-09-30 20:15:38 +0000553 if (SuccSU->NumPredsLeft == 0) {
David Greene2ae85ad2010-01-05 01:26:01 +0000554 dbgs() << "*** Scheduling failed! ***\n";
Dan Gohmand27a0e02008-11-19 23:18:57 +0000555 SuccSU->dump(this);
David Greene2ae85ad2010-01-05 01:26:01 +0000556 dbgs() << " has been released too many times!\n";
Edwin Törökbd448e32009-07-14 16:55:14 +0000557 llvm_unreachable(0);
Dan Gohmand27a0e02008-11-19 23:18:57 +0000558 }
559#endif
Reid Klecknere9b95fd2009-09-30 20:15:38 +0000560 --SuccSU->NumPredsLeft;
561
Dan Gohmand27a0e02008-11-19 23:18:57 +0000562 // Compute how many cycles it will be before this actually becomes
563 // available. This is the max of the start time of all predecessors plus
564 // their latencies.
David Goodwind34903a2009-11-20 19:32:48 +0000565 SuccSU->setDepthToAtLeast(SU->getDepth() + SuccEdge->getLatency());
Dan Gohmand27a0e02008-11-19 23:18:57 +0000566
Dan Gohmana91eb052009-02-10 23:27:53 +0000567 // If all the node's predecessors are scheduled, this node is ready
568 // to be scheduled. Ignore the special ExitSU node.
569 if (SuccSU->NumPredsLeft == 0 && SuccSU != &ExitSU)
Dan Gohmand27a0e02008-11-19 23:18:57 +0000570 PendingQueue.push_back(SuccSU);
Dan Gohmana91eb052009-02-10 23:27:53 +0000571}
572
573/// ReleaseSuccessors - Call ReleaseSucc on each of SU's successors.
David Goodwind34903a2009-11-20 19:32:48 +0000574void SchedulePostRATDList::ReleaseSuccessors(SUnit *SU) {
Dan Gohmana91eb052009-02-10 23:27:53 +0000575 for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
David Goodwin996892b2009-11-03 20:57:50 +0000576 I != E; ++I) {
David Goodwind34903a2009-11-20 19:32:48 +0000577 ReleaseSucc(SU, &*I);
David Goodwin996892b2009-11-03 20:57:50 +0000578 }
Dan Gohmand27a0e02008-11-19 23:18:57 +0000579}
580
581/// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
582/// count of its successors. If a successor pending count is zero, add it to
583/// the Available queue.
David Goodwind34903a2009-11-20 19:32:48 +0000584void SchedulePostRATDList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
David Greene2ae85ad2010-01-05 01:26:01 +0000585 DEBUG(dbgs() << "*** Scheduling [" << CurCycle << "]: ");
Dan Gohmand27a0e02008-11-19 23:18:57 +0000586 DEBUG(SU->dump(this));
587
588 Sequence.push_back(SU);
David Goodwind34903a2009-11-20 19:32:48 +0000589 assert(CurCycle >= SU->getDepth() &&
David Goodwin996892b2009-11-03 20:57:50 +0000590 "Node scheduled above its depth!");
David Goodwind34903a2009-11-20 19:32:48 +0000591 SU->setDepthToAtLeast(CurCycle);
Dan Gohmand27a0e02008-11-19 23:18:57 +0000592
David Goodwind34903a2009-11-20 19:32:48 +0000593 ReleaseSuccessors(SU);
Dan Gohmand27a0e02008-11-19 23:18:57 +0000594 SU->isScheduled = true;
595 AvailableQueue.ScheduledNode(SU);
596}
597
598/// ListScheduleTopDown - The main loop of list scheduling for top-down
599/// schedulers.
David Goodwind34903a2009-11-20 19:32:48 +0000600void SchedulePostRATDList::ListScheduleTopDown() {
Dan Gohmand27a0e02008-11-19 23:18:57 +0000601 unsigned CurCycle = 0;
David Goodwin996892b2009-11-03 20:57:50 +0000602
603 // We're scheduling top-down but we're visiting the regions in
604 // bottom-up order, so we don't know the hazards at the start of a
605 // region. So assume no hazards (this should usually be ok as most
606 // blocks are a single region).
607 HazardRec->Reset();
608
Dan Gohmana91eb052009-02-10 23:27:53 +0000609 // Release any successors of the special Entry node.
David Goodwind34903a2009-11-20 19:32:48 +0000610 ReleaseSuccessors(&EntrySU);
Dan Gohmana91eb052009-02-10 23:27:53 +0000611
David Goodwind34903a2009-11-20 19:32:48 +0000612 // Add all leaves to Available queue.
Dan Gohmand27a0e02008-11-19 23:18:57 +0000613 for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
614 // It is available if it has no predecessors.
David Goodwin996892b2009-11-03 20:57:50 +0000615 bool available = SUnits[i].Preds.empty();
David Goodwin996892b2009-11-03 20:57:50 +0000616 if (available) {
Dan Gohmand27a0e02008-11-19 23:18:57 +0000617 AvailableQueue.push(&SUnits[i]);
618 SUnits[i].isAvailable = true;
619 }
620 }
Dan Gohmana91eb052009-02-10 23:27:53 +0000621
David Goodwin745d9d32009-08-12 21:47:46 +0000622 // In any cycle where we can't schedule any instructions, we must
623 // stall or emit a noop, depending on the target.
Benjamin Kramer0db71af2009-09-06 12:10:17 +0000624 bool CycleHasInsts = false;
David Goodwin745d9d32009-08-12 21:47:46 +0000625
Dan Gohmand27a0e02008-11-19 23:18:57 +0000626 // While Available queue is not empty, grab the node with the highest
627 // priority. If it is not ready put it back. Schedule the node.
Dan Gohman99603bb2009-01-16 01:33:36 +0000628 std::vector<SUnit*> NotReady;
Dan Gohmand27a0e02008-11-19 23:18:57 +0000629 Sequence.reserve(SUnits.size());
630 while (!AvailableQueue.empty() || !PendingQueue.empty()) {
631 // Check to see if any of the pending instructions are ready to issue. If
632 // so, add them to the available queue.
Dan Gohman6b2ee8f2008-12-16 03:25:46 +0000633 unsigned MinDepth = ~0u;
Dan Gohmand27a0e02008-11-19 23:18:57 +0000634 for (unsigned i = 0, e = PendingQueue.size(); i != e; ++i) {
David Goodwind34903a2009-11-20 19:32:48 +0000635 if (PendingQueue[i]->getDepth() <= CurCycle) {
Dan Gohmand27a0e02008-11-19 23:18:57 +0000636 AvailableQueue.push(PendingQueue[i]);
637 PendingQueue[i]->isAvailable = true;
638 PendingQueue[i] = PendingQueue.back();
639 PendingQueue.pop_back();
640 --i; --e;
David Goodwind34903a2009-11-20 19:32:48 +0000641 } else if (PendingQueue[i]->getDepth() < MinDepth)
642 MinDepth = PendingQueue[i]->getDepth();
Dan Gohmand27a0e02008-11-19 23:18:57 +0000643 }
David Goodwin391efe02009-08-11 17:35:23 +0000644
David Greene2ae85ad2010-01-05 01:26:01 +0000645 DEBUG(dbgs() << "\n*** Examining Available\n";
David Goodwin387579f2009-08-11 17:56:42 +0000646 LatencyPriorityQueue q = AvailableQueue;
647 while (!q.empty()) {
648 SUnit *su = q.pop();
David Greene2ae85ad2010-01-05 01:26:01 +0000649 dbgs() << "Height " << su->getHeight() << ": ";
David Goodwin387579f2009-08-11 17:56:42 +0000650 su->dump(this);
651 });
David Goodwin391efe02009-08-11 17:35:23 +0000652
Dan Gohman99603bb2009-01-16 01:33:36 +0000653 SUnit *FoundSUnit = 0;
Dan Gohman99603bb2009-01-16 01:33:36 +0000654 bool HasNoopHazards = false;
655 while (!AvailableQueue.empty()) {
656 SUnit *CurSUnit = AvailableQueue.pop();
657
658 ScheduleHazardRecognizer::HazardType HT =
659 HazardRec->getHazardType(CurSUnit);
660 if (HT == ScheduleHazardRecognizer::NoHazard) {
661 FoundSUnit = CurSUnit;
662 break;
663 }
664
665 // Remember if this is a noop hazard.
666 HasNoopHazards |= HT == ScheduleHazardRecognizer::NoopHazard;
667
668 NotReady.push_back(CurSUnit);
669 }
670
671 // Add the nodes that aren't ready back onto the available list.
672 if (!NotReady.empty()) {
673 AvailableQueue.push_all(NotReady);
674 NotReady.clear();
675 }
676
David Goodwin996892b2009-11-03 20:57:50 +0000677 // If we found a node to schedule...
Dan Gohmand27a0e02008-11-19 23:18:57 +0000678 if (FoundSUnit) {
David Goodwin996892b2009-11-03 20:57:50 +0000679 // ... schedule the node...
David Goodwind34903a2009-11-20 19:32:48 +0000680 ScheduleNodeTopDown(FoundSUnit, CurCycle);
Dan Gohman99603bb2009-01-16 01:33:36 +0000681 HazardRec->EmitInstruction(FoundSUnit);
Benjamin Kramer0db71af2009-09-06 12:10:17 +0000682 CycleHasInsts = true;
Dan Gohmand27a0e02008-11-19 23:18:57 +0000683
David Goodwin5ab4fd42009-08-10 15:55:25 +0000684 // If we are using the target-specific hazards, then don't
685 // advance the cycle time just because we schedule a node. If
686 // the target allows it we can schedule multiple nodes in the
687 // same cycle.
688 if (!EnablePostRAHazardAvoidance) {
689 if (FoundSUnit->Latency) // Don't increment CurCycle for pseudo-ops!
690 ++CurCycle;
691 }
Dan Gohman99603bb2009-01-16 01:33:36 +0000692 } else {
Benjamin Kramer0db71af2009-09-06 12:10:17 +0000693 if (CycleHasInsts) {
David Greene2ae85ad2010-01-05 01:26:01 +0000694 DEBUG(dbgs() << "*** Finished cycle " << CurCycle << '\n');
David Goodwin745d9d32009-08-12 21:47:46 +0000695 HazardRec->AdvanceCycle();
696 } else if (!HasNoopHazards) {
697 // Otherwise, we have a pipeline stall, but no other problem,
698 // just advance the current cycle and try again.
David Greene2ae85ad2010-01-05 01:26:01 +0000699 DEBUG(dbgs() << "*** Stall in cycle " << CurCycle << '\n');
David Goodwin745d9d32009-08-12 21:47:46 +0000700 HazardRec->AdvanceCycle();
David Goodwind34903a2009-11-20 19:32:48 +0000701 ++NumStalls;
David Goodwin745d9d32009-08-12 21:47:46 +0000702 } else {
703 // Otherwise, we have no instructions to issue and we have instructions
704 // that will fault if we don't do this right. This is the case for
705 // processors without pipeline interlocks and other cases.
David Greene2ae85ad2010-01-05 01:26:01 +0000706 DEBUG(dbgs() << "*** Emitting noop in cycle " << CurCycle << '\n');
David Goodwin745d9d32009-08-12 21:47:46 +0000707 HazardRec->EmitNoop();
708 Sequence.push_back(0); // NULL here means noop
David Goodwind34903a2009-11-20 19:32:48 +0000709 ++NumNoops;
David Goodwin745d9d32009-08-12 21:47:46 +0000710 }
711
Dan Gohman99603bb2009-01-16 01:33:36 +0000712 ++CurCycle;
Benjamin Kramer0db71af2009-09-06 12:10:17 +0000713 CycleHasInsts = false;
Dan Gohmand27a0e02008-11-19 23:18:57 +0000714 }
715 }
716
717#ifndef NDEBUG
Dan Gohmanf6e4a002008-11-20 01:26:25 +0000718 VerifySchedule(/*isBottomUp=*/false);
Dan Gohmand27a0e02008-11-19 23:18:57 +0000719#endif
720}
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000721
722//===----------------------------------------------------------------------===//
723// Public Constructor Functions
724//===----------------------------------------------------------------------===//
725
Evan Cheng86e24b02009-10-16 21:06:15 +0000726FunctionPass *llvm::createPostRAScheduler(CodeGenOpt::Level OptLevel) {
727 return new PostRAScheduler(OptLevel);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000728}