@@ -135,9 +135,6 @@ class RAGreedy : public MachineFunctionPass,
135
135
std::unique_ptr<Spiller> SpillerInstance;
136
136
PQueue Queue;
137
137
unsigned NextCascade;
138
-
139
- // AVR specific: have we already unallocated REG_Y after a spill was done?
140
- bool IsYReserved;
141
138
142
139
// Live ranges pass through a number of stages as we try to allocate them.
143
140
// Some of the stages may also create new live ranges:
@@ -425,7 +422,6 @@ class RAGreedy : public MachineFunctionPass,
425
422
void collectHintInfo (unsigned , HintsInfo &);
426
423
427
424
bool isUnusedCalleeSavedReg (unsigned PhysReg) const ;
428
- void UndoRegYAllocation ();
429
425
};
430
426
} // end anonymous namespace
431
427
@@ -452,7 +448,7 @@ FunctionPass* llvm::createGreedyRegisterAllocator() {
452
448
return new RAGreedy ();
453
449
}
454
450
455
- RAGreedy::RAGreedy (): MachineFunctionPass(ID), IsYReserved( false ) {
451
+ RAGreedy::RAGreedy (): MachineFunctionPass(ID) {
456
452
initializeLiveDebugVariablesPass (*PassRegistry::getPassRegistry ());
457
453
initializeSlotIndexesPass (*PassRegistry::getPassRegistry ());
458
454
initializeLiveIntervalsPass (*PassRegistry::getPassRegistry ());
@@ -1642,34 +1638,6 @@ RAGreedy::tryInstructionSplit(LiveInterval &VirtReg, AllocationOrder &Order,
1642
1638
return 0 ;
1643
1639
}
1644
1640
1645
- // AVR specific code used to handle the reservation of REG_Y if any other
1646
- // register has been spilled.
1647
- // :NOTE: KEEP THIS CONSTANT UPDATED with the backend!
1648
- // This has to be a define because of linkage problems between libraries.
1649
- #define REG_Y (51U )
1650
- namespace llvm {
1651
- bool RA_ReserveREG_Y = false ;
1652
- bool RA_InSpillerCode = false ;
1653
- } // end of namespace llvm
1654
-
1655
- void RAGreedy::UndoRegYAllocation () {
1656
- // search through all virtual registers where REG_Y has been assigned and
1657
- // send them back to the work list for reallocation
1658
- for (unsigned i = 0 , e = MRI->getNumVirtRegs (); i != e; ++i) {
1659
- unsigned VirtReg = TargetRegisterInfo::index2VirtReg (i);
1660
- if (MRI->reg_nodbg_empty (VirtReg))
1661
- continue ;
1662
-
1663
- for (MCRegAliasIterator AI (REG_Y, TRI, true ); AI.isValid (); ++AI)
1664
- if (VRM->getPhys (VirtReg) == *AI) {
1665
- LiveInterval &LI = LIS->getInterval (VirtReg);
1666
- Matrix->unassign (LI);
1667
- enqueue (&LI);
1668
- }
1669
- }
1670
- }
1671
- #undef REG_Y
1672
-
1673
1641
1674
1642
// ===----------------------------------------------------------------------===//
1675
1643
// Local Splitting
@@ -2610,25 +2578,10 @@ unsigned RAGreedy::selectOrSplitImpl(LiveInterval &VirtReg,
2610
2578
DEBUG (dbgs () << " Do as if this register is in memory\n " );
2611
2579
NewVRegs.push_back (VirtReg.reg );
2612
2580
} else {
2613
- RA_InSpillerCode = true ;
2614
2581
NamedRegionTimer T (" Spiller" , TimerGroupName, TimePassesIsEnabled);
2615
2582
LiveRangeEdit LRE (&VirtReg, NewVRegs, *MF, *LIS, VRM, this , &DeadRemats);
2616
2583
spiller ().spill (LRE);
2617
2584
setStage (NewVRegs.begin (), NewVRegs.end (), RS_Done);
2618
- RA_InSpillerCode = false ;
2619
-
2620
- // AVR specific: If we have reached this point and the backend has notified
2621
- // it has inserted a spill via ReserveREG_Y, then search for any allocations
2622
- // of REG_Y in the live intervals and undo them.
2623
- if (!IsYReserved && RA_ReserveREG_Y) {
2624
- // do all this work only once
2625
- IsYReserved = true ;
2626
- // update the reserved register list
2627
- MRI->freezeReservedRegs (VRM->getMachineFunction ());
2628
- RegClassInfo.runOnMachineFunction (VRM->getMachineFunction ());
2629
- // finally perform the real work
2630
- UndoRegYAllocation ();
2631
- }
2632
2585
2633
2586
if (VerifyEnabled)
2634
2587
MF->verify (this , " After spilling" );
@@ -2688,8 +2641,5 @@ bool RAGreedy::runOnMachineFunction(MachineFunction &mf) {
2688
2641
postOptimization ();
2689
2642
2690
2643
releaseMemory ();
2691
-
2692
- IsYReserved = false ;
2693
- RA_ReserveREG_Y = false ;
2694
2644
return true ;
2695
2645
}
0 commit comments