summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/IR/Instructions.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 312541c1d83..ba20d77215f 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -4848,6 +4848,31 @@ public:
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
+
+ /// \brief Gets the pointer operand.
+ Value *getPointerOperand() {
+ return getOperand(0);
+ }
+
+ /// \brief Gets the pointer operand.
+ const Value *getPointerOperand() const {
+ return getOperand(0);
+ }
+
+ /// \brief Gets the operand index of the pointer operand.
+ static unsigned getPointerOperandIndex() {
+ return 0U;
+ }
+
+ /// \brief Returns the address space of the pointer operand.
+ unsigned getSrcAddressSpace() const {
+ return getPointerOperand()->getType()->getPointerAddressSpace();
+ }
+
+ /// \brief Returns the address space of the result.
+ unsigned getDestAddressSpace() const {
+ return getType()->getPointerAddressSpace();
+ }
};
} // End llvm namespace
OpenPOWER on IntegriCloud