2012-01-13 14:30:30 +08:00
|
|
|
//===- MachineScheduler.cpp - Machine Instruction Scheduler ---------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// MachineScheduler schedules machine instructions after phi elimination. It
|
|
|
|
// preserves LiveIntervals so it can be invoked before register allocation.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "misched"
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
2012-03-08 09:41:12 +08:00
|
|
|
#include "llvm/CodeGen/MachineScheduler.h"
|
2012-01-13 14:30:30 +08:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2012-03-08 07:01:06 +08:00
|
|
|
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
|
2012-01-13 14:30:30 +08:00
|
|
|
#include "llvm/Analysis/AliasAnalysis.h"
|
2012-01-14 10:17:09 +08:00
|
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
2012-01-13 14:30:30 +08:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include "llvm/ADT/OwningPtr.h"
|
|
|
|
|
2012-01-17 14:55:07 +08:00
|
|
|
#include <queue>
|
|
|
|
|
2012-01-13 14:30:30 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2012-03-07 08:18:25 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
static cl::opt<bool> ViewMISchedDAGs("view-misched-dags", cl::Hidden,
|
|
|
|
cl::desc("Pop up a window to show MISched dags after they are processed"));
|
|
|
|
#else
|
|
|
|
static bool ViewMISchedDAGs = false;
|
|
|
|
#endif // NDEBUG
|
|
|
|
|
2012-01-14 10:17:06 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Machine Instruction Scheduling Pass and Registry
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-01-13 14:30:30 +08:00
|
|
|
namespace {
|
2012-01-17 14:55:03 +08:00
|
|
|
/// MachineScheduler runs after coalescing and before register allocation.
|
2012-03-08 09:41:12 +08:00
|
|
|
class MachineScheduler : public MachineSchedContext,
|
|
|
|
public MachineFunctionPass {
|
2012-01-13 14:30:30 +08:00
|
|
|
public:
|
2012-01-17 14:55:03 +08:00
|
|
|
MachineScheduler();
|
2012-01-13 14:30:30 +08:00
|
|
|
|
|
|
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
|
|
|
|
|
|
|
virtual void releaseMemory() {}
|
|
|
|
|
|
|
|
virtual bool runOnMachineFunction(MachineFunction&);
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &O, const Module* = 0) const;
|
|
|
|
|
|
|
|
static char ID; // Class identification, replacement for typeinfo
|
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
2012-01-17 14:55:03 +08:00
|
|
|
char MachineScheduler::ID = 0;
|
2012-01-13 14:30:30 +08:00
|
|
|
|
2012-01-17 14:55:03 +08:00
|
|
|
char &llvm::MachineSchedulerID = MachineScheduler::ID;
|
2012-01-13 14:30:30 +08:00
|
|
|
|
2012-01-17 14:55:03 +08:00
|
|
|
INITIALIZE_PASS_BEGIN(MachineScheduler, "misched",
|
2012-01-13 14:30:30 +08:00
|
|
|
"Machine Instruction Scheduler", false, false)
|
|
|
|
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
|
|
|
|
INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
|
|
|
|
INITIALIZE_PASS_DEPENDENCY(LiveIntervals)
|
2012-01-17 14:55:03 +08:00
|
|
|
INITIALIZE_PASS_END(MachineScheduler, "misched",
|
2012-01-13 14:30:30 +08:00
|
|
|
"Machine Instruction Scheduler", false, false)
|
|
|
|
|
2012-01-17 14:55:03 +08:00
|
|
|
MachineScheduler::MachineScheduler()
|
2012-03-08 09:41:12 +08:00
|
|
|
: MachineFunctionPass(ID) {
|
2012-01-17 14:55:03 +08:00
|
|
|
initializeMachineSchedulerPass(*PassRegistry::getPassRegistry());
|
2012-01-13 14:30:30 +08:00
|
|
|
}
|
|
|
|
|
2012-01-17 14:55:03 +08:00
|
|
|
void MachineScheduler::getAnalysisUsage(AnalysisUsage &AU) const {
|
2012-01-13 14:30:30 +08:00
|
|
|
AU.setPreservesCFG();
|
|
|
|
AU.addRequiredID(MachineDominatorsID);
|
|
|
|
AU.addRequired<MachineLoopInfo>();
|
|
|
|
AU.addRequired<AliasAnalysis>();
|
2012-03-09 08:52:20 +08:00
|
|
|
AU.addRequired<TargetPassConfig>();
|
2012-01-13 14:30:30 +08:00
|
|
|
AU.addRequired<SlotIndexes>();
|
|
|
|
AU.addPreserved<SlotIndexes>();
|
|
|
|
AU.addRequired<LiveIntervals>();
|
|
|
|
AU.addPreserved<LiveIntervals>();
|
|
|
|
MachineFunctionPass::getAnalysisUsage(AU);
|
|
|
|
}
|
|
|
|
|
|
|
|
MachinePassRegistry MachineSchedRegistry::Registry;
|
|
|
|
|
2012-03-09 08:52:20 +08:00
|
|
|
/// A dummy default scheduler factory indicates whether the scheduler
|
|
|
|
/// is overridden on the command line.
|
|
|
|
static ScheduleDAGInstrs *useDefaultMachineSched(MachineSchedContext *C) {
|
|
|
|
return 0;
|
|
|
|
}
|
2012-01-13 14:30:30 +08:00
|
|
|
|
|
|
|
/// MachineSchedOpt allows command line selection of the scheduler.
|
|
|
|
static cl::opt<MachineSchedRegistry::ScheduleDAGCtor, false,
|
|
|
|
RegisterPassParser<MachineSchedRegistry> >
|
|
|
|
MachineSchedOpt("misched",
|
2012-03-09 08:52:20 +08:00
|
|
|
cl::init(&useDefaultMachineSched), cl::Hidden,
|
2012-01-13 14:30:30 +08:00
|
|
|
cl::desc("Machine instruction scheduler to use"));
|
|
|
|
|
2012-03-09 08:52:20 +08:00
|
|
|
static MachineSchedRegistry
|
|
|
|
SchedDefaultRegistry("default", "Use the target's default scheduler choice.",
|
|
|
|
useDefaultMachineSched);
|
|
|
|
|
|
|
|
/// Forward declare the common machine scheduler. This will be used as the
|
|
|
|
/// default scheduler if the target does not set a default.
|
|
|
|
static ScheduleDAGInstrs *createCommonMachineSched(MachineSchedContext *C);
|
|
|
|
|
2012-03-08 09:41:12 +08:00
|
|
|
bool MachineScheduler::runOnMachineFunction(MachineFunction &mf) {
|
|
|
|
// Initialize the context of the pass.
|
|
|
|
MF = &mf;
|
|
|
|
MLI = &getAnalysis<MachineLoopInfo>();
|
|
|
|
MDT = &getAnalysis<MachineDominatorTree>();
|
2012-03-09 08:52:20 +08:00
|
|
|
PassConfig = &getAnalysis<TargetPassConfig>();
|
2012-03-08 09:41:12 +08:00
|
|
|
AA = &getAnalysis<AliasAnalysis>();
|
|
|
|
|
|
|
|
LIS = &getAnalysis<LiveIntervals>();
|
|
|
|
const TargetInstrInfo *TII = MF->getTarget().getInstrInfo();
|
|
|
|
|
|
|
|
// Select the scheduler, or set the default.
|
2012-03-09 08:52:20 +08:00
|
|
|
MachineSchedRegistry::ScheduleDAGCtor Ctor = MachineSchedOpt;
|
|
|
|
if (Ctor == useDefaultMachineSched) {
|
|
|
|
// Get the default scheduler set by the target.
|
|
|
|
Ctor = MachineSchedRegistry::getDefault();
|
|
|
|
if (!Ctor) {
|
|
|
|
Ctor = createCommonMachineSched;
|
|
|
|
MachineSchedRegistry::setDefault(Ctor);
|
|
|
|
}
|
2012-03-08 09:41:12 +08:00
|
|
|
}
|
|
|
|
// Instantiate the selected scheduler.
|
|
|
|
OwningPtr<ScheduleDAGInstrs> Scheduler(Ctor(this));
|
|
|
|
|
|
|
|
// Visit all machine basic blocks.
|
|
|
|
for (MachineFunction::iterator MBB = MF->begin(), MBBEnd = MF->end();
|
|
|
|
MBB != MBBEnd; ++MBB) {
|
|
|
|
|
|
|
|
// Break the block into scheduling regions [I, RegionEnd), and schedule each
|
|
|
|
// region as soon as it is discovered.
|
|
|
|
unsigned RemainingCount = MBB->size();
|
2012-03-09 11:46:39 +08:00
|
|
|
for(MachineBasicBlock::iterator RegionEnd = MBB->end();
|
|
|
|
RegionEnd != MBB->begin();) {
|
2012-03-08 09:41:12 +08:00
|
|
|
Scheduler->startBlock(MBB);
|
|
|
|
// The next region starts above the previous region. Look backward in the
|
|
|
|
// instruction stream until we find the nearest boundary.
|
|
|
|
MachineBasicBlock::iterator I = RegionEnd;
|
2012-03-09 11:46:39 +08:00
|
|
|
for(;I != MBB->begin(); --I, --RemainingCount) {
|
2012-03-08 09:41:12 +08:00
|
|
|
if (TII->isSchedulingBoundary(llvm::prior(I), MBB, *MF))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Notify the scheduler of the region, even if we may skip scheduling
|
|
|
|
// it. Perhaps it still needs to be bundled.
|
|
|
|
Scheduler->enterRegion(MBB, I, RegionEnd, RemainingCount);
|
|
|
|
|
|
|
|
// Skip empty scheduling regions (0 or 1 schedulable instructions).
|
|
|
|
if (I == RegionEnd || I == llvm::prior(RegionEnd)) {
|
|
|
|
RegionEnd = llvm::prior(RegionEnd);
|
|
|
|
if (I != RegionEnd)
|
|
|
|
--RemainingCount;
|
|
|
|
// Close the current region. Bundle the terminator if needed.
|
|
|
|
Scheduler->exitRegion();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
DEBUG(dbgs() << "MachineScheduling " << MF->getFunction()->getName()
|
|
|
|
<< ":BB#" << MBB->getNumber() << "\n From: " << *I << " To: ";
|
|
|
|
if (RegionEnd != MBB->end()) dbgs() << *RegionEnd;
|
|
|
|
else dbgs() << "End";
|
|
|
|
dbgs() << " Remaining: " << RemainingCount << "\n");
|
|
|
|
|
|
|
|
// Inform ScheduleDAGInstrs of the region being scheduled. It calls back
|
|
|
|
// to our schedule() method.
|
|
|
|
Scheduler->schedule();
|
|
|
|
Scheduler->exitRegion();
|
|
|
|
|
|
|
|
// Scheduling has invalidated the current iterator 'I'. Ask the
|
|
|
|
// scheduler for the top of it's scheduled region.
|
|
|
|
RegionEnd = Scheduler->begin();
|
|
|
|
}
|
|
|
|
assert(RemainingCount == 0 && "Instruction count mismatch!");
|
|
|
|
Scheduler->finishBlock();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MachineScheduler::print(raw_ostream &O, const Module* m) const {
|
|
|
|
// unimplemented
|
|
|
|
}
|
|
|
|
|
2012-01-14 10:17:06 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-03-08 09:41:12 +08:00
|
|
|
// ScheduleTopeDownLive - Base class for basic top-down scheduling with
|
|
|
|
// LiveIntervals preservation.
|
|
|
|
// ===----------------------------------------------------------------------===//
|
2012-01-14 10:17:06 +08:00
|
|
|
|
|
|
|
namespace {
|
2012-02-09 08:40:52 +08:00
|
|
|
/// ScheduleTopDownLive is an implementation of ScheduleDAGInstrs that schedules
|
2012-01-14 10:17:06 +08:00
|
|
|
/// machine instructions while updating LiveIntervals.
|
2012-01-17 14:55:03 +08:00
|
|
|
class ScheduleTopDownLive : public ScheduleDAGInstrs {
|
2012-03-08 09:41:12 +08:00
|
|
|
AliasAnalysis *AA;
|
2012-01-14 10:17:06 +08:00
|
|
|
public:
|
2012-03-08 09:41:12 +08:00
|
|
|
ScheduleTopDownLive(MachineSchedContext *C):
|
|
|
|
ScheduleDAGInstrs(*C->MF, *C->MLI, *C->MDT, /*IsPostRA=*/false, C->LIS),
|
|
|
|
AA(C->AA) {}
|
2012-01-17 14:55:07 +08:00
|
|
|
|
2012-03-08 09:41:12 +08:00
|
|
|
/// ScheduleDAGInstrs interface.
|
2012-03-08 07:00:49 +08:00
|
|
|
void schedule();
|
2012-01-17 14:55:07 +08:00
|
|
|
|
|
|
|
/// Interface implemented by the selected top-down liveinterval scheduler.
|
|
|
|
///
|
|
|
|
/// Pick the next node to schedule, or return NULL.
|
|
|
|
virtual SUnit *pickNode() = 0;
|
|
|
|
|
|
|
|
/// When all preceeding dependencies have been resolved, free this node for
|
|
|
|
/// scheduling.
|
|
|
|
virtual void releaseNode(SUnit *SU) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void releaseSucc(SUnit *SU, SDep *SuccEdge);
|
|
|
|
void releaseSuccessors(SUnit *SU);
|
2012-01-14 10:17:06 +08:00
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
2012-01-17 14:55:07 +08:00
|
|
|
/// ReleaseSucc - Decrement the NumPredsLeft count of a successor. When
|
|
|
|
/// NumPredsLeft reaches zero, release the successor node.
|
|
|
|
void ScheduleTopDownLive::releaseSucc(SUnit *SU, SDep *SuccEdge) {
|
|
|
|
SUnit *SuccSU = SuccEdge->getSUnit();
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
if (SuccSU->NumPredsLeft == 0) {
|
|
|
|
dbgs() << "*** Scheduling failed! ***\n";
|
|
|
|
SuccSU->dump(this);
|
|
|
|
dbgs() << " has been released too many times!\n";
|
|
|
|
llvm_unreachable(0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
--SuccSU->NumPredsLeft;
|
|
|
|
if (SuccSU->NumPredsLeft == 0 && SuccSU != &ExitSU)
|
|
|
|
releaseNode(SuccSU);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// releaseSuccessors - Call releaseSucc on each of SU's successors.
|
|
|
|
void ScheduleTopDownLive::releaseSuccessors(SUnit *SU) {
|
|
|
|
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
|
|
|
|
I != E; ++I) {
|
|
|
|
releaseSucc(SU, &*I);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-08 07:00:49 +08:00
|
|
|
/// schedule - This is called back from ScheduleDAGInstrs::Run() when it's
|
2012-01-17 14:55:07 +08:00
|
|
|
/// time to do some work.
|
2012-03-08 07:00:49 +08:00
|
|
|
void ScheduleTopDownLive::schedule() {
|
2012-03-08 09:41:12 +08:00
|
|
|
buildSchedGraph(AA);
|
2012-01-17 14:55:07 +08:00
|
|
|
|
|
|
|
DEBUG(dbgs() << "********** MI Scheduling **********\n");
|
|
|
|
DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
|
|
|
|
SUnits[su].dumpAll(this));
|
|
|
|
|
2012-03-07 08:18:25 +08:00
|
|
|
if (ViewMISchedDAGs) viewGraph();
|
|
|
|
|
2012-01-17 14:55:07 +08:00
|
|
|
// Release any successors of the special Entry node. It is currently unused,
|
|
|
|
// but we keep up appearances.
|
|
|
|
releaseSuccessors(&EntrySU);
|
|
|
|
|
|
|
|
// Release all DAG roots for scheduling.
|
|
|
|
for (std::vector<SUnit>::iterator I = SUnits.begin(), E = SUnits.end();
|
|
|
|
I != E; ++I) {
|
|
|
|
// A SUnit is ready to schedule if it has no predecessors.
|
|
|
|
if (I->Preds.empty())
|
|
|
|
releaseNode(&(*I));
|
|
|
|
}
|
|
|
|
|
2012-03-08 07:00:52 +08:00
|
|
|
MachineBasicBlock::iterator InsertPos = Begin;
|
2012-01-17 14:55:07 +08:00
|
|
|
while (SUnit *SU = pickNode()) {
|
|
|
|
DEBUG(dbgs() << "*** Scheduling Instruction:\n"; SU->dump(this));
|
|
|
|
|
|
|
|
// Move the instruction to its new location in the instruction stream.
|
|
|
|
MachineInstr *MI = SU->getInstr();
|
|
|
|
if (&*InsertPos == MI)
|
|
|
|
++InsertPos;
|
|
|
|
else {
|
2012-02-15 09:23:52 +08:00
|
|
|
BB->splice(InsertPos, BB, MI);
|
2012-03-08 09:41:12 +08:00
|
|
|
LIS->handleMove(MI);
|
2012-01-17 14:55:07 +08:00
|
|
|
if (Begin == InsertPos)
|
|
|
|
Begin = MI;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Release dependent instructions for scheduling.
|
|
|
|
releaseSuccessors(SU);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-17 14:55:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2012-03-08 09:41:12 +08:00
|
|
|
// Placeholder for the default machine instruction scheduler.
|
2012-01-17 14:55:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace {
|
2012-03-09 08:52:20 +08:00
|
|
|
class CommonMachineScheduler : public ScheduleDAGInstrs {
|
2012-03-08 09:41:12 +08:00
|
|
|
AliasAnalysis *AA;
|
2012-01-17 14:55:03 +08:00
|
|
|
public:
|
2012-03-09 08:52:20 +08:00
|
|
|
CommonMachineScheduler(MachineSchedContext *C):
|
2012-03-08 09:41:12 +08:00
|
|
|
ScheduleDAGInstrs(*C->MF, *C->MLI, *C->MDT, /*IsPostRA=*/false, C->LIS),
|
|
|
|
AA(C->AA) {}
|
2012-01-17 14:55:03 +08:00
|
|
|
|
2012-03-08 07:00:49 +08:00
|
|
|
/// schedule - This is called back from ScheduleDAGInstrs::Run() when it's
|
2012-01-17 14:55:07 +08:00
|
|
|
/// time to do some work.
|
2012-03-08 07:00:49 +08:00
|
|
|
void schedule();
|
2012-01-17 14:55:03 +08:00
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
2012-03-09 08:52:20 +08:00
|
|
|
/// The common machine scheduler will be used as the default scheduler if the
|
|
|
|
/// target does not set a default.
|
|
|
|
static ScheduleDAGInstrs *createCommonMachineSched(MachineSchedContext *C) {
|
|
|
|
return new CommonMachineScheduler(C);
|
2012-01-17 14:55:03 +08:00
|
|
|
}
|
|
|
|
static MachineSchedRegistry
|
2012-03-09 08:52:20 +08:00
|
|
|
SchedCommonRegistry("common", "Use the target's default scheduler choice.",
|
|
|
|
createCommonMachineSched);
|
2012-01-17 14:55:03 +08:00
|
|
|
|
|
|
|
/// Schedule - This is called back from ScheduleDAGInstrs::Run() when it's
|
|
|
|
/// time to do some work.
|
2012-03-09 08:52:20 +08:00
|
|
|
void CommonMachineScheduler::schedule() {
|
2012-03-08 09:41:12 +08:00
|
|
|
buildSchedGraph(AA);
|
2012-01-17 14:55:03 +08:00
|
|
|
|
|
|
|
DEBUG(dbgs() << "********** MI Scheduling **********\n");
|
|
|
|
DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
|
|
|
|
SUnits[su].dumpAll(this));
|
|
|
|
|
|
|
|
// TODO: Put interesting things here.
|
2012-01-17 14:55:07 +08:00
|
|
|
//
|
|
|
|
// When this is fully implemented, it will become a subclass of
|
|
|
|
// ScheduleTopDownLive. So this driver will disappear.
|
2012-01-17 14:55:03 +08:00
|
|
|
}
|
|
|
|
|
2012-01-14 10:17:06 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Machine Instruction Shuffler for Correctness Testing
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-01-13 14:30:30 +08:00
|
|
|
#ifndef NDEBUG
|
|
|
|
namespace {
|
2012-02-22 14:08:11 +08:00
|
|
|
// Nodes with a higher number have higher priority. This way we attempt to
|
2012-01-17 14:55:07 +08:00
|
|
|
// schedule the latest instructions earliest.
|
|
|
|
//
|
|
|
|
// TODO: Relies on the property of the BuildSchedGraph that results in SUnits
|
2012-02-22 14:08:11 +08:00
|
|
|
// being ordered in sequence top-down.
|
2012-01-17 14:55:07 +08:00
|
|
|
struct ShuffleSUnitOrder {
|
|
|
|
bool operator()(SUnit *A, SUnit *B) const {
|
2012-02-22 14:08:11 +08:00
|
|
|
return A->NodeNum < B->NodeNum;
|
2012-01-17 14:55:07 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-01-13 14:30:30 +08:00
|
|
|
/// Reorder instructions as much as possible.
|
2012-01-17 14:55:03 +08:00
|
|
|
class InstructionShuffler : public ScheduleTopDownLive {
|
2012-01-17 14:55:07 +08:00
|
|
|
std::priority_queue<SUnit*, std::vector<SUnit*>, ShuffleSUnitOrder> Queue;
|
2012-01-13 14:30:30 +08:00
|
|
|
public:
|
2012-03-08 09:41:12 +08:00
|
|
|
InstructionShuffler(MachineSchedContext *C):
|
|
|
|
ScheduleTopDownLive(C) {}
|
2012-01-13 14:30:30 +08:00
|
|
|
|
2012-01-17 14:55:07 +08:00
|
|
|
/// ScheduleTopDownLive Interface
|
|
|
|
|
|
|
|
virtual SUnit *pickNode() {
|
|
|
|
if (Queue.empty()) return NULL;
|
|
|
|
SUnit *SU = Queue.top();
|
|
|
|
Queue.pop();
|
|
|
|
return SU;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void releaseNode(SUnit *SU) {
|
|
|
|
Queue.push(SU);
|
2012-01-13 14:30:30 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
2012-03-08 09:41:12 +08:00
|
|
|
static ScheduleDAGInstrs *createInstructionShuffler(MachineSchedContext *C) {
|
|
|
|
return new InstructionShuffler(C);
|
2012-01-13 14:30:30 +08:00
|
|
|
}
|
|
|
|
static MachineSchedRegistry ShufflerRegistry("shuffle",
|
|
|
|
"Shuffle machine instructions",
|
|
|
|
createInstructionShuffler);
|
|
|
|
#endif // !NDEBUG
|