blob: f3c725da9e6c8792b41d5c73873ad5b2b5ddc109 [file] [log] [blame]
Dale Johannesen72f15962007-07-13 17:31:29 +00001//===----- SchedulePostRAList.cpp - list scheduler ------------------------===//
Dale Johannesene7e7d0d2007-07-13 17:13:54 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dale Johannesene7e7d0d2007-07-13 17:13:54 +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 Goodwin82c72482009-10-28 18:29:54 +000022#include "AntiDepBreaker.h"
David Goodwin34877712009-10-26 19:32:42 +000023#include "AggressiveAntiDepBreaker.h"
David Goodwin2e7be612009-10-26 16:59:04 +000024#include "CriticalAntiDepBreaker.h"
Dan Gohman6dc75fe2009-02-06 17:12:10 +000025#include "ScheduleDAGInstrs.h"
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000026#include "llvm/CodeGen/Passes.h"
Dan Gohman343f0c02008-11-19 23:18:57 +000027#include "llvm/CodeGen/LatencyPriorityQueue.h"
28#include "llvm/CodeGen/SchedulerRegistry.h"
Dan Gohman3f237442008-12-16 03:25:46 +000029#include "llvm/CodeGen/MachineDominators.h"
David Goodwinc7951f82009-10-01 19:45:32 +000030#include "llvm/CodeGen/MachineFrameInfo.h"
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000031#include "llvm/CodeGen/MachineFunctionPass.h"
Dan Gohman3f237442008-12-16 03:25:46 +000032#include "llvm/CodeGen/MachineLoopInfo.h"
Dan Gohman21d90032008-11-25 00:52:40 +000033#include "llvm/CodeGen/MachineRegisterInfo.h"
Dan Gohman2836c282009-01-16 01:33:36 +000034#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
Dan Gohmana70dca12009-10-09 23:27:56 +000035#include "llvm/Analysis/AliasAnalysis.h"
Dan Gohmanbed353d2009-02-10 23:29:38 +000036#include "llvm/Target/TargetLowering.h"
Dan Gohman79ce2762009-01-15 19:20:50 +000037#include "llvm/Target/TargetMachine.h"
Dan Gohman21d90032008-11-25 00:52:40 +000038#include "llvm/Target/TargetInstrInfo.h"
39#include "llvm/Target/TargetRegisterInfo.h"
David Goodwin0dad89f2009-09-30 00:10:16 +000040#include "llvm/Target/TargetSubtarget.h"
David Goodwine10deca2009-10-26 22:31:16 +000041#include "llvm/Support/CommandLine.h"
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000042#include "llvm/Support/Debug.h"
Torok Edwinc25e7582009-07-11 20:10:48 +000043#include "llvm/Support/ErrorHandling.h"
David Goodwin3a5f0d42009-08-11 01:44:26 +000044#include "llvm/Support/raw_ostream.h"
David Goodwin2e7be612009-10-26 16:59:04 +000045#include "llvm/ADT/BitVector.h"
Dan Gohman343f0c02008-11-19 23:18:57 +000046#include "llvm/ADT/Statistic.h"
David Goodwin88a589c2009-08-25 17:03:05 +000047#include <set>
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000048using namespace llvm;
49
Dan Gohman2836c282009-01-16 01:33:36 +000050STATISTIC(NumNoops, "Number of noops inserted");
Dan Gohman343f0c02008-11-19 23:18:57 +000051STATISTIC(NumStalls, "Number of pipeline stalls");
David Goodwin2e7be612009-10-26 16:59:04 +000052STATISTIC(NumFixedAnti, "Number of fixed anti-dependencies");
Dan Gohman343f0c02008-11-19 23:18:57 +000053
David Goodwin471850a2009-10-01 21:46:35 +000054// Post-RA scheduling is enabled with
55// TargetSubtarget.enablePostRAScheduler(). This flag can be used to
56// override the target.
57static cl::opt<bool>
58EnablePostRAScheduler("post-RA-scheduler",
59 cl::desc("Enable scheduling after register allocation"),
David Goodwin9843a932009-10-01 22:19:57 +000060 cl::init(false), cl::Hidden);
David Goodwin2e7be612009-10-26 16:59:04 +000061static cl::opt<std::string>
Dan Gohman21d90032008-11-25 00:52:40 +000062EnableAntiDepBreaking("break-anti-dependencies",
David Goodwin2e7be612009-10-26 16:59:04 +000063 cl::desc("Break post-RA scheduling anti-dependencies: "
64 "\"critical\", \"all\", or \"none\""),
65 cl::init("none"), cl::Hidden);
Dan Gohman2836c282009-01-16 01:33:36 +000066
David Goodwin1f152282009-09-01 18:34:03 +000067// If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod
68static cl::opt<int>
69DebugDiv("postra-sched-debugdiv",
70 cl::desc("Debug control MBBs that are scheduled"),
71 cl::init(0), cl::Hidden);
72static cl::opt<int>
73DebugMod("postra-sched-debugmod",
74 cl::desc("Debug control MBBs that are scheduled"),
75 cl::init(0), cl::Hidden);
76
David Goodwinada0ef82009-10-26 19:41:00 +000077AntiDepBreaker::~AntiDepBreaker() { }
78
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000079namespace {
Nick Lewycky6726b6d2009-10-25 06:33:48 +000080 class PostRAScheduler : public MachineFunctionPass {
Dan Gohmana70dca12009-10-09 23:27:56 +000081 AliasAnalysis *AA;
Evan Chengfa163542009-10-16 21:06:15 +000082 CodeGenOpt::Level OptLevel;
Dan Gohmana70dca12009-10-09 23:27:56 +000083
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000084 public:
85 static char ID;
Evan Chengfa163542009-10-16 21:06:15 +000086 PostRAScheduler(CodeGenOpt::Level ol) :
87 MachineFunctionPass(&ID), OptLevel(ol) {}
Dan Gohman21d90032008-11-25 00:52:40 +000088
Dan Gohman3f237442008-12-16 03:25:46 +000089 void getAnalysisUsage(AnalysisUsage &AU) const {
Dan Gohman845012e2009-07-31 23:37:33 +000090 AU.setPreservesCFG();
Dan Gohmana70dca12009-10-09 23:27:56 +000091 AU.addRequired<AliasAnalysis>();
Dan Gohman3f237442008-12-16 03:25:46 +000092 AU.addRequired<MachineDominatorTree>();
93 AU.addPreserved<MachineDominatorTree>();
94 AU.addRequired<MachineLoopInfo>();
95 AU.addPreserved<MachineLoopInfo>();
96 MachineFunctionPass::getAnalysisUsage(AU);
97 }
98
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000099 const char *getPassName() const {
Dan Gohman21d90032008-11-25 00:52:40 +0000100 return "Post RA top-down list latency scheduler";
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000101 }
102
103 bool runOnMachineFunction(MachineFunction &Fn);
104 };
Dan Gohman343f0c02008-11-19 23:18:57 +0000105 char PostRAScheduler::ID = 0;
106
Nick Lewycky6726b6d2009-10-25 06:33:48 +0000107 class SchedulePostRATDList : public ScheduleDAGInstrs {
Dan Gohman343f0c02008-11-19 23:18:57 +0000108 /// AvailableQueue - The priority queue to use for the available SUnits.
Dan Gohmanc1ae8c92009-10-21 01:44:44 +0000109 ///
Dan Gohman343f0c02008-11-19 23:18:57 +0000110 LatencyPriorityQueue AvailableQueue;
Jim Grosbach90013032010-05-14 21:19:48 +0000111
Dan Gohman343f0c02008-11-19 23:18:57 +0000112 /// PendingQueue - This contains all of the instructions whose operands have
113 /// been issued, but their results are not ready yet (due to the latency of
114 /// the operation). Once the operands becomes available, the instruction is
115 /// added to the AvailableQueue.
116 std::vector<SUnit*> PendingQueue;
117
Dan Gohman21d90032008-11-25 00:52:40 +0000118 /// Topo - A topological ordering for SUnits.
119 ScheduleDAGTopologicalSort Topo;
Dan Gohman343f0c02008-11-19 23:18:57 +0000120
Dan Gohman2836c282009-01-16 01:33:36 +0000121 /// HazardRec - The hazard recognizer to use.
122 ScheduleHazardRecognizer *HazardRec;
123
David Goodwin2e7be612009-10-26 16:59:04 +0000124 /// AntiDepBreak - Anti-dependence breaking object, or NULL if none
125 AntiDepBreaker *AntiDepBreak;
126
Dan Gohmana70dca12009-10-09 23:27:56 +0000127 /// AA - AliasAnalysis for making memory reference queries.
128 AliasAnalysis *AA;
129
Dan Gohmanc1ae8c92009-10-21 01:44:44 +0000130 /// KillIndices - The index of the most recent kill (proceding bottom-up),
131 /// or ~0u if the register is not live.
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000132 unsigned KillIndices[TargetRegisterInfo::FirstVirtualRegister];
133
Dan Gohman21d90032008-11-25 00:52:40 +0000134 public:
Dan Gohman79ce2762009-01-15 19:20:50 +0000135 SchedulePostRATDList(MachineFunction &MF,
Dan Gohman3f237442008-12-16 03:25:46 +0000136 const MachineLoopInfo &MLI,
Dan Gohman2836c282009-01-16 01:33:36 +0000137 const MachineDominatorTree &MDT,
Dan Gohmana70dca12009-10-09 23:27:56 +0000138 ScheduleHazardRecognizer *HR,
David Goodwin2e7be612009-10-26 16:59:04 +0000139 AntiDepBreaker *ADB,
140 AliasAnalysis *aa)
Dan Gohman79ce2762009-01-15 19:20:50 +0000141 : ScheduleDAGInstrs(MF, MLI, MDT), Topo(SUnits),
David Goodwin2e7be612009-10-26 16:59:04 +0000142 HazardRec(HR), AntiDepBreak(ADB), AA(aa) {}
Dan Gohman2836c282009-01-16 01:33:36 +0000143
144 ~SchedulePostRATDList() {
Dan Gohman2836c282009-01-16 01:33:36 +0000145 }
Dan Gohman343f0c02008-11-19 23:18:57 +0000146
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000147 /// StartBlock - Initialize register live-range state for scheduling in
148 /// this block.
149 ///
150 void StartBlock(MachineBasicBlock *BB);
151
152 /// Schedule - Schedule the instruction range using list scheduling.
153 ///
Dan Gohman343f0c02008-11-19 23:18:57 +0000154 void Schedule();
Jim Grosbach90013032010-05-14 21:19:48 +0000155
Dan Gohmanc1ae8c92009-10-21 01:44:44 +0000156 /// Observe - Update liveness information to account for the current
157 /// instruction, which will not be scheduled.
158 ///
159 void Observe(MachineInstr *MI, unsigned Count);
160
161 /// FinishBlock - Clean up register live-range state.
162 ///
163 void FinishBlock();
164
David Goodwin2e7be612009-10-26 16:59:04 +0000165 /// FixupKills - Fix register kill flags that have been made
166 /// invalid due to scheduling
167 ///
168 void FixupKills(MachineBasicBlock *MBB);
169
Dan Gohman343f0c02008-11-19 23:18:57 +0000170 private:
David Goodwin557bbe62009-11-20 19:32:48 +0000171 void ReleaseSucc(SUnit *SU, SDep *SuccEdge);
172 void ReleaseSuccessors(SUnit *SU);
173 void ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle);
174 void ListScheduleTopDown();
David Goodwin5e411782009-09-03 22:15:25 +0000175 void StartBlockForKills(MachineBasicBlock *BB);
Jim Grosbach90013032010-05-14 21:19:48 +0000176
David Goodwin8f909342009-09-23 16:35:25 +0000177 // ToggleKillFlag - Toggle a register operand kill flag. Other
178 // adjustments may be made to the instruction if necessary. Return
179 // true if the operand has been deleted, false if not.
180 bool ToggleKillFlag(MachineInstr *MI, MachineOperand &MO);
Dan Gohman343f0c02008-11-19 23:18:57 +0000181 };
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000182}
183
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000184/// isSchedulingBoundary - Test if the given instruction should be
185/// considered a scheduling boundary. This primarily includes labels
186/// and terminators.
187///
188static bool isSchedulingBoundary(const MachineInstr *MI,
189 const MachineFunction &MF) {
190 // Terminators and labels can't be scheduled around.
191 if (MI->getDesc().isTerminator() || MI->isLabel())
192 return true;
193
Evan Cheng1015ba72010-05-21 20:53:24 +0000194 // Don't attempt to schedule around any instruction that defines
Dan Gohmanbed353d2009-02-10 23:29:38 +0000195 // a stack-oriented pointer, as it's unlikely to be profitable. This
196 // saves compile time, because it doesn't require every single
197 // stack slot reference to depend on the instruction that does the
198 // modification.
199 const TargetLowering &TLI = *MF.getTarget().getTargetLowering();
Evan Cheng1015ba72010-05-21 20:53:24 +0000200 if (MI->definesRegister(TLI.getStackPointerRegisterToSaveRestore()))
Dan Gohmanbed353d2009-02-10 23:29:38 +0000201 return true;
202
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000203 return false;
204}
205
Dan Gohman343f0c02008-11-19 23:18:57 +0000206bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
Dan Gohman5bf7c2a2009-10-10 00:15:38 +0000207 AA = &getAnalysis<AliasAnalysis>();
208
David Goodwin471850a2009-10-01 21:46:35 +0000209 // Check for explicit enable/disable of post-ra scheduling.
David Goodwin4c3715c2009-10-22 23:19:17 +0000210 TargetSubtarget::AntiDepBreakMode AntiDepMode = TargetSubtarget::ANTIDEP_NONE;
David Goodwin87d21b92009-11-13 19:52:48 +0000211 SmallVector<TargetRegisterClass*, 4> CriticalPathRCs;
David Goodwin471850a2009-10-01 21:46:35 +0000212 if (EnablePostRAScheduler.getPosition() > 0) {
213 if (!EnablePostRAScheduler)
Evan Chengc83da2f92009-10-16 06:10:34 +0000214 return false;
David Goodwin471850a2009-10-01 21:46:35 +0000215 } else {
Evan Chengc83da2f92009-10-16 06:10:34 +0000216 // Check that post-RA scheduling is enabled for this target.
David Goodwin471850a2009-10-01 21:46:35 +0000217 const TargetSubtarget &ST = Fn.getTarget().getSubtarget<TargetSubtarget>();
David Goodwin87d21b92009-11-13 19:52:48 +0000218 if (!ST.enablePostRAScheduler(OptLevel, AntiDepMode, CriticalPathRCs))
Evan Chengc83da2f92009-10-16 06:10:34 +0000219 return false;
David Goodwin471850a2009-10-01 21:46:35 +0000220 }
David Goodwin0dad89f2009-09-30 00:10:16 +0000221
David Goodwin4c3715c2009-10-22 23:19:17 +0000222 // Check for antidep breaking override...
223 if (EnableAntiDepBreaking.getPosition() > 0) {
Jim Grosbach90013032010-05-14 21:19:48 +0000224 AntiDepMode = (EnableAntiDepBreaking == "all") ?
225 TargetSubtarget::ANTIDEP_ALL :
226 (EnableAntiDepBreaking == "critical")
227 ? TargetSubtarget::ANTIDEP_CRITICAL : TargetSubtarget::ANTIDEP_NONE;
David Goodwin4c3715c2009-10-22 23:19:17 +0000228 }
229
David Greenee1b21292010-01-05 01:26:01 +0000230 DEBUG(dbgs() << "PostRAScheduler\n");
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000231
Dan Gohman3f237442008-12-16 03:25:46 +0000232 const MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>();
233 const MachineDominatorTree &MDT = getAnalysis<MachineDominatorTree>();
Evan Cheng729aab32010-06-12 00:12:18 +0000234 const TargetMachine &TM = Fn.getTarget();
235 const InstrItineraryData &InstrItins = TM.getInstrItineraryData();
236 ScheduleHazardRecognizer *HR =
237 TM.getInstrInfo()->CreateTargetPostRAHazardRecognizer(InstrItins);
Jim Grosbach90013032010-05-14 21:19:48 +0000238 AntiDepBreaker *ADB =
David Goodwin34877712009-10-26 19:32:42 +0000239 ((AntiDepMode == TargetSubtarget::ANTIDEP_ALL) ?
David Goodwin87d21b92009-11-13 19:52:48 +0000240 (AntiDepBreaker *)new AggressiveAntiDepBreaker(Fn, CriticalPathRCs) :
Jim Grosbach90013032010-05-14 21:19:48 +0000241 ((AntiDepMode == TargetSubtarget::ANTIDEP_CRITICAL) ?
David Goodwin34877712009-10-26 19:32:42 +0000242 (AntiDepBreaker *)new CriticalAntiDepBreaker(Fn) : NULL));
Dan Gohman3f237442008-12-16 03:25:46 +0000243
David Goodwin2e7be612009-10-26 16:59:04 +0000244 SchedulePostRATDList Scheduler(Fn, MLI, MDT, HR, ADB, AA);
Dan Gohman79ce2762009-01-15 19:20:50 +0000245
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000246 // Loop over all of the basic blocks
247 for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
Dan Gohman343f0c02008-11-19 23:18:57 +0000248 MBB != MBBe; ++MBB) {
David Goodwin1f152282009-09-01 18:34:03 +0000249#ifndef NDEBUG
250 // If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod
251 if (DebugDiv > 0) {
252 static int bbcnt = 0;
253 if (bbcnt++ % DebugDiv != DebugMod)
254 continue;
David Greenee1b21292010-01-05 01:26:01 +0000255 dbgs() << "*** DEBUG scheduling " << Fn.getFunction()->getNameStr() <<
Dan Gohman0ba90f32009-10-31 20:19:03 +0000256 ":BB#" << MBB->getNumber() << " ***\n";
David Goodwin1f152282009-09-01 18:34:03 +0000257 }
258#endif
259
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000260 // Initialize register live-range state for scheduling in this block.
261 Scheduler.StartBlock(MBB);
262
Dan Gohmanf7119392009-01-16 22:10:20 +0000263 // Schedule each sequence of instructions not interrupted by a label
264 // or anything else that effectively needs to shut down scheduling.
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000265 MachineBasicBlock::iterator Current = MBB->end();
Dan Gohman47ac0f02009-02-11 04:27:20 +0000266 unsigned Count = MBB->size(), CurrentCount = Count;
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000267 for (MachineBasicBlock::iterator I = Current; I != MBB->begin(); ) {
268 MachineInstr *MI = prior(I);
269 if (isSchedulingBoundary(MI, Fn)) {
Dan Gohman1274ced2009-03-10 18:10:43 +0000270 Scheduler.Run(MBB, I, Current, CurrentCount);
Dan Gohmanaf1d8ca2010-05-01 00:01:06 +0000271 Scheduler.EmitSchedule();
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000272 Current = MI;
Dan Gohman47ac0f02009-02-11 04:27:20 +0000273 CurrentCount = Count - 1;
Dan Gohman1274ced2009-03-10 18:10:43 +0000274 Scheduler.Observe(MI, CurrentCount);
Dan Gohmanf7119392009-01-16 22:10:20 +0000275 }
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000276 I = MI;
Dan Gohman47ac0f02009-02-11 04:27:20 +0000277 --Count;
Dan Gohman43f07fb2009-02-03 18:57:45 +0000278 }
Dan Gohman47ac0f02009-02-11 04:27:20 +0000279 assert(Count == 0 && "Instruction count mismatch!");
Duncan Sands9e8bd0b2009-03-11 09:04:34 +0000280 assert((MBB->begin() == Current || CurrentCount != 0) &&
Dan Gohman1274ced2009-03-10 18:10:43 +0000281 "Instruction count mismatch!");
282 Scheduler.Run(MBB, MBB->begin(), Current, CurrentCount);
Dan Gohmanaf1d8ca2010-05-01 00:01:06 +0000283 Scheduler.EmitSchedule();
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000284
285 // Clean up register live-range state.
286 Scheduler.FinishBlock();
David Goodwin88a589c2009-08-25 17:03:05 +0000287
David Goodwin5e411782009-09-03 22:15:25 +0000288 // Update register kills
David Goodwin88a589c2009-08-25 17:03:05 +0000289 Scheduler.FixupKills(MBB);
Dan Gohman343f0c02008-11-19 23:18:57 +0000290 }
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000291
David Goodwin2e7be612009-10-26 16:59:04 +0000292 delete HR;
293 delete ADB;
294
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000295 return true;
296}
Jim Grosbach90013032010-05-14 21:19:48 +0000297
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000298/// StartBlock - Initialize register live-range state for scheduling in
299/// this block.
Dan Gohman21d90032008-11-25 00:52:40 +0000300///
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000301void SchedulePostRATDList::StartBlock(MachineBasicBlock *BB) {
302 // Call the superclass.
303 ScheduleDAGInstrs::StartBlock(BB);
Dan Gohman21d90032008-11-25 00:52:40 +0000304
David Goodwin2e7be612009-10-26 16:59:04 +0000305 // Reset the hazard recognizer and anti-dep breaker.
David Goodwind94a4e52009-08-10 15:55:25 +0000306 HazardRec->Reset();
David Goodwin2e7be612009-10-26 16:59:04 +0000307 if (AntiDepBreak != NULL)
308 AntiDepBreak->StartBlock(BB);
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000309}
310
311/// Schedule - Schedule the instruction range using list scheduling.
312///
313void SchedulePostRATDList::Schedule() {
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000314 // Build the scheduling graph.
Dan Gohmana70dca12009-10-09 23:27:56 +0000315 BuildSchedGraph(AA);
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000316
David Goodwin2e7be612009-10-26 16:59:04 +0000317 if (AntiDepBreak != NULL) {
Jim Grosbach90013032010-05-14 21:19:48 +0000318 unsigned Broken =
David Goodwin557bbe62009-11-20 19:32:48 +0000319 AntiDepBreak->BreakAntiDependencies(SUnits, Begin, InsertPos,
320 InsertPosIndex);
Jim Grosbach90013032010-05-14 21:19:48 +0000321
David Goodwin557bbe62009-11-20 19:32:48 +0000322 if (Broken != 0) {
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000323 // We made changes. Update the dependency graph.
324 // Theoretically we could update the graph in place:
325 // When a live range is changed to use a different register, remove
326 // the def's anti-dependence *and* output-dependence edges due to
327 // that register, and add new anti-dependence and output-dependence
328 // edges based on the next live range of the register.
David Goodwin557bbe62009-11-20 19:32:48 +0000329 SUnits.clear();
330 Sequence.clear();
331 EntrySU = SUnit();
332 ExitSU = SUnit();
333 BuildSchedGraph(AA);
Jim Grosbach90013032010-05-14 21:19:48 +0000334
David Goodwin2e7be612009-10-26 16:59:04 +0000335 NumFixedAnti += Broken;
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000336 }
337 }
338
David Greenee1b21292010-01-05 01:26:01 +0000339 DEBUG(dbgs() << "********** List Scheduling **********\n");
David Goodwind94a4e52009-08-10 15:55:25 +0000340 DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
341 SUnits[su].dumpAll(this));
342
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000343 AvailableQueue.initNodes(SUnits);
David Goodwin557bbe62009-11-20 19:32:48 +0000344 ListScheduleTopDown();
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000345 AvailableQueue.releaseState();
346}
347
348/// Observe - Update liveness information to account for the current
349/// instruction, which will not be scheduled.
350///
Dan Gohman47ac0f02009-02-11 04:27:20 +0000351void SchedulePostRATDList::Observe(MachineInstr *MI, unsigned Count) {
David Goodwin2e7be612009-10-26 16:59:04 +0000352 if (AntiDepBreak != NULL)
353 AntiDepBreak->Observe(MI, Count, InsertPosIndex);
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000354}
355
356/// FinishBlock - Clean up register live-range state.
357///
358void SchedulePostRATDList::FinishBlock() {
David Goodwin2e7be612009-10-26 16:59:04 +0000359 if (AntiDepBreak != NULL)
360 AntiDepBreak->FinishBlock();
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000361
362 // Call the superclass.
363 ScheduleDAGInstrs::FinishBlock();
364}
365
David Goodwin5e411782009-09-03 22:15:25 +0000366/// StartBlockForKills - Initialize register live-range state for updating kills
367///
368void SchedulePostRATDList::StartBlockForKills(MachineBasicBlock *BB) {
369 // Initialize the indices to indicate that no registers are live.
David Goodwin990d2852009-12-09 17:18:22 +0000370 for (unsigned i = 0; i < TRI->getNumRegs(); ++i)
371 KillIndices[i] = ~0u;
David Goodwin5e411782009-09-03 22:15:25 +0000372
373 // Determine the live-out physregs for this block.
374 if (!BB->empty() && BB->back().getDesc().isReturn()) {
375 // In a return block, examine the function live-out regs.
376 for (MachineRegisterInfo::liveout_iterator I = MRI.liveout_begin(),
377 E = MRI.liveout_end(); I != E; ++I) {
378 unsigned Reg = *I;
379 KillIndices[Reg] = BB->size();
380 // Repeat, for all subregs.
381 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
382 *Subreg; ++Subreg) {
383 KillIndices[*Subreg] = BB->size();
384 }
385 }
386 }
387 else {
388 // In a non-return block, examine the live-in regs of all successors.
389 for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),
390 SE = BB->succ_end(); SI != SE; ++SI) {
391 for (MachineBasicBlock::livein_iterator I = (*SI)->livein_begin(),
392 E = (*SI)->livein_end(); I != E; ++I) {
393 unsigned Reg = *I;
394 KillIndices[Reg] = BB->size();
395 // Repeat, for all subregs.
396 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
397 *Subreg; ++Subreg) {
398 KillIndices[*Subreg] = BB->size();
399 }
400 }
401 }
402 }
403}
404
David Goodwin8f909342009-09-23 16:35:25 +0000405bool SchedulePostRATDList::ToggleKillFlag(MachineInstr *MI,
406 MachineOperand &MO) {
407 // Setting kill flag...
408 if (!MO.isKill()) {
409 MO.setIsKill(true);
410 return false;
411 }
Jim Grosbach90013032010-05-14 21:19:48 +0000412
David Goodwin8f909342009-09-23 16:35:25 +0000413 // If MO itself is live, clear the kill flag...
414 if (KillIndices[MO.getReg()] != ~0u) {
415 MO.setIsKill(false);
416 return false;
417 }
418
419 // If any subreg of MO is live, then create an imp-def for that
420 // subreg and keep MO marked as killed.
Benjamin Kramer8bff4af2009-10-02 15:59:52 +0000421 MO.setIsKill(false);
David Goodwin8f909342009-09-23 16:35:25 +0000422 bool AllDead = true;
423 const unsigned SuperReg = MO.getReg();
424 for (const unsigned *Subreg = TRI->getSubRegisters(SuperReg);
425 *Subreg; ++Subreg) {
426 if (KillIndices[*Subreg] != ~0u) {
427 MI->addOperand(MachineOperand::CreateReg(*Subreg,
428 true /*IsDef*/,
429 true /*IsImp*/,
430 false /*IsKill*/,
431 false /*IsDead*/));
432 AllDead = false;
433 }
434 }
435
Dan Gohmanc1ae8c92009-10-21 01:44:44 +0000436 if(AllDead)
Benjamin Kramer8bff4af2009-10-02 15:59:52 +0000437 MO.setIsKill(true);
David Goodwin8f909342009-09-23 16:35:25 +0000438 return false;
439}
440
David Goodwin88a589c2009-08-25 17:03:05 +0000441/// FixupKills - Fix the register kill flags, they may have been made
442/// incorrect by instruction reordering.
443///
444void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) {
David Greenee1b21292010-01-05 01:26:01 +0000445 DEBUG(dbgs() << "Fixup kills for BB#" << MBB->getNumber() << '\n');
David Goodwin88a589c2009-08-25 17:03:05 +0000446
447 std::set<unsigned> killedRegs;
448 BitVector ReservedRegs = TRI->getReservedRegs(MF);
David Goodwin5e411782009-09-03 22:15:25 +0000449
450 StartBlockForKills(MBB);
Jim Grosbach90013032010-05-14 21:19:48 +0000451
David Goodwin7886cd82009-08-29 00:11:13 +0000452 // Examine block from end to start...
David Goodwin88a589c2009-08-25 17:03:05 +0000453 unsigned Count = MBB->size();
454 for (MachineBasicBlock::iterator I = MBB->end(), E = MBB->begin();
455 I != E; --Count) {
456 MachineInstr *MI = --I;
Dale Johannesenb0812f12010-03-05 00:02:59 +0000457 if (MI->isDebugValue())
458 continue;
David Goodwin88a589c2009-08-25 17:03:05 +0000459
David Goodwin7886cd82009-08-29 00:11:13 +0000460 // Update liveness. Registers that are defed but not used in this
461 // instruction are now dead. Mark register and all subregs as they
462 // are completely defined.
463 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
464 MachineOperand &MO = MI->getOperand(i);
465 if (!MO.isReg()) continue;
466 unsigned Reg = MO.getReg();
467 if (Reg == 0) continue;
468 if (!MO.isDef()) continue;
469 // Ignore two-addr defs.
470 if (MI->isRegTiedToUseOperand(i)) continue;
Jim Grosbach90013032010-05-14 21:19:48 +0000471
David Goodwin7886cd82009-08-29 00:11:13 +0000472 KillIndices[Reg] = ~0u;
Jim Grosbach90013032010-05-14 21:19:48 +0000473
David Goodwin7886cd82009-08-29 00:11:13 +0000474 // Repeat for all subregs.
475 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
476 *Subreg; ++Subreg) {
477 KillIndices[*Subreg] = ~0u;
478 }
479 }
David Goodwin88a589c2009-08-25 17:03:05 +0000480
David Goodwin8f909342009-09-23 16:35:25 +0000481 // Examine all used registers and set/clear kill flag. When a
482 // register is used multiple times we only set the kill flag on
483 // the first use.
David Goodwin88a589c2009-08-25 17:03:05 +0000484 killedRegs.clear();
485 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
486 MachineOperand &MO = MI->getOperand(i);
487 if (!MO.isReg() || !MO.isUse()) continue;
488 unsigned Reg = MO.getReg();
489 if ((Reg == 0) || ReservedRegs.test(Reg)) continue;
490
David Goodwin7886cd82009-08-29 00:11:13 +0000491 bool kill = false;
492 if (killedRegs.find(Reg) == killedRegs.end()) {
493 kill = true;
494 // A register is not killed if any subregs are live...
495 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
496 *Subreg; ++Subreg) {
497 if (KillIndices[*Subreg] != ~0u) {
498 kill = false;
499 break;
500 }
501 }
502
503 // If subreg is not live, then register is killed if it became
504 // live in this instruction
505 if (kill)
506 kill = (KillIndices[Reg] == ~0u);
507 }
Jim Grosbach90013032010-05-14 21:19:48 +0000508
David Goodwin88a589c2009-08-25 17:03:05 +0000509 if (MO.isKill() != kill) {
David Greenee1b21292010-01-05 01:26:01 +0000510 DEBUG(dbgs() << "Fixing " << MO << " in ");
Jakob Stoklund Olesen15d75d92009-12-03 01:49:56 +0000511 // Warning: ToggleKillFlag may invalidate MO.
512 ToggleKillFlag(MI, MO);
David Goodwin88a589c2009-08-25 17:03:05 +0000513 DEBUG(MI->dump());
514 }
Jim Grosbach90013032010-05-14 21:19:48 +0000515
David Goodwin88a589c2009-08-25 17:03:05 +0000516 killedRegs.insert(Reg);
517 }
Jim Grosbach90013032010-05-14 21:19:48 +0000518
David Goodwina3251db2009-08-31 20:47:02 +0000519 // Mark any used register (that is not using undef) and subregs as
520 // now live...
David Goodwin7886cd82009-08-29 00:11:13 +0000521 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
522 MachineOperand &MO = MI->getOperand(i);
David Goodwina3251db2009-08-31 20:47:02 +0000523 if (!MO.isReg() || !MO.isUse() || MO.isUndef()) continue;
David Goodwin7886cd82009-08-29 00:11:13 +0000524 unsigned Reg = MO.getReg();
525 if ((Reg == 0) || ReservedRegs.test(Reg)) continue;
526
David Goodwin7886cd82009-08-29 00:11:13 +0000527 KillIndices[Reg] = Count;
Jim Grosbach90013032010-05-14 21:19:48 +0000528
David Goodwin7886cd82009-08-29 00:11:13 +0000529 for (const unsigned *Subreg = TRI->getSubRegisters(Reg);
530 *Subreg; ++Subreg) {
531 KillIndices[*Subreg] = Count;
532 }
533 }
David Goodwin88a589c2009-08-25 17:03:05 +0000534 }
535}
536
Dan Gohman343f0c02008-11-19 23:18:57 +0000537//===----------------------------------------------------------------------===//
538// Top-Down Scheduling
539//===----------------------------------------------------------------------===//
540
541/// ReleaseSucc - Decrement the NumPredsLeft count of a successor. Add it to
542/// the PendingQueue if the count reaches zero. Also update its cycle bound.
David Goodwin557bbe62009-11-20 19:32:48 +0000543void SchedulePostRATDList::ReleaseSucc(SUnit *SU, SDep *SuccEdge) {
Dan Gohman54e4c362008-12-09 22:54:47 +0000544 SUnit *SuccSU = SuccEdge->getSUnit();
Reid Klecknerc277ab02009-09-30 20:15:38 +0000545
Dan Gohman343f0c02008-11-19 23:18:57 +0000546#ifndef NDEBUG
Reid Klecknerc277ab02009-09-30 20:15:38 +0000547 if (SuccSU->NumPredsLeft == 0) {
David Greenee1b21292010-01-05 01:26:01 +0000548 dbgs() << "*** Scheduling failed! ***\n";
Dan Gohman343f0c02008-11-19 23:18:57 +0000549 SuccSU->dump(this);
David Greenee1b21292010-01-05 01:26:01 +0000550 dbgs() << " has been released too many times!\n";
Torok Edwinc23197a2009-07-14 16:55:14 +0000551 llvm_unreachable(0);
Dan Gohman343f0c02008-11-19 23:18:57 +0000552 }
553#endif
Reid Klecknerc277ab02009-09-30 20:15:38 +0000554 --SuccSU->NumPredsLeft;
555
Dan Gohman343f0c02008-11-19 23:18:57 +0000556 // Compute how many cycles it will be before this actually becomes
557 // available. This is the max of the start time of all predecessors plus
558 // their latencies.
David Goodwin557bbe62009-11-20 19:32:48 +0000559 SuccSU->setDepthToAtLeast(SU->getDepth() + SuccEdge->getLatency());
Jim Grosbach90013032010-05-14 21:19:48 +0000560
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000561 // If all the node's predecessors are scheduled, this node is ready
562 // to be scheduled. Ignore the special ExitSU node.
563 if (SuccSU->NumPredsLeft == 0 && SuccSU != &ExitSU)
Dan Gohman343f0c02008-11-19 23:18:57 +0000564 PendingQueue.push_back(SuccSU);
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000565}
566
567/// ReleaseSuccessors - Call ReleaseSucc on each of SU's successors.
David Goodwin557bbe62009-11-20 19:32:48 +0000568void SchedulePostRATDList::ReleaseSuccessors(SUnit *SU) {
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000569 for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
David Goodwin4de099d2009-11-03 20:57:50 +0000570 I != E; ++I) {
David Goodwin557bbe62009-11-20 19:32:48 +0000571 ReleaseSucc(SU, &*I);
David Goodwin4de099d2009-11-03 20:57:50 +0000572 }
Dan Gohman343f0c02008-11-19 23:18:57 +0000573}
574
575/// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
576/// count of its successors. If a successor pending count is zero, add it to
577/// the Available queue.
David Goodwin557bbe62009-11-20 19:32:48 +0000578void SchedulePostRATDList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
David Greenee1b21292010-01-05 01:26:01 +0000579 DEBUG(dbgs() << "*** Scheduling [" << CurCycle << "]: ");
Dan Gohman343f0c02008-11-19 23:18:57 +0000580 DEBUG(SU->dump(this));
Jim Grosbach90013032010-05-14 21:19:48 +0000581
Dan Gohman343f0c02008-11-19 23:18:57 +0000582 Sequence.push_back(SU);
Jim Grosbach90013032010-05-14 21:19:48 +0000583 assert(CurCycle >= SU->getDepth() &&
David Goodwin4de099d2009-11-03 20:57:50 +0000584 "Node scheduled above its depth!");
David Goodwin557bbe62009-11-20 19:32:48 +0000585 SU->setDepthToAtLeast(CurCycle);
Dan Gohman343f0c02008-11-19 23:18:57 +0000586
David Goodwin557bbe62009-11-20 19:32:48 +0000587 ReleaseSuccessors(SU);
Dan Gohman343f0c02008-11-19 23:18:57 +0000588 SU->isScheduled = true;
589 AvailableQueue.ScheduledNode(SU);
590}
591
592/// ListScheduleTopDown - The main loop of list scheduling for top-down
593/// schedulers.
David Goodwin557bbe62009-11-20 19:32:48 +0000594void SchedulePostRATDList::ListScheduleTopDown() {
Dan Gohman343f0c02008-11-19 23:18:57 +0000595 unsigned CurCycle = 0;
Jim Grosbach90013032010-05-14 21:19:48 +0000596
David Goodwin4de099d2009-11-03 20:57:50 +0000597 // We're scheduling top-down but we're visiting the regions in
598 // bottom-up order, so we don't know the hazards at the start of a
599 // region. So assume no hazards (this should usually be ok as most
600 // blocks are a single region).
601 HazardRec->Reset();
602
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000603 // Release any successors of the special Entry node.
David Goodwin557bbe62009-11-20 19:32:48 +0000604 ReleaseSuccessors(&EntrySU);
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000605
David Goodwin557bbe62009-11-20 19:32:48 +0000606 // Add all leaves to Available queue.
Dan Gohman343f0c02008-11-19 23:18:57 +0000607 for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
608 // It is available if it has no predecessors.
David Goodwin4de099d2009-11-03 20:57:50 +0000609 bool available = SUnits[i].Preds.empty();
David Goodwin4de099d2009-11-03 20:57:50 +0000610 if (available) {
Dan Gohman343f0c02008-11-19 23:18:57 +0000611 AvailableQueue.push(&SUnits[i]);
612 SUnits[i].isAvailable = true;
613 }
614 }
Dan Gohman9e64bbb2009-02-10 23:27:53 +0000615
David Goodwin2ffb0ce2009-08-12 21:47:46 +0000616 // In any cycle where we can't schedule any instructions, we must
617 // stall or emit a noop, depending on the target.
Benjamin Kramerbe441c02009-09-06 12:10:17 +0000618 bool CycleHasInsts = false;
David Goodwin2ffb0ce2009-08-12 21:47:46 +0000619
Dan Gohman343f0c02008-11-19 23:18:57 +0000620 // While Available queue is not empty, grab the node with the highest
621 // priority. If it is not ready put it back. Schedule the node.
Dan Gohman2836c282009-01-16 01:33:36 +0000622 std::vector<SUnit*> NotReady;
Dan Gohman343f0c02008-11-19 23:18:57 +0000623 Sequence.reserve(SUnits.size());
624 while (!AvailableQueue.empty() || !PendingQueue.empty()) {
625 // Check to see if any of the pending instructions are ready to issue. If
626 // so, add them to the available queue.
Dan Gohman3f237442008-12-16 03:25:46 +0000627 unsigned MinDepth = ~0u;
Dan Gohman343f0c02008-11-19 23:18:57 +0000628 for (unsigned i = 0, e = PendingQueue.size(); i != e; ++i) {
David Goodwin557bbe62009-11-20 19:32:48 +0000629 if (PendingQueue[i]->getDepth() <= CurCycle) {
Dan Gohman343f0c02008-11-19 23:18:57 +0000630 AvailableQueue.push(PendingQueue[i]);
631 PendingQueue[i]->isAvailable = true;
632 PendingQueue[i] = PendingQueue.back();
633 PendingQueue.pop_back();
634 --i; --e;
David Goodwin557bbe62009-11-20 19:32:48 +0000635 } else if (PendingQueue[i]->getDepth() < MinDepth)
636 MinDepth = PendingQueue[i]->getDepth();
Dan Gohman343f0c02008-11-19 23:18:57 +0000637 }
David Goodwinc93d8372009-08-11 17:35:23 +0000638
David Greenee1b21292010-01-05 01:26:01 +0000639 DEBUG(dbgs() << "\n*** Examining Available\n";
David Goodwin7cd01182009-08-11 17:56:42 +0000640 LatencyPriorityQueue q = AvailableQueue;
641 while (!q.empty()) {
642 SUnit *su = q.pop();
David Greenee1b21292010-01-05 01:26:01 +0000643 dbgs() << "Height " << su->getHeight() << ": ";
David Goodwin7cd01182009-08-11 17:56:42 +0000644 su->dump(this);
645 });
David Goodwinc93d8372009-08-11 17:35:23 +0000646
Dan Gohman2836c282009-01-16 01:33:36 +0000647 SUnit *FoundSUnit = 0;
Dan Gohman2836c282009-01-16 01:33:36 +0000648 bool HasNoopHazards = false;
649 while (!AvailableQueue.empty()) {
650 SUnit *CurSUnit = AvailableQueue.pop();
651
652 ScheduleHazardRecognizer::HazardType HT =
653 HazardRec->getHazardType(CurSUnit);
654 if (HT == ScheduleHazardRecognizer::NoHazard) {
655 FoundSUnit = CurSUnit;
656 break;
657 }
658
659 // Remember if this is a noop hazard.
660 HasNoopHazards |= HT == ScheduleHazardRecognizer::NoopHazard;
661
662 NotReady.push_back(CurSUnit);
663 }
664
665 // Add the nodes that aren't ready back onto the available list.
666 if (!NotReady.empty()) {
667 AvailableQueue.push_all(NotReady);
668 NotReady.clear();
669 }
670
David Goodwin4de099d2009-11-03 20:57:50 +0000671 // If we found a node to schedule...
Dan Gohman343f0c02008-11-19 23:18:57 +0000672 if (FoundSUnit) {
David Goodwin4de099d2009-11-03 20:57:50 +0000673 // ... schedule the node...
David Goodwin557bbe62009-11-20 19:32:48 +0000674 ScheduleNodeTopDown(FoundSUnit, CurCycle);
Dan Gohman2836c282009-01-16 01:33:36 +0000675 HazardRec->EmitInstruction(FoundSUnit);
Benjamin Kramerbe441c02009-09-06 12:10:17 +0000676 CycleHasInsts = true;
Dan Gohman2836c282009-01-16 01:33:36 +0000677 } else {
Benjamin Kramerbe441c02009-09-06 12:10:17 +0000678 if (CycleHasInsts) {
David Greenee1b21292010-01-05 01:26:01 +0000679 DEBUG(dbgs() << "*** Finished cycle " << CurCycle << '\n');
David Goodwin2ffb0ce2009-08-12 21:47:46 +0000680 HazardRec->AdvanceCycle();
681 } else if (!HasNoopHazards) {
682 // Otherwise, we have a pipeline stall, but no other problem,
683 // just advance the current cycle and try again.
David Greenee1b21292010-01-05 01:26:01 +0000684 DEBUG(dbgs() << "*** Stall in cycle " << CurCycle << '\n');
David Goodwin2ffb0ce2009-08-12 21:47:46 +0000685 HazardRec->AdvanceCycle();
David Goodwin557bbe62009-11-20 19:32:48 +0000686 ++NumStalls;
David Goodwin2ffb0ce2009-08-12 21:47:46 +0000687 } else {
688 // Otherwise, we have no instructions to issue and we have instructions
689 // that will fault if we don't do this right. This is the case for
690 // processors without pipeline interlocks and other cases.
David Greenee1b21292010-01-05 01:26:01 +0000691 DEBUG(dbgs() << "*** Emitting noop in cycle " << CurCycle << '\n');
David Goodwin2ffb0ce2009-08-12 21:47:46 +0000692 HazardRec->EmitNoop();
693 Sequence.push_back(0); // NULL here means noop
David Goodwin557bbe62009-11-20 19:32:48 +0000694 ++NumNoops;
David Goodwin2ffb0ce2009-08-12 21:47:46 +0000695 }
696
Dan Gohman2836c282009-01-16 01:33:36 +0000697 ++CurCycle;
Benjamin Kramerbe441c02009-09-06 12:10:17 +0000698 CycleHasInsts = false;
Dan Gohman343f0c02008-11-19 23:18:57 +0000699 }
700 }
701
702#ifndef NDEBUG
Dan Gohmana1e6d362008-11-20 01:26:25 +0000703 VerifySchedule(/*isBottomUp=*/false);
Dan Gohman343f0c02008-11-19 23:18:57 +0000704#endif
705}
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000706
707//===----------------------------------------------------------------------===//
708// Public Constructor Functions
709//===----------------------------------------------------------------------===//
710
Evan Chengfa163542009-10-16 21:06:15 +0000711FunctionPass *llvm::createPostRAScheduler(CodeGenOpt::Level OptLevel) {
712 return new PostRAScheduler(OptLevel);
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000713}