From d7b223fde51c651d2e1aa856efaf19793a77e5e7 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sun, 12 May 2024 22:07:46 -0400 Subject: [PATCH] Implement `bgezal`/`bgezall` (#23) --- src/main.cpp | 1 + src/recompilation.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 10231ca..ed5be02 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1182,6 +1182,7 @@ int main(int argc, char** argv) { RabbitizerConfig_Cfg.pseudos.pseudoBeqz = false; RabbitizerConfig_Cfg.pseudos.pseudoBnez = false; RabbitizerConfig_Cfg.pseudos.pseudoNot = false; + RabbitizerConfig_Cfg.pseudos.pseudoBal = false; std::vector relocatable_sections_ordered{}; diff --git a/src/recompilation.cpp b/src/recompilation.cpp index 38ad6ff..8c5bf4e 100644 --- a/src/recompilation.cpp +++ b/src/recompilation.cpp @@ -638,6 +638,15 @@ bool process_instruction(const RecompPort::Context& context, const RecompPort::C case InstrId::cpu_break: print_line("do_break({})", instr_vram); break; + case InstrId::cpu_bgezall: + is_branch_likely = true; + [[fallthrough]]; + case InstrId::cpu_bgezal: + print_indent(); + print_branch_condition("if (SIGNED({}{}) >= 0) {{", ctx_gpr_prefix(rs), rs); + print_func_call(instr.getBranchVramGeneric()); + print_line("}}"); + break; // Cop1 loads/stores case InstrId::cpu_mtc1: