mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 10:20:09 +01:00
clover: replace major llvm version checks with LLVM_VERSION_MAJOR
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Acked-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
parent
08890068c5
commit
7527144383
2 changed files with 19 additions and 17 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue