Skip to content

Commit

Permalink
Update LLVM to new llvm-mirror (LLVM 11)
Browse files Browse the repository at this point in the history
Use clang-cl to build LLVM on Windows.
  • Loading branch information
Nekotekina committed Mar 3, 2020
1 parent 68f50c7 commit 5b0476e
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ignore = dirty
[submodule "llvm"]
path = llvm
url = https://github.com/RPCS3/llvm
url = https://github.com/RPCS3/llvm-mirror
ignore = dirty
[submodule "Vulkan/glslang"]
path = Vulkan/glslang
Expand Down
2 changes: 1 addition & 1 deletion .travis/build-linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd rpcs3
git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/span 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/libusb 3rdparty/FAudio Vulkan/glslang

# Download pre-compiled llvm libs
curl -sLO https://github.com/RPCS3/llvm/releases/download/continuous-linux-master/llvmlibs-linux.tar.gz
curl -sLO https://github.com/RPCS3/llvm-mirror/releases/download/custom-build/llvmlibs-linux.tar.gz
mkdir llvmlibs
tar -xzf ./llvmlibs-linux.tar.gz -C llvmlibs

Expand Down
10 changes: 5 additions & 5 deletions 3rdparty/llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(WITH_LLVM)
option(LLVM_INCLUDE_TOOLS OFF)
option(LLVM_INCLUDE_UTILS OFF)
option(WITH_POLLY OFF)
option(LLVM_ENABLE_CXX1Z TRUE)
option(LLVM_CCACHE_BUILD ON)

set(CXX_FLAGS_OLD ${CMAKE_CXX_FLAGS})

Expand All @@ -27,7 +27,7 @@ if(WITH_LLVM)
set(CMAKE_CXX_FLAGS ${CXX_FLAGS_OLD})

# now tries to find LLVM again
find_package(LLVM 10.0 CONFIG)
find_package(LLVM 11.0 CONFIG)
if(NOT LLVM_FOUND)
message(FATAL_ERROR "Couldn't build LLVM from the submodule. You might need to run `git submodule update --init`")
endif()
Expand All @@ -40,11 +40,11 @@ if(WITH_LLVM)
set(LLVM_DIR ${CMAKE_SOURCE_DIR}/${LLVM_DIR})
endif()

find_package(LLVM 10.0 CONFIG)
find_package(LLVM 11.0 CONFIG)

if (NOT LLVM_FOUND)
if (LLVM_VERSION AND LLVM_VERSION_MAJOR LESS 9)
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 9.0. \
if (LLVM_VERSION AND LLVM_VERSION_MAJOR LESS 11)
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 11.0. \
Enable BUILD_LLVM_SUBMODULE option to build LLVM from included as a git submodule.")
endif()

Expand Down
6 changes: 3 additions & 3 deletions Utilities/JIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ class ObjectCache final : public llvm::ObjectCache
void notifyObjectCompiled(const llvm::Module* module, llvm::MemoryBufferRef obj) override
{
std::string name = m_path;
name.append(module->getName());
name.append(module->getName().data());
//fs::file(name, fs::rewrite).write(obj.getBufferStart(), obj.getBufferSize());
name.append(".gz");

Expand Down Expand Up @@ -1026,7 +1026,7 @@ class ObjectCache final : public llvm::ObjectCache
std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module* module) override
{
std::string path = m_path;
path.append(module->getName());
path.append(module->getName().data());

if (auto buf = load(path))
{
Expand All @@ -1044,7 +1044,7 @@ std::string jit_compiler::cpu(const std::string& _cpu)

if (m_cpu.empty())
{
m_cpu = llvm::sys::getHostCPUName();
m_cpu = llvm::sys::getHostCPUName().operator std::string();

if (m_cpu == "sandybridge" ||
m_cpu == "ivybridge" ||
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ image: Visual Studio 2019

environment:
QTDIR: C:\Qt\5.14\msvc2017_64
LLVMLIBS: https://github.com/RPCS3/llvm/releases/download/continuous-master/llvmlibs.7z
LLVMLIBS: https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win/llvmlibs.7z
GLSLANG: https://www.dropbox.com/s/6e8w6t5dxh3ad4l/glslang.7z?dl=1
COMPATDB: https://rpcs3.net/compatibility?api=v1&export
VULKAN_SDK: "C:\\VulkanSDK\\1.1.126.0"
Expand Down
2 changes: 1 addition & 1 deletion llvm
Submodule llvm updated from 1394b1 to 0c0b09
1 change: 1 addition & 0 deletions rpcs3/Emu/CPU/CPUTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "llvm/IR/Module.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/IR/IntrinsicsX86.h"
#ifdef _MSC_VER
#pragma warning(pop)
#else
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/Cell/PPUTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,12 @@ Value* PPUTranslator::ReadMemory(Value* addr, Type* type, bool is_be, u32 align)
{
// Read, byteswap, bitcast
const auto int_type = m_ir->getIntNTy(size);
const auto value = m_ir->CreateAlignedLoad(GetMemory(addr, int_type), align, true);
const auto value = m_ir->CreateAlignedLoad(GetMemory(addr, int_type), llvm::MaybeAlign{align}, true);
return m_ir->CreateBitCast(Call(int_type, fmt::format("llvm.bswap.i%u", size), value), type);
}

// Read normally
return m_ir->CreateAlignedLoad(GetMemory(addr, type), align, true);
return m_ir->CreateAlignedLoad(GetMemory(addr, type), llvm::MaybeAlign{align}, true);
}

void PPUTranslator::WriteMemory(Value* addr, Value* value, bool is_be, u32 align)
Expand All @@ -558,7 +558,7 @@ void PPUTranslator::WriteMemory(Value* addr, Value* value, bool is_be, u32 align
}

// Write
m_ir->CreateAlignedStore(value, GetMemory(addr, value->getType()), align, true);
m_ir->CreateAlignedStore(value, GetMemory(addr, value->getType()), llvm::MaybeAlign{align}, true);
}

void PPUTranslator::CompilationError(const std::string& error)
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/SPURecompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4346,7 +4346,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
}

// Load unaligned code block from LS
llvm::Value* vls = m_ir->CreateAlignedLoad(_ptr<u32[8]>(data_addr, j - starta), 4);
llvm::Value* vls = m_ir->CreateAlignedLoad(_ptr<u32[8]>(data_addr, j - starta), llvm::MaybeAlign{4});

// Mask if necessary
if (holes)
Expand Down
2 changes: 1 addition & 1 deletion rpcs3_llvm.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Lib>
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='Debug - LLVM'">..\llvm_build\Debug\lib</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='Release - LLVM'">..\llvm_build\Release\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>LLVMProfileData.lib;LLVMDebugInfoCodeView.lib;LLVMDebugInfoMSF.lib;LLVMInstrumentation.lib;LLVMMCJIT.lib;LLVMRuntimeDyld.lib;LLVMVectorize.lib;LLVMX86CodeGen.lib;LLVMGlobalISel.lib;LLVMX86Disassembler.lib;LLVMExecutionEngine.lib;LLVMAsmPrinter.lib;LLVMSelectionDAG.lib;LLVMCodeGen.lib;LLVMScalarOpts.lib;LLVMInstCombine.lib;LLVMTransformUtils.lib;LLVMAnalysis.lib;LLVMTarget.lib;LLVMX86Desc.lib;LLVMObject.lib;LLVMMCParser.lib;LLVMBitReader.lib;LLVMCore.lib;LLVMX86Utils.lib;LLVMMC.lib;LLVMX86Info.lib;LLVMSupport.lib;LLVMMCDisassembler.lib;LLVMipo.lib;LLVMBinaryFormat.lib;LLVMPasses.lib;LLVMIRReader.lib;LLVMLinker.lib;LLVMAsmParser.lib;LLVMX86AsmParser.lib;LLVMDemangle.lib;LLVMDebugInfoDWARF.lib;LLVMRemarks.lib;LLVMBitstreamReader.lib;LLVMTextAPI.lib</AdditionalDependencies>
<AdditionalDependencies>LLVMProfileData.lib;LLVMDebugInfoCodeView.lib;LLVMDebugInfoMSF.lib;LLVMInstrumentation.lib;LLVMMCJIT.lib;LLVMRuntimeDyld.lib;LLVMVectorize.lib;LLVMX86CodeGen.lib;LLVMGlobalISel.lib;LLVMX86Disassembler.lib;LLVMExecutionEngine.lib;LLVMAsmPrinter.lib;LLVMSelectionDAG.lib;LLVMCodeGen.lib;LLVMScalarOpts.lib;LLVMInstCombine.lib;LLVMTransformUtils.lib;LLVMAnalysis.lib;LLVMTarget.lib;LLVMX86Desc.lib;LLVMObject.lib;LLVMMCParser.lib;LLVMBitReader.lib;LLVMCore.lib;LLVMX86Utils.lib;LLVMMC.lib;LLVMX86Info.lib;LLVMSupport.lib;LLVMMCDisassembler.lib;LLVMipo.lib;LLVMBinaryFormat.lib;LLVMPasses.lib;LLVMIRReader.lib;LLVMLinker.lib;LLVMAsmParser.lib;LLVMX86AsmParser.lib;LLVMDemangle.lib;LLVMDebugInfoDWARF.lib;LLVMRemarks.lib;LLVMBitstreamReader.lib;LLVMTextAPI.lib;LLVMCFGuard.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemGroup />
Expand Down

0 comments on commit 5b0476e

Please sign in to comment.