llvm: update to 18

This commit is contained in:
oltolm 2024-03-10 12:56:16 +01:00 committed by Megamouse
parent 175aa510c8
commit c40826c140
3 changed files with 11 additions and 15 deletions

View File

@ -36,12 +36,7 @@ if(WITH_LLVM)
set(STATIC_LINK_LLVM ON CACHE BOOL "Link against LLVM statically. This will get set to ON if you build LLVM from the submodule." FORCE)
# now tries to find LLVM again
find_package(LLVM 16.0 CONFIG)
if(NOT LLVM_FOUND)
set(LLVM_DIR "${CMAKE_CURRENT_BINARY_DIR}/llvm_build/lib/cmake/llvm/")
find_package(LLVM 17.0 CONFIG)
endif()
if(NOT LLVM_FOUND)
message(FATAL_ERROR "Couldn't build LLVM from the submodule. You might need to run `git submodule update --init`")
endif()
@ -53,18 +48,14 @@ if(WITH_LLVM)
set(LLVM_DIR ${CMAKE_SOURCE_DIR}/${LLVM_DIR})
endif()
find_package(LLVM 16.0 CONFIG)
if(NOT LLVM_FOUND)
find_package(LLVM 17.0 CONFIG)
endif()
find_package(LLVM CONFIG)
if (NOT LLVM_FOUND)
if (LLVM_VERSION AND LLVM_VERSION_MAJOR LESS 16)
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required versions 16...17. \
message(FATAL_ERROR "Can't find LLVM libraries from the CMAKE_PREFIX_PATH path or LLVM_DIR. \
Enable BUILD_LLVM option to build LLVM from included as a git submodule.")
endif()
message(FATAL_ERROR "Can't find LLVM libraries from the CMAKE_PREFIX_PATH path or LLVM_DIR. \
if (LLVM_VERSION VERSION_LESS 16)
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 16 or above. \
Enable BUILD_LLVM option to build LLVM from included as a git submodule.")
endif()
endif()

View File

@ -30,6 +30,7 @@ LOG_CHANNEL(jit_log, "JIT");
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#endif
#include <llvm/Support/CodeGen.h>
#include "llvm/Support/TargetSelect.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
@ -542,7 +543,11 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, co
.setErrorStr(&result)
.setEngineKind(llvm::EngineKind::JIT)
.setMCJITMemoryManager(std::move(mem))
#if LLVM_VERSION_MAJOR < 18
.setOptLevel(llvm::CodeGenOpt::Aggressive)
#else
.setOptLevel(llvm::CodeGenOptLevel::Aggressive)
#endif
.setCodeModel(flags & 0x2 ? llvm::CodeModel::Large : llvm::CodeModel::Small)
#ifdef __APPLE__
//.setCodeModel(llvm::CodeModel::Large)

View File

@ -1047,7 +1047,7 @@ template <typename CT> requires requires (const CT& x) { std::size(x); }
const char* file = __builtin_FILE(),
const char* func = __builtin_FUNCTION())
{
// TODO: Supoort std::array
// TODO: Support std::array
constexpr bool is_const = std::is_array_v<std::remove_cvref_t<CT>>;
if constexpr (is_const)