Don't print save/restore calls when non volatile registers as local variables option is enabled.

This commit is contained in:
Skyth 2024-09-27 19:26:13 +03:00
parent acd49010e6
commit d5f44c11c5
2 changed files with 20 additions and 2 deletions

View File

@ -157,7 +157,14 @@ bool Recompiler::Recompile(
if (targetSymbol != image.symbols.end() && targetSymbol->address == address && targetSymbol->type == Symbol_Function)
{
println("\t{}(ctx, base);", targetSymbol->name);
if (config.nonVolatileRegistersAsLocalVariables && (targetSymbol->name.starts_with("__rest") || targetSymbol->name.starts_with("__save")))
{
// print nothing
}
else
{
println("\t{}(ctx, base);", targetSymbol->name);
}
}
else
{

View File

@ -20,7 +20,18 @@ void SWARecompiler::Analyse()
f.base = fn.BeginAddress;
f.size = fn.FunctionLength * 4;
image.symbols.emplace(std::format("sub_{:X}", f.base), f.base, f.size, Symbol_Function);
std::string name;
if (f.base == 0x831B0B40) name = "__restgprlr_14";
else if (f.base == 0x831B0AF0) name = "__savegprlr_14";
else if (f.base == 0x831B144C) name = "__restfpr_14";
else if (f.base == 0x831B1400) name = "__savefpr_14";
else if (f.base == 0x831B36E8) name = "__restvmx_14";
else if (f.base == 0x831B3450) name = "__savevmx_14";
else if (f.base == 0x831B377C) name = "__restvmx_64";
else if (f.base == 0x831B34E4) name = "__savevmx_64";
else name = std::format("sub_{:X}", f.base);
image.symbols.emplace(name, f.base, f.size, Symbol_Function);
}
for (size_t i = 15; i < 128; i++)