aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-08-28 00:07:00 +0100
committerEric Engestrom <[email protected]>2019-09-06 22:26:29 +0100
commit75271443830c4a2d89b32b6cd73d7900a2985477 (patch)
tree6ca876a3c183f125e705cae0d07572a83a96fe5e /src/gallium
parent08890068c5c2c923ad85ced58c479ffbe4f84fc5 (diff)
clover: replace major llvm version checks with LLVM_VERSION_MAJOR
Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp3
-rw-r--r--src/gallium/state_trackers/clover/llvm/compat.hpp33
2 files changed, 19 insertions, 17 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
index 40bb426218d..0ef34489f38 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
@@ -38,7 +38,8 @@
#include "util/algorithm.hpp"
#include <map>
-#if HAVE_LLVM < 0x0400
+#include <llvm/Config/llvm-config.h>
+#if LLVM_VERSION_MAJOR < 4
#include <llvm/Bitcode/ReaderWriter.h>
#else
#include <llvm/Bitcode/BitcodeReader.h>
diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp b/src/gallium/state_trackers/clover/llvm/compat.hpp
index 629a759e05d..2015fccaf8c 100644
--- a/src/gallium/state_trackers/clover/llvm/compat.hpp
+++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
@@ -36,7 +36,8 @@
#include "util/algorithm.hpp"
-#if HAVE_LLVM < 0x0400
+#include <llvm/Config/llvm-config.h>
+#if LLVM_VERSION_MAJOR < 4
#include <llvm/Bitcode/ReaderWriter.h>
#else
#include <llvm/Bitcode/BitcodeReader.h>
@@ -48,7 +49,7 @@
#include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/Utils/Cloning.h>
#include <llvm/Target/TargetMachine.h>
-#if HAVE_LLVM >= 0x0400
+#if LLVM_VERSION_MAJOR >= 4
#include <llvm/Support/Error.h>
#else
#include <llvm/Support/ErrorOr.h>
@@ -60,7 +61,7 @@
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
-#if HAVE_LLVM >= 0x0800
+#if LLVM_VERSION_MAJOR >= 8
#include <clang/Basic/CodeGenOptions.h>
#else
#include <clang/Frontend/CodeGenOptions.h>
@@ -72,22 +73,22 @@ namespace clover {
template<typename T, typename AS>
unsigned target_address_space(const T &target, const AS lang_as) {
const auto &map = target.getAddressSpaceMap();
-#if HAVE_LLVM >= 0x0500
+#if LLVM_VERSION_MAJOR >= 5
return map[static_cast<unsigned>(lang_as)];
#else
return map[lang_as - clang::LangAS::Offset];
#endif
}
-#if HAVE_LLVM >= 0x1000
+#if LLVM_VERSION_MAJOR >= 10
const clang::InputKind ik_opencl = clang::Language::OpenCL;
-#elif HAVE_LLVM >= 0x0500
+#elif LLVM_VERSION_MAJOR >= 5
const clang::InputKind ik_opencl = clang::InputKind::OpenCL;
#else
const clang::InputKind ik_opencl = clang::IK_OpenCL;
#endif
-#if HAVE_LLVM >= 0x0500
+#if LLVM_VERSION_MAJOR >= 5
const clang::LangStandard::Kind lang_opencl10 = clang::LangStandard::lang_opencl10;
#else
const clang::LangStandard::Kind lang_opencl10 = clang::LangStandard::lang_opencl;
@@ -96,7 +97,7 @@ namespace clover {
inline void
add_link_bitcode_file(clang::CodeGenOptions &opts,
const std::string &path) {
-#if HAVE_LLVM >= 0x0500
+#if LLVM_VERSION_MAJOR >= 5
clang::CodeGenOptions::BitcodeFileToLink F;
F.Filename = path;
@@ -108,7 +109,7 @@ namespace clover {
#endif
}
-#if HAVE_LLVM >= 0x0600
+#if LLVM_VERSION_MAJOR >= 6
const auto default_code_model = ::llvm::None;
#else
const auto default_code_model = ::llvm::CodeModel::Default;
@@ -116,7 +117,7 @@ namespace clover {
template<typename M, typename F> void
handle_module_error(M &mod, const F &f) {
-#if HAVE_LLVM >= 0x0400
+#if LLVM_VERSION_MAJOR >= 4
if (::llvm::Error err = mod.takeError())
::llvm::handleAllErrors(std::move(err), [&](::llvm::ErrorInfoBase &eib) {
f(eib.message());
@@ -130,7 +131,7 @@ namespace clover {
template<typename T> void
set_diagnostic_handler(::llvm::LLVMContext &ctx,
T *diagnostic_handler, void *data) {
-#if HAVE_LLVM >= 0x0600
+#if LLVM_VERSION_MAJOR >= 6
ctx.setDiagnosticHandlerCallBack(diagnostic_handler, data);
#else
ctx.setDiagnosticHandler(diagnostic_handler, data);
@@ -140,7 +141,7 @@ namespace clover {
inline std::unique_ptr< ::llvm::Module>
clone_module(const ::llvm::Module &mod)
{
-#if HAVE_LLVM >= 0x0700
+#if LLVM_VERSION_MAJOR >= 7
return ::llvm::CloneModule(mod);
#else
return ::llvm::CloneModule(&mod);
@@ -150,7 +151,7 @@ namespace clover {
template<typename T> void
write_bitcode_to_file(const ::llvm::Module &mod, T &os)
{
-#if HAVE_LLVM >= 0x0700
+#if LLVM_VERSION_MAJOR >= 7
::llvm::WriteBitcodeToFile(mod, os);
#else
::llvm::WriteBitcodeToFile(&mod, os);
@@ -160,7 +161,7 @@ namespace clover {
template<typename TM, typename PM, typename OS, typename FT>
bool add_passes_to_emit_file(TM &tm, PM &pm, OS &os, FT &ft)
{
-#if HAVE_LLVM >= 0x0700
+#if LLVM_VERSION_MAJOR >= 7
return tm.addPassesToEmitFile(pm, os, nullptr, ft);
#else
return tm.addPassesToEmitFile(pm, os, ft);
@@ -172,7 +173,7 @@ namespace clover {
T copts,
clang::DiagnosticsEngine &diag)
{
-#if HAVE_LLVM >= 0x1000
+#if LLVM_VERSION_MAJOR >= 10
return clang::CompilerInvocation::CreateFromArgs(
cinv, copts, diag);
#else
@@ -183,7 +184,7 @@ namespace clover {
template<typename T, typename M>
T get_abi_type(const T &arg_type, const M &mod) {
-#if HAVE_LLVM >= 0x0700
+#if LLVM_VERSION_MAJOR >= 7
return arg_type;
#else
::llvm::DataLayout dl(&mod);