55d9d9173e
[ci skip]
75 lines
2.5 KiB
Diff
75 lines
2.5 KiB
Diff
From ef49a0ae57ce16c71172390dc123485da0f1a4fd Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Babokin <dmitry.y.babokin@intel.com>
|
|
Date: Tue, 5 Jun 2018 15:27:00 -0700
|
|
Subject: [PATCH] Compile time fixes
|
|
|
|
---
|
|
cbackend.cpp | 8 ++++++--
|
|
module.cpp | 9 +++++++++
|
|
opt.cpp | 1 +
|
|
3 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/cbackend.cpp b/cbackend.cpp
|
|
index 2da435f9..8b548dfa 100644
|
|
--- a/cbackend.cpp
|
|
+++ b/cbackend.cpp
|
|
@@ -4190,8 +4190,10 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
|
|
#define Intrinsic llvm::Intrinsic
|
|
#if ISPC_LLVM_VERSION == ISPC_LLVM_3_2
|
|
#include "llvm/Intrinsics.gen"
|
|
-#else /* LLVM 3.3+ */
|
|
+#elif ISPC_LLVM_VERSION <= ISPC_LLVM_6_0 /* LLVM 3.3-6.0 */
|
|
#include "llvm/IR/Intrinsics.gen"
|
|
+#else /* LLVM 7.0+ */
|
|
+ #include "llvm/IR/Intrinsics.h"
|
|
#endif
|
|
#undef Intrinsic
|
|
#undef GET_GCC_BUILTIN_NAME
|
|
@@ -4422,8 +4424,10 @@ bool CWriter::visitBuiltinCall(llvm::CallInst &I, llvm::Intrinsic::ID ID,
|
|
#define Intrinsic llvm::Intrinsic
|
|
#if ISPC_LLVM_VERSION == ISPC_LLVM_3_2
|
|
#include "llvm/Intrinsics.gen"
|
|
-#else /* LLVM 3.3+ */
|
|
+#elif ISPC_LLVM_VERSION <= ISPC_LLVM_6_0 /* LLVM 3.3-6.0 */
|
|
#include "llvm/IR/Intrinsics.gen"
|
|
+#else /* LLVM 7.0+ */
|
|
+ #include "llvm/IR/Intrinsics.h"
|
|
#endif
|
|
#undef Intrinsic
|
|
#undef GET_GCC_BUILTIN_NAME
|
|
diff --git a/module.cpp b/module.cpp
|
|
index 4aa459df..71bdf663 100644
|
|
--- a/module.cpp
|
|
+++ b/module.cpp
|
|
@@ -1573,10 +1573,19 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine,
|
|
#else // LLVM 3.7+
|
|
llvm::raw_fd_ostream &fos(of->os());
|
|
#endif
|
|
+#if ISPC_LLVM_VERSION <= ISPC_LLVM_6_0
|
|
if (targetMachine->addPassesToEmitFile(pm, fos, fileType)) {
|
|
fprintf(stderr, "Fatal error adding passes to emit object file!");
|
|
exit(1);
|
|
}
|
|
+#else // LLVM 7.0+
|
|
+ // Third parameter is for generation of .dwo file, which is separate DWARF
|
|
+ // file for ELF targets. We don't support it currently.
|
|
+ if (targetMachine->addPassesToEmitFile(pm, fos, nullptr, fileType)) {
|
|
+ fprintf(stderr, "Fatal error adding passes to emit object file!");
|
|
+ exit(1);
|
|
+ }
|
|
+#endif
|
|
|
|
// Finally, run the passes to emit the object file/assembly
|
|
pm.run(*module);
|
|
diff --git a/opt.cpp b/opt.cpp
|
|
index 1edbe33b..e26eccfd 100644
|
|
--- a/opt.cpp
|
|
+++ b/opt.cpp
|
|
@@ -101,6 +101,7 @@
|
|
#include <llvm/Transforms/IPO.h>
|
|
#if ISPC_LLVM_VERSION >= ISPC_LLVM_7_0
|
|
#include "llvm/Transforms/Utils.h"
|
|
+ #include "llvm/Transforms/InstCombine/InstCombine.h"
|
|
#endif
|
|
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
|
|
#include <llvm/Target/TargetOptions.h>
|