@@ -107,14 +107,6 @@ static cl::opt<bool> ExhaustiveSearch(
107107 " and interference cutoffs of last chance recoloring" ),
108108 cl::Hidden);
109109
110- static cl::opt<bool > EnableDeferredSpilling (
111- " enable-deferred-spilling" , cl::Hidden,
112- cl::desc (" Instead of spilling a variable right away, defer the actual "
113- " code insertion to the end of the allocation. That way the "
114- " allocator might still find a suitable coloring for this "
115- " variable because of other evicted variables." ),
116- cl::init(false ));
117-
118110// FIXME: Find a good default for this flag and remove the flag.
119111static cl::opt<unsigned >
120112CSRFirstTimeCost (" regalloc-csr-first-time-cost" ,
@@ -328,7 +320,6 @@ const char *const RAGreedy::StageName[] = {
328320 " RS_Split" ,
329321 " RS_Split2" ,
330322 " RS_Spill" ,
331- " RS_Memory" ,
332323 " RS_Done"
333324};
334325#endif
@@ -456,13 +447,6 @@ unsigned DefaultPriorityAdvisor::getPriority(const LiveInterval &LI) const {
456447 // Unsplit ranges that couldn't be allocated immediately are deferred until
457448 // everything else has been allocated.
458449 Prio = Size;
459- } else if (Stage == RS_Memory) {
460- // Memory operand should be considered last.
461- // Change the priority such that Memory operand are assigned in
462- // the reverse order that they came in.
463- // TODO: Make this a member variable and probably do something about hints.
464- static unsigned MemOp = 0 ;
465- Prio = MemOp++;
466450 } else {
467451 // Giant live ranges fall back to the global assignment heuristic, which
468452 // prevents excessive spilling in pathological cases.
@@ -2650,34 +2634,22 @@ MCRegister RAGreedy::selectOrSplitImpl(const LiveInterval &VirtReg,
26502634 }
26512635
26522636 // Finally spill VirtReg itself.
2653- if ((EnableDeferredSpilling ||
2654- TRI->shouldUseDeferredSpillingForVirtReg (*MF, VirtReg)) &&
2655- ExtraInfo->getStage (VirtReg) < RS_Memory) {
2656- // TODO: This is experimental and in particular, we do not model
2657- // the live range splitting done by spilling correctly.
2658- // We would need a deep integration with the spiller to do the
2659- // right thing here. Anyway, that is still good for early testing.
2660- ExtraInfo->setStage (VirtReg, RS_Memory);
2661- LLVM_DEBUG (dbgs () << " Do as if this register is in memory\n " );
2662- NewVRegs.push_back (VirtReg.reg ());
2663- } else {
2664- NamedRegionTimer T (" spill" , " Spiller" , TimerGroupName,
2665- TimerGroupDescription, TimePassesIsEnabled);
2666- LiveRangeEdit LRE (&VirtReg, NewVRegs, *MF, *LIS, VRM, this , &DeadRemats);
2667- spiller ().spill (LRE, &Order);
2668- ExtraInfo->setStage (NewVRegs.begin (), NewVRegs.end (), RS_Done);
2669-
2670- // Tell LiveDebugVariables about the new ranges. Ranges not being covered by
2671- // the new regs are kept in LDV (still mapping to the old register), until
2672- // we rewrite spilled locations in LDV at a later stage.
2673- for (Register r : spiller ().getSpilledRegs ())
2674- DebugVars->splitRegister (r, LRE.regs (), *LIS);
2675- for (Register r : spiller ().getReplacedRegs ())
2676- DebugVars->splitRegister (r, LRE.regs (), *LIS);
2637+ NamedRegionTimer T (" spill" , " Spiller" , TimerGroupName,
2638+ TimerGroupDescription, TimePassesIsEnabled);
2639+ LiveRangeEdit LRE (&VirtReg, NewVRegs, *MF, *LIS, VRM, this , &DeadRemats);
2640+ spiller ().spill (LRE, &Order);
2641+ ExtraInfo->setStage (NewVRegs.begin (), NewVRegs.end (), RS_Done);
2642+
2643+ // Tell LiveDebugVariables about the new ranges. Ranges not being covered by
2644+ // the new regs are kept in LDV (still mapping to the old register), until
2645+ // we rewrite spilled locations in LDV at a later stage.
2646+ for (Register r : spiller ().getSpilledRegs ())
2647+ DebugVars->splitRegister (r, LRE.regs (), *LIS);
2648+ for (Register r : spiller ().getReplacedRegs ())
2649+ DebugVars->splitRegister (r, LRE.regs (), *LIS);
26772650
2678- if (VerifyEnabled)
2679- MF->verify (LIS, Indexes, " After spilling" , &errs ());
2680- }
2651+ if (VerifyEnabled)
2652+ MF->verify (LIS, Indexes, " After spilling" , &errs ());
26812653
26822654 // The live virtual register requesting allocation was spilled, so tell
26832655 // the caller not to allocate anything during this round.
0 commit comments