diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-11-01 11:25:55 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-11-01 11:25:55 +0000 |
commit | 174fbec3dfdf5e20ad5b75dcfcc709011ddb1a12 (patch) | |
tree | a5d6963c6ba6acf83c92d01b3b4332efa5f24c83 /include | |
parent | d988b75c4424ed14521b59f0ffb09527be00958b (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Instructions.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 9cfb89fe9f..69593b48c1 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -766,6 +766,13 @@ public: return reinterpret_cast<PointerType*>(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(); } |