diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:44:32 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:44:32 +0000 | 
| commit | 5a5ac124e1efaf208671f01c46edb15f29ed2a0b (patch) | |
| tree | a6140557876943cdd800ee997c9317283394b22c /lib/CodeGen/RegAllocGreedy.cpp | |
| parent | f03b5bed27d0d2eafd68562ce14f8b5e3f1f0801 (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/RegAllocGreedy.cpp')
| -rw-r--r-- | lib/CodeGen/RegAllocGreedy.cpp | 12 | 
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp index edc329499c426..26f42c93323ad 100644 --- a/lib/CodeGen/RegAllocGreedy.cpp +++ b/lib/CodeGen/RegAllocGreedy.cpp @@ -538,8 +538,9 @@ void RAGreedy::enqueue(PQueue &CurQueue, LiveInterval *LI) {      // Giant live ranges fall back to the global assignment heuristic, which      // prevents excessive spilling in pathological cases.      bool ReverseLocal = TRI->reverseLocalAssignment(); +    const TargetRegisterClass &RC = *MRI->getRegClass(Reg);      bool ForceGlobal = !ReverseLocal && -      (Size / SlotIndex::InstrDist) > (2 * MRI->getRegClass(Reg)->getNumRegs()); +      (Size / SlotIndex::InstrDist) > (2 * RC.getNumRegs());      if (ExtraRegInfo[Reg].Stage == RS_Assign && !ForceGlobal && !LI->empty() &&          LIS->intervalIsInOneMBB(*LI)) { @@ -552,10 +553,10 @@ void RAGreedy::enqueue(PQueue &CurQueue, LiveInterval *LI) {          // Allocating bottom up may allow many short LRGs to be assigned first          // to one of the cheap registers. This could be much faster for very          // large blocks on targets with many physical registers. -        Prio = Indexes->getZeroIndex().getInstrDistance(LI->beginIndex()); +        Prio = Indexes->getZeroIndex().getInstrDistance(LI->endIndex());        } -    } -    else { +      Prio |= RC.AllocationPriority << 24; +    } else {        // Allocate global and split ranges in long->short order. Long ranges that        // don't fit should be spilled (or split) ASAP so they don't create        // interference.  Mark a bit to prioritize global above local ranges. @@ -1554,7 +1555,8 @@ RAGreedy::tryInstructionSplit(LiveInterval &VirtReg, AllocationOrder &Order,    DEBUG(dbgs() << "Split around " << Uses.size() << " individual instrs.\n"); -  const TargetRegisterClass *SuperRC = TRI->getLargestLegalSuperClass(CurRC); +  const TargetRegisterClass *SuperRC = +      TRI->getLargestLegalSuperClass(CurRC, *MF);    unsigned SuperRCNumAllocatableRegs = RCI.getNumAllocatableRegs(SuperRC);    // Split around every non-copy instruction if this split will relax    // the constraints on the virtual register.  | 
