From 48fc88fa541d9084daf3ade6e4df2046ad9736e2 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Wed, 7 May 2008 22:54:15 +0000 Subject: Turn StripPointerCast() into a method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50836 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IntrinsicInst.h | 6 +++--- include/llvm/Value.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h index 494eaae..c674e47 100644 --- a/include/llvm/IntrinsicInst.h +++ b/include/llvm/IntrinsicInst.h @@ -183,7 +183,7 @@ namespace llvm { /// getDest - This is just like getRawDest, but it strips off any cast /// instructions that feed it, giving the original input. The returned /// value is guaranteed to be a pointer. - Value *getDest() const { return StripPointerCasts(getRawDest()); } + Value *getDest() const { return getRawDest()->stripPointerCasts(); } /// set* - Set the specified arguments of the instruction. /// @@ -234,7 +234,7 @@ namespace llvm { /// getSource - This is just like getRawSource, but it strips off any cast /// instructions that feed it, giving the original input. The returned /// value is guaranteed to be a pointer. - Value *getSource() const { return StripPointerCasts(getRawSource()); } + Value *getSource() const { return getRawSource()->stripPointerCasts(); } void setSource(Value *Ptr) { @@ -264,7 +264,7 @@ namespace llvm { /// getSource - This is just like getRawSource, but it strips off any cast /// instructions that feed it, giving the original input. The returned /// value is guaranteed to be a pointer. - Value *getSource() const { return StripPointerCasts(getRawSource()); } + Value *getSource() const { return getRawSource()->stripPointerCasts(); } void setSource(Value *Ptr) { assert(getRawSource()->getType() == Ptr->getType() && diff --git a/include/llvm/Value.h b/include/llvm/Value.h index e3e6474..2bcac08 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -220,6 +220,11 @@ public: /// getRawType - This should only be used to implement the vmcore library. /// const Type *getRawType() const { return Ty.getRawType(); } + + /// stripPointerCasts - This method strips off any unneeded pointer + /// casts from the specified value, returning the original uncasted value. + /// Note that the returned value is guaranteed to have pointer type. + Value *stripPointerCasts(); }; inline std::ostream &operator<<(std::ostream &OS, const Value &V) { @@ -272,11 +277,6 @@ template <> inline bool isa_impl(const Value &Val) { return isa(Val) || isa(Val) || isa(Val); } -/// StripPointerCasts - This function strips off any unneeded pointer -/// casts from the specified value, returning the original uncasted value. -/// Note that the returned value is guaranteed to have pointer type. -Value *StripPointerCasts(Value *Ptr); - } // End llvm namespace #endif -- cgit v1.1