1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00

LLVM CPU override option

This commit is contained in:
Nekotekina 2017-03-14 15:23:07 +03:00
parent b45cea1434
commit 07646c2124
3 changed files with 11 additions and 4 deletions

View File

@ -246,8 +246,9 @@ static void dummy()
{
}
jit_compiler::jit_compiler(std::unordered_map<std::string, std::uintptr_t> init_linkage_info)
jit_compiler::jit_compiler(std::unordered_map<std::string, std::uintptr_t> init_linkage_info, std::string _cpu)
: m_link(std::move(init_linkage_info))
, m_cpu(std::move(_cpu))
{
#ifdef _MSC_VER
m_link.emplace("__chkstk", (u64)&dummy);
@ -259,7 +260,11 @@ jit_compiler::jit_compiler(std::unordered_map<std::string, std::uintptr_t> init_
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
LLVMLinkInMCJIT();
m_cpu = llvm::sys::getHostCPUName();
if (m_cpu.empty())
{
m_cpu = llvm::sys::getHostCPUName();
}
if (m_cpu == "skylake")
{

View File

@ -41,7 +41,7 @@ class jit_compiler final
void init();
public:
jit_compiler(std::unordered_map<std::string, std::uintptr_t>);
jit_compiler(std::unordered_map<std::string, std::uintptr_t>, std::string _cpu);
~jit_compiler();
// Compile module

View File

@ -94,6 +94,8 @@ cfg::map_entry<ppu_decoder_type> g_cfg_ppu_decoder(cfg::root.core, "PPU Decoder"
cfg::bool_entry g_cfg_llvm_logs(cfg::root.core, "Save LLVM logs");
cfg::string_entry g_cfg_llvm_cpu(cfg::root.core, "Use LLVM CPU");
const ppu_decoder<ppu_interpreter_precise> s_ppu_interpreter_precise;
const ppu_decoder<ppu_interpreter_fast> s_ppu_interpreter_fast;
@ -928,7 +930,7 @@ extern void ppu_initialize(const ppu_module& info)
}
}
const auto jit = fxm::make<jit_compiler>(std::move(link_table));
const auto jit = fxm::make<jit_compiler>(std::move(link_table), g_cfg_llvm_cpu.get());
LOG_SUCCESS(PPU, "LLVM: JIT initialized (%s)", jit->cpu());
}