aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-05-29 18:15:49 +0000
committerOwen Anderson <resistor@mac.com>2008-05-29 18:15:49 +0000
commit5f7420b108f55e89abcfa299c6e65cad18103ef2 (patch)
tree4bd5e38635d067f8e32c0578c9068b44a96a9f96 /lib
parent5124f288d6a462e883a7087c740a69103ae309f4 (diff)
downloadexternal_llvm-5f7420b108f55e89abcfa299c6e65cad18103ef2.zip
external_llvm-5f7420b108f55e89abcfa299c6e65cad18103ef2.tar.gz
external_llvm-5f7420b108f55e89abcfa299c6e65cad18103ef2.tar.bz2
Renumbering needs to account for instruction slot offsets when performing lookups in the index maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 976aa5a..228c0a9 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -58,8 +58,6 @@ void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LiveVariables>();
AU.addPreservedID(MachineLoopInfoID);
AU.addPreservedID(MachineDominatorsID);
- AU.addPreservedID(PHIEliminationID);
- AU.addRequiredID(PHIEliminationID);
AU.addRequiredID(TwoAddressInstructionPassID);
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -75,6 +73,8 @@ void LiveIntervals::releaseMemory() {
delete ClonedMIs[i];
}
+#include <iostream>
+
void LiveIntervals::computeNumbering() {
Index2MiMap OldI2MI = i2miMap_;
@@ -112,14 +112,27 @@ void LiveIntervals::computeNumbering() {
for (iterator I = begin(), E = end(); I != E; ++I)
for (LiveInterval::iterator LI = I->second.begin(), LE = I->second.end();
LI != LE; ++LI) {
- LI->start = mi2iMap_[OldI2MI[LI->start]];
- LI->end = mi2iMap_[OldI2MI[LI->end]];
+ unsigned offset = LI->start % InstrSlots::NUM;
+ LI->start = mi2iMap_[OldI2MI[LI->start / InstrSlots::NUM]] + offset;
+
+ if (LI->end / InstrSlots::NUM < OldI2MI.size()) {
+ // FIXME: Not correct when the instruction at LI->end has
+ // been removed
+ offset = LI->end % InstrSlots::NUM;
+ LI->end = mi2iMap_[OldI2MI[LI->end / InstrSlots::NUM]] + offset;
+ } else {
+ LI->end = i2miMap_.size() * InstrSlots::NUM;
+ }
VNInfo* vni = LI->valno;
- vni->def = mi2iMap_[OldI2MI[vni->def]];
+ offset = vni->def % InstrSlots::NUM;
+ vni->def = mi2iMap_[OldI2MI[vni->def / InstrSlots::NUM]] + offset;
- for (size_t i = 0; i < vni->kills.size(); ++i)
- vni->kills[i] = mi2iMap_[OldI2MI[vni->kills[i]]];
+ for (size_t i = 0; i < vni->kills.size(); ++i) {
+ offset = vni->kills[i] % InstrSlots::NUM;
+ vni->kills[i] = mi2iMap_[OldI2MI[vni->kills[i] / InstrSlots::NUM]] +
+ offset;
+ }
}
}