diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-07-27 17:15:28 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-07-27 17:15:28 +0000 |
commit | 0ae73930273be3a5eaa1f9d375dfd5f341fd5dc2 (patch) | |
tree | 2f7f71d5785bdc6529ce00c2a971b2f2e1f20c3b /llvm/lib/IR/DataLayout.cpp | |
parent | 2e2014740377b549694abeb78881d56f7757af66 (diff) | |
download | bcm5719-llvm-0ae73930273be3a5eaa1f9d375dfd5f341fd5dc2.tar.gz bcm5719-llvm-0ae73930273be3a5eaa1f9d375dfd5f341fd5dc2.zip |
Revert "Add const to a bunch of Type* in DataLayout. NFC."
This reverts commit r243135.
Feedback from Craig Topper and David Blaikie was that we don't put const on Type as it has no mutable state.
llvm-svn: 243283
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r-- | llvm/lib/IR/DataLayout.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index c880bcec11e..80a59e05bc5 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -37,7 +37,7 @@ using namespace llvm; // Support for StructLayout //===----------------------------------------------------------------------===// -StructLayout::StructLayout(const StructType *ST, const DataLayout &DL) { +StructLayout::StructLayout(StructType *ST, const DataLayout &DL) { assert(!ST->isOpaque() && "Cannot get layout of opaque structs"); StructAlignment = 0; StructSize = 0; @@ -451,7 +451,7 @@ void DataLayout::setPointerAlignment(uint32_t AddrSpace, unsigned ABIAlign, /// preferred if ABIInfo = false) the layout wants for the specified datatype. unsigned DataLayout::getAlignmentInfo(AlignTypeEnum AlignType, uint32_t BitWidth, bool ABIInfo, - const Type *Ty) const { + Type *Ty) const { // Check to see if we have an exact match and remember the best match we see. int BestMatchIdx = -1; int LargestInt = -1; @@ -516,7 +516,7 @@ unsigned DataLayout::getAlignmentInfo(AlignTypeEnum AlignType, namespace { class StructLayoutMap { - typedef DenseMap<const StructType*, StructLayout*> LayoutInfoTy; + typedef DenseMap<StructType*, StructLayout*> LayoutInfoTy; LayoutInfoTy LayoutInfo; public: @@ -529,7 +529,7 @@ public: } } - StructLayout *&operator[](const StructType *STy) { + StructLayout *&operator[](StructType *STy) { return LayoutInfo[STy]; } }; @@ -548,7 +548,7 @@ DataLayout::~DataLayout() { clear(); } -const StructLayout *DataLayout::getStructLayout(const StructType *Ty) const { +const StructLayout *DataLayout::getStructLayout(StructType *Ty) const { if (!LayoutMap) LayoutMap = new StructLayoutMap(); @@ -599,7 +599,7 @@ unsigned DataLayout::getPointerSize(unsigned AS) const { return I->TypeByteWidth; } -unsigned DataLayout::getPointerTypeSizeInBits(const Type *Ty) const { +unsigned DataLayout::getPointerTypeSizeInBits(Type *Ty) const { assert(Ty->isPtrOrPtrVectorTy() && "This should only be called with a pointer or pointer vector type"); @@ -617,7 +617,7 @@ unsigned DataLayout::getPointerTypeSizeInBits(const Type *Ty) const { Get the ABI (\a abi_or_pref == true) or preferred alignment (\a abi_or_pref == false) for the requested type \a Ty. */ -unsigned DataLayout::getAlignment(const Type *Ty, bool abi_or_pref) const { +unsigned DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const { int AlignType = -1; assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"); @@ -671,7 +671,7 @@ unsigned DataLayout::getAlignment(const Type *Ty, bool abi_or_pref) const { abi_or_pref, Ty); } -unsigned DataLayout::getABITypeAlignment(const Type *Ty) const { +unsigned DataLayout::getABITypeAlignment(Type *Ty) const { return getAlignment(Ty, true); } @@ -681,11 +681,11 @@ unsigned DataLayout::getABIIntegerTypeAlignment(unsigned BitWidth) const { return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, nullptr); } -unsigned DataLayout::getPrefTypeAlignment(const Type *Ty) const { +unsigned DataLayout::getPrefTypeAlignment(Type *Ty) const { return getAlignment(Ty, false); } -unsigned DataLayout::getPreferredTypeAlignmentShift(const Type *Ty) const { +unsigned DataLayout::getPreferredTypeAlignmentShift(Type *Ty) const { unsigned Align = getPrefTypeAlignment(Ty); assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); return Log2_32(Align); @@ -696,12 +696,12 @@ IntegerType *DataLayout::getIntPtrType(LLVMContext &C, return IntegerType::get(C, getPointerSizeInBits(AddressSpace)); } -Type *DataLayout::getIntPtrType(const Type *Ty) const { +Type *DataLayout::getIntPtrType(Type *Ty) const { assert(Ty->isPtrOrPtrVectorTy() && "Expected a pointer or pointer vector type."); unsigned NumBits = getPointerTypeSizeInBits(Ty); IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); - if (const VectorType *VecTy = dyn_cast<VectorType>(Ty)) + if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) return VectorType::get(IntTy, VecTy->getNumElements()); return IntTy; } @@ -720,7 +720,7 @@ unsigned DataLayout::getLargestLegalIntTypeSize() const { uint64_t DataLayout::getIndexedOffset(Type *ptrTy, ArrayRef<Value *> Indices) const { - const Type *Ty = ptrTy; + Type *Ty = ptrTy; assert(Ty->isPointerTy() && "Illegal argument for getIndexedOffset()"); uint64_t Result = 0; |