Whitespace.

llvm-svn: 119895
This commit is contained in:
Andrew Trick 2010-11-20 02:43:55 +00:00
parent fbfd7ba547
commit 799ec1c4d6
1 changed files with 20 additions and 20 deletions

View File

@ -247,11 +247,11 @@ class LiveVirtRegQueue {
typedef std::priority_queue typedef std::priority_queue
<LiveInterval*, std::vector<LiveInterval*>, LessSpillWeightPriority> PQ; <LiveInterval*, std::vector<LiveInterval*>, LessSpillWeightPriority> PQ;
PQ pq_; PQ pq_;
public: public:
// Is the queue empty? // Is the queue empty?
bool empty() { return pq_.empty(); } bool empty() { return pq_.empty(); }
// Get the highest priority lvr (top + pop) // Get the highest priority lvr (top + pop)
LiveInterval *get() { LiveInterval *get() {
LiveInterval *lvr = pq_.top(); LiveInterval *lvr = pq_.top();
@ -337,20 +337,20 @@ void RegAllocBase::spillReg(LiveInterval& lvr, unsigned reg,
SmallVectorImpl<LiveInterval*> &splitLVRs) { SmallVectorImpl<LiveInterval*> &splitLVRs) {
LiveIntervalUnion::Query &Q = query(lvr, reg); LiveIntervalUnion::Query &Q = query(lvr, reg);
const SmallVectorImpl<LiveInterval*> &pendingSpills = Q.interferingVRegs(); const SmallVectorImpl<LiveInterval*> &pendingSpills = Q.interferingVRegs();
for (SmallVectorImpl<LiveInterval*>::const_iterator I = pendingSpills.begin(), for (SmallVectorImpl<LiveInterval*>::const_iterator I = pendingSpills.begin(),
E = pendingSpills.end(); I != E; ++I) { E = pendingSpills.end(); I != E; ++I) {
LiveInterval &spilledLVR = **I; LiveInterval &spilledLVR = **I;
DEBUG(dbgs() << "extracting from " << DEBUG(dbgs() << "extracting from " <<
tri_->getName(reg) << " " << spilledLVR << '\n'); tri_->getName(reg) << " " << spilledLVR << '\n');
// Deallocate the interfering vreg by removing it from the union. // Deallocate the interfering vreg by removing it from the union.
// A LiveInterval instance may not be in a union during modification! // A LiveInterval instance may not be in a union during modification!
physReg2liu_[reg].extract(spilledLVR); physReg2liu_[reg].extract(spilledLVR);
// Clear the vreg assignment. // Clear the vreg assignment.
vrm_->clearVirt(spilledLVR.reg); vrm_->clearVirt(spilledLVR.reg);
// Spill the extracted interval. // Spill the extracted interval.
spiller().spill(&spilledLVR, splitLVRs, pendingSpills); spiller().spill(&spilledLVR, splitLVRs, pendingSpills);
} }
@ -385,7 +385,7 @@ RegAllocBase::spillInterferences(LiveInterval &lvr, unsigned preg,
DEBUG(dbgs() << "spilling " << tri_->getName(preg) << DEBUG(dbgs() << "spilling " << tri_->getName(preg) <<
" interferences with " << lvr << "\n"); " interferences with " << lvr << "\n");
assert(numInterferences > 0 && "expect interference"); assert(numInterferences > 0 && "expect interference");
// Spill each interfering vreg allocated to preg or an alias. // Spill each interfering vreg allocated to preg or an alias.
spillReg(lvr, preg, splitLVRs); spillReg(lvr, preg, splitLVRs);
for (const unsigned *asI = tri_->getAliasSet(preg); *asI; ++asI) for (const unsigned *asI = tri_->getAliasSet(preg); *asI; ++asI)
@ -399,7 +399,7 @@ RegAllocBase::spillInterferences(LiveInterval &lvr, unsigned preg,
// Driver for the register assignment and splitting heuristics. // Driver for the register assignment and splitting heuristics.
// Manages iteration over the LiveIntervalUnions. // Manages iteration over the LiveIntervalUnions.
// //
// Minimal implementation of register assignment and splitting--spills whenever // Minimal implementation of register assignment and splitting--spills whenever
// we run out of registers. // we run out of registers.
// //
@ -413,14 +413,14 @@ unsigned RABasic::selectOrSplit(LiveInterval &lvr,
// Populate a list of physical register spill candidates. // Populate a list of physical register spill candidates.
SmallVector<unsigned, 8> pregSpillCands; SmallVector<unsigned, 8> pregSpillCands;
// Check for an available register in this class. // Check for an available register in this class.
const TargetRegisterClass *trc = mri_->getRegClass(lvr.reg); const TargetRegisterClass *trc = mri_->getRegClass(lvr.reg);
for (TargetRegisterClass::iterator trcI = trc->allocation_order_begin(*mf_), for (TargetRegisterClass::iterator trcI = trc->allocation_order_begin(*mf_),
trcEnd = trc->allocation_order_end(*mf_); trcEnd = trc->allocation_order_end(*mf_);
trcI != trcEnd; ++trcI) { trcI != trcEnd; ++trcI) {
unsigned preg = *trcI; unsigned preg = *trcI;
if (reservedRegs_.test(preg)) continue; if (reservedRegs_.test(preg)) continue;
// Check interference and intialize queries for this lvr as a side effect. // Check interference and intialize queries for this lvr as a side effect.
unsigned interfReg = checkPhysRegInterference(lvr, preg); unsigned interfReg = checkPhysRegInterference(lvr, preg);
if (interfReg == 0) { if (interfReg == 0) {
@ -437,13 +437,13 @@ unsigned RABasic::selectOrSplit(LiveInterval &lvr,
} }
} }
// Try to spill another interfering reg with less spill weight. // Try to spill another interfering reg with less spill weight.
// //
// FIXME: RAGreedy will sort this list by spill weight. // FIXME: RAGreedy will sort this list by spill weight.
for (SmallVectorImpl<unsigned>::iterator pregI = pregSpillCands.begin(), for (SmallVectorImpl<unsigned>::iterator pregI = pregSpillCands.begin(),
pregE = pregSpillCands.end(); pregI != pregE; ++pregI) { pregE = pregSpillCands.end(); pregI != pregE; ++pregI) {
if (!spillInterferences(lvr, *pregI, splitLVRs)) continue; if (!spillInterferences(lvr, *pregI, splitLVRs)) continue;
unsigned interfReg = checkPhysRegInterference(lvr, *pregI); unsigned interfReg = checkPhysRegInterference(lvr, *pregI);
if (interfReg != 0) { if (interfReg != 0) {
const LiveSegment &seg = const LiveSegment &seg =
@ -459,7 +459,7 @@ unsigned RABasic::selectOrSplit(LiveInterval &lvr,
DEBUG(dbgs() << "spilling: " << lvr << '\n'); DEBUG(dbgs() << "spilling: " << lvr << '\n');
SmallVector<LiveInterval*, 1> pendingSpills; SmallVector<LiveInterval*, 1> pendingSpills;
spiller().spill(&lvr, splitLVRs, pendingSpills); spiller().spill(&lvr, splitLVRs, pendingSpills);
// The live virtual register requesting allocation was spilled, so tell // The live virtual register requesting allocation was spilled, so tell
// the caller not to allocate anything during this round. // the caller not to allocate anything during this round.
return 0; return 0;
@ -478,7 +478,7 @@ bool RABasic::runOnMachineFunction(MachineFunction &mf) {
mf_ = &mf; mf_ = &mf;
tm_ = &mf.getTarget(); tm_ = &mf.getTarget();
mri_ = &mf.getRegInfo(); mri_ = &mf.getRegInfo();
DEBUG(rmf_ = &getAnalysis<RenderMachineFunction>()); DEBUG(rmf_ = &getAnalysis<RenderMachineFunction>());
@ -490,10 +490,10 @@ bool RABasic::runOnMachineFunction(MachineFunction &mf) {
// We may want to force InlineSpiller for this register allocator. For // We may want to force InlineSpiller for this register allocator. For
// now we're also experimenting with the standard spiller. // now we're also experimenting with the standard spiller.
// //
//spiller_.reset(createInlineSpiller(*this, *mf_, *vrm_)); //spiller_.reset(createInlineSpiller(*this, *mf_, *vrm_));
spiller_.reset(createSpiller(*this, *mf_, *vrm_)); spiller_.reset(createSpiller(*this, *mf_, *vrm_));
allocatePhysRegs(); allocatePhysRegs();
// Diagnostic output before rewriting // Diagnostic output before rewriting
@ -513,24 +513,24 @@ bool RABasic::runOnMachineFunction(MachineFunction &mf) {
// FIXME: MachineVerifier is currently broken when using the standard // FIXME: MachineVerifier is currently broken when using the standard
// spiller. Enable it for InlineSpiller only. // spiller. Enable it for InlineSpiller only.
// mf_->verify(this); // mf_->verify(this);
// Verify that LiveIntervals are partitioned into unions and disjoint within // Verify that LiveIntervals are partitioned into unions and disjoint within
// the unions. // the unions.
verify(); verify();
} }
#endif // !NDEBUG #endif // !NDEBUG
// Run rewriter // Run rewriter
std::auto_ptr<VirtRegRewriter> rewriter(createVirtRegRewriter()); std::auto_ptr<VirtRegRewriter> rewriter(createVirtRegRewriter());
rewriter->runOnMachineFunction(*mf_, *vrm_, lis_); rewriter->runOnMachineFunction(*mf_, *vrm_, lis_);
// The pass output is in VirtRegMap. Release all the transient data. // The pass output is in VirtRegMap. Release all the transient data.
releaseMemory(); releaseMemory();
return true; return true;
} }
FunctionPass* llvm::createBasicRegisterAllocator() FunctionPass* llvm::createBasicRegisterAllocator()
{ {
return new RABasic(); return new RABasic();
} }