From 857eac3d1046c8a598127950533f44af4e3ff541 Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Wed, 15 Jan 2025 19:49:56 +0200 Subject: [PATCH] PPU Analyzer: Remove ppu_function::name to lower sizeof(ppu_function) --- rpcs3/Emu/Cell/PPUAnalyser.h | 3 +-- rpcs3/Emu/Cell/PPUThread.cpp | 5 +---- rpcs3/Emu/Cell/PPUTranslator.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUAnalyser.h b/rpcs3/Emu/Cell/PPUAnalyser.h index f9bc1ca82b..6b45688134 100644 --- a/rpcs3/Emu/Cell/PPUAnalyser.h +++ b/rpcs3/Emu/Cell/PPUAnalyser.h @@ -14,7 +14,7 @@ #include "PPUOpcodes.h" // PPU Function Attributes -enum class ppu_attr : u32 +enum class ppu_attr : u8 { known_size, no_return, @@ -38,7 +38,6 @@ struct ppu_function std::map blocks{}; // Basic blocks: addr -> size std::set calls{}; // Set of called functions std::set callers{}; - mutable std::string name{}; // Function name struct iterator { diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 8b246a79f6..ee7b4fa885 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -4908,9 +4908,6 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s part.local_bounds.first = std::min(part.local_bounds.first, func.addr); part.local_bounds.second = std::max(part.local_bounds.second, func.addr + func.size); - // Fixup some information - func.name = fmt::format("__0x%x", func.addr - reloc); - bsize += func.size; fpos++; @@ -5473,7 +5470,7 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module { if (func.size) { - const auto f = cast(_module->getOrInsertFunction(func.name, _func).getCallee()); + const auto f = cast(_module->getOrInsertFunction(fmt::format("__0x%x", func.addr - reloc), _func).getCallee()); f->setCallingConv(CallingConv::GHC); f->addParamAttr(1, llvm::Attribute::NoAlias); f->addFnAttr(Attribute::NoUnwind); diff --git a/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/Emu/Cell/PPUTranslator.cpp index 806762dc6b..28eb844d7c 100644 --- a/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -185,7 +185,12 @@ bool ppu_test_address_may_be_mmio(std::span> insts); Function* PPUTranslator::Translate(const ppu_function& info) { - m_function = m_module->getFunction(info.name); + // Instruction address is (m_addr + base) + const u64 base = m_reloc ? m_reloc->addr : 0; + m_addr = info.addr - base; + m_attr = m_info.attr + info.attr; + + m_function = m_module->getFunction(fmt::format("__0x%x", m_addr)); std::fill(std::begin(m_globals), std::end(m_globals), nullptr); std::fill(std::begin(m_locals), std::end(m_locals), nullptr); @@ -193,11 +198,6 @@ Function* PPUTranslator::Translate(const ppu_function& info) IRBuilder<> irb(BasicBlock::Create(m_context, "__entry", m_function)); m_ir = &irb; - // Instruction address is (m_addr + base) - const u64 base = m_reloc ? m_reloc->addr : 0; - m_addr = info.addr - base; - m_attr = m_info.attr + info.attr; - // Don't emit check in small blocks without terminator bool need_check = info.size >= 16;