aboutsummaryrefslogtreecommitdiff
path: root/gcc/reorg.c
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2003-07-06 09:56:09 +0000
committerAndreas Jaeger <aj@suse.de>2003-07-06 09:56:09 +0000
commitf51559f5bca04191836c6af031d19825fa985139 (patch)
tree4fb7a1aaa85c3c4aeda23d46346034b73d069df2 /gcc/reorg.c
parentbf581bdc628aea8bdf348cfff6252eb19ad118de (diff)
* jump.c: Convert prototypes to ISO C90.
* langhooks-def.h: Likewise. Add extern to prototypes. * langhooks.c: Likewise. * langhooks.h: Likewise. * lcm.c: Likewise. * local-alloc.c: Likewise. * loop-init.c: Likewise. * loop-unroll.c: Likewise. * loop-unswitch.c: Likewise. * loop.c: Likewise. * loop.h: Likewise. Add extern to prototypes. * machmode.h: Likewise. * main.c: Likewise. * mbchar.c: Likewise. * mbchar.h: Likewise. * mkdeps.c: Likewise. * mkdeps.h: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * output.h: Likewise. * gccspec.c: Likwise. * postreload.c: Likewise. * prefix.c: Likewise. * prefix.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * real.h: Likewise. * recog.c: Likewise. * recog.h: Likewise. * reg-stack.c: Likewise. * regclass.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * resource.h: Likewise. * rtl-error.c: Likewise. * rtl.c: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@68998 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reorg.c')
-rw-r--r--gcc/reorg.c254
1 files changed, 95 insertions, 159 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 37a82140326..9a7c05bc7f1 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1,6 +1,6 @@
/* Perform instruction reorganizations for delay slot filling.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
Hacked by Michael Tiemann (tiemann@cygnus.com).
@@ -177,53 +177,52 @@ static int *uid_to_ruid;
/* Highest valid index in `uid_to_ruid'. */
static int max_uid;
-static int stop_search_p PARAMS ((rtx, int));
-static int resource_conflicts_p PARAMS ((struct resources *,
- struct resources *));
-static int insn_references_resource_p PARAMS ((rtx, struct resources *, int));
-static int insn_sets_resource_p PARAMS ((rtx, struct resources *, int));
-static rtx find_end_label PARAMS ((void));
-static rtx emit_delay_sequence PARAMS ((rtx, rtx, int));
-static rtx add_to_delay_list PARAMS ((rtx, rtx));
-static rtx delete_from_delay_slot PARAMS ((rtx));
-static void delete_scheduled_jump PARAMS ((rtx));
-static void note_delay_statistics PARAMS ((int, int));
+static int stop_search_p (rtx, int);
+static int resource_conflicts_p (struct resources *, struct resources *);
+static int insn_references_resource_p (rtx, struct resources *, int);
+static int insn_sets_resource_p (rtx, struct resources *, int);
+static rtx find_end_label (void);
+static rtx emit_delay_sequence (rtx, rtx, int);
+static rtx add_to_delay_list (rtx, rtx);
+static rtx delete_from_delay_slot (rtx);
+static void delete_scheduled_jump (rtx);
+static void note_delay_statistics (int, int);
#if defined(ANNUL_IFFALSE_SLOTS) || defined(ANNUL_IFTRUE_SLOTS)
-static rtx optimize_skip PARAMS ((rtx));
+static rtx optimize_skip (rtx);
#endif
-static int get_jump_flags PARAMS ((rtx, rtx));
-static int rare_destination PARAMS ((rtx));
-static int mostly_true_jump PARAMS ((rtx, rtx));
-static rtx get_branch_condition PARAMS ((rtx, rtx));
-static int condition_dominates_p PARAMS ((rtx, rtx));
-static int redirect_with_delay_slots_safe_p PARAMS ((rtx, rtx, rtx));
-static int redirect_with_delay_list_safe_p PARAMS ((rtx, rtx, rtx));
-static int check_annul_list_true_false PARAMS ((int, rtx));
-static rtx steal_delay_list_from_target PARAMS ((rtx, rtx, rtx, rtx,
- struct resources *,
- struct resources *,
- struct resources *,
- int, int *, int *, rtx *));
-static rtx steal_delay_list_from_fallthrough PARAMS ((rtx, rtx, rtx, rtx,
- struct resources *,
- struct resources *,
- struct resources *,
- int, int *, int *));
-static void try_merge_delay_insns PARAMS ((rtx, rtx));
-static rtx redundant_insn PARAMS ((rtx, rtx, rtx));
-static int own_thread_p PARAMS ((rtx, rtx, int));
-static void update_block PARAMS ((rtx, rtx));
-static int reorg_redirect_jump PARAMS ((rtx, rtx));
-static void update_reg_dead_notes PARAMS ((rtx, rtx));
-static void fix_reg_dead_note PARAMS ((rtx, rtx));
-static void update_reg_unused_notes PARAMS ((rtx, rtx));
-static void fill_simple_delay_slots PARAMS ((int));
-static rtx fill_slots_from_thread PARAMS ((rtx, rtx, rtx, rtx, int, int,
- int, int, int *, rtx));
-static void fill_eager_delay_slots PARAMS ((void));
-static void relax_delay_slots PARAMS ((rtx));
+static int get_jump_flags (rtx, rtx);
+static int rare_destination (rtx);
+static int mostly_true_jump (rtx, rtx);
+static rtx get_branch_condition (rtx, rtx);
+static int condition_dominates_p (rtx, rtx);
+static int redirect_with_delay_slots_safe_p (rtx, rtx, rtx);
+static int redirect_with_delay_list_safe_p (rtx, rtx, rtx);
+static int check_annul_list_true_false (int, rtx);
+static rtx steal_delay_list_from_target (rtx, rtx, rtx, rtx,
+ struct resources *,
+ struct resources *,
+ struct resources *,
+ int, int *, int *, rtx *);
+static rtx steal_delay_list_from_fallthrough (rtx, rtx, rtx, rtx,
+ struct resources *,
+ struct resources *,
+ struct resources *,
+ int, int *, int *);
+static void try_merge_delay_insns (rtx, rtx);
+static rtx redundant_insn (rtx, rtx, rtx);
+static int own_thread_p (rtx, rtx, int);
+static void update_block (rtx, rtx);
+static int reorg_redirect_jump (rtx, rtx);
+static void update_reg_dead_notes (rtx, rtx);
+static void fix_reg_dead_note (rtx, rtx);
+static void update_reg_unused_notes (rtx, rtx);
+static void fill_simple_delay_slots (int);
+static rtx fill_slots_from_thread (rtx, rtx, rtx, rtx, int, int, int, int,
+ int *, rtx);
+static void fill_eager_delay_slots (void);
+static void relax_delay_slots (rtx);
#ifdef HAVE_return
-static void make_return_insns PARAMS ((rtx));
+static void make_return_insns (rtx);
#endif
/* Return TRUE if this insn should stop the search for insn to fill delay
@@ -231,9 +230,7 @@ static void make_return_insns PARAMS ((rtx));
In all cases, jumps terminate the search. */
static int
-stop_search_p (insn, labels_p)
- rtx insn;
- int labels_p;
+stop_search_p (rtx insn, int labels_p)
{
if (insn == 0)
return 1;
@@ -267,8 +264,7 @@ stop_search_p (insn, labels_p)
resource set contains a volatile memory reference. Otherwise, return FALSE. */
static int
-resource_conflicts_p (res1, res2)
- struct resources *res1, *res2;
+resource_conflicts_p (struct resources *res1, struct resources *res2)
{
if ((res1->cc && res2->cc) || (res1->memory && res2->memory)
|| (res1->unch_memory && res2->unch_memory)
@@ -299,10 +295,8 @@ resource_conflicts_p (res1, res2)
a large block of complex code. */
static int
-insn_references_resource_p (insn, res, include_delayed_effects)
- rtx insn;
- struct resources *res;
- int include_delayed_effects;
+insn_references_resource_p (rtx insn, struct resources *res,
+ int include_delayed_effects)
{
struct resources insn_res;
@@ -317,10 +311,8 @@ insn_references_resource_p (insn, res, include_delayed_effects)
in front of mark_set_resources for details. */
static int
-insn_sets_resource_p (insn, res, include_delayed_effects)
- rtx insn;
- struct resources *res;
- int include_delayed_effects;
+insn_sets_resource_p (rtx insn, struct resources *res,
+ int include_delayed_effects)
{
struct resources insn_sets;
@@ -333,7 +325,7 @@ insn_sets_resource_p (insn, res, include_delayed_effects)
none, make one. */
static rtx
-find_end_label ()
+find_end_label (void)
{
rtx insn;
@@ -430,10 +422,7 @@ find_end_label ()
Returns the SEQUENCE that replaces INSN. */
static rtx
-emit_delay_sequence (insn, list, length)
- rtx insn;
- rtx list;
- int length;
+emit_delay_sequence (rtx insn, rtx list, int length)
{
int i = 1;
rtx li;
@@ -556,9 +545,7 @@ emit_delay_sequence (insn, list, length)
be in the order in which the insns are to be executed. */
static rtx
-add_to_delay_list (insn, delay_list)
- rtx insn;
- rtx delay_list;
+add_to_delay_list (rtx insn, rtx delay_list)
{
/* If we have an empty list, just make a new list element. If
INSN has its block number recorded, clear it since we may
@@ -581,8 +568,7 @@ add_to_delay_list (insn, delay_list)
produce an insn with no delay slots. Return the new insn. */
static rtx
-delete_from_delay_slot (insn)
- rtx insn;
+delete_from_delay_slot (rtx insn)
{
rtx trial, seq_insn, seq, prev;
rtx delay_list = 0;
@@ -639,8 +625,7 @@ delete_from_delay_slot (insn)
the insn that sets CC0 for it and delete it too. */
static void
-delete_scheduled_jump (insn)
- rtx insn;
+delete_scheduled_jump (rtx insn)
{
/* Delete the insn that sets cc0 for us. On machines without cc0, we could
delete the insn that sets the condition code, but it is hard to find it.
@@ -697,8 +682,7 @@ static int num_filled_delays[NUM_REORG_FUNCTIONS][MAX_DELAY_HISTOGRAM+1][MAX_REO
static int reorg_pass_number;
static void
-note_delay_statistics (slots_filled, index)
- int slots_filled, index;
+note_delay_statistics (int slots_filled, int index)
{
num_insns_needing_delays[index][reorg_pass_number]++;
if (slots_filled > MAX_DELAY_HISTOGRAM)
@@ -741,8 +725,7 @@ note_delay_statistics (slots_filled, index)
of delay slots required. */
static rtx
-optimize_skip (insn)
- rtx insn;
+optimize_skip (rtx insn)
{
rtx trial = next_nonnote_insn (insn);
rtx next_trial = next_active_insn (trial);
@@ -823,8 +806,7 @@ optimize_skip (insn)
are predicted as very likely taken. */
static int
-get_jump_flags (insn, label)
- rtx insn, label;
+get_jump_flags (rtx insn, rtx label)
{
int flags;
@@ -887,8 +869,7 @@ get_jump_flags (insn, label)
return 0. */
static int
-rare_destination (insn)
- rtx insn;
+rare_destination (rtx insn)
{
int jump_count = 0;
rtx next;
@@ -939,8 +920,7 @@ rare_destination (insn)
CONDITION, if nonzero, is the condition that JUMP_INSN is testing. */
static int
-mostly_true_jump (jump_insn, condition)
- rtx jump_insn, condition;
+mostly_true_jump (rtx jump_insn, rtx condition)
{
rtx target_label = JUMP_LABEL (jump_insn);
rtx insn, note;
@@ -1062,9 +1042,7 @@ mostly_true_jump (jump_insn, condition)
type of jump, or it doesn't go to TARGET, return 0. */
static rtx
-get_branch_condition (insn, target)
- rtx insn;
- rtx target;
+get_branch_condition (rtx insn, rtx target)
{
rtx pat = PATTERN (insn);
rtx src;
@@ -1110,9 +1088,7 @@ get_branch_condition (insn, target)
INSN, i.e., if INSN will always branch if CONDITION is true. */
static int
-condition_dominates_p (condition, insn)
- rtx condition;
- rtx insn;
+condition_dominates_p (rtx condition, rtx insn)
{
rtx other_condition = get_branch_condition (insn, JUMP_LABEL (insn));
enum rtx_code code = GET_CODE (condition);
@@ -1138,8 +1114,7 @@ condition_dominates_p (condition, insn)
any insns already in the delay slot of JUMP. */
static int
-redirect_with_delay_slots_safe_p (jump, newlabel, seq)
- rtx jump, newlabel, seq;
+redirect_with_delay_slots_safe_p (rtx jump, rtx newlabel, rtx seq)
{
int flags, i;
rtx pat = PATTERN (seq);
@@ -1173,8 +1148,7 @@ redirect_with_delay_slots_safe_p (jump, newlabel, seq)
any insns we wish to place in the delay slot of JUMP. */
static int
-redirect_with_delay_list_safe_p (jump, newlabel, delay_list)
- rtx jump, newlabel, delay_list;
+redirect_with_delay_list_safe_p (rtx jump, rtx newlabel, rtx delay_list)
{
int flags, i;
rtx li;
@@ -1207,9 +1181,7 @@ redirect_with_delay_list_safe_p (jump, newlabel, delay_list)
If not, return 0; otherwise return 1. */
static int
-check_annul_list_true_false (annul_true_p, delay_list)
- int annul_true_p;
- rtx delay_list;
+check_annul_list_true_false (int annul_true_p, rtx delay_list)
{
rtx temp;
@@ -1249,18 +1221,12 @@ check_annul_list_true_false (annul_true_p, delay_list)
execution should continue. */
static rtx
-steal_delay_list_from_target (insn, condition, seq, delay_list,
- sets, needed, other_needed,
- slots_to_fill, pslots_filled, pannul_p,
- pnew_thread)
- rtx insn, condition;
- rtx seq;
- rtx delay_list;
- struct resources *sets, *needed, *other_needed;
- int slots_to_fill;
- int *pslots_filled;
- int *pannul_p;
- rtx *pnew_thread;
+steal_delay_list_from_target (rtx insn, rtx condition, rtx seq,
+ rtx delay_list, struct resources *sets,
+ struct resources *needed,
+ struct resources *other_needed,
+ int slots_to_fill, int *pslots_filled,
+ int *pannul_p, rtx *pnew_thread)
{
rtx temp;
int slots_remaining = slots_to_fill - *pslots_filled;
@@ -1388,16 +1354,12 @@ steal_delay_list_from_target (insn, condition, seq, delay_list,
for INSN since unconditional branches are much easier to fill. */
static rtx
-steal_delay_list_from_fallthrough (insn, condition, seq,
- delay_list, sets, needed, other_needed,
- slots_to_fill, pslots_filled, pannul_p)
- rtx insn, condition;
- rtx seq;
- rtx delay_list;
- struct resources *sets, *needed, *other_needed;
- int slots_to_fill;
- int *pslots_filled;
- int *pannul_p;
+steal_delay_list_from_fallthrough (rtx insn, rtx condition, rtx seq,
+ rtx delay_list, struct resources *sets,
+ struct resources *needed,
+ struct resources *other_needed,
+ int slots_to_fill, int *pslots_filled,
+ int *pannul_p)
{
int i;
int flags;
@@ -1472,8 +1434,7 @@ steal_delay_list_from_fallthrough (insn, condition, seq,
we delete the merged insn. */
static void
-try_merge_delay_insns (insn, thread)
- rtx insn, thread;
+try_merge_delay_insns (rtx insn, rtx thread)
{
rtx trial, next_trial;
rtx delay_insn = XVECEXP (PATTERN (insn), 0, 0);
@@ -1663,10 +1624,7 @@ try_merge_delay_insns (insn, thread)
gain in rare cases. */
static rtx
-redundant_insn (insn, target, delay_list)
- rtx insn;
- rtx target;
- rtx delay_list;
+redundant_insn (rtx insn, rtx target, rtx delay_list)
{
rtx target_main = target;
rtx ipat = PATTERN (insn);
@@ -1873,10 +1831,7 @@ redundant_insn (insn, target, delay_list)
finding an active insn, we do not own this thread. */
static int
-own_thread_p (thread, label, allow_fallthrough)
- rtx thread;
- rtx label;
- int allow_fallthrough;
+own_thread_p (rtx thread, rtx label, int allow_fallthrough)
{
rtx active_insn;
rtx insn;
@@ -1920,9 +1875,7 @@ own_thread_p (thread, label, allow_fallthrough)
BARRIER in relax_delay_slots. */
static void
-update_block (insn, where)
- rtx insn;
- rtx where;
+update_block (rtx insn, rtx where)
{
/* Ignore if this was in a delay slot and it came from the target of
a branch. */
@@ -1941,9 +1894,7 @@ update_block (insn, where)
the basic block containing the jump. */
static int
-reorg_redirect_jump (jump, nlabel)
- rtx jump;
- rtx nlabel;
+reorg_redirect_jump (rtx jump, rtx nlabel)
{
incr_ticks_for_insn (jump);
return redirect_jump (jump, nlabel, 1);
@@ -1961,8 +1912,7 @@ reorg_redirect_jump (jump, nlabel)
is dead because it sees a REG_DEAD note immediately before a CODE_LABEL. */
static void
-update_reg_dead_notes (insn, delayed_insn)
- rtx insn, delayed_insn;
+update_reg_dead_notes (rtx insn, rtx delayed_insn)
{
rtx p, link, next;
@@ -1995,8 +1945,7 @@ update_reg_dead_notes (insn, delayed_insn)
confused into thinking the register is dead. */
static void
-fix_reg_dead_note (start_insn, stop_insn)
- rtx start_insn, stop_insn;
+fix_reg_dead_note (rtx start_insn, rtx stop_insn)
{
rtx p, link, next;
@@ -2026,8 +1975,7 @@ fix_reg_dead_note (start_insn, stop_insn)
does. */
static void
-update_reg_unused_notes (insn, redundant_insn)
- rtx insn, redundant_insn;
+update_reg_unused_notes (rtx insn, rtx redundant_insn)
{
rtx link, next;
@@ -2060,8 +2008,7 @@ update_reg_unused_notes (insn, redundant_insn)
through FINAL_SEQUENCE. */
static void
-fill_simple_delay_slots (non_jumps_p)
- int non_jumps_p;
+fill_simple_delay_slots (int non_jumps_p)
{
rtx insn, pat, trial, next_trial;
int i;
@@ -2564,17 +2511,10 @@ fill_simple_delay_slots (non_jumps_p)
slot. We then adjust the jump to point after the insns we have taken. */
static rtx
-fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
- thread_if_true, own_thread,
- slots_to_fill, pslots_filled, delay_list)
- rtx insn;
- rtx condition;
- rtx thread, opposite_thread;
- int likely;
- int thread_if_true;
- int own_thread;
- int slots_to_fill, *pslots_filled;
- rtx delay_list;
+fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
+ rtx opposite_thread, int likely, int thread_if_true,
+ int own_thread, int slots_to_fill,
+ int *pslots_filled, rtx delay_list)
{
rtx new_thread;
struct resources opposite_needed, set, needed;
@@ -2991,7 +2931,7 @@ fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
if safe. */
static void
-fill_eager_delay_slots ()
+fill_eager_delay_slots (void)
{
rtx insn;
int i;
@@ -3018,7 +2958,7 @@ fill_eager_delay_slots ()
delay slots only in certain circumstances which may depend on
nearby insns (which change due to reorg's actions).
- For example, the PA port normally has delay slots for unconditional
+ For example, the PA port normally has delay slots for unconditional
jumps.
However, the PA port claims such jumps do not have a delay slot
@@ -3119,8 +3059,7 @@ fill_eager_delay_slots ()
threading. */
static void
-relax_delay_slots (first)
- rtx first;
+relax_delay_slots (rtx first)
{
rtx insn, next, pat;
rtx trial, delay_insn, target_label;
@@ -3485,8 +3424,7 @@ relax_delay_slots (first)
RETURN as well. */
static void
-make_return_insns (first)
- rtx first;
+make_return_insns (rtx first)
{
rtx insn, jump_insn, pat;
rtx real_return_label = end_of_function_label;
@@ -3617,9 +3555,7 @@ make_return_insns (first)
/* Try to find insns to place in delay slots. */
void
-dbr_schedule (first, file)
- rtx first;
- FILE *file;
+dbr_schedule (rtx first, FILE *file)
{
rtx insn, next, epilogue_insn = 0;
int i;