[MIPS] Mark `jalr[.hb] $zero, $ra` as a return instruction
This PR marks MIPS jalr[.hb] $zero, $ra as a return instruction.
Resolves #7355.
Effects
Before:
After:
Hi @psifertex and @zznop, I've rebased the branch onto the latest dev branch. Any progress on getting this reviewed? :)
Yes, I'll get this tested and merged today or tomorrow.
Looks like this code change affects jalr branches that don't use the zero operand too, and it causes regressions
Should be a simple fix. Looking into it now.
I'm going to go with:
case MIPS_JALR_HB:
if (instr.operands[0].reg == REG_ZERO && instr.operands[1].reg == REG_RA)
result.AddBranch(FunctionReturn, 0, nullptr, hasBranchDelay);
else
result.delaySlots = 1;
break;
I see that you were probably following the pattern for MIPS_JR/MIPS_JR_HB, but I think we want to continue to not do anything in cases where it's not a jalr $zero, $ra and let Binja figure out the branch type when lifting.
Merged your commit with the changes discussed above. This will be available in 5.3.8765-dev and later
Merged your commit with the changes discussed above. This will be available in 5.3.8765-dev and later
Thanks!