Commit 6910dd70 by Richard Kenner

(output_function_epilogue): Restore registers using sp+ instead of fp(n) in leaf functions.

(output_function_epilogue): Restore registers using sp+ instead of fp(n) in
leaf functions.
(USE_MOVQ, use_movq): Function replaced by macro.

From-SVN: r11560
parent a9f6f5aa
...@@ -290,6 +290,7 @@ output_function_epilogue (stream, size) ...@@ -290,6 +290,7 @@ output_function_epilogue (stream, size)
int fsize = (size + 3) & -4; int fsize = (size + 3) & -4;
int big = 0; int big = 0;
rtx insn = get_last_insn (); rtx insn = get_last_insn ();
int restore_from_sp = 0;
/* If the last insn was a BARRIER, we don't have to write any code. */ /* If the last insn was a BARRIER, we don't have to write any code. */
if (GET_CODE (insn) == NOTE) if (GET_CODE (insn) == NOTE)
...@@ -337,8 +338,10 @@ output_function_epilogue (stream, size) ...@@ -337,8 +338,10 @@ output_function_epilogue (stream, size)
mask |= 1 << regno; mask |= 1 << regno;
} }
offset = foffset + nregs * 4; offset = foffset + nregs * 4;
restore_from_sp = ! frame_pointer_needed
|| (! current_function_calls_alloca && leaf_function_p ());
if (offset + fsize >= 0x8000 if (offset + fsize >= 0x8000
&& frame_pointer_needed && ! restore_from_sp
&& (mask || fmask || fpoffset)) && (mask || fmask || fpoffset))
{ {
#ifdef MOTOROLA #ifdef MOTOROLA
...@@ -374,7 +377,7 @@ output_function_epilogue (stream, size) ...@@ -374,7 +377,7 @@ output_function_epilogue (stream, size)
offset + fsize, reg_names[i]); offset + fsize, reg_names[i]);
#endif #endif
} }
else if (! frame_pointer_needed) else if (restore_from_sp)
{ {
#ifdef MOTOROLA #ifdef MOTOROLA
asm_fprintf (stream, "\t%Omove.l (%Rsp)+,%s\n", asm_fprintf (stream, "\t%Omove.l (%Rsp)+,%s\n",
...@@ -415,7 +418,7 @@ output_function_epilogue (stream, size) ...@@ -415,7 +418,7 @@ output_function_epilogue (stream, size)
offset + fsize, mask); offset + fsize, mask);
#endif #endif
} }
else if (! frame_pointer_needed) else if (restore_from_sp)
{ {
#ifdef MOTOROLA #ifdef MOTOROLA
asm_fprintf (stream, "\tmovm.l (%Rsp)+,%0I0x%x\n", mask); asm_fprintf (stream, "\tmovm.l (%Rsp)+,%0I0x%x\n", mask);
...@@ -452,7 +455,7 @@ output_function_epilogue (stream, size) ...@@ -452,7 +455,7 @@ output_function_epilogue (stream, size)
foffset + fsize, fmask); foffset + fsize, fmask);
#endif #endif
} }
else if (! frame_pointer_needed) else if (restore_from_sp)
{ {
#ifdef MOTOROLA #ifdef MOTOROLA
asm_fprintf (stream, "\tfmovm (%Rsp)+,%0I0x%x\n", fmask); asm_fprintf (stream, "\tfmovm (%Rsp)+,%0I0x%x\n", fmask);
...@@ -491,7 +494,7 @@ output_function_epilogue (stream, size) ...@@ -491,7 +494,7 @@ output_function_epilogue (stream, size)
fpoffset + fsize, reg_names[regno]); fpoffset + fsize, reg_names[regno]);
#endif #endif
} }
else if (! frame_pointer_needed) else if (restore_from_sp)
{ {
#ifdef MOTOROLA #ifdef MOTOROLA
asm_fprintf (stream, "\tfpmovd (%Rsp)+,%s\n", asm_fprintf (stream, "\tfpmovd (%Rsp)+,%s\n",
...@@ -1051,11 +1054,7 @@ legitimize_pic_address (orig, mode, reg) ...@@ -1051,11 +1054,7 @@ legitimize_pic_address (orig, mode, reg)
typedef enum { MOVL, SWAP, NEGW, NOTW, NOTB, MOVQ } CONST_METHOD; typedef enum { MOVL, SWAP, NEGW, NOTW, NOTB, MOVQ } CONST_METHOD;
use_movq (i) #define USE_MOVQ(i) ((unsigned)((i) + 128) <= 255)
int i;
{
return (i >= -128 && i <= 127);
}
CONST_METHOD CONST_METHOD
const_method (constant) const_method (constant)
...@@ -1065,21 +1064,21 @@ const_method (constant) ...@@ -1065,21 +1064,21 @@ const_method (constant)
unsigned u; unsigned u;
i = INTVAL (constant); i = INTVAL (constant);
if (use_movq (i)) if (USE_MOVQ (i))
return MOVQ; return MOVQ;
/* if -256 < N < 256 but N is not in range for a moveq /* if -256 < N < 256 but N is not in range for a moveq
N^ff will be, so use moveq #N^ff, dreg; not.b dreg. */ N^ff will be, so use moveq #N^ff, dreg; not.b dreg. */
if (use_movq (i ^ 0xff)) if (USE_MOVQ (i ^ 0xff))
return NOTB; return NOTB;
/* Likewise, try with not.w */ /* Likewise, try with not.w */
if (use_movq (i ^ 0xffff)) if (USE_MOVQ (i ^ 0xffff))
return NOTW; return NOTW;
/* This is the only value where neg.w is useful */ /* This is the only value where neg.w is useful */
if (i == -65408) if (i == -65408)
return NEGW; return NEGW;
/* Try also with swap */ /* Try also with swap */
u = i; u = i;
if (use_movq ((u >> 16) | (u << 16))) if (USE_MOVQ ((u >> 16) | (u << 16)))
return SWAP; return SWAP;
/* Otherwise, use move.l */ /* Otherwise, use move.l */
return MOVL; return MOVL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment