diff options
author | Micah Villmow <villmow@gmail.com> | 2012-10-11 21:27:41 +0000 |
---|---|---|
committer | Micah Villmow <villmow@gmail.com> | 2012-10-11 21:27:41 +0000 |
commit | fb384d61c78b60787ed65475d8403aee65023962 (patch) | |
tree | 7bf869f21ac85ae4ddbeea3069784c88381bd07e /include/llvm | |
parent | d9a3bad4487dee0b9ed1a0f5555dffe605826158 (diff) |
Revert 165732 for further review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/DataLayout.h | 16 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 32 | ||||
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 2 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/Local.h | 3 |
4 files changed, 17 insertions, 36 deletions
diff --git a/include/llvm/DataLayout.h b/include/llvm/DataLayout.h index c9ac0b7feaa..a24737e842b 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 9c526bd97bb..6837608b2c0 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 183ccbd48ec..b3149e960a8 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 fd1b5556ef2..21dd3fbe110 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; |