summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-02 23:49:30 +0000
committerDan Gohman <gohman@apple.com>2010-08-02 23:49:30 +0000
commit7cac95778f234953b5c7a1a41b1a2bcd4fe0e7e1 (patch)
treec47f05f9673a159136717e515480675a4b9aa72f /llvm/include
parentdc03bd0894c532a91905da3536b0e1b0d2f13339 (diff)
downloadbcm5719-llvm-7cac95778f234953b5c7a1a41b1a2bcd4fe0e7e1.tar.gz
bcm5719-llvm-7cac95778f234953b5c7a1a41b1a2bcd4fe0e7e1.zip
Make SCEVUnknown a CallbackVH, so that it can be notified directly
of Value deletions and RAUWs, instead of relying on ScalarEvolution's Scalars map being notified, as that's complicated at best, and insufficient in general. This means SCEVUnknown needs a non-trivial destructor, so introduce a mechanism to allow ScalarEvolution to locate all the SCEVUnknowns. llvm-svn: 110086
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Analysis/ScalarEvolution.h5
-rw-r--r--llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h26
2 files changed, 23 insertions, 8 deletions
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 1b27efb9955..7f224203ab3 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -661,6 +661,11 @@ namespace llvm {
private:
FoldingSet<SCEV> UniqueSCEVs;
BumpPtrAllocator SCEVAllocator;
+
+ /// FirstUnknown - The head of a linked list of all SCEVUnknown
+ /// values that have been allocated. This is used by releaseMemory
+ /// to locate them all and call their destructors.
+ SCEVUnknown *FirstUnknown;
};
}
diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
index ec4ac071da7..3e846e1be83 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -520,18 +520,28 @@ namespace llvm {
/// value, and only represent it as its LLVM Value. This is the "bottom"
/// value for the analysis.
///
- class SCEVUnknown : public SCEV {
+ class SCEVUnknown : public SCEV, private CallbackVH {
friend class ScalarEvolution;
- friend class ScalarEvolution::SCEVCallbackVH;
- // This should be an AssertingVH, however SCEVUnknowns are allocated in a
- // BumpPtrAllocator so their destructors are never called.
- Value *V;
- SCEVUnknown(const FoldingSetNodeIDRef ID, Value *v) :
- SCEV(ID, scUnknown), V(v) {}
+ // Implement CallbackVH.
+ virtual void deleted();
+ virtual void allUsesReplacedWith(Value *New);
+
+ /// SE - The parent ScalarEvolution value. This is used to update
+ /// the parent's maps when the value associated with a SCEVUnknown
+ /// is deleted or RAUW'd.
+ ScalarEvolution *SE;
+
+ /// Next - The next pointer in the linked list of all
+ /// SCEVUnknown instances owned by a ScalarEvolution.
+ SCEVUnknown *Next;
+
+ SCEVUnknown(const FoldingSetNodeIDRef ID, Value *V,
+ ScalarEvolution *se, SCEVUnknown *next) :
+ SCEV(ID, scUnknown), CallbackVH(V), SE(se), Next(next) {}
public:
- Value *getValue() const { return V; }
+ Value *getValue() const { return getValPtr(); }
/// isSizeOf, isAlignOf, isOffsetOf - Test whether this is a special
/// constant representing a type size, alignment, or field offset in
OpenPOWER on IntegriCloud