2012-01-11 22:28:30 +00:00
|
|
|
//===-- RegAllocBasic.cpp - Basic Register Allocator ----------------------===//
|
2010-10-22 23:09:15 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the RABasic function pass, which provides a minimal
|
|
|
|
// implementation of the basic register allocator.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "regalloc"
|
2011-06-03 20:34:53 +00:00
|
|
|
#include "RegAllocBase.h"
|
2011-04-05 21:40:37 +00:00
|
|
|
#include "LiveDebugVariables.h"
|
2011-03-10 01:51:42 +00:00
|
|
|
#include "LiveRangeEdit.h"
|
2010-10-22 23:09:15 +00:00
|
|
|
#include "RenderMachineFunction.h"
|
|
|
|
#include "Spiller.h"
|
2010-11-08 18:02:08 +00:00
|
|
|
#include "VirtRegMap.h"
|
2010-11-11 17:46:29 +00:00
|
|
|
#include "llvm/Analysis/AliasAnalysis.h"
|
2010-10-22 23:09:15 +00:00
|
|
|
#include "llvm/Function.h"
|
|
|
|
#include "llvm/PassAnalysisSupport.h"
|
|
|
|
#include "llvm/CodeGen/CalcSpillWeights.h"
|
2010-11-08 18:02:08 +00:00
|
|
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
2010-10-22 23:09:15 +00:00
|
|
|
#include "llvm/CodeGen/LiveStackAnalysis.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
|
|
|
#include "llvm/CodeGen/MachineInstr.h"
|
|
|
|
#include "llvm/CodeGen/MachineLoopInfo.h"
|
|
|
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
|
|
|
#include "llvm/CodeGen/Passes.h"
|
|
|
|
#include "llvm/CodeGen/RegAllocRegistry.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
#include "llvm/Target/TargetOptions.h"
|
2010-11-08 18:02:08 +00:00
|
|
|
#include "llvm/Target/TargetRegisterInfo.h"
|
2010-10-22 23:09:15 +00:00
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
2010-12-07 23:18:47 +00:00
|
|
|
#include <cstdlib>
|
2011-02-22 23:01:52 +00:00
|
|
|
#include <queue>
|
2010-10-26 18:34:01 +00:00
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
static RegisterRegAlloc basicRegAlloc("basic", "basic register allocator",
|
|
|
|
createBasicRegisterAllocator);
|
|
|
|
|
2011-02-22 23:01:52 +00:00
|
|
|
namespace {
|
|
|
|
struct CompSpillWeight {
|
|
|
|
bool operator()(LiveInterval *A, LiveInterval *B) const {
|
|
|
|
return A->weight < B->weight;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2010-11-25 16:42:51 +00:00
|
|
|
namespace {
|
2010-10-22 23:09:15 +00:00
|
|
|
/// RABasic provides a minimal implementation of the basic register allocation
|
|
|
|
/// algorithm. It prioritizes live virtual registers by spill weight and spills
|
|
|
|
/// whenever a register is unavailable. This is not practical in production but
|
|
|
|
/// provides a useful baseline both for measuring other allocators and comparing
|
|
|
|
/// the speed of the basic algorithm against other styles of allocators.
|
|
|
|
class RABasic : public MachineFunctionPass, public RegAllocBase
|
|
|
|
{
|
|
|
|
// context
|
2010-11-30 23:18:47 +00:00
|
|
|
MachineFunction *MF;
|
2010-10-22 23:09:15 +00:00
|
|
|
|
|
|
|
// analyses
|
2010-11-30 23:18:47 +00:00
|
|
|
LiveStacks *LS;
|
|
|
|
RenderMachineFunction *RMF;
|
2010-10-22 23:09:15 +00:00
|
|
|
|
|
|
|
// state
|
2010-11-30 23:18:47 +00:00
|
|
|
std::auto_ptr<Spiller> SpillerInstance;
|
2011-02-22 23:01:52 +00:00
|
|
|
std::priority_queue<LiveInterval*, std::vector<LiveInterval*>,
|
|
|
|
CompSpillWeight> Queue;
|
2012-02-08 18:54:35 +00:00
|
|
|
|
|
|
|
// Scratch space. Allocated here to avoid repeated malloc calls in
|
|
|
|
// selectOrSplit().
|
|
|
|
BitVector UsableRegs;
|
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
public:
|
|
|
|
RABasic();
|
|
|
|
|
|
|
|
/// Return the pass name.
|
|
|
|
virtual const char* getPassName() const {
|
|
|
|
return "Basic Register Allocator";
|
|
|
|
}
|
|
|
|
|
|
|
|
/// RABasic analysis usage.
|
2010-11-30 23:18:47 +00:00
|
|
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
2010-10-22 23:09:15 +00:00
|
|
|
|
|
|
|
virtual void releaseMemory();
|
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
virtual Spiller &spiller() { return *SpillerInstance; }
|
2010-11-10 19:18:47 +00:00
|
|
|
|
2010-12-08 22:22:41 +00:00
|
|
|
virtual float getPriority(LiveInterval *LI) { return LI->weight; }
|
|
|
|
|
2011-02-22 23:01:52 +00:00
|
|
|
virtual void enqueue(LiveInterval *LI) {
|
|
|
|
Queue.push(LI);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual LiveInterval *dequeue() {
|
|
|
|
if (Queue.empty())
|
|
|
|
return 0;
|
|
|
|
LiveInterval *LI = Queue.top();
|
|
|
|
Queue.pop();
|
|
|
|
return LI;
|
|
|
|
}
|
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
virtual unsigned selectOrSplit(LiveInterval &VirtReg,
|
|
|
|
SmallVectorImpl<LiveInterval*> &SplitVRegs);
|
2010-10-22 23:09:15 +00:00
|
|
|
|
|
|
|
/// Perform register allocation.
|
|
|
|
virtual bool runOnMachineFunction(MachineFunction &mf);
|
|
|
|
|
2012-01-11 22:52:14 +00:00
|
|
|
// Helper for spilling all live virtual registers currently unified under preg
|
|
|
|
// that interfere with the most recently queried lvr. Return true if spilling
|
|
|
|
// was successful, and append any new spilled/split intervals to splitLVRs.
|
|
|
|
bool spillInterferences(LiveInterval &VirtReg, unsigned PhysReg,
|
|
|
|
SmallVectorImpl<LiveInterval*> &SplitVRegs);
|
|
|
|
|
|
|
|
void spillReg(LiveInterval &VirtReg, unsigned PhysReg,
|
|
|
|
SmallVectorImpl<LiveInterval*> &SplitVRegs);
|
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
static char ID;
|
|
|
|
};
|
|
|
|
|
|
|
|
char RABasic::ID = 0;
|
|
|
|
|
|
|
|
} // end anonymous namespace
|
|
|
|
|
|
|
|
RABasic::RABasic(): MachineFunctionPass(ID) {
|
2011-04-05 21:40:37 +00:00
|
|
|
initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry());
|
2010-10-22 23:09:15 +00:00
|
|
|
initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());
|
|
|
|
initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
|
2011-06-26 22:34:10 +00:00
|
|
|
initializeRegisterCoalescerPass(*PassRegistry::getPassRegistry());
|
2012-01-17 06:55:03 +00:00
|
|
|
initializeMachineSchedulerPass(*PassRegistry::getPassRegistry());
|
2010-10-22 23:09:15 +00:00
|
|
|
initializeCalculateSpillWeightsPass(*PassRegistry::getPassRegistry());
|
|
|
|
initializeLiveStacksPass(*PassRegistry::getPassRegistry());
|
2010-11-03 20:39:26 +00:00
|
|
|
initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
|
2010-10-22 23:09:15 +00:00
|
|
|
initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry());
|
|
|
|
initializeVirtRegMapPass(*PassRegistry::getPassRegistry());
|
|
|
|
initializeRenderMachineFunctionPass(*PassRegistry::getPassRegistry());
|
|
|
|
}
|
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
void RABasic::getAnalysisUsage(AnalysisUsage &AU) const {
|
|
|
|
AU.setPreservesCFG();
|
|
|
|
AU.addRequired<AliasAnalysis>();
|
|
|
|
AU.addPreserved<AliasAnalysis>();
|
|
|
|
AU.addRequired<LiveIntervals>();
|
|
|
|
AU.addPreserved<SlotIndexes>();
|
2011-04-05 21:40:37 +00:00
|
|
|
AU.addRequired<LiveDebugVariables>();
|
|
|
|
AU.addPreserved<LiveDebugVariables>();
|
2010-11-30 23:18:47 +00:00
|
|
|
AU.addRequired<CalculateSpillWeights>();
|
|
|
|
AU.addRequired<LiveStacks>();
|
|
|
|
AU.addPreserved<LiveStacks>();
|
|
|
|
AU.addRequiredID(MachineDominatorsID);
|
|
|
|
AU.addPreservedID(MachineDominatorsID);
|
|
|
|
AU.addRequired<MachineLoopInfo>();
|
|
|
|
AU.addPreserved<MachineLoopInfo>();
|
|
|
|
AU.addRequired<VirtRegMap>();
|
|
|
|
AU.addPreserved<VirtRegMap>();
|
|
|
|
DEBUG(AU.addRequired<RenderMachineFunction>());
|
|
|
|
MachineFunctionPass::getAnalysisUsage(AU);
|
2010-10-22 23:09:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RABasic::releaseMemory() {
|
2010-11-30 23:18:47 +00:00
|
|
|
SpillerInstance.reset(0);
|
2010-10-22 23:09:15 +00:00
|
|
|
RegAllocBase::releaseMemory();
|
|
|
|
}
|
|
|
|
|
2012-01-11 22:52:14 +00:00
|
|
|
// Helper for spillInterferences() that spills all interfering vregs currently
|
|
|
|
// assigned to this physical register.
|
|
|
|
void RABasic::spillReg(LiveInterval& VirtReg, unsigned PhysReg,
|
|
|
|
SmallVectorImpl<LiveInterval*> &SplitVRegs) {
|
|
|
|
LiveIntervalUnion::Query &Q = query(VirtReg, PhysReg);
|
|
|
|
assert(Q.seenAllInterferences() && "need collectInterferences()");
|
|
|
|
const SmallVectorImpl<LiveInterval*> &PendingSpills = Q.interferingVRegs();
|
|
|
|
|
|
|
|
for (SmallVectorImpl<LiveInterval*>::const_iterator I = PendingSpills.begin(),
|
|
|
|
E = PendingSpills.end(); I != E; ++I) {
|
|
|
|
LiveInterval &SpilledVReg = **I;
|
|
|
|
DEBUG(dbgs() << "extracting from " <<
|
|
|
|
TRI->getName(PhysReg) << " " << SpilledVReg << '\n');
|
|
|
|
|
|
|
|
// Deallocate the interfering vreg by removing it from the union.
|
|
|
|
// A LiveInterval instance may not be in a union during modification!
|
|
|
|
unassign(SpilledVReg, PhysReg);
|
|
|
|
|
|
|
|
// Spill the extracted interval.
|
2012-02-28 22:07:24 +00:00
|
|
|
LiveRangeEdit LRE(SpilledVReg, SplitVRegs);
|
2012-01-11 22:52:14 +00:00
|
|
|
spiller().spill(LRE);
|
|
|
|
}
|
|
|
|
// After extracting segments, the query's results are invalid. But keep the
|
|
|
|
// contents valid until we're done accessing pendingSpills.
|
|
|
|
Q.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Spill or split all live virtual registers currently unified under PhysReg
|
|
|
|
// that interfere with VirtReg. The newly spilled or split live intervals are
|
|
|
|
// returned by appending them to SplitVRegs.
|
|
|
|
bool RABasic::spillInterferences(LiveInterval &VirtReg, unsigned PhysReg,
|
|
|
|
SmallVectorImpl<LiveInterval*> &SplitVRegs) {
|
|
|
|
// Record each interference and determine if all are spillable before mutating
|
|
|
|
// either the union or live intervals.
|
|
|
|
unsigned NumInterferences = 0;
|
|
|
|
// Collect interferences assigned to any alias of the physical register.
|
2012-03-04 10:43:23 +00:00
|
|
|
for (const uint16_t *asI = TRI->getOverlaps(PhysReg); *asI; ++asI) {
|
2012-01-11 22:52:14 +00:00
|
|
|
LiveIntervalUnion::Query &QAlias = query(VirtReg, *asI);
|
|
|
|
NumInterferences += QAlias.collectInterferingVRegs();
|
|
|
|
if (QAlias.seenUnspillableVReg()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DEBUG(dbgs() << "spilling " << TRI->getName(PhysReg) <<
|
|
|
|
" interferences with " << VirtReg << "\n");
|
|
|
|
assert(NumInterferences > 0 && "expect interference");
|
|
|
|
|
|
|
|
// Spill each interfering vreg allocated to PhysReg or an alias.
|
2012-03-04 10:43:23 +00:00
|
|
|
for (const uint16_t *AliasI = TRI->getOverlaps(PhysReg); *AliasI; ++AliasI)
|
2012-01-11 22:52:14 +00:00
|
|
|
spillReg(VirtReg, *AliasI, SplitVRegs);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
// Driver for the register assignment and splitting heuristics.
|
|
|
|
// Manages iteration over the LiveIntervalUnions.
|
2010-11-20 02:43:55 +00:00
|
|
|
//
|
2010-11-30 23:18:47 +00:00
|
|
|
// This is a minimal implementation of register assignment and splitting that
|
|
|
|
// spills whenever we run out of registers.
|
2010-10-22 23:09:15 +00:00
|
|
|
//
|
|
|
|
// selectOrSplit can only be called once per live virtual register. We then do a
|
|
|
|
// single interference test for each register the correct class until we find an
|
|
|
|
// available register. So, the number of interference tests in the worst case is
|
|
|
|
// |vregs| * |machineregs|. And since the number of interference tests is
|
2010-11-30 23:18:47 +00:00
|
|
|
// minimal, there is no value in caching them outside the scope of
|
|
|
|
// selectOrSplit().
|
|
|
|
unsigned RABasic::selectOrSplit(LiveInterval &VirtReg,
|
|
|
|
SmallVectorImpl<LiveInterval*> &SplitVRegs) {
|
2012-02-08 18:54:35 +00:00
|
|
|
// Check for register mask interference. When live ranges cross calls, the
|
|
|
|
// set of usable registers is reduced to the callee-saved ones.
|
|
|
|
bool CrossRegMasks = LIS->checkRegMaskInterference(VirtReg, UsableRegs);
|
|
|
|
|
2010-11-10 19:18:47 +00:00
|
|
|
// Populate a list of physical register spill candidates.
|
2010-11-30 23:18:47 +00:00
|
|
|
SmallVector<unsigned, 8> PhysRegSpillCands;
|
2010-11-08 18:02:08 +00:00
|
|
|
|
2010-11-20 02:43:55 +00:00
|
|
|
// Check for an available register in this class.
|
2011-06-03 20:34:53 +00:00
|
|
|
ArrayRef<unsigned> Order =
|
|
|
|
RegClassInfo.getOrder(MRI->getRegClass(VirtReg.reg));
|
|
|
|
for (ArrayRef<unsigned>::iterator I = Order.begin(), E = Order.end(); I != E;
|
|
|
|
++I) {
|
2010-11-30 23:18:47 +00:00
|
|
|
unsigned PhysReg = *I;
|
|
|
|
|
2012-02-08 18:54:35 +00:00
|
|
|
// If PhysReg is clobbered by a register mask, it isn't useful for
|
|
|
|
// allocation or spilling.
|
|
|
|
if (CrossRegMasks && !UsableRegs.test(PhysReg))
|
|
|
|
continue;
|
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
// Check interference and as a side effect, intialize queries for this
|
|
|
|
// VirtReg and its aliases.
|
|
|
|
unsigned interfReg = checkPhysRegInterference(VirtReg, PhysReg);
|
2010-11-08 18:02:08 +00:00
|
|
|
if (interfReg == 0) {
|
2010-11-10 19:18:47 +00:00
|
|
|
// Found an available register.
|
2010-11-30 23:18:47 +00:00
|
|
|
return PhysReg;
|
2010-10-22 23:09:15 +00:00
|
|
|
}
|
2012-01-11 23:19:08 +00:00
|
|
|
LiveIntervalUnion::Query &IntfQ = query(VirtReg, interfReg);
|
|
|
|
IntfQ.collectInterferingVRegs(1);
|
|
|
|
LiveInterval *interferingVirtReg = IntfQ.interferingVRegs().front();
|
2010-11-10 19:18:47 +00:00
|
|
|
|
2010-12-09 18:15:21 +00:00
|
|
|
// The current VirtReg must either be spillable, or one of its interferences
|
2010-11-30 23:18:47 +00:00
|
|
|
// must have less spill weight.
|
|
|
|
if (interferingVirtReg->weight < VirtReg.weight ) {
|
|
|
|
PhysRegSpillCands.push_back(PhysReg);
|
2010-11-08 18:02:08 +00:00
|
|
|
}
|
2010-10-22 23:09:15 +00:00
|
|
|
}
|
2010-11-10 19:18:47 +00:00
|
|
|
// Try to spill another interfering reg with less spill weight.
|
2010-11-30 23:18:47 +00:00
|
|
|
for (SmallVectorImpl<unsigned>::iterator PhysRegI = PhysRegSpillCands.begin(),
|
|
|
|
PhysRegE = PhysRegSpillCands.end(); PhysRegI != PhysRegE; ++PhysRegI) {
|
2010-11-10 19:18:47 +00:00
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
if (!spillInterferences(VirtReg, *PhysRegI, SplitVRegs)) continue;
|
2010-11-20 02:43:55 +00:00
|
|
|
|
2010-12-07 18:51:27 +00:00
|
|
|
assert(checkPhysRegInterference(VirtReg, *PhysRegI) == 0 &&
|
|
|
|
"Interference after spill.");
|
2010-11-10 19:18:47 +00:00
|
|
|
// Tell the caller to allocate to this newly freed physical register.
|
2010-11-30 23:18:47 +00:00
|
|
|
return *PhysRegI;
|
2010-11-08 18:02:08 +00:00
|
|
|
}
|
2011-05-06 21:58:30 +00:00
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
// No other spill candidates were found, so spill the current VirtReg.
|
|
|
|
DEBUG(dbgs() << "spilling: " << VirtReg << '\n');
|
2011-05-06 21:58:30 +00:00
|
|
|
if (!VirtReg.isSpillable())
|
|
|
|
return ~0u;
|
2011-03-10 01:51:42 +00:00
|
|
|
LiveRangeEdit LRE(VirtReg, SplitVRegs);
|
|
|
|
spiller().spill(LRE);
|
2010-11-20 02:43:55 +00:00
|
|
|
|
2010-11-10 19:18:47 +00:00
|
|
|
// The live virtual register requesting allocation was spilled, so tell
|
|
|
|
// the caller not to allocate anything during this round.
|
|
|
|
return 0;
|
2010-11-08 18:02:08 +00:00
|
|
|
}
|
2010-10-22 23:09:15 +00:00
|
|
|
|
|
|
|
bool RABasic::runOnMachineFunction(MachineFunction &mf) {
|
|
|
|
DEBUG(dbgs() << "********** BASIC REGISTER ALLOCATION **********\n"
|
|
|
|
<< "********** Function: "
|
|
|
|
<< ((Value*)mf.getFunction())->getName() << '\n');
|
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
MF = &mf;
|
|
|
|
DEBUG(RMF = &getAnalysis<RenderMachineFunction>());
|
2010-11-11 17:46:29 +00:00
|
|
|
|
2010-12-10 23:49:00 +00:00
|
|
|
RegAllocBase::init(getAnalysis<VirtRegMap>(), getAnalysis<LiveIntervals>());
|
2011-03-31 23:02:17 +00:00
|
|
|
SpillerInstance.reset(createInlineSpiller(*this, *MF, *VRM));
|
2010-11-20 02:43:55 +00:00
|
|
|
|
2010-10-26 18:34:01 +00:00
|
|
|
allocatePhysRegs();
|
2010-10-22 23:09:15 +00:00
|
|
|
|
2010-12-08 01:06:06 +00:00
|
|
|
addMBBLiveIns(MF);
|
2010-11-20 02:57:05 +00:00
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
// Diagnostic output before rewriting
|
2010-11-30 23:18:47 +00:00
|
|
|
DEBUG(dbgs() << "Post alloc VirtRegMap:\n" << *VRM << "\n");
|
2010-10-22 23:09:15 +00:00
|
|
|
|
|
|
|
// optional HTML output
|
2010-11-30 23:18:47 +00:00
|
|
|
DEBUG(RMF->renderMachineFunction("After basic register allocation.", VRM));
|
2010-10-22 23:09:15 +00:00
|
|
|
|
2010-11-09 21:04:34 +00:00
|
|
|
// FIXME: Verification currently must run before VirtRegRewriter. We should
|
|
|
|
// make the rewriter a separate pass and override verifyAnalysis instead. When
|
|
|
|
// that happens, verification naturally falls under VerifyMachineCode.
|
|
|
|
#ifndef NDEBUG
|
2010-12-17 23:16:35 +00:00
|
|
|
if (VerifyEnabled) {
|
2010-11-09 21:04:34 +00:00
|
|
|
// Verify accuracy of LiveIntervals. The standard machine code verifier
|
|
|
|
// ensures that each LiveIntervals covers all uses of the virtual reg.
|
|
|
|
|
2010-11-30 23:18:47 +00:00
|
|
|
// FIXME: MachineVerifier is badly broken when using the standard
|
|
|
|
// spiller. Always use -spiller=inline with -verify-regalloc. Even with the
|
|
|
|
// inline spiller, some tests fail to verify because the coalescer does not
|
|
|
|
// always generate verifiable code.
|
2010-12-18 00:06:56 +00:00
|
|
|
MF->verify(this, "In RABasic::verify");
|
2010-11-20 02:43:55 +00:00
|
|
|
|
2010-11-09 21:04:34 +00:00
|
|
|
// Verify that LiveIntervals are partitioned into unions and disjoint within
|
|
|
|
// the unions.
|
|
|
|
verify();
|
|
|
|
}
|
|
|
|
#endif // !NDEBUG
|
2010-11-20 02:43:55 +00:00
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
// Run rewriter
|
2011-02-18 22:03:18 +00:00
|
|
|
VRM->rewrite(LIS->getSlotIndexes());
|
2010-10-26 18:34:01 +00:00
|
|
|
|
2011-04-05 21:40:37 +00:00
|
|
|
// Write out new DBG_VALUE instructions.
|
|
|
|
getAnalysis<LiveDebugVariables>().emitDebugValues(VRM);
|
|
|
|
|
2012-02-21 04:51:23 +00:00
|
|
|
// All machine operands and other references to virtual registers have been
|
|
|
|
// replaced. Remove the virtual registers and release all the transient data.
|
|
|
|
VRM->clearAllVirt();
|
|
|
|
MRI->clearVirtRegs();
|
2010-10-26 18:34:01 +00:00
|
|
|
releaseMemory();
|
2010-11-20 02:43:55 +00:00
|
|
|
|
2010-10-22 23:09:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-11-20 02:43:55 +00:00
|
|
|
FunctionPass* llvm::createBasicRegisterAllocator()
|
2010-10-22 23:09:15 +00:00
|
|
|
{
|
|
|
|
return new RABasic();
|
|
|
|
}
|