From: Chandler Carruth Date: Thu, 1 Nov 2012 11:25:55 +0000 (+0000) Subject: Add a getAddressSpace method to the GEP instruction to mirror that of X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba98ef892f61307b5253a87c1003f780e50b5f91;p=platform%2Fupstream%2Fllvm.git Add a getAddressSpace method to the GEP instruction to mirror that of the inttoptr instruction. The conceptual model here is that 'getAddressSpace' refers to the address space of this instruction's type. It just happens that for GEPs, that is always the same as the pointer operand's address space. We want both names so that access patterns can be consistent between different instruction types. llvm-svn: 167229 --- diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h index 9cfb89f..69593b4 100644 --- a/llvm/include/llvm/Instructions.h +++ b/llvm/include/llvm/Instructions.h @@ -766,6 +766,13 @@ public: return reinterpret_cast(Instruction::getType()); } + /// \brief Returns the address space of this instruction's pointer type. + unsigned getAddressSpace() const { + // Note that this is always the same as the pointer operand's address space + // and that is cheaper to compute, so cheat here. + return getPointerAddressSpace(); + } + /// getIndexedType - Returns the type of the element that would be loaded with /// a load instruction with the specified parameters. /// @@ -3606,7 +3613,7 @@ public: /// \brief Clone an identical IntToPtrInst virtual IntToPtrInst *clone_impl() const; - /// \brief return the address space of the pointer. + /// \brief Returns the address space of this instruction's pointer type. unsigned getAddressSpace() const { return getType()->getPointerAddressSpace(); }