summaryrefslogtreecommitdiff
path: root/arch/mips/il.cpp
diff options
context:
space:
mode:
authorRong "Mantle" Bao <webmaster@csmantle.top>2025-09-06 14:29:28 +0800
committerBrandon Miller <brandon@vector35.com>2025-12-11 15:10:05 -0500
commit44a4945e5c3532dfaccbad3f23622464f0173691 (patch)
treeac170c8abd90d81dd74cd40d160e92c185aa434c /arch/mips/il.cpp
parent7c0484defff7f1008f62e0181f81e19013531ff1 (diff)
[MIPS] Mark `jalr[.hb] $zero, $ra` as a return instruction
Diffstat (limited to 'arch/mips/il.cpp')
-rw-r--r--arch/mips/il.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/mips/il.cpp b/arch/mips/il.cpp
index bfbfeeed..5700acbc 100644
--- a/arch/mips/il.cpp
+++ b/arch/mips/il.cpp
@@ -1430,7 +1430,10 @@ bool GetLowLevelILForInstruction(Architecture* arch, uint64_t addr, LowLevelILFu
{
operand = 2;
}
- il.AddInstruction(il.Call(ReadILOperand(il, instr, operand, registerSize(instr.operands[operand]), addrSize, true)));
+ if (operand == 2 && op1.reg == REG_ZERO && op2.reg == REG_RA)
+ il.AddInstruction(il.Return(il.Register(addrSize, REG_RA)));
+ else
+ il.AddInstruction(il.Call(ReadILOperand(il, instr, operand, registerSize(instr.operands[operand]), addrSize, true)));
}
break;
case MIPS_JR: