Skip to content
This repository was archived by the owner on Dec 20, 2019. It is now read-only.

Commit 9b92b4b

Browse files
authored
Merge pull request #14 from lateralusX/lateralusX/build-llvm-windows-x64
Build LLVM Windows x64 using CMake + VS2015 or VS2017.
2 parents 0b3cb8a + e2ae330 commit 9b92b4b

File tree

11 files changed

+30
-16
lines changed

11 files changed

+30
-16
lines changed

include/llvm/CodeGen/PBQP/CostAllocator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ class CostPool {
8787
!std::is_same<PoolEntry*,
8888
typename std::remove_const<CostKeyT>::type>::value,
8989
bool>::type
90-
operator()(const PoolEntry* a, const CostKeyT &b) {
90+
operator()(const PoolEntry* a, const CostKeyT &b) const {
9191
return compare(a->getCost(), b);
9292
}
93-
bool operator()(const PoolEntry* a, const PoolEntry* b) {
93+
bool operator()(const PoolEntry* a, const PoolEntry* b) const {
9494
return compare(a->getCost(), b->getCost());
9595
}
9696
private:

include/llvm/CodeGen/PBQP/Math.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class Vector {
138138

139139
class VectorComparator {
140140
public:
141-
bool operator()(const Vector &A, const Vector &B) {
141+
bool operator()(const Vector &A, const Vector &B) const {
142142
if (A.Length < B.Length)
143143
return true;
144144
if (B.Length < A.Length)
@@ -386,7 +386,7 @@ class Matrix {
386386

387387
class MatrixComparator {
388388
public:
389-
bool operator()(const Matrix &A, const Matrix &B) {
389+
bool operator()(const Matrix &A, const Matrix &B) const {
390390
if (A.Rows < B.Rows)
391391
return true;
392392
if (B.Rows < A.Rows)

include/llvm/Support/Compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#define LLVM_MSC_PREREQ(version) 0
6262
#endif
6363

64-
#ifndef _MSC_VER
64+
#if !defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER >= 1910)
6565
#define LLVM_NOEXCEPT noexcept
6666
#else
6767
#define LLVM_NOEXCEPT
@@ -117,7 +117,7 @@
117117
#define LLVM_DELETED_FUNCTION
118118
#endif
119119

120-
#if __has_feature(cxx_constexpr) || defined(__GXX_EXPERIMENTAL_CXX0X__)
120+
#if __has_feature(cxx_constexpr) || defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(_MSC_VER) && _MSC_VER >= 1900)
121121
# define LLVM_CONSTEXPR constexpr
122122
#else
123123
# define LLVM_CONSTEXPR

lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,10 @@ bool AsmPrinter::doInitialization(Module &M) {
256256
switch (MAI->getWinEHEncodingType()) {
257257
default: llvm_unreachable("unsupported unwinding information encoding");
258258
case WinEH::EncodingType::Itanium:
259-
ES = new Win64Exception(this);
259+
if (!EnableMonoEH)
260+
ES = new Win64Exception(this);
261+
else
262+
ES = new Win64Exception(this, true);
260263
break;
261264
}
262265
break;

lib/CodeGen/AsmPrinter/DwarfMonoException.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ void DwarfMonoException::EmitMonoLSDA(const FunctionEHFrameInfo *EFI) {
396396
[](const LandingPadInfo *L,
397397
const LandingPadInfo *R) { return L->TypeIds < R->TypeIds; });
398398

399-
assert(Asm->MAI->getExceptionHandlingType() == ExceptionHandling::DwarfCFI);
400399

401400
// The type_info itself is emitted
402401
int TTypeEncoding = dwarf::DW_EH_PE_udata4;

lib/CodeGen/AsmPrinter/Win64Exception.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ using namespace llvm;
3939

4040
Win64Exception::Win64Exception(AsmPrinter *A)
4141
: EHStreamer(A), shouldEmitPersonality(false), shouldEmitLSDA(false),
42-
shouldEmitMoves(false) {}
42+
shouldEmitMoves(false), disableEmitPersonality(false) {}
43+
44+
Win64Exception::Win64Exception (AsmPrinter *A, bool disableEmitPersonality)
45+
: EHStreamer(A), shouldEmitPersonality(false), shouldEmitLSDA(false),
46+
shouldEmitMoves(false), disableEmitPersonality(disableEmitPersonality) {}
4347

4448
Win64Exception::~Win64Exception() {}
4549

@@ -62,8 +66,9 @@ void Win64Exception::beginFunction(const MachineFunction *MF) {
6266
unsigned PerEncoding = TLOF.getPersonalityEncoding();
6367
const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
6468

65-
shouldEmitPersonality = hasLandingPads &&
66-
PerEncoding != dwarf::DW_EH_PE_omit && Per;
69+
if (!disableEmitPersonality)
70+
shouldEmitPersonality = hasLandingPads &&
71+
PerEncoding != dwarf::DW_EH_PE_omit && Per;
6772

6873
unsigned LSDAEncoding = TLOF.getLSDAEncoding();
6974
shouldEmitLSDA = shouldEmitPersonality &&

lib/CodeGen/AsmPrinter/Win64Exception.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ class Win64Exception : public EHStreamer {
2929
/// Per-function flag to indicate if frame moves info should be emitted.
3030
bool shouldEmitMoves;
3131

32+
/// Per-function flag to indicate if personality info should be disabled.
33+
bool disableEmitPersonality;
34+
3235
public:
3336
//===--------------------------------------------------------------------===//
3437
// Main entry points.
3538
//
3639
Win64Exception(AsmPrinter *A);
40+
Win64Exception(AsmPrinter *A, bool disableEmitPersonality);
3741
virtual ~Win64Exception();
3842

3943
/// Emit all exception information that should come after the content.

lib/Target/X86/X86CallingConv.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ def CC_X86_64_AnyReg : CallingConv<[
383383

384384
def CC_X86_64_Mono : CallingConv<[
385385
CCIfInReg<CCAssignToReg<[R10]>>,
386-
386+
// Mingw64 and native Win64 use Win64 CC
387+
CCIfSubtarget<"isTargetWin64()", CCDelegateTo<CC_X86_Win64_C>>,
388+
// Otherwise, drop to normal X86-64 CC
387389
CCDelegateTo<CC_X86_64_C>
388390
]>;
389391

lib/Target/X86/X86FrameLowering.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,9 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
473473
MF.getTarget().getMCAsmInfo()->getExceptionHandlingType() ==
474474
ExceptionHandling::WinEH; // Not necessarily synonymous with IsWin64.
475475
bool NeedsWinEH = IsWinEH && Fn->needsUnwindTableEntry();
476-
bool NeedsDwarfCFI =
477-
!IsWinEH && (MMI.hasDebugInfo() || Fn->needsUnwindTableEntry());
476+
bool NeedsDwarfCFI = Fn->getCallingConv() == CallingConv::Mono ?
477+
(MMI.hasDebugInfo() || Fn->needsUnwindTableEntry()) :
478+
!IsWinEH && (MMI.hasDebugInfo () || Fn->needsUnwindTableEntry ());
478479
bool UseLEA = STI.useLeaForSP();
479480
unsigned StackAlign = getStackAlignment();
480481
unsigned SlotSize = RegInfo->getSlotSize();

tools/llvm-readobj/Error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class _readobj_error_category : public std::error_category {
2424
};
2525
} // namespace
2626

27-
const char *_readobj_error_category::name() const {
27+
const char *_readobj_error_category::name() const LLVM_NOEXCEPT {
2828
return "llvm.readobj";
2929
}
3030

0 commit comments

Comments
 (0)