aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/DataLayout.h16
-rw-r--r--include/llvm/Instructions.h32
-rw-r--r--include/llvm/Target/TargetLowering.h2
-rw-r--r--include/llvm/Transforms/Utils/Local.h3
4 files changed, 17 insertions, 36 deletions
diff --git a/include/llvm/DataLayout.h b/include/llvm/DataLayout.h
index c9ac0b7..a24737e 100644
--- a/include/llvm/DataLayout.h
+++ b/include/llvm/DataLayout.h
@@ -231,7 +231,9 @@ public:
}
/// Layout pointer alignment
- unsigned getPointerABIAlignment(unsigned AS) const {
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerABIAlignment(unsigned AS = 0) const {
DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
if (val == Pointers.end()) {
val = Pointers.find(0);
@@ -239,7 +241,9 @@ public:
return val->second.ABIAlign;
}
/// Return target's alignment for stack-based pointers
- unsigned getPointerPrefAlignment(unsigned AS) const {
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerPrefAlignment(unsigned AS = 0) const {
DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
if (val == Pointers.end()) {
val = Pointers.find(0);
@@ -247,7 +251,9 @@ public:
return val->second.PrefAlign;
}
/// Layout pointer size
- unsigned getPointerSize(unsigned AS) const {
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerSize(unsigned AS = 0) const {
DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
if (val == Pointers.end()) {
val = Pointers.find(0);
@@ -255,7 +261,9 @@ public:
return val->second.TypeBitWidth;
}
/// Layout pointer size, in bits
- unsigned getPointerSizeInBits(unsigned AS) const {
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerSizeInBits(unsigned AS = 0) const {
DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
if (val == Pointers.end()) {
val = Pointers.find(0);
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 9c526bd..6837608 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -350,16 +350,7 @@ public:
static unsigned getPointerOperandIndex() { return 1U; }
unsigned getPointerAddressSpace() const {
- if (getPointerOperand()->getType()->isPointerTy())
- return cast<PointerType>(getPointerOperand()->getType())
- ->getAddressSpace();
- if (getPointerOperand()->getType()->isVectorTy()
- && cast<VectorType>(getPointerOperand()->getType())->isPointerTy())
- return cast<PointerType>(cast<VectorType>(
- getPointerOperand()->getType())->getElementType())
- ->getAddressSpace();
- llvm_unreachable("Only a vector of pointers or pointers can be used!");
- return 0;
+ return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -3662,15 +3653,7 @@ public:
/// @brief return the address space of the pointer.
unsigned getAddressSpace() const {
- if (getType()->isPointerTy())
- return cast<PointerType>(getType())->getAddressSpace();
- if (getType()->isVectorTy() &&
- cast<VectorType>(getType())->getElementType()->isPointerTy())
- return cast<PointerType>(
- cast<VectorType>(getType())->getElementType())
- ->getAddressSpace();
- llvm_unreachable("Must be a pointer or a vector of pointers.");
- return 0;
+ return cast<PointerType>(getType())->getAddressSpace();
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -3712,16 +3695,7 @@ public:
/// @brief return the address space of the pointer.
unsigned getPointerAddressSpace() const {
- Type *Ty = getOperand(0)->getType();
- if (Ty->isPointerTy())
- return cast<PointerType>(Ty)->getAddressSpace();
- if (Ty->isVectorTy()
- && cast<VectorType>(Ty)->getElementType()->isPointerTy())
- return cast<PointerType>(
- cast<VectorType>(Ty)->getElementType())
- ->getAddressSpace();
- llvm_unreachable("Must be a pointer or a vector of pointers.");
- return 0;
+ return cast<PointerType>(getOperand(0)->getType())->getAddressSpace();
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 183ccbd..b3149e9 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -146,7 +146,7 @@ public:
// Return the pointer type for the given address space, defaults to
// the pointer type from the data layout.
// FIXME: The default needs to be removed once all the code is updated.
- virtual MVT getPointerTy(uint32_t AS = 0) const { return PointerTy; }
+ virtual MVT getPointerTy(uint32_t addrspace = 0) const { return PointerTy; }
virtual MVT getShiftAmountTy(EVT LHSTy) const;
/// isSelectExpensive - Return true if the select operation is expensive for
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h
index fd1b555..21dd3fb 100644
--- a/include/llvm/Transforms/Utils/Local.h
+++ b/include/llvm/Transforms/Utils/Local.h
@@ -186,8 +186,7 @@ Value *EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &TD, User *GEP,
bool isInBounds = cast<GEPOperator>(GEP)->isInBounds() && !NoAssumptions;
// Build a mask for high order bits.
- unsigned AS = cast<GEPOperator>(GEP)->getPointerAddressSpace();
- unsigned IntPtrWidth = TD.getPointerSizeInBits(AS);
+ unsigned IntPtrWidth = TD.getPointerSizeInBits();
uint64_t PtrSizeMask = ~0ULL >> (64-IntPtrWidth);
for (User::op_iterator i = GEP->op_begin() + 1, e = GEP->op_end(); i != e;