Commit ef8200df by Jim Wilson

*** empty log message ***

From-SVN: r662
parent 9b30bae2
...@@ -1923,17 +1923,16 @@ output_function_prologue (file, size, leaf_function) ...@@ -1923,17 +1923,16 @@ output_function_prologue (file, size, leaf_function)
} }
void void
output_function_epilogue (file, size, leaf_function, true_epilogue) output_function_epilogue (file, size, leaf_function)
FILE *file; FILE *file;
int size; int size;
int leaf_function;
{ {
int n_fregs, i; int n_fregs, i;
char *ret; char *ret;
if (leaf_label) if (leaf_label)
{ {
if (leaf_function < 0)
abort ();
emit_label_after (leaf_label, get_last_insn ()); emit_label_after (leaf_label, get_last_insn ());
final_scan_insn (get_last_insn (), file, 0, 0, 1); final_scan_insn (get_last_insn (), file, 0, 0, 1);
} }
...@@ -1962,66 +1961,46 @@ output_function_epilogue (file, size, leaf_function, true_epilogue) ...@@ -1962,66 +1961,46 @@ output_function_epilogue (file, size, leaf_function, true_epilogue)
else else
ret = (current_function_returns_struct ? "jmp %i7+12" : "ret"); ret = (current_function_returns_struct ? "jmp %i7+12" : "ret");
/* Tail calls have to do this work themselves. */ if (TARGET_EPILOGUE || leaf_label)
if (leaf_function >= 0)
{ {
if (TARGET_EPILOGUE || leaf_label) int old_target_epilogue = TARGET_EPILOGUE;
{ target_flags &= ~old_target_epilogue;
int old_target_epilogue = TARGET_EPILOGUE;
target_flags &= ~old_target_epilogue;
if (! leaf_function) if (! leaf_function)
{
/* If we wound up with things in our delay slot, flush them here. */
if (current_function_epilogue_delay_list)
{ {
/* If we wound up with things in our delay slot, rtx insn = emit_jump_insn_after (gen_rtx (RETURN, VOIDmode),
flush them here. */ get_last_insn ());
if (current_function_epilogue_delay_list) PATTERN (insn) = gen_rtx (PARALLEL, VOIDmode,
{ gen_rtvec (2,
rtx insn = emit_jump_insn_after (gen_rtx (RETURN, VOIDmode), PATTERN (XEXP (current_function_epilogue_delay_list, 0)),
get_last_insn ()); PATTERN (insn)));
PATTERN (insn) = gen_rtx (PARALLEL, VOIDmode, final_scan_insn (insn, file, 1, 0, 1);
gen_rtvec (2,
PATTERN (XEXP (current_function_epilogue_delay_list, 0)),
PATTERN (insn)));
final_scan_insn (insn, file, 1, 0, 1);
}
else
fprintf (file, "\t%s\n\trestore\n", ret);
}
else if (actual_fsize < 4096)
{
if (current_function_epilogue_delay_list)
{
fprintf (file, "\t%s\n", ret);
final_scan_insn (XEXP (current_function_epilogue_delay_list, 0),
file, 1, 0, 1);
}
else
fprintf (file, "\t%s\n\tadd %%sp,%d,%%sp\n",
ret, actual_fsize);
} }
else else
fprintf (file, "\t%s\n\trestore\n", ret);
}
else if (actual_fsize < 4096)
{
if (current_function_epilogue_delay_list)
{ {
if (current_function_epilogue_delay_list) fprintf (file, "\t%s\n", ret);
abort (); final_scan_insn (XEXP (current_function_epilogue_delay_list, 0),
fprintf (file, "\tsethi %%hi(%d),%%g1\n\tor %%g1,%%lo(%d),%%g1\n\t%s\n\tadd %%sp,%%g1,%%sp\n", file, 1, 0, 1);
actual_fsize, actual_fsize, ret);
} }
target_flags |= old_target_epilogue; else
fprintf (file, "\t%s\n\tadd %%sp,%d,%%sp\n", ret, actual_fsize);
} }
} else
else if (true_epilogue)
{
/* We may still need a return insn! Somebody could jump around
the tail-calls that this function makes. */
if (TARGET_EPILOGUE)
{ {
rtx last = get_last_insn (); if (current_function_epilogue_delay_list)
abort ();
last = prev_nonnote_insn (last); fprintf (file, "\tsethi %%hi(%d),%%g1\n\tor %%g1,%%lo(%d),%%g1\n\t%s\n\tadd %%sp,%%g1,%%sp\n",
if (last == 0 actual_fsize, actual_fsize, ret);
|| (GET_CODE (last) != JUMP_INSN && GET_CODE (last) != BARRIER))
fprintf (file, "\t%s\n\tnop\n", ret);
} }
target_flags |= old_target_epilogue;
} }
} }
...@@ -2213,25 +2192,6 @@ output_floatsidf2 (operands) ...@@ -2213,25 +2192,6 @@ output_floatsidf2 (operands)
return "fitod %1,%0"; return "fitod %1,%0";
return "st %r1,[%%fp-4]\n\tld [%%fp-4],%0\n\tfitod %0,%0"; return "st %r1,[%%fp-4]\n\tld [%%fp-4],%0\n\tfitod %0,%0";
} }
int
tail_call_valid_p ()
{
static int checked = 0;
static int valid_p = 0;
if (! checked)
{
register int i;
checked = 1;
for (i = 32; i < FIRST_PSEUDO_REGISTER; i++)
if (! fixed_regs[i] && ! call_used_regs[i])
return 0;
valid_p = 1;
}
return valid_p;
}
/* Leaf functions and non-leaf functions have different needs. */ /* Leaf functions and non-leaf functions have different needs. */
...@@ -2308,93 +2268,6 @@ output_arc_profiler (arcno, insert_after) ...@@ -2308,93 +2268,6 @@ output_arc_profiler (arcno, insert_after)
insert_after); insert_after);
} }
/* All the remaining routines in this file have been turned off. */
#if 0
char *
output_tail_call (operands, insn)
rtx *operands;
rtx insn;
{
int this_fsize = actual_fsize;
rtx next;
int need_nop_at_end = 0;
next = next_real_insn (insn);
while (next && GET_CODE (next) == CODE_LABEL)
next = next_real_insn (insn);
if (final_sequence && this_fsize > 0)
{
rtx xoperands[1];
/* If we have to restore any registers, don't take any chances
restoring a register before we discharge it into
its home. If the frame size is only 88, we are guaranteed
that the epilogue will fit in the delay slot. */
rtx delay_insn = XVECEXP (final_sequence, 0, 1);
if (GET_CODE (PATTERN (delay_insn)) == SET)
{
rtx dest = SET_DEST (PATTERN (delay_insn));
if (GET_CODE (dest) == REG
&& reg_mentioned_p (dest, insn))
abort ();
}
else if (GET_CODE (PATTERN (delay_insn)) == PARALLEL)
abort ();
xoperands[0] = operands[0];
final_scan_insn (delay_insn, asm_out_file, 0, 0, 1);
operands[0] = xoperands[0];
final_sequence = 0;
}
/* Make sure we are clear to return. */
output_function_epilogue (asm_out_file, get_frame_size (), -1, 0);
/* Strip the MEM. */
operands[0] = XEXP (operands[0], 0);
if (final_sequence == 0
&& (next == 0
|| GET_CODE (next) == CALL_INSN
|| GET_CODE (next) == JUMP_INSN))
need_nop_at_end = 1;
if (flag_pic)
return output_pic_sequence_2 (2, 3, 0, "jmpl %%g1+%3", operands, need_nop_at_end);
if (GET_CODE (operands[0]) == REG)
output_asm_insn ("jmpl %a0,%%g0", operands);
else if (TARGET_TAIL_CALL)
{
/* We assume all labels will be within 16 MB of our call. */
if (need_nop_at_end || final_sequence)
output_asm_insn ("b %a0", operands);
else
output_asm_insn ("b,a %a0", operands);
}
else if (! final_sequence)
{
output_asm_insn ("sethi %%hi(%a0),%%g1\n\tjmpl %%g1+%%lo(%a0),%%g1",
operands);
}
else
{
int i;
rtx x = PATTERN (XVECEXP (final_sequence, 0, 1));
for (i = 1; i < 32; i++)
if ((i == 1 || ! fixed_regs[i])
&& call_used_regs[i]
&& ! refers_to_regno_p (i, i+1, x, 0))
break;
if (i == 32)
abort ();
operands[1] = gen_rtx (REG, SImode, i);
output_asm_insn ("sethi %%hi(%a0),%1\n\tjmpl %1+%%lo(%a0),%1", operands);
}
return (need_nop_at_end ? "nop" : "");
}
#endif
/* Print operand X (an rtx) in assembler syntax to file FILE. /* Print operand X (an rtx) in assembler syntax to file FILE.
CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
For `%' followed by punctuation, CODE is the punctuation and X is null. */ For `%' followed by punctuation, CODE is the punctuation and X is null. */
......
...@@ -83,10 +83,6 @@ extern int target_flags; ...@@ -83,10 +83,6 @@ extern int target_flags;
use fast return insns, but lose some generality. */ use fast return insns, but lose some generality. */
#define TARGET_EPILOGUE (target_flags & 2) #define TARGET_EPILOGUE (target_flags & 2)
/* Nonzero if we assume that all calls will fall within a 16MB
pc-relative range. Useful with -fomit-frame-pointer. */
#define TARGET_TAIL_CALL (target_flags & 8)
/* Nonzero means that reference doublewords as if they were guaranteed /* Nonzero means that reference doublewords as if they were guaranteed
to be aligned...if they aren't, too bad for the user! to be aligned...if they aren't, too bad for the user!
Like -fast in Sun cc. */ Like -fast in Sun cc. */
...@@ -106,7 +102,6 @@ extern int target_flags; ...@@ -106,7 +102,6 @@ extern int target_flags;
{"soft-float", -1}, \ {"soft-float", -1}, \
{"epilogue", 2}, \ {"epilogue", 2}, \
{"no-epilogue", -2}, \ {"no-epilogue", -2}, \
{"tail-call", 8}, \
{"hope-align", 16}, \ {"hope-align", 16}, \
{"force-align", 48}, \ {"force-align", 48}, \
{ "", TARGET_DEFAULT}} { "", TARGET_DEFAULT}}
...@@ -866,7 +861,7 @@ extern int current_function_outgoing_args_size; ...@@ -866,7 +861,7 @@ extern int current_function_outgoing_args_size;
extern union tree_node *current_function_decl; extern union tree_node *current_function_decl;
#define FUNCTION_EPILOGUE(FILE, SIZE) \ #define FUNCTION_EPILOGUE(FILE, SIZE) \
output_function_epilogue (FILE, SIZE, leaf_function, 1) output_function_epilogue (FILE, SIZE, leaf_function)
#define DELAY_SLOTS_FOR_EPILOGUE 1 #define DELAY_SLOTS_FOR_EPILOGUE 1
#define ELIGIBLE_FOR_EPILOGUE_DELAY(trial, slots_filled) \ #define ELIGIBLE_FOR_EPILOGUE_DELAY(trial, slots_filled) \
......
...@@ -2317,12 +2317,6 @@ ...@@ -2317,12 +2317,6 @@
"jmp %%o0+0\;restore" "jmp %%o0+0\;restore"
[(set_attr "type" "misc") [(set_attr "type" "misc")
(set_attr "length" "2")]) (set_attr "length" "2")])
;(define_insn "tail_call" ;; tail call
; [(set (pc) (match_operand 0 "memory_operand" "m"))]
; "tail_call_valid_p ()"
; "* return output_tail_call (operands, insn);"
; [(set_attr "type" "branch")])
;; Split up troublesome insns for better scheduling. */ ;; Split up troublesome insns for better scheduling. */
......
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