SPU: improve analyser (v5)

Fix jumptable analysis
This commit is contained in:
Nekotekina 2018-06-30 02:07:39 +03:00
parent 712632d28a
commit afd5af04f6

View File

@ -94,7 +94,7 @@ void spu_cache::initialize()
}
// SPU cache file (version + block size type)
const std::string loc = _main->cache + u8"spu-§" + fmt::to_lower(g_cfg.core.spu_block_size.to_string()) + "-v4.dat";
const std::string loc = _main->cache + "spu-" + fmt::to_lower(g_cfg.core.spu_block_size.to_string()) + "-v5.dat";
auto cache = std::make_shared<spu_cache>(loc);
@ -556,7 +556,7 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
add_block(pos + 4);
}
}
else if (type == spu_itype::BI && !op.d && !op.e)
else if (type == spu_itype::BI && g_cfg.core.spu_block_size != spu_block_size_type::safe && !op.d && !op.e && !sync)
{
// Analyse jump table (TODO)
std::basic_string<u32> jt_abs;
@ -590,6 +590,8 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
if (std::max(jt_abs.size(), jt_rel.size()) * 4 + start <= i)
{
// Neither type of jump table completes
jt_abs.clear();
jt_rel.clear();
break;
}
}
@ -619,6 +621,8 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
{
jt_abs.clear();
}
verify(HERE), jt_abs.size() != jt_rel.size();
}
if (jt_abs.size() >= jt_rel.size())
@ -685,6 +689,10 @@ std::vector<u32> spu_recompiler_base::block(const be_t<u32>* ls, u32 entry_point
LOG_WARNING(SPU, "[0x%x] No patterns detected (hbr=0x%x:0x%x)", pos, hbr_loc, hbr_tg);
}
}
else if (type == spu_itype::BI && sync)
{
LOG_NOTICE(SPU, "[0x%x] At 0x%x: ignoring indirect branch (SYNC)", result[0], pos);
}
if (type == spu_itype::BI || sl)
{