mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-07-11 02:24:44 -06:00
Use std::string_view in cpu code
This commit is contained in:
parent
54b8b5399b
commit
e5cdae8c5a
@ -525,7 +525,7 @@ class jit_compiler final
|
||||
atomic_t<usz> m_disk_space = umax;
|
||||
|
||||
public:
|
||||
jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags = 0, std::function<u64(const std::string&)> symbols_cement = {}) noexcept;
|
||||
jit_compiler(const std::unordered_map<std::string, u64>& _link, std::string_view _cpu, u32 flags = 0, std::function<u64(const std::string&)> symbols_cement = {}) noexcept;
|
||||
jit_compiler& operator=(thread_state) noexcept;
|
||||
~jit_compiler() noexcept;
|
||||
|
||||
@ -571,7 +571,7 @@ public:
|
||||
u64 get(const std::string& name);
|
||||
|
||||
// Get CPU info
|
||||
static std::string cpu(const std::string& _cpu);
|
||||
static std::string cpu(std::string_view _cpu);
|
||||
|
||||
// Get system triple (PPU)
|
||||
static std::string triple1();
|
||||
|
||||
@ -551,9 +551,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
std::string jit_compiler::cpu(const std::string& _cpu)
|
||||
std::string jit_compiler::cpu(std::string_view _cpu)
|
||||
{
|
||||
std::string m_cpu = _cpu;
|
||||
std::string m_cpu = std::string(_cpu);
|
||||
|
||||
if (m_cpu.empty())
|
||||
{
|
||||
@ -681,7 +681,7 @@ bool jit_compiler::add_sub_disk_space(ssz space)
|
||||
}).second;
|
||||
}
|
||||
|
||||
jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags, std::function<u64(const std::string&)> symbols_cement) noexcept
|
||||
jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, std::string_view _cpu, u32 flags, std::function<u64(const std::string&)> symbols_cement) noexcept
|
||||
: m_context(new llvm::LLVMContext)
|
||||
, m_cpu(cpu(_cpu))
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ namespace utils
|
||||
// Printing utilities
|
||||
|
||||
template <typename T>
|
||||
concept Logger = requires (T& t, const std::string& msg)
|
||||
concept Logger = requires (T& t, std::string_view msg)
|
||||
{
|
||||
{ t.print(msg) };
|
||||
};
|
||||
@ -28,7 +28,7 @@ namespace utils
|
||||
: log(chan)
|
||||
{}
|
||||
|
||||
void print(const std::string& s)
|
||||
void print(std::string_view s)
|
||||
{
|
||||
log.error("%s", s);
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ namespace aarch64
|
||||
return result;
|
||||
}
|
||||
|
||||
gpr GHC_frame_preservation_pass::get_base_register_for_call(const std::string& callee_name, gpr default_reg)
|
||||
gpr GHC_frame_preservation_pass::get_base_register_for_call(std::string_view callee_name, gpr default_reg)
|
||||
{
|
||||
// We go over the base_register_lookup table and find the first matching pattern
|
||||
for (const auto& pattern : m_config.base_register_lookup)
|
||||
|
||||
@ -67,7 +67,7 @@ namespace aarch64
|
||||
|
||||
bool is_faux_function(const std::string& function_name);
|
||||
|
||||
gpr get_base_register_for_call(const std::string& callee_name, gpr default_reg = gpr::x19);
|
||||
gpr get_base_register_for_call(std::string_view callee_name, gpr default_reg = gpr::x19);
|
||||
|
||||
void process_leaf_function(llvm::IRBuilder<>* irb, llvm::Function& f);
|
||||
|
||||
|
||||
@ -5177,7 +5177,7 @@ bool ppu_initialize(const ppu_module<lv2_obj>& info, bool check_only, u64 file_s
|
||||
settings += ppu_settings::contains_symbol_resolver; // Avoid invalidating all modules for this purpose
|
||||
|
||||
// Write version, hash, CPU, settings
|
||||
fmt::append(obj_name, "v7-kusa-%s-%s-%s.obj", fmt::base57(output, 16), fmt::base57(settings), jit_compiler::cpu(g_cfg.core.llvm_cpu));
|
||||
fmt::append(obj_name, "v7-kusa-%s-%s-%s.obj", fmt::base57(output, 16), fmt::base57(settings), jit_compiler::cpu(g_cfg.core.llvm_cpu.to_string()));
|
||||
}
|
||||
|
||||
if (cpu ? cpu->state.all_of(cpu_flag::exit) : Emu.IsStopped())
|
||||
@ -5318,7 +5318,7 @@ bool ppu_initialize(const ppu_module<lv2_obj>& info, bool check_only, u64 file_s
|
||||
|
||||
{
|
||||
// Use another JIT instance
|
||||
jit_compiler jit2({}, g_cfg.core.llvm_cpu, 0x1);
|
||||
jit_compiler jit2({}, g_cfg.core.llvm_cpu.to_string(), 0x1);
|
||||
ppu_initialize2(jit2, part, cache_path, obj_name);
|
||||
}
|
||||
|
||||
@ -5351,7 +5351,7 @@ bool ppu_initialize(const ppu_module<lv2_obj>& info, bool check_only, u64 file_s
|
||||
// Initialize compiler instance
|
||||
while (jits.size() < utils::aligned_div<u64>(module_counter, c_moudles_per_jit) && is_being_used_in_emulation)
|
||||
{
|
||||
jits.emplace_back(std::make_shared<jit_compiler>(s_link_table, g_cfg.core.llvm_cpu, 0, symbols_cement));
|
||||
jits.emplace_back(std::make_shared<jit_compiler>(s_link_table, g_cfg.core.llvm_cpu.to_string(), 0, symbols_cement));
|
||||
|
||||
for (const auto& [addr, func] : *shared_map)
|
||||
{
|
||||
|
||||
@ -961,7 +961,7 @@ void PPUTranslator::WriteMemory(Value* addr, Value* value, bool is_be, u32 align
|
||||
m_ir->CreateAlignedStore(value, GetMemory(addr), llvm::MaybeAlign{align})->setVolatile(true);
|
||||
}
|
||||
|
||||
void PPUTranslator::CompilationError(const std::string& error)
|
||||
void PPUTranslator::CompilationError(std::string_view error)
|
||||
{
|
||||
ppu_log.error("LLVM: [0x%08x] Error: %s", m_addr + (m_reloc ? m_reloc->addr : 0), error);
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ public:
|
||||
}
|
||||
|
||||
// Handle compilation errors
|
||||
void CompilationError(const std::string& error);
|
||||
void CompilationError(std::string_view error);
|
||||
|
||||
PPUTranslator(llvm::LLVMContext& context, llvm::Module* _module, const ppu_module<lv2_obj>& info, llvm::ExecutionEngine& engine);
|
||||
~PPUTranslator();
|
||||
|
||||
@ -77,7 +77,7 @@ void spu_llvm_set_compile_context(spu_llvm_compile_context* context) noexcept
|
||||
class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
|
||||
{
|
||||
// JIT Instance
|
||||
jit_compiler m_jit{{}, jit_compiler::cpu(g_cfg.core.llvm_cpu)};
|
||||
jit_compiler m_jit{{}, jit_compiler::cpu(g_cfg.core.llvm_cpu.to_string())};
|
||||
|
||||
// Interpreter table size power
|
||||
const u8 m_interp_magn;
|
||||
@ -1592,7 +1592,7 @@ public:
|
||||
clear_transforms();
|
||||
#ifdef ARCH_ARM64
|
||||
{
|
||||
auto should_exclude_function = [](const std::string& fn_name)
|
||||
auto should_exclude_function = [](std::string_view fn_name)
|
||||
{
|
||||
return fn_name.starts_with("spu_") || fn_name.starts_with("tr_");
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user