X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FIR%2FDataLayout.cpp;h=dea05fbef4ab426756b06805a643078341c6124c;hb=7df1db57b3ae35afcc1df648f1446b7c7b60993b;hp=5654e15ae30266826b199e68727eb99169942457;hpb=6e9eeab69f0ce496d0120f9718e026f319d2ab01;p=oota-llvm.git diff --git a/lib/IR/DataLayout.cpp b/lib/IR/DataLayout.cpp index 5654e15ae30..dea05fbef4a 100644 --- a/lib/IR/DataLayout.cpp +++ b/lib/IR/DataLayout.cpp @@ -155,10 +155,9 @@ DataLayout::InvalidPointerElem = { 0U, 0U, 0U, ~0U }; const char *DataLayout::getManglingComponent(const Triple &T) { if (T.isOSBinFormatMachO()) return "-m:o"; - if (T.isOSBinFormatELF() || T.isArch64Bit()) - return "-m:e"; - assert(T.isOSBinFormatCOFF()); - return "-m:w"; + if (T.isOSWindows() && T.getArch() == Triple::x86 && T.isOSBinFormatCOFF()) + return "-m:w"; + return "-m:e"; } static const LayoutAlignElem DefaultAlignments[] = { @@ -179,7 +178,7 @@ static const LayoutAlignElem DefaultAlignments[] = { void DataLayout::reset(StringRef Desc) { clear(); - LayoutMap = 0; + LayoutMap = nullptr; LittleEndian = false; StackNaturalAlign = 0; ManglingMode = MM_None; @@ -345,7 +344,7 @@ void DataLayout::parseSpecifier(StringRef Desc) { } } -DataLayout::DataLayout(const Module *M) : LayoutMap(0) { +DataLayout::DataLayout(const Module *M) : LayoutMap(nullptr) { const DataLayout *Other = M->getDataLayout(); if (Other) *this = *Other; @@ -358,7 +357,7 @@ bool DataLayout::operator==(const DataLayout &Other) const { StackNaturalAlign == Other.StackNaturalAlign && ManglingMode == Other.ManglingMode && LegalIntWidths == Other.LegalIntWidths && - Alignments == Other.Alignments && Pointers == Pointers; + Alignments == Other.Alignments && Pointers == Other.Pointers; assert(Ret == (getStringRepresentation() == Other.getStringRepresentation())); return Ret; } @@ -489,7 +488,7 @@ void DataLayout::clear() { Alignments.clear(); Pointers.clear(); delete static_cast(LayoutMap); - LayoutMap = 0; + LayoutMap = nullptr; } DataLayout::~DataLayout() { @@ -688,7 +687,7 @@ unsigned DataLayout::getABITypeAlignment(Type *Ty) const { /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for /// an integer type of the specified bitwidth. unsigned DataLayout::getABIIntegerTypeAlignment(unsigned BitWidth) const { - return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, 0); + return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, nullptr); } unsigned DataLayout::getPrefTypeAlignment(Type *Ty) const { @@ -709,7 +708,7 @@ IntegerType *DataLayout::getIntPtrType(LLVMContext &C, Type *DataLayout::getIntPtrType(Type *Ty) const { assert(Ty->isPtrOrPtrVectorTy() && "Expected a pointer or pointer vector type."); - unsigned NumBits = getTypeSizeInBits(Ty->getScalarType()); + unsigned NumBits = getPointerTypeSizeInBits(Ty); IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); if (VectorType *VecTy = dyn_cast(Ty)) return VectorType::get(IntTy, VecTy->getNumElements()); @@ -720,7 +719,7 @@ Type *DataLayout::getSmallestLegalIntType(LLVMContext &C, unsigned Width) const for (unsigned LegalIntWidth : LegalIntWidths) if (Width <= LegalIntWidth) return Type::getIntNTy(C, LegalIntWidth); - return 0; + return nullptr; } unsigned DataLayout::getLargestLegalIntTypeSize() const {