diff options
Diffstat (limited to 'contrib/llvm/lib/IR/DataLayout.cpp')
-rw-r--r-- | contrib/llvm/lib/IR/DataLayout.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/contrib/llvm/lib/IR/DataLayout.cpp b/contrib/llvm/lib/IR/DataLayout.cpp index 63c24b5ee7af..6e0ebbd4a730 100644 --- a/contrib/llvm/lib/IR/DataLayout.cpp +++ b/contrib/llvm/lib/IR/DataLayout.cpp @@ -1,9 +1,8 @@ //===- DataLayout.cpp - Data size & alignment routines ---------------------==// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -185,6 +184,8 @@ void DataLayout::reset(StringRef Desc) { AllocaAddrSpace = 0; StackNaturalAlign = 0; ProgramAddrSpace = 0; + FunctionPtrAlign = 0; + TheFunctionPtrAlignType = FunctionPtrAlignType::Independent; ManglingMode = MM_None; NonIntegralAddressSpaces.clear(); @@ -380,6 +381,22 @@ void DataLayout::parseSpecifier(StringRef Desc) { StackNaturalAlign = inBytes(getInt(Tok)); break; } + case 'F': { + switch (Tok.front()) { + case 'i': + TheFunctionPtrAlignType = FunctionPtrAlignType::Independent; + break; + case 'n': + TheFunctionPtrAlignType = FunctionPtrAlignType::MultipleOfFunctionAlign; + break; + default: + report_fatal_error("Unknown function pointer alignment type in " + "datalayout string"); + } + Tok = Tok.substr(1); + FunctionPtrAlign = inBytes(getInt(Tok)); + break; + } case 'P': { // Function address space. ProgramAddrSpace = getAddrSpace(Tok); break; @@ -433,6 +450,8 @@ bool DataLayout::operator==(const DataLayout &Other) const { AllocaAddrSpace == Other.AllocaAddrSpace && StackNaturalAlign == Other.StackNaturalAlign && ProgramAddrSpace == Other.ProgramAddrSpace && + FunctionPtrAlign == Other.FunctionPtrAlign && + TheFunctionPtrAlignType == Other.TheFunctionPtrAlignType && ManglingMode == Other.ManglingMode && LegalIntWidths == Other.LegalIntWidths && Alignments == Other.Alignments && Pointers == Other.Pointers; @@ -444,12 +463,9 @@ DataLayout::AlignmentsTy::iterator DataLayout::findAlignmentLowerBound(AlignTypeEnum AlignType, uint32_t BitWidth) { auto Pair = std::make_pair((unsigned)AlignType, BitWidth); - return std::lower_bound(Alignments.begin(), Alignments.end(), Pair, - [](const LayoutAlignElem &LHS, - const std::pair<unsigned, uint32_t> &RHS) { - return std::tie(LHS.AlignType, LHS.TypeBitWidth) < - std::tie(RHS.first, RHS.second); - }); + return partition_point(Alignments, [=](const LayoutAlignElem &E) { + return std::make_pair(E.AlignType, E.TypeBitWidth) < Pair; + }); } void |