summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-06 18:46:59 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-08-06 18:46:59 +0000
commit23436597a8efad427059f2a6db5264e6a40d2dc7 (patch)
tree6e70a3198a2ed4dc8d0eaf20e01bf511f9d523d9 /lib/CodeGen/LiveInterval.cpp
parent90c579de5a383cee278acc3f7e7b9d0a656e6a35 (diff)
downloadllvm-23436597a8efad427059f2a6db5264e6a40d2dc7.tar.gz
llvm-23436597a8efad427059f2a6db5264e6a40d2dc7.tar.bz2
llvm-23436597a8efad427059f2a6db5264e6a40d2dc7.tar.xz
Add LiveInterval::RenumberValues - Garbage collection for VNInfos.
After heavy editing of a live interval, it is much easier to simply renumber the live values instead of trying to keep track of the unused ones. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 14b10d1825..f4c06b203c 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -180,6 +180,21 @@ void LiveInterval::markValNoForDeletion(VNInfo *ValNo) {
}
}
+/// RenumberValues - Renumber all values in order of appearance and delete the
+/// remaining unused values.
+void LiveInterval::RenumberValues() {
+ SmallPtrSet<VNInfo*, 8> Seen;
+ valnos.clear();
+ for (const_iterator I = begin(), E = end(); I != E; ++I) {
+ VNInfo *VNI = I->valno;
+ if (!Seen.insert(VNI))
+ continue;
+ assert(!VNI->isUnused() && "Unused valno used by live range");
+ VNI->id = (unsigned)valnos.size();
+ valnos.push_back(VNI);
+ }
+}
+
/// extendIntervalEndTo - This method is used when we want to extend the range
/// specified by I to end at the specified endpoint. To do this, we should
/// merge and eliminate all ranges that this will overlap with. The iterator is