diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-02 23:05:16 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-02 23:05:16 +0000 |
commit | e2dc0c978e2435dbbb55cb7fca7750034c3e292a (patch) | |
tree | f227598acf41489f334d644536356ce578b4bcba /lib/CodeGen/SplitKit.cpp | |
parent | e89a05337a9946040251a5f19165c41b9a1a7b27 (diff) |
Extract a method. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126893 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SplitKit.cpp')
-rw-r--r-- | lib/CodeGen/SplitKit.cpp | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp index 4c2a7bda0f..c0612026d2 100644 --- a/lib/CodeGen/SplitKit.cpp +++ b/lib/CodeGen/SplitKit.cpp @@ -646,6 +646,29 @@ void SplitEditor::closeIntv() { OpenIdx = 0; } +void SplitEditor::extendPHIKillRanges() { + // Extend live ranges to be live-out for successor PHI values. + for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), + E = Edit.getParent().vni_end(); I != E; ++I) { + const VNInfo *PHIVNI = *I; + if (PHIVNI->isUnused() || !PHIVNI->isPHIDef()) + continue; + unsigned RegIdx = RegAssign.lookup(PHIVNI->def); + MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); + for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), + PE = MBB->pred_end(); PI != PE; ++PI) { + SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); + // The predecessor may not have a live-out value. That is OK, like an + // undef PHI operand. + if (Edit.getParent().liveAt(End)) { + assert(RegAssign.lookup(End) == RegIdx && + "Different register assignment in phi predecessor"); + extendRange(RegIdx, End); + } + } + } +} + /// rewriteAssigned - Rewrite all uses of Edit.getReg(). void SplitEditor::rewriteAssigned() { for (MachineRegisterInfo::reg_iterator RI = MRI.reg_begin(Edit.getReg()), @@ -737,34 +760,8 @@ void SplitEditor::finish() { // All other values have simple liveness that can be computed from RegAssign // and the parent live interval. - // Extend live ranges to be live-out for successor PHI values. - for (LiveInterval::const_vni_iterator I = Edit.getParent().vni_begin(), - E = Edit.getParent().vni_end(); I != E; ++I) { - const VNInfo *PHIVNI = *I; - if (PHIVNI->isUnused() || !PHIVNI->isPHIDef()) - continue; - unsigned RegIdx = RegAssign.lookup(PHIVNI->def); - MachineBasicBlock *MBB = LIS.getMBBFromIndex(PHIVNI->def); - DEBUG(dbgs() << " map phi in BB#" << MBB->getNumber() << '@' << PHIVNI->def - << " -> " << RegIdx << '\n'); - for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), - PE = MBB->pred_end(); PI != PE; ++PI) { - SlotIndex End = LIS.getMBBEndIdx(*PI).getPrevSlot(); - DEBUG(dbgs() << " pred BB#" << (*PI)->getNumber() << '@' << End); - // The predecessor may not have a live-out value. That is OK, like an - // undef PHI operand. - if (Edit.getParent().liveAt(End)) { - DEBUG(dbgs() << " has parent live out\n"); - assert(RegAssign.lookup(End) == RegIdx && - "Different register assignment in phi predecessor"); - extendRange(RegIdx, End); - } else - DEBUG(dbgs() << " is not live-out\n"); - } - DEBUG(dbgs() << " " << *Edit.get(RegIdx) << '\n'); - } - // Rewrite instructions. + extendPHIKillRanges(); rewriteAssigned(); // FIXME: Delete defs that were rematted everywhere. |