SPU LLVM: Avoid raw pointers

This commit is contained in:
Elad 2026-07-06 23:16:45 +03:00
parent c198e220e2
commit ca029e5523
2 changed files with 8 additions and 3 deletions

View File

@ -9987,6 +9987,11 @@ std::array<reg_state_t, s_reg_max>& block_reg_info::evaluate_start_state(const s
void spu_recompiler_base::add_pattern(inst_attr attr, u32 start, u64 info, std::shared_ptr<void> info_ptr)
{
if (m_inst_attrs[start / 4] != inst_attr::none)
{
fmt::throw_exception("SPU Pattern is occupied! (start=0x%x)", start);
}
m_patterns[start] = pattern_info{info, info_ptr};
m_inst_attrs[start / 4] = attr;
}

View File

@ -210,7 +210,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
function_info* m_finfo = nullptr;
// Reduced Loop Pattern information (if available)
reduced_loop_t* m_reduced_loop_info = nullptr;
std::shared_ptr<reduced_loop_t> m_reduced_loop_info;
// All blocks in the current function chunk
std::unordered_map<u32, block_info, value_hash<u32, 2>> m_blocks;
@ -2689,7 +2689,7 @@ public:
}
const bool is_reduced_loop = m_inst_attrs[(baddr - start) / 4] == inst_attr::reduced_loop;
m_reduced_loop_info = is_reduced_loop ? std::static_pointer_cast<reduced_loop_t>(ensure(m_patterns.at(baddr - start).info_ptr)).get() : nullptr;
m_reduced_loop_info = is_reduced_loop ? std::static_pointer_cast<reduced_loop_t>(ensure(m_patterns.at(baddr - start).info_ptr)) : nullptr;
BasicBlock* block_optimization_phi_parent = nullptr;
const auto block_optimization_inner = is_reduced_loop ? BasicBlock::Create(m_context, fmt::format("b-loop-it-0x%x", m_pos), m_function) : nullptr;
@ -7813,7 +7813,7 @@ public:
value_t<f32[4]> clamp_smax(value_t<f32[4]> v, u32 gpr = s_reg_max)
{
if (m_reduced_loop_info && gpr < s_reg_max && m_reduced_loop_info->is_gpr_not_NaN_hint(gpr))
if (gpr < s_reg_max && m_reduced_loop_info && m_reduced_loop_info->is_gpr_not_NaN_hint(gpr))
{
return v;
}