aboutsummaryrefslogtreecommitdiff
path: root/src/lj_emit_mips.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_emit_mips.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lj_emit_mips.h b/src/lj_emit_mips.h
index 8e7ee66f..f3db918f 100644
--- a/src/lj_emit_mips.h
+++ b/src/lj_emit_mips.h
@@ -152,16 +152,18 @@ static void emit_jmp(ASMState *as, MCode *target)
152 emit_branch(as, MIPSI_B, RID_ZERO, RID_ZERO, (target)); 152 emit_branch(as, MIPSI_B, RID_ZERO, RID_ZERO, (target));
153} 153}
154 154
155static void emit_call(ASMState *as, void *target) 155static void emit_call(ASMState *as, void *target, int needcfa)
156{ 156{
157 MCode *p = as->mcp; 157 MCode *p = as->mcp;
158 *--p = MIPSI_NOP; 158 *--p = MIPSI_NOP;
159 if ((((uintptr_t)target ^ (uintptr_t)p) >> 28) == 0) 159 if ((((uintptr_t)target ^ (uintptr_t)p) >> 28) == 0) {
160 *--p = MIPSI_JAL | (((uintptr_t)target >>2) & 0x03ffffffu); 160 *--p = MIPSI_JAL | (((uintptr_t)target >>2) & 0x03ffffffu);
161 else /* Target out of range: need indirect call. */ 161 } else { /* Target out of range: need indirect call. */
162 *--p = MIPSI_JALR | MIPSF_S(RID_CFUNCADDR); 162 *--p = MIPSI_JALR | MIPSF_S(RID_CFUNCADDR);
163 needcfa = 1;
164 }
163 as->mcp = p; 165 as->mcp = p;
164 ra_allockreg(as, i32ptr(target), RID_CFUNCADDR); 166 if (needcfa) ra_allockreg(as, i32ptr(target), RID_CFUNCADDR);
165} 167}
166 168
167/* -- Emit generic operations --------------------------------------------- */ 169/* -- Emit generic operations --------------------------------------------- */