summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit8c0f69315031d89080caf2c487bab08936e50b34 (patch)
tree1e4cee29eecf2639c509a1bb32ab3711bdc5896e /llvm
parenta7aed18624f7783b7c31b06069c43bec89f1813f (diff)
downloadbcm5719-llvm-8c0f69315031d89080caf2c487bab08936e50b34.tar.gz
bcm5719-llvm-8c0f69315031d89080caf2c487bab08936e50b34.zip
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. llvm-svn: 110463
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/CodeGen/LiveInterval.h4
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp15
-rw-r--r--llvm/lib/CodeGen/SplitKit.cpp4
3 files changed, 22 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h
index 2e0651dcc16..0c92b853402 100644
--- a/llvm/include/llvm/CodeGen/LiveInterval.h
+++ b/llvm/include/llvm/CodeGen/LiveInterval.h
@@ -336,6 +336,10 @@ namespace llvm {
return VNI;
}
+ /// RenumberValues - Renumber all values in order of appearance and remove
+ /// unused values.
+ void RenumberValues();
+
/// isOnlyLROfValNo - Return true if the specified live range is the only
/// one defined by the its val#.
bool isOnlyLROfValNo(const LiveRange *LR) {
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 14b10d18256..f4c06b203cb 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/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
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp
index fdc448d1e8b..9b0d73a4f23 100644
--- a/llvm/lib/CodeGen/SplitKit.cpp
+++ b/llvm/lib/CodeGen/SplitKit.cpp
@@ -553,8 +553,10 @@ void SplitEditor::rewrite() {
}
// dupli_ goes in last, after rewriting.
- if (dupli_)
+ if (dupli_) {
+ dupli_->RenumberValues();
intervals_.push_back(dupli_);
+ }
// FIXME: *Calculate spill weights, allocation hints, and register classes for
// firstInterval..
OpenPOWER on IntegriCloud