diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-04-25 19:27:13 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-04-25 19:27:13 +0000 |
commit | 621d3675cbb422283e6e858d778d3c2abfd5b929 (patch) | |
tree | d37556f78a2e9c5544b8bffb39a30e5ea031100f | |
parent | dfaf4261ab6e11c30c2ef4a7a7280357d272a566 (diff) | |
download | bcm5719-llvm-621d3675cbb422283e6e858d778d3c2abfd5b929.tar.gz bcm5719-llvm-621d3675cbb422283e6e858d778d3c2abfd5b929.zip |
Add useful helpers to AddrSpaceCastInst
llvm-svn: 267450
-rw-r--r-- | llvm/include/llvm/IR/Instructions.h | 25 |
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 |