aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-26 22:11:00 +0000
committerChris Lattner <sabre@nondot.org>2003-02-26 22:11:00 +0000
commit31a9d185bfa253af2f0fece59d8b1227dad64b15 (patch)
tree59a9f34aca69a10ebf410081f1a1f9261a3413f6 /include/llvm/Analysis
parentcd4d41cd4ff557d1d792a8ae2473ab445b881bc7 (diff)
downloadexternal_llvm-31a9d185bfa253af2f0fece59d8b1227dad64b15.zip
external_llvm-31a9d185bfa253af2f0fece59d8b1227dad64b15.tar.gz
external_llvm-31a9d185bfa253af2f0fece59d8b1227dad64b15.tar.bz2
Make the aliassettracker much more precise by actually tracking size
information for various accesses. What a concept. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/AliasSetTracker.h33
1 files changed, 20 insertions, 13 deletions
diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h
index ad71d99..713add5 100644
--- a/include/llvm/Analysis/AliasSetTracker.h
+++ b/include/llvm/Analysis/AliasSetTracker.h
@@ -29,12 +29,19 @@ class AliasSet {
class PointerRec {
HashNodePair *NextInList;
AliasSet *AS;
+ unsigned Size;
public:
- PointerRec() : NextInList(0), AS(0) {}
+ PointerRec() : NextInList(0), AS(0), Size(0) {}
HashNodePair *getNext() const { return NextInList; }
bool hasAliasSet() const { return AS != 0; }
+ void updateSize(unsigned NewSize) {
+ if (NewSize > Size) Size = NewSize;
+ }
+
+ unsigned getSize() const { return Size; }
+
AliasSet *getAliasSet(AliasSetTracker &AST) {
assert(AS && "No AliasSet yet!");
if (AS->Forward) {
@@ -87,7 +94,7 @@ class AliasSet {
unsigned AliasTy : 1;
/// Define an iterator for alias sets... this is just a forward iterator.
- class iterator : public forward_iterator<Value*, ptrdiff_t> {
+ class iterator : public forward_iterator<HashNodePair, ptrdiff_t> {
HashNodePair *CurNode;
public:
iterator(HashNodePair *CN = 0) : CurNode(CN) {}
@@ -102,11 +109,11 @@ class AliasSet {
return *this;
}
- value_type operator*() const {
+ value_type &operator*() const {
assert(CurNode && "Dereferencing AliasSet.end()!");
- return CurNode->first;
+ return *CurNode;
}
- value_type operator->() const { return operator*(); }
+ value_type *operator->() const { return &operator*(); }
iterator& operator++() { // Preincrement
assert(CurNode && "Advancing past AliasSet.end()!");
@@ -148,8 +155,8 @@ private:
AliasSet() : PtrListHead(0), PtrListTail(0), Forward(0), RefCount(0),
AccessTy(NoModRef), AliasTy(MustAlias) {
}
- Value *getSomePointer() const {
- return PtrListHead ? PtrListHead->first : 0;
+ HashNodePair *getSomePointer() const {
+ return PtrListHead ? PtrListHead : 0;
}
/// getForwardedTarget - Return the real alias set this represents. If this
@@ -170,13 +177,13 @@ private:
void removeFromTracker(AliasSetTracker &AST);
- void addPointer(AliasSetTracker &AST, HashNodePair &Entry);
+ void addPointer(AliasSetTracker &AST, HashNodePair &Entry, unsigned Size);
void addCallSite(CallSite CS);
/// aliasesPointer - Return true if the specified pointer "may" (or must)
/// alias one of the members in the set.
///
- bool aliasesPointer(const Value *Ptr, AliasAnalysis &AA) const;
+ bool aliasesPointer(const Value *Ptr, unsigned Size, AliasAnalysis &AA) const;
bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const;
};
@@ -219,7 +226,7 @@ public:
/// getAliasSetForPointer - Return the alias set that the specified pointer
/// lives in...
- AliasSet &getAliasSetForPointer(Value *P);
+ AliasSet &getAliasSetForPointer(Value *P, unsigned Size);
/// getAliasAnalysis - Return the underlying alias analysis object used by
/// this tracker.
@@ -248,11 +255,11 @@ private:
AliasSet::PointerRec())).first;
}
- void addPointer(Value *P, AliasSet::AccessType E) {
- AliasSet &AS = getAliasSetForPointer(P);
+ void addPointer(Value *P, unsigned Size, AliasSet::AccessType E) {
+ AliasSet &AS = getAliasSetForPointer(P, Size);
AS.AccessTy |= E;
}
- AliasSet *findAliasSetForPointer(const Value *Ptr);
+ AliasSet *findAliasSetForPointer(const Value *Ptr, unsigned Size);
AliasSet *findAliasSetForCallSite(CallSite CS);
};