aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-30 19:45:21 +0000
committerChris Lattner <sabre@nondot.org>2009-08-30 19:45:21 +0000
commita07ae6be66a0c6afe662ea4ad8e67d38fc087c5a (patch)
tree26f1f199fe593dc95d4db0e024d66cf949cecc5a
parentd91aafd0055a10230f3d606a933b2dac4f68284b (diff)
add a "getPointerAddressSpace" helper method to LoadInst and StoreInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80503 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Instructions.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index b5d842a6d5..ee9657dbba 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -277,6 +277,11 @@ public:
const Value *getPointerOperand() const { return getOperand(0); }
static unsigned getPointerOperandIndex() { return 0U; }
+ unsigned getPointerAddressSpace() const {
+ return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
+ }
+
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const LoadInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -341,6 +346,10 @@ public:
const Value *getPointerOperand() const { return getOperand(1); }
static unsigned getPointerOperandIndex() { return 1U; }
+ unsigned getPointerAddressSpace() const {
+ return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const StoreInst *) { return true; }
static inline bool classof(const Instruction *I) {