mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-16 23:17:29 +00:00
llvm: add support for LLVM 17
This commit is contained in:
parent
7bb94227be
commit
50df01d00e
9
3rdparty/llvm/CMakeLists.txt
vendored
9
3rdparty/llvm/CMakeLists.txt
vendored
@ -38,6 +38,10 @@ if(WITH_LLVM)
|
||||
|
||||
# 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()
|
||||
@ -50,10 +54,13 @@ if(WITH_LLVM)
|
||||
endif()
|
||||
|
||||
find_package(LLVM 16.0 CONFIG)
|
||||
if(NOT LLVM_FOUND)
|
||||
find_package(LLVM 17.0 CONFIG)
|
||||
endif()
|
||||
|
||||
if (NOT LLVM_FOUND)
|
||||
if (LLVM_VERSION AND LLVM_VERSION_MAJOR LESS 16)
|
||||
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 16. \
|
||||
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required versions 16...17. \
|
||||
Enable BUILD_LLVM option to build LLVM from included as a git submodule.")
|
||||
endif()
|
||||
|
||||
|
@ -866,7 +866,7 @@ void asmjit::simd_builder::vec_extract_gpr(u32 esize, const x86::Gp& dst, const
|
||||
#endif
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/TargetParser/Host.h"
|
||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
|
||||
#include "llvm/ExecutionEngine/ObjectCache.h"
|
||||
|
@ -922,6 +922,14 @@ inline llvm_div<T1, T2> operator /(T1&& a1, T2&& a2)
|
||||
return {a1, a2};
|
||||
}
|
||||
|
||||
inline llvm::Constant* getZeroValueForNegation(llvm::Type* Ty)
|
||||
{
|
||||
if (Ty->isFPOrFPVectorTy())
|
||||
return llvm::ConstantFP::getNegativeZero(Ty);
|
||||
|
||||
return llvm::Constant::getNullValue(Ty);
|
||||
}
|
||||
|
||||
template <typename A1, typename T = llvm_common_t<A1>>
|
||||
struct llvm_neg
|
||||
{
|
||||
@ -971,7 +979,7 @@ struct llvm_neg
|
||||
{
|
||||
v1 = i->getOperand(1);
|
||||
|
||||
if (i->getOperand(0) == llvm::ConstantFP::getZeroValueForNegation(v1->getType()))
|
||||
if (i->getOperand(0) == getZeroValueForNegation(v1->getType()))
|
||||
{
|
||||
if (auto r1 = a1.match(v1, _m); v1)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@
|
||||
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
|
||||
#endif
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/TargetParser/Host.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#if LLVM_VERSION_MAJOR < 17
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
@ -4373,7 +4373,7 @@ void spu_recompiler_base::dump(const spu_program& result, std::string& out)
|
||||
#if LLVM_VERSION_MAJOR < 17
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#endif
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/TargetParser/Host.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
@ -6304,9 +6304,15 @@ public:
|
||||
pm.add(createEarlyCSEPass());
|
||||
pm.add(createCFGSimplificationPass());
|
||||
//pm.add(createNewGVNPass());
|
||||
#if LLVM_VERSION_MAJOR < 17
|
||||
pm.add(createDeadStoreEliminationPass());
|
||||
#endif
|
||||
pm.add(createLICMPass());
|
||||
#if LLVM_VERSION_MAJOR < 17
|
||||
pm.add(createAggressiveDCEPass());
|
||||
#else
|
||||
pm.add(createDeadCodeEliminationPass());
|
||||
#endif
|
||||
//pm.add(createLintPass()); // Check
|
||||
|
||||
for (auto& f : *m_module)
|
||||
@ -6772,8 +6778,12 @@ public:
|
||||
// Basic optimizations
|
||||
pm.add(createEarlyCSEPass());
|
||||
pm.add(createCFGSimplificationPass());
|
||||
#if LLVM_VERSION_MAJOR < 17
|
||||
pm.add(createDeadStoreEliminationPass());
|
||||
pm.add(createAggressiveDCEPass());
|
||||
#else
|
||||
pm.add(createDeadCodeEliminationPass());
|
||||
#endif
|
||||
//pm.add(createLintPass());
|
||||
|
||||
for (auto& f : *_module)
|
||||
|
Loading…
Reference in New Issue
Block a user