From 44a4945e5c3532dfaccbad3f23622464f0173691 Mon Sep 17 00:00:00 2001 From: "Rong \"Mantle\" Bao" Date: Sat, 6 Sep 2025 14:29:28 +0800 Subject: [MIPS] Mark `jalr[.hb] $zero, $ra` as a return instruction --- arch/mips/arch_mips.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'arch/mips/arch_mips.cpp') diff --git a/arch/mips/arch_mips.cpp b/arch/mips/arch_mips.cpp index 6150e578..51a5d411 100644 --- a/arch/mips/arch_mips.cpp +++ b/arch/mips/arch_mips.cpp @@ -332,10 +332,12 @@ protected: result.AddBranch(CallDestination, instr.operands[0].immediate, nullptr, hasBranchDelay); break; - //Jmp to register register value is unknown case MIPS_JALR: case MIPS_JALR_HB: - result.delaySlots = 1; + if (instr.operands[0].reg == REG_ZERO && instr.operands[1].reg == REG_RA) + result.AddBranch(FunctionReturn, 0, nullptr, hasBranchDelay); + else + result.AddBranch(UnresolvedBranch, 0, nullptr, hasBranchDelay); break; case MIPS_BGEZAL: -- cgit v1.3.1