summaryrefslogtreecommitdiff
path: root/lib/CodeGen/InterferenceCache.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-14 00:17:10 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-14 00:17:10 +0000
commitc66a37df73f70ec3dbed06277763624f33ee3512 (patch)
tree8508c1e84206b414e064c9cc13433c54877daf3c /lib/CodeGen/InterferenceCache.h
parent77f379e2a100e2fe778145cc3f28c6837adee33e (diff)
downloadllvm-c66a37df73f70ec3dbed06277763624f33ee3512.tar.gz
llvm-c66a37df73f70ec3dbed06277763624f33ee3512.tar.bz2
llvm-c66a37df73f70ec3dbed06277763624f33ee3512.tar.xz
Reapply r135074 and r135080 with a fix.
The cache entry referenced by the best split candidate could become clobbered by an unsuccessful candidate. The correct fix here is to use reference counts on the cache entries. Coming up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/InterferenceCache.h')
-rw-r--r--lib/CodeGen/InterferenceCache.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/InterferenceCache.h b/lib/CodeGen/InterferenceCache.h
index 6c36fa4021..6434b3a788 100644
--- a/lib/CodeGen/InterferenceCache.h
+++ b/lib/CodeGen/InterferenceCache.h
@@ -127,10 +127,14 @@ public:
Entry *CacheEntry;
BlockInterference *Current;
public:
- /// Cursor - Create a cursor for the interference allocated to PhysReg and
- /// all its aliases.
- Cursor(InterferenceCache &Cache, unsigned PhysReg)
- : CacheEntry(Cache.get(PhysReg)), Current(0) {}
+ /// Cursor - Create a dangling cursor.
+ Cursor() : CacheEntry(0), Current(0) {}
+
+ /// setPhysReg - Point this cursor to PhysReg's interference.
+ void setPhysReg(InterferenceCache &Cache, unsigned PhysReg) {
+ CacheEntry = Cache.get(PhysReg);
+ Current = 0;
+ }
/// moveTo - Move cursor to basic block MBBNum.
void moveToBlock(unsigned MBBNum) {