diff options
author | Dan Gohman <gohman@apple.com> | 2010-12-15 20:02:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-12-15 20:02:24 +0000 |
commit | 5034dd318a9dfa0dc45a3ac01e58e60f2aa2498d (patch) | |
tree | 85f466bd781bcb1865313cc739b252f02116c838 /include/llvm/Analysis/ValueTracking.h | |
parent | d5f4bc2c339a88c331dd7ecaa36833358bc1d3b1 (diff) | |
download | llvm-5034dd318a9dfa0dc45a3ac01e58e60f2aa2498d.tar.gz llvm-5034dd318a9dfa0dc45a3ac01e58e60f2aa2498d.tar.bz2 llvm-5034dd318a9dfa0dc45a3ac01e58e60f2aa2498d.tar.xz |
Move Value::getUnderlyingObject to be a standalone
function so that it can live in Analysis instead of
VMCore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ValueTracking.h')
-rw-r--r-- | include/llvm/Analysis/ValueTracking.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h index 953d9106ed..dcc150d18d 100644 --- a/include/llvm/Analysis/ValueTracking.h +++ b/include/llvm/Analysis/ValueTracking.h @@ -121,6 +121,18 @@ namespace llvm { /// GetStringLength - If we can compute the length of the string pointed to by /// the specified pointer, return 'len+1'. If we can't, return 0. uint64_t GetStringLength(Value *V); + + /// GetUnderlyingObject - This method strips off any GEP address adjustments + /// and pointer casts from the specified value, returning the original object + /// being addressed. Note that the returned value has pointer type if the + /// specified value does. If the MaxLookup value is non-zero, it limits the + /// number of instructions to be stripped off. + Value *GetUnderlyingObject(Value *V, unsigned MaxLookup = 6); + static inline const Value * + GetUnderlyingObject(const Value *V, unsigned MaxLookup = 6) { + return GetUnderlyingObject(const_cast<Value *>(V), MaxLookup); + } + } // end namespace llvm #endif |