diff --git a/include/llvm/CodeGen/PBQP/CostAllocator.h b/include/llvm/CodeGen/PBQP/CostAllocator.h index 892e5b4557b..2c75f7eaadf 100644 --- a/include/llvm/CodeGen/PBQP/CostAllocator.h +++ b/include/llvm/CodeGen/PBQP/CostAllocator.h @@ -87,10 +87,10 @@ class CostPool { !std::is_same::type>::value, bool>::type - operator()(const PoolEntry* a, const CostKeyT &b) { + operator()(const PoolEntry* a, const CostKeyT &b) const { return compare(a->getCost(), b); } - bool operator()(const PoolEntry* a, const PoolEntry* b) { + bool operator()(const PoolEntry* a, const PoolEntry* b) const { return compare(a->getCost(), b->getCost()); } private: diff --git a/include/llvm/CodeGen/PBQP/Math.h b/include/llvm/CodeGen/PBQP/Math.h index 69a9d83cc09..7d2ed9d1f0b 100644 --- a/include/llvm/CodeGen/PBQP/Math.h +++ b/include/llvm/CodeGen/PBQP/Math.h @@ -138,7 +138,7 @@ class Vector { class VectorComparator { public: - bool operator()(const Vector &A, const Vector &B) { + bool operator()(const Vector &A, const Vector &B) const { if (A.Length < B.Length) return true; if (B.Length < A.Length) @@ -386,7 +386,7 @@ class Matrix { class MatrixComparator { public: - bool operator()(const Matrix &A, const Matrix &B) { + bool operator()(const Matrix &A, const Matrix &B) const { if (A.Rows < B.Rows) return true; if (B.Rows < A.Rows) diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index 85f0cc6a391..db9345b1ff9 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -61,7 +61,7 @@ #define LLVM_MSC_PREREQ(version) 0 #endif -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER >= 1910) #define LLVM_NOEXCEPT noexcept #else #define LLVM_NOEXCEPT @@ -117,7 +117,7 @@ #define LLVM_DELETED_FUNCTION #endif -#if __has_feature(cxx_constexpr) || defined(__GXX_EXPERIMENTAL_CXX0X__) +#if __has_feature(cxx_constexpr) || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_MSC_VER) && _MSC_VER >= 1900) # define LLVM_CONSTEXPR constexpr #else # define LLVM_CONSTEXPR diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index f079a8c332c..621ee53c97a 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -256,7 +256,10 @@ bool AsmPrinter::doInitialization(Module &M) { switch (MAI->getWinEHEncodingType()) { default: llvm_unreachable("unsupported unwinding information encoding"); case WinEH::EncodingType::Itanium: - ES = new Win64Exception(this); + if (!EnableMonoEH) + ES = new Win64Exception(this); + else + ES = new Win64Exception(this, true); break; } break; diff --git a/lib/CodeGen/AsmPrinter/DwarfMonoException.cpp b/lib/CodeGen/AsmPrinter/DwarfMonoException.cpp index b2a4a415857..a7dfe018b1c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfMonoException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfMonoException.cpp @@ -396,7 +396,6 @@ void DwarfMonoException::EmitMonoLSDA(const FunctionEHFrameInfo *EFI) { [](const LandingPadInfo *L, const LandingPadInfo *R) { return L->TypeIds < R->TypeIds; }); - assert(Asm->MAI->getExceptionHandlingType() == ExceptionHandling::DwarfCFI); // The type_info itself is emitted int TTypeEncoding = dwarf::DW_EH_PE_udata4; diff --git a/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/lib/CodeGen/AsmPrinter/Win64Exception.cpp index 0f0ad755835..107b2cd831b 100644 --- a/lib/CodeGen/AsmPrinter/Win64Exception.cpp +++ b/lib/CodeGen/AsmPrinter/Win64Exception.cpp @@ -39,7 +39,11 @@ using namespace llvm; Win64Exception::Win64Exception(AsmPrinter *A) : EHStreamer(A), shouldEmitPersonality(false), shouldEmitLSDA(false), - shouldEmitMoves(false) {} + shouldEmitMoves(false), disableEmitPersonality(false) {} + +Win64Exception::Win64Exception (AsmPrinter *A, bool disableEmitPersonality) + : EHStreamer(A), shouldEmitPersonality(false), shouldEmitLSDA(false), + shouldEmitMoves(false), disableEmitPersonality(disableEmitPersonality) {} Win64Exception::~Win64Exception() {} @@ -62,8 +66,9 @@ void Win64Exception::beginFunction(const MachineFunction *MF) { unsigned PerEncoding = TLOF.getPersonalityEncoding(); const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()]; - shouldEmitPersonality = hasLandingPads && - PerEncoding != dwarf::DW_EH_PE_omit && Per; + if (!disableEmitPersonality) + shouldEmitPersonality = hasLandingPads && + PerEncoding != dwarf::DW_EH_PE_omit && Per; unsigned LSDAEncoding = TLOF.getLSDAEncoding(); shouldEmitLSDA = shouldEmitPersonality && diff --git a/lib/CodeGen/AsmPrinter/Win64Exception.h b/lib/CodeGen/AsmPrinter/Win64Exception.h index 538e1328157..f43877fbb64 100644 --- a/lib/CodeGen/AsmPrinter/Win64Exception.h +++ b/lib/CodeGen/AsmPrinter/Win64Exception.h @@ -29,11 +29,15 @@ class Win64Exception : public EHStreamer { /// Per-function flag to indicate if frame moves info should be emitted. bool shouldEmitMoves; + /// Per-function flag to indicate if personality info should be disabled. + bool disableEmitPersonality; + public: //===--------------------------------------------------------------------===// // Main entry points. // Win64Exception(AsmPrinter *A); + Win64Exception(AsmPrinter *A, bool disableEmitPersonality); virtual ~Win64Exception(); /// Emit all exception information that should come after the content. diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td index 3ef8383bfe5..e7c04b73e2f 100644 --- a/lib/Target/X86/X86CallingConv.td +++ b/lib/Target/X86/X86CallingConv.td @@ -383,7 +383,9 @@ def CC_X86_64_AnyReg : CallingConv<[ def CC_X86_64_Mono : CallingConv<[ CCIfInReg>, - + // Mingw64 and native Win64 use Win64 CC + CCIfSubtarget<"isTargetWin64()", CCDelegateTo>, + // Otherwise, drop to normal X86-64 CC CCDelegateTo ]>; diff --git a/lib/Target/X86/X86FrameLowering.cpp b/lib/Target/X86/X86FrameLowering.cpp index 2dbd407388c..dcee32215a2 100644 --- a/lib/Target/X86/X86FrameLowering.cpp +++ b/lib/Target/X86/X86FrameLowering.cpp @@ -473,8 +473,9 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const { MF.getTarget().getMCAsmInfo()->getExceptionHandlingType() == ExceptionHandling::WinEH; // Not necessarily synonymous with IsWin64. bool NeedsWinEH = IsWinEH && Fn->needsUnwindTableEntry(); - bool NeedsDwarfCFI = - !IsWinEH && (MMI.hasDebugInfo() || Fn->needsUnwindTableEntry()); + bool NeedsDwarfCFI = Fn->getCallingConv() == CallingConv::Mono ? + (MMI.hasDebugInfo() || Fn->needsUnwindTableEntry()) : + !IsWinEH && (MMI.hasDebugInfo () || Fn->needsUnwindTableEntry ()); bool UseLEA = STI.useLeaForSP(); unsigned StackAlign = getStackAlignment(); unsigned SlotSize = RegInfo->getSlotSize(); diff --git a/tools/llvm-readobj/Error.cpp b/tools/llvm-readobj/Error.cpp index a078f5c095c..7e6f780c5d1 100644 --- a/tools/llvm-readobj/Error.cpp +++ b/tools/llvm-readobj/Error.cpp @@ -24,7 +24,7 @@ class _readobj_error_category : public std::error_category { }; } // namespace -const char *_readobj_error_category::name() const { +const char *_readobj_error_category::name() const LLVM_NOEXCEPT { return "llvm.readobj"; } diff --git a/tools/obj2yaml/Error.cpp b/tools/obj2yaml/Error.cpp index 00741287a64..1b6a84c5bc6 100644 --- a/tools/obj2yaml/Error.cpp +++ b/tools/obj2yaml/Error.cpp @@ -20,7 +20,7 @@ class _obj2yaml_error_category : public std::error_category { }; } // namespace -const char *_obj2yaml_error_category::name() const { return "obj2yaml"; } +const char *_obj2yaml_error_category::name() const LLVM_NOEXCEPT { return "obj2yaml"; } std::string _obj2yaml_error_category::message(int ev) const { switch (static_cast(ev)) {