From: Eric Engestrom Date: Tue, 27 Aug 2019 23:07:00 +0000 (+0100) Subject: clover: replace major llvm version checks with LLVM_VERSION_MAJOR X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=75271443830c4a2d89b32b6cd73d7900a2985477;p=mesa.git clover: replace major llvm version checks with LLVM_VERSION_MAJOR Signed-off-by: Eric Engestrom Acked-by: Michel Dänzer --- 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 -#if HAVE_LLVM < 0x0400 +#include +#if LLVM_VERSION_MAJOR < 4 #include #else #include 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 +#if LLVM_VERSION_MAJOR < 4 #include #else #include @@ -48,7 +49,7 @@ #include #include #include -#if HAVE_LLVM >= 0x0400 +#if LLVM_VERSION_MAJOR >= 4 #include #else #include @@ -60,7 +61,7 @@ #include #include -#if HAVE_LLVM >= 0x0800 +#if LLVM_VERSION_MAJOR >= 8 #include #else #include @@ -72,22 +73,22 @@ namespace clover { template 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(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 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 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 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 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 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);