diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-08-08 03:00:28 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-08-08 03:00:28 +0000 |
commit | 8df786012dc6b875f31ba4152e09c6e0098082ee (patch) | |
tree | 3d88de0b43d1ef6287f9273c4b54c5aeee429d0b /lib | |
parent | 6a2bfdaab62db8737bf54a8429da3cb8fbdfff62 (diff) |
- Each val# can have multiple kills.
- Fix some minor bugs related to special markers on val# def. ~0U means
undefined, ~1U means dead val#.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40916 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/LiveInterval.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/SimpleRegisterCoalescing.cpp | 4 |
3 files changed, 10 insertions, 12 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index a11a8f5e44..580cf44383 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/lib/CodeGen/LiveInterval.cpp @@ -300,7 +300,7 @@ void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments, // we want to avoid the interval scan if not. bool MustMapCurValNos = false; for (unsigned i = 0, e = getNumValNums(); i != e; ++i) { - if (ValueNumberInfo[i].def == ~1U) continue; // tombstone value # + //if (ValueNumberInfo[i].def == ~1U) continue; // tombstone value # if (i != (unsigned)LHSValNoAssignments[i]) { MustMapCurValNos = true; break; @@ -508,14 +508,11 @@ void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const { OS << i << "@"; if (ValueNumberInfo[i].def == ~0U) { OS << "?"; + } else if (ValueNumberInfo[i].def == ~1U) { + OS << "x"; } else { OS << ValueNumberInfo[i].def; } - if (ValueNumberInfo[i].kill == ~0U) { - OS << ",?"; - } else { - OS << "," << ValueNumberInfo[i].kill; - } } } } diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index c17f2ac90b..c286a1a09d 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -347,7 +347,6 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, // Get the Idx of the defining instructions. unsigned defIndex = getDefIndex(MIIdx); - unsigned ValNum; unsigned SrcReg, DstReg; if (!tii_->isMoveInstr(*mi, SrcReg, DstReg)) @@ -378,6 +377,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, LiveRange LR(defIndex, killIdx, ValNum); interval.addRange(LR); DOUT << " +" << LR << "\n"; + interval.addKillForValNum(ValNum, killIdx); return; } } @@ -412,10 +412,11 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, // block to the 'use' slot of the killing instruction. for (unsigned i = 0, e = vi.Kills.size(); i != e; ++i) { MachineInstr *Kill = vi.Kills[i]; + unsigned killIdx = getUseIndex(getInstructionIndex(Kill))+1; LiveRange LR(getMBBStartIdx(Kill->getParent()), - getUseIndex(getInstructionIndex(Kill))+1, - ValNum); + killIdx, ValNum); interval.addRange(LR); + interval.addKillForValNum(ValNum, killIdx); DOUT << " +" << LR; } @@ -450,7 +451,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb, interval.setValueNumberInfo(1, interval.getValNumInfo(0)); // Value#0 is now defined by the 2-addr instruction. - interval.setValueNumberInfo(0, LiveInterval::VNInfo(DefIndex, ~0U, 0U)); + interval.setValueNumberInfo(0, LiveInterval::VNInfo(DefIndex, 0U)); // Add the new live interval which replaces the range for the input copy. LiveRange LR(DefIndex, RedefIndex, ValNo); diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index a37a00545f..cead5e5240 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -132,7 +132,7 @@ bool SimpleRegisterCoalescing::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInte // We are about to delete CopyMI, so need to remove it as the 'instruction // that defines this value #'. Update the the valnum with the new defining // instruction #. - IntB.setValueNumberInfo(BValNo, LiveInterval::VNInfo(FillerStart, ~0U, 0)); + IntB.setValueNumberInfo(BValNo, LiveInterval::VNInfo(FillerStart, 0)); // Okay, we can merge them. We need to insert a new liverange: // [ValLR.end, BLR.begin) of either value number, then we merge the @@ -645,7 +645,7 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RH // Otherwise, use the specified value #. LHSValNoAssignments[VN] = RHSValID; if (VN != (unsigned)RHSValID) - ValueNumberInfo[VN].def = ~1U; + ValueNumberInfo[VN].def = RHSValNoInfo.def; else ValueNumberInfo[VN] = RHSValNoInfo; } |