From ce3b538a7bc880394227c5b4ed1169ab8c363f37 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 30 Aug 2009 19:45:21 +0000 Subject: [PATCH] add a "getPointerAddressSpace" helper method to LoadInst and StoreInst. llvm-svn: 80503 --- llvm/include/llvm/Instructions.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h index b5d842a6d50c..ee9657dbba94 100644 --- a/llvm/include/llvm/Instructions.h +++ b/llvm/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(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(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) {