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

Commit

Permalink
Merge pull request #14 from lateralusX/lateralusX/build-llvm-windows-x64
Browse files Browse the repository at this point in the history
Build LLVM Windows x64 using CMake + VS2015 or VS2017.
  • Loading branch information
vargaz authored Jun 19, 2018
2 parents 0b3cb8a + e2ae330 commit 9b92b4b
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 16 deletions.
4 changes: 2 additions & 2 deletions include/llvm/CodeGen/PBQP/CostAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ class CostPool {
!std::is_same<PoolEntry*,
typename std::remove_const<CostKeyT>::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:
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/CodeGen/PBQP/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/Support/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lib/CodeGen/AsmPrinter/DwarfMonoException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions lib/CodeGen/AsmPrinter/Win64Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand All @@ -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 &&
Expand Down
4 changes: 4 additions & 0 deletions lib/CodeGen/AsmPrinter/Win64Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion lib/Target/X86/X86CallingConv.td
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,9 @@ def CC_X86_64_AnyReg : CallingConv<[

def CC_X86_64_Mono : CallingConv<[
CCIfInReg<CCAssignToReg<[R10]>>,

// Mingw64 and native Win64 use Win64 CC
CCIfSubtarget<"isTargetWin64()", CCDelegateTo<CC_X86_Win64_C>>,
// Otherwise, drop to normal X86-64 CC
CCDelegateTo<CC_X86_64_C>
]>;

Expand Down
5 changes: 3 additions & 2 deletions lib/Target/X86/X86FrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tools/llvm-readobj/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
2 changes: 1 addition & 1 deletion tools/obj2yaml/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<obj2yaml_error>(ev)) {
Expand Down

0 comments on commit 9b92b4b

Please sign in to comment.