summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-11-01 10:59:30 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-11-01 10:59:30 +0000
commit1521406a4b5b08209fb817a4673f636ef0fd8f46 (patch)
tree5dd449ad899470f1106d3f72dc2cb87b0643d112 /include
parentacd01d1c641cabc3e02a7b4f699264d1c5a7733a (diff)
downloadllvm-1521406a4b5b08209fb817a4673f636ef0fd8f46.tar.gz
llvm-1521406a4b5b08209fb817a4673f636ef0fd8f46.tar.bz2
llvm-1521406a4b5b08209fb817a4673f636ef0fd8f46.tar.xz
Remove a weird static helper from the GEP instruction and just directly
compute the address space in the one place it was used. Also write the getPointerAddressSpace member in terms of the getPointerOperandType member. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167226 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Instructions.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 715ab6c90a..2e75ec5f9a 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -772,10 +772,6 @@ public:
static Type *getIndexedType(Type *Ptr, ArrayRef<Constant *> IdxList);
static Type *getIndexedType(Type *Ptr, ArrayRef<uint64_t> IdxList);
- /// getAddressSpace - Returns the address space used by the GEP pointer.
- ///
- static unsigned getAddressSpace(Value *Ptr);
-
inline op_iterator idx_begin() { return op_begin()+1; }
inline const_op_iterator idx_begin() const { return op_begin()+1; }
inline op_iterator idx_end() { return op_end(); }
@@ -791,22 +787,22 @@ public:
return 0U; // get index for modifying correct operand.
}
- unsigned getPointerAddressSpace() const {
- return getPointerOperand()->getType()->getPointerAddressSpace();
- }
-
/// getPointerOperandType - Method to return the pointer operand as a
/// PointerType.
Type *getPointerOperandType() const {
return getPointerOperand()->getType();
}
+ unsigned getPointerAddressSpace() const {
+ return getPointerOperandType()->getPointerAddressSpace();
+ }
+
/// GetGEPReturnType - Returns the pointer type returned by the GEP
/// instruction, which may be a vector of pointers.
static Type *getGEPReturnType(Value *Ptr, ArrayRef<Value *> IdxList) {
Type *PtrTy = PointerType::get(checkGEPType(
getIndexedType(Ptr->getType(), IdxList)),
- getAddressSpace(Ptr));
+ Ptr->getType()->getPointerAddressSpace());
// Vector GEP
if (Ptr->getType()->isVectorTy()) {
unsigned NumElem = cast<VectorType>(Ptr->getType())->getNumElements();