aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/LiveIntervalUnion.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-09 21:52:03 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-02-09 21:52:03 +0000
commit4f6364fd3f2af74330b1bc4e545173af074707a5 (patch)
treefcf0820ef4d4ba41aa05e00866e32a41cada6b21 /lib/CodeGen/LiveIntervalUnion.h
parent80fd30563c341d6db778f407547707396ff97c75 (diff)
downloadexternal_llvm-4f6364fd3f2af74330b1bc4e545173af074707a5.tar.gz
external_llvm-4f6364fd3f2af74330b1bc4e545173af074707a5.tar.bz2
external_llvm-4f6364fd3f2af74330b1bc4e545173af074707a5.zip
Add tags to live interval unions to avoid using stale queries.
The tag is updated whenever the live interval union is changed, and it is tested before using cached information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125224 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalUnion.h')
-rw-r--r--lib/CodeGen/LiveIntervalUnion.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/CodeGen/LiveIntervalUnion.h b/lib/CodeGen/LiveIntervalUnion.h
index ff23cf61a3..6f9c5f4455 100644
--- a/lib/CodeGen/LiveIntervalUnion.h
+++ b/lib/CodeGen/LiveIntervalUnion.h
@@ -64,10 +64,12 @@ public:
private:
const unsigned RepReg; // representative register number
+ unsigned Tag; // unique tag for current contents.
LiveSegments Segments; // union of virtual reg segments
public:
- LiveIntervalUnion(unsigned r, Allocator &a) : RepReg(r), Segments(a) {}
+ LiveIntervalUnion(unsigned r, Allocator &a) : RepReg(r), Tag(0), Segments(a)
+ {}
// Iterate over all segments in the union of live virtual registers ordered
// by their starting position.
@@ -81,6 +83,12 @@ public:
typedef LiveSegments Map;
const Map &getMap() { return Segments; }
+ /// getTag - Return an opaque tag representing the current state of the union.
+ unsigned getTag() const { return Tag; }
+
+ /// changedSince - Return true if the union change since getTag returned tag.
+ bool changedSince(unsigned tag) const { return tag != Tag; }
+
// Add a live virtual register to this union and merge its segments.
void unify(LiveInterval &VirtReg);
@@ -155,6 +163,7 @@ public:
bool CheckedFirstInterference;
bool SeenAllInterferences;
bool SeenUnspillableVReg;
+ unsigned Tag;
public:
Query(): LiveUnion(), VirtReg() {}
@@ -171,17 +180,19 @@ public:
CheckedFirstInterference = false;
SeenAllInterferences = false;
SeenUnspillableVReg = false;
+ Tag = 0;
}
void init(LiveInterval *VReg, LiveIntervalUnion *LIU) {
assert(VReg && LIU && "Invalid arguments");
- if (VirtReg == VReg && LiveUnion == LIU) {
+ if (VirtReg == VReg && LiveUnion == LIU && !LIU->changedSince(Tag)) {
// Retain cached results, e.g. firstInterference.
return;
}
clear();
LiveUnion = LIU;
VirtReg = VReg;
+ Tag = LIU->getTag();
}
LiveInterval &virtReg() const {