Commit d329e058 by Andreas Jaeger Committed by Andreas Jaeger

caller-save.c: Convert to ISO C90.

	* caller-save.c: Convert to ISO C90.
	* calls.c: Likewise.
	* cfg.c: Likewise.
	* cfganal.c: Likewise.
	* cfgbuild.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfghooks.c: Likewise.
	* cfglayout.c: Likewise.
	* cfglayout.h: Likewise.
	* cfgloop.c: Likewise.
	* cfgloop.h: Likewise.
	* cfgloopanal.c: Likewise.
	* cfgloopmainip.c: Likewise.
	* cfgrtl.c: Likewise.

From-SVN: r68331
parent 84edd42c
2003-06-22 Andreas Jaeger <aj@suse.de>
* caller-save.c: Convert to ISO C90.
* calls.c: Likewise.
* cfg.c: Likewise.
* cfganal.c: Likewise.
* cfgbuild.c: Likewise.
* cfgcleanup.c: Likewise.
* cfghooks.c: Likewise.
* cfglayout.c: Likewise.
* cfglayout.h: Likewise.
* cfgloop.c: Likewise.
* cfgloop.h: Likewise.
* cfgloopanal.c: Likewise.
* cfgloopmainip.c: Likewise.
* cfgrtl.c: Likewise.
2003-06-22 Richard Earnshaw <rearnsha@arm.com> 2003-06-22 Richard Earnshaw <rearnsha@arm.com>
* arm.h (BIGGEST_ALIGNMENT): Use TARGET_REALLY_IWMMXT for selecting * arm.h (BIGGEST_ALIGNMENT): Use TARGET_REALLY_IWMMXT for selecting
......
/* Save and restore call-clobbered registers which are live across a call. /* Save and restore call-clobbered registers which are live across a call.
Copyright (C) 1989, 1992, 1994, 1995, 1997, 1998, Copyright (C) 1989, 1992, 1994, 1995, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -51,13 +51,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -51,13 +51,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
register because it is live we first try to save in multi-register modes. register because it is live we first try to save in multi-register modes.
If that is not possible the save is done one register at a time. */ If that is not possible the save is done one register at a time. */
static enum machine_mode static enum machine_mode
regno_save_mode[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]; regno_save_mode[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1];
/* For each hard register, a place on the stack where it can be saved, /* For each hard register, a place on the stack where it can be saved,
if needed. */ if needed. */
static rtx static rtx
regno_save_mem[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]; regno_save_mem[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1];
/* We will only make a register eligible for caller-save if it can be /* We will only make a register eligible for caller-save if it can be
...@@ -68,7 +68,7 @@ static rtx ...@@ -68,7 +68,7 @@ static rtx
static int static int
reg_save_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; reg_save_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE];
static int static int
reg_restore_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; reg_restore_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE];
/* Set of hard regs currently residing in save area (during insn scan). */ /* Set of hard regs currently residing in save area (during insn scan). */
...@@ -88,29 +88,28 @@ static HARD_REG_SET referenced_regs; ...@@ -88,29 +88,28 @@ static HARD_REG_SET referenced_regs;
static HARD_REG_SET this_insn_sets; static HARD_REG_SET this_insn_sets;
static void mark_set_regs PARAMS ((rtx, rtx, void *)); static void mark_set_regs (rtx, rtx, void *);
static void mark_referenced_regs PARAMS ((rtx)); static void mark_referenced_regs (rtx);
static int insert_save PARAMS ((struct insn_chain *, int, int, static int insert_save (struct insn_chain *, int, int, HARD_REG_SET *,
HARD_REG_SET *, enum machine_mode *);
enum machine_mode *)); static int insert_restore (struct insn_chain *, int, int, int,
static int insert_restore PARAMS ((struct insn_chain *, int, int, enum machine_mode *);
int, enum machine_mode *)); static struct insn_chain *insert_one_insn (struct insn_chain *, int, int,
static struct insn_chain *insert_one_insn PARAMS ((struct insn_chain *, int, rtx);
int, rtx)); static void add_stored_regs (rtx, rtx, void *);
static void add_stored_regs PARAMS ((rtx, rtx, void *));
/* Initialize for caller-save. /* Initialize for caller-save.
Look at all the hard registers that are used by a call and for which Look at all the hard registers that are used by a call and for which
regclass.c has not already excluded from being used across a call. regclass.c has not already excluded from being used across a call.
Ensure that we can find a mode to save the register and that there is a Ensure that we can find a mode to save the register and that there is a
simple insn to save and restore the register. This latter check avoids simple insn to save and restore the register. This latter check avoids
problems that would occur if we tried to save the MQ register of some problems that would occur if we tried to save the MQ register of some
machines directly into memory. */ machines directly into memory. */
void void
init_caller_save () init_caller_save (void)
{ {
rtx addr_reg; rtx addr_reg;
int offset; int offset;
...@@ -184,7 +183,7 @@ init_caller_save () ...@@ -184,7 +183,7 @@ init_caller_save ()
address = addr_reg; address = addr_reg;
/* Next we try to form an insn to save and restore the register. We /* Next we try to form an insn to save and restore the register. We
see if such an insn is recognized and meets its constraints. see if such an insn is recognized and meets its constraints.
To avoid lots of unnecessary RTL allocation, we construct all the RTL To avoid lots of unnecessary RTL allocation, we construct all the RTL
once, then modify the memory and register operands in-place. */ once, then modify the memory and register operands in-place. */
...@@ -256,7 +255,7 @@ init_caller_save () ...@@ -256,7 +255,7 @@ init_caller_save ()
/* Initialize save areas by showing that we haven't allocated any yet. */ /* Initialize save areas by showing that we haven't allocated any yet. */
void void
init_save_areas () init_save_areas (void)
{ {
int i, j; int i, j;
...@@ -274,17 +273,17 @@ init_save_areas () ...@@ -274,17 +273,17 @@ init_save_areas ()
Future work: Future work:
In the fallback case we should iterate backwards across all possible In the fallback case we should iterate backwards across all possible
modes for the save, choosing the largest available one instead of modes for the save, choosing the largest available one instead of
falling back to the smallest mode immediately. (eg TF -> DF -> SF). falling back to the smallest mode immediately. (eg TF -> DF -> SF).
We do not try to use "move multiple" instructions that exist We do not try to use "move multiple" instructions that exist
on some machines (such as the 68k moveml). It could be a win to try on some machines (such as the 68k moveml). It could be a win to try
and use them when possible. The hard part is doing it in a way that is and use them when possible. The hard part is doing it in a way that is
machine independent since they might be saving non-consecutive machine independent since they might be saving non-consecutive
registers. (imagine caller-saving d0,d1,a0,a1 on the 68k) */ registers. (imagine caller-saving d0,d1,a0,a1 on the 68k) */
void void
setup_save_areas () setup_save_areas (void)
{ {
int i, j, k; int i, j, k;
unsigned int r; unsigned int r;
...@@ -300,7 +299,7 @@ setup_save_areas () ...@@ -300,7 +299,7 @@ setup_save_areas ()
if (reg_renumber[i] >= 0 && REG_N_CALLS_CROSSED (i) > 0) if (reg_renumber[i] >= 0 && REG_N_CALLS_CROSSED (i) > 0)
{ {
unsigned int regno = reg_renumber[i]; unsigned int regno = reg_renumber[i];
unsigned int endregno unsigned int endregno
= regno + HARD_REGNO_NREGS (regno, GET_MODE (regno_reg_rtx[i])); = regno + HARD_REGNO_NREGS (regno, GET_MODE (regno_reg_rtx[i]));
for (r = regno; r < endregno; r++) for (r = regno; r < endregno; r++)
...@@ -367,7 +366,7 @@ setup_save_areas () ...@@ -367,7 +366,7 @@ setup_save_areas ()
/* Find the places where hard regs are live across calls and save them. */ /* Find the places where hard regs are live across calls and save them. */
void void
save_call_clobbered_regs () save_call_clobbered_regs (void)
{ {
struct insn_chain *chain, *next; struct insn_chain *chain, *next;
enum machine_mode save_mode [FIRST_PSEUDO_REGISTER]; enum machine_mode save_mode [FIRST_PSEUDO_REGISTER];
...@@ -488,7 +487,7 @@ save_call_clobbered_regs () ...@@ -488,7 +487,7 @@ save_call_clobbered_regs ()
regno += insert_restore (chain, GET_CODE (insn) == JUMP_INSN, regno += insert_restore (chain, GET_CODE (insn) == JUMP_INSN,
regno, MOVE_MAX_WORDS, save_mode); regno, MOVE_MAX_WORDS, save_mode);
} }
} }
} }
/* Here from note_stores when an insn stores a value in a register. /* Here from note_stores when an insn stores a value in a register.
...@@ -496,10 +495,8 @@ save_call_clobbered_regs () ...@@ -496,10 +495,8 @@ save_call_clobbered_regs ()
been assigned hard regs have had their register number changed already, been assigned hard regs have had their register number changed already,
so we can ignore pseudos. */ so we can ignore pseudos. */
static void static void
mark_set_regs (reg, setter, data) mark_set_regs (rtx reg, rtx setter ATTRIBUTE_UNUSED,
rtx reg; void *data ATTRIBUTE_UNUSED)
rtx setter ATTRIBUTE_UNUSED;
void *data ATTRIBUTE_UNUSED;
{ {
int regno, endregno, i; int regno, endregno, i;
enum machine_mode mode = GET_MODE (reg); enum machine_mode mode = GET_MODE (reg);
...@@ -529,10 +526,7 @@ mark_set_regs (reg, setter, data) ...@@ -529,10 +526,7 @@ mark_set_regs (reg, setter, data)
been assigned hard regs have had their register number changed already, been assigned hard regs have had their register number changed already,
so we can ignore pseudos. */ so we can ignore pseudos. */
static void static void
add_stored_regs (reg, setter, data) add_stored_regs (rtx reg, rtx setter, void *data)
rtx reg;
rtx setter;
void *data;
{ {
int regno, endregno, i; int regno, endregno, i;
enum machine_mode mode = GET_MODE (reg); enum machine_mode mode = GET_MODE (reg);
...@@ -562,8 +556,7 @@ add_stored_regs (reg, setter, data) ...@@ -562,8 +556,7 @@ add_stored_regs (reg, setter, data)
/* Walk X and record all referenced registers in REFERENCED_REGS. */ /* Walk X and record all referenced registers in REFERENCED_REGS. */
static void static void
mark_referenced_regs (x) mark_referenced_regs (rtx x)
rtx x;
{ {
enum rtx_code code = GET_CODE (x); enum rtx_code code = GET_CODE (x);
const char *fmt; const char *fmt;
...@@ -639,12 +632,8 @@ mark_referenced_regs (x) ...@@ -639,12 +632,8 @@ mark_referenced_regs (x)
Return the extra number of registers saved. */ Return the extra number of registers saved. */
static int static int
insert_restore (chain, before_p, regno, maxrestore, save_mode) insert_restore (struct insn_chain *chain, int before_p, int regno,
struct insn_chain *chain; int maxrestore, enum machine_mode *save_mode)
int before_p;
int regno;
int maxrestore;
enum machine_mode *save_mode;
{ {
int i, k; int i, k;
rtx pat = NULL_RTX; rtx pat = NULL_RTX;
...@@ -695,7 +684,7 @@ insert_restore (chain, before_p, regno, maxrestore, save_mode) ...@@ -695,7 +684,7 @@ insert_restore (chain, before_p, regno, maxrestore, save_mode)
&& numregs == (unsigned int) HARD_REGNO_NREGS (regno, save_mode [regno])) && numregs == (unsigned int) HARD_REGNO_NREGS (regno, save_mode [regno]))
mem = adjust_address (mem, save_mode[regno], 0); mem = adjust_address (mem, save_mode[regno], 0);
pat = gen_rtx_SET (VOIDmode, pat = gen_rtx_SET (VOIDmode,
gen_rtx_REG (GET_MODE (mem), gen_rtx_REG (GET_MODE (mem),
regno), mem); regno), mem);
code = reg_restore_code[regno][GET_MODE (mem)]; code = reg_restore_code[regno][GET_MODE (mem)];
new = insert_one_insn (chain, before_p, code, pat); new = insert_one_insn (chain, before_p, code, pat);
...@@ -715,12 +704,8 @@ insert_restore (chain, before_p, regno, maxrestore, save_mode) ...@@ -715,12 +704,8 @@ insert_restore (chain, before_p, regno, maxrestore, save_mode)
/* Like insert_restore above, but save registers instead. */ /* Like insert_restore above, but save registers instead. */
static int static int
insert_save (chain, before_p, regno, to_save, save_mode) insert_save (struct insn_chain *chain, int before_p, int regno,
struct insn_chain *chain; HARD_REG_SET (*to_save), enum machine_mode *save_mode)
int before_p;
int regno;
HARD_REG_SET *to_save;
enum machine_mode *save_mode;
{ {
int i; int i;
unsigned int k; unsigned int k;
...@@ -742,7 +727,7 @@ insert_save (chain, before_p, regno, to_save, save_mode) ...@@ -742,7 +727,7 @@ insert_save (chain, before_p, regno, to_save, save_mode)
/* Get the pattern to emit and update our status. /* Get the pattern to emit and update our status.
See if we can save several registers with a single instruction. See if we can save several registers with a single instruction.
Work backwards to the single register case. */ Work backwards to the single register case. */
for (i = MOVE_MAX_WORDS; i > 0; i--) for (i = MOVE_MAX_WORDS; i > 0; i--)
{ {
...@@ -790,15 +775,11 @@ insert_save (chain, before_p, regno, to_save, save_mode) ...@@ -790,15 +775,11 @@ insert_save (chain, before_p, regno, to_save, save_mode)
/* Emit a new caller-save insn and set the code. */ /* Emit a new caller-save insn and set the code. */
static struct insn_chain * static struct insn_chain *
insert_one_insn (chain, before_p, code, pat) insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat)
struct insn_chain *chain;
int before_p;
int code;
rtx pat;
{ {
rtx insn = chain->insn; rtx insn = chain->insn;
struct insn_chain *new; struct insn_chain *new;
#ifdef HAVE_cc0 #ifdef HAVE_cc0
/* If INSN references CC0, put our insns in front of the insn that sets /* If INSN references CC0, put our insns in front of the insn that sets
CC0. This is always safe, since the only way we could be passed an CC0. This is always safe, since the only way we could be passed an
......
/* Control flow graph manipulation code for GNU compiler. /* Control flow graph manipulation code for GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -138,13 +138,13 @@ struct basic_block_def entry_exit_blocks[2] ...@@ -138,13 +138,13 @@ struct basic_block_def entry_exit_blocks[2]
} }
}; };
void debug_flow_info PARAMS ((void)); void debug_flow_info (void);
static void free_edge PARAMS ((edge)); static void free_edge (edge);
/* Called once at initialization time. */ /* Called once at initialization time. */
void void
init_flow () init_flow (void)
{ {
static int initialized; static int initialized;
...@@ -163,7 +163,7 @@ init_flow () ...@@ -163,7 +163,7 @@ init_flow ()
obstack_free (&flow_obstack, flow_firstobj); obstack_free (&flow_obstack, flow_firstobj);
flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0); flow_firstobj = (char *) obstack_alloc (&flow_obstack, 0);
} }
bb_pool = create_alloc_pool ("Basic block pool", bb_pool = create_alloc_pool ("Basic block pool",
sizeof (struct basic_block_def), 100); sizeof (struct basic_block_def), 100);
edge_pool = create_alloc_pool ("Edge pool", edge_pool = create_alloc_pool ("Edge pool",
sizeof (struct edge_def), 100); sizeof (struct edge_def), 100);
...@@ -173,8 +173,7 @@ init_flow () ...@@ -173,8 +173,7 @@ init_flow ()
without actually unlinking it from the pred/succ lists. */ without actually unlinking it from the pred/succ lists. */
static void static void
free_edge (e) free_edge (edge e)
edge e;
{ {
n_edges--; n_edges--;
pool_free (edge_pool, e); pool_free (edge_pool, e);
...@@ -183,7 +182,7 @@ free_edge (e) ...@@ -183,7 +182,7 @@ free_edge (e)
/* Free the memory associated with the edge structures. */ /* Free the memory associated with the edge structures. */
void void
clear_edges () clear_edges (void)
{ {
basic_block bb; basic_block bb;
edge e; edge e;
...@@ -223,7 +222,7 @@ clear_edges () ...@@ -223,7 +222,7 @@ clear_edges ()
/* Allocate memory for basic_block. */ /* Allocate memory for basic_block. */
basic_block basic_block
alloc_block () alloc_block (void)
{ {
basic_block bb; basic_block bb;
bb = pool_alloc (bb_pool); bb = pool_alloc (bb_pool);
...@@ -233,8 +232,7 @@ alloc_block () ...@@ -233,8 +232,7 @@ alloc_block ()
/* Link block B to chain after AFTER. */ /* Link block B to chain after AFTER. */
void void
link_block (b, after) link_block (basic_block b, basic_block after)
basic_block b, after;
{ {
b->next_bb = after->next_bb; b->next_bb = after->next_bb;
b->prev_bb = after; b->prev_bb = after;
...@@ -244,8 +242,7 @@ link_block (b, after) ...@@ -244,8 +242,7 @@ link_block (b, after)
/* Unlink block B from chain. */ /* Unlink block B from chain. */
void void
unlink_block (b) unlink_block (basic_block b)
basic_block b;
{ {
b->next_bb->prev_bb = b->prev_bb; b->next_bb->prev_bb = b->prev_bb;
b->prev_bb->next_bb = b->next_bb; b->prev_bb->next_bb = b->next_bb;
...@@ -253,11 +250,11 @@ unlink_block (b) ...@@ -253,11 +250,11 @@ unlink_block (b)
/* Sequentially order blocks and compact the arrays. */ /* Sequentially order blocks and compact the arrays. */
void void
compact_blocks () compact_blocks (void)
{ {
int i; int i;
basic_block bb; basic_block bb;
i = 0; i = 0;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
...@@ -275,8 +272,7 @@ compact_blocks () ...@@ -275,8 +272,7 @@ compact_blocks ()
/* Remove block B from the basic block array. */ /* Remove block B from the basic block array. */
void void
expunge_block (b) expunge_block (basic_block b)
basic_block b;
{ {
unlink_block (b); unlink_block (b);
BASIC_BLOCK (b->index) = NULL; BASIC_BLOCK (b->index) = NULL;
...@@ -289,9 +285,7 @@ expunge_block (b) ...@@ -289,9 +285,7 @@ expunge_block (b)
possibly already exist. */ possibly already exist. */
edge edge
unchecked_make_edge (src, dst, flags) unchecked_make_edge (basic_block src, basic_block dst, int flags)
basic_block src, dst;
int flags;
{ {
edge e; edge e;
e = pool_alloc (edge_pool); e = pool_alloc (edge_pool);
...@@ -314,10 +308,7 @@ unchecked_make_edge (src, dst, flags) ...@@ -314,10 +308,7 @@ unchecked_make_edge (src, dst, flags)
edge cache CACHE. Return the new edge, NULL if already exist. */ edge cache CACHE. Return the new edge, NULL if already exist. */
edge edge
cached_make_edge (edge_cache, src, dst, flags) cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int flags)
sbitmap *edge_cache;
basic_block src, dst;
int flags;
{ {
int use_edge_cache; int use_edge_cache;
edge e; edge e;
...@@ -349,7 +340,7 @@ cached_make_edge (edge_cache, src, dst, flags) ...@@ -349,7 +340,7 @@ cached_make_edge (edge_cache, src, dst, flags)
} }
break; break;
} }
e = unchecked_make_edge (src, dst, flags); e = unchecked_make_edge (src, dst, flags);
if (use_edge_cache) if (use_edge_cache)
...@@ -362,9 +353,7 @@ cached_make_edge (edge_cache, src, dst, flags) ...@@ -362,9 +353,7 @@ cached_make_edge (edge_cache, src, dst, flags)
created edge or NULL if already exist. */ created edge or NULL if already exist. */
edge edge
make_edge (src, dest, flags) make_edge (basic_block src, basic_block dest, int flags)
basic_block src, dest;
int flags;
{ {
return cached_make_edge (NULL, src, dest, flags); return cached_make_edge (NULL, src, dest, flags);
} }
...@@ -373,9 +362,7 @@ make_edge (src, dest, flags) ...@@ -373,9 +362,7 @@ make_edge (src, dest, flags)
that it is the single edge leaving SRC. */ that it is the single edge leaving SRC. */
edge edge
make_single_succ_edge (src, dest, flags) make_single_succ_edge (basic_block src, basic_block dest, int flags)
basic_block src, dest;
int flags;
{ {
edge e = make_edge (src, dest, flags); edge e = make_edge (src, dest, flags);
...@@ -387,8 +374,7 @@ make_single_succ_edge (src, dest, flags) ...@@ -387,8 +374,7 @@ make_single_succ_edge (src, dest, flags)
/* This function will remove an edge from the flow graph. */ /* This function will remove an edge from the flow graph. */
void void
remove_edge (e) remove_edge (edge e)
edge e;
{ {
edge last_pred = NULL; edge last_pred = NULL;
edge last_succ = NULL; edge last_succ = NULL;
...@@ -423,9 +409,7 @@ remove_edge (e) ...@@ -423,9 +409,7 @@ remove_edge (e)
/* Redirect an edge's successor from one block to another. */ /* Redirect an edge's successor from one block to another. */
void void
redirect_edge_succ (e, new_succ) redirect_edge_succ (edge e, basic_block new_succ)
edge e;
basic_block new_succ;
{ {
edge *pe; edge *pe;
...@@ -443,9 +427,7 @@ redirect_edge_succ (e, new_succ) ...@@ -443,9 +427,7 @@ redirect_edge_succ (e, new_succ)
/* Like previous but avoid possible duplicate edge. */ /* Like previous but avoid possible duplicate edge. */
edge edge
redirect_edge_succ_nodup (e, new_succ) redirect_edge_succ_nodup (edge e, basic_block new_succ)
edge e;
basic_block new_succ;
{ {
edge s; edge s;
...@@ -473,9 +455,7 @@ redirect_edge_succ_nodup (e, new_succ) ...@@ -473,9 +455,7 @@ redirect_edge_succ_nodup (e, new_succ)
/* Redirect an edge's predecessor from one block to another. */ /* Redirect an edge's predecessor from one block to another. */
void void
redirect_edge_pred (e, new_pred) redirect_edge_pred (edge e, basic_block new_pred)
edge e;
basic_block new_pred;
{ {
edge *pe; edge *pe;
...@@ -492,7 +472,7 @@ redirect_edge_pred (e, new_pred) ...@@ -492,7 +472,7 @@ redirect_edge_pred (e, new_pred)
} }
void void
clear_bb_flags () clear_bb_flags (void)
{ {
basic_block bb; basic_block bb;
...@@ -501,8 +481,7 @@ clear_bb_flags () ...@@ -501,8 +481,7 @@ clear_bb_flags ()
} }
void void
dump_flow_info (file) dump_flow_info (FILE *file)
FILE *file;
{ {
int i; int i;
int max_regno = max_reg_num (); int max_regno = max_reg_num ();
...@@ -625,16 +604,13 @@ dump_flow_info (file) ...@@ -625,16 +604,13 @@ dump_flow_info (file)
} }
void void
debug_flow_info () debug_flow_info (void)
{ {
dump_flow_info (stderr); dump_flow_info (stderr);
} }
void void
dump_edge_info (file, e, do_succ) dump_edge_info (FILE *file, edge e, int do_succ)
FILE *file;
edge e;
int do_succ;
{ {
basic_block side = (do_succ ? e->dest : e->src); basic_block side = (do_succ ? e->dest : e->src);
...@@ -693,9 +669,7 @@ static void *first_edge_aux_obj = 0; ...@@ -693,9 +669,7 @@ static void *first_edge_aux_obj = 0;
be first initialized by alloc_aux_for_blocks. */ be first initialized by alloc_aux_for_blocks. */
inline void inline void
alloc_aux_for_block (bb, size) alloc_aux_for_block (basic_block bb, int size)
basic_block bb;
int size;
{ {
/* Verify that aux field is clear. */ /* Verify that aux field is clear. */
if (bb->aux || !first_block_aux_obj) if (bb->aux || !first_block_aux_obj)
...@@ -708,8 +682,7 @@ alloc_aux_for_block (bb, size) ...@@ -708,8 +682,7 @@ alloc_aux_for_block (bb, size)
alloc_aux_for_block for each basic block. */ alloc_aux_for_block for each basic block. */
void void
alloc_aux_for_blocks (size) alloc_aux_for_blocks (int size)
int size;
{ {
static int initialized; static int initialized;
...@@ -735,7 +708,7 @@ alloc_aux_for_blocks (size) ...@@ -735,7 +708,7 @@ alloc_aux_for_blocks (size)
/* Clear AUX pointers of all blocks. */ /* Clear AUX pointers of all blocks. */
void void
clear_aux_for_blocks () clear_aux_for_blocks (void)
{ {
basic_block bb; basic_block bb;
...@@ -747,7 +720,7 @@ clear_aux_for_blocks () ...@@ -747,7 +720,7 @@ clear_aux_for_blocks ()
of all blocks. */ of all blocks. */
void void
free_aux_for_blocks () free_aux_for_blocks (void)
{ {
if (!first_block_aux_obj) if (!first_block_aux_obj)
abort (); abort ();
...@@ -761,9 +734,7 @@ free_aux_for_blocks () ...@@ -761,9 +734,7 @@ free_aux_for_blocks ()
be first initialized by alloc_aux_for_edges. */ be first initialized by alloc_aux_for_edges. */
inline void inline void
alloc_aux_for_edge (e, size) alloc_aux_for_edge (edge e, int size)
edge e;
int size;
{ {
/* Verify that aux field is clear. */ /* Verify that aux field is clear. */
if (e->aux || !first_edge_aux_obj) if (e->aux || !first_edge_aux_obj)
...@@ -776,8 +747,7 @@ alloc_aux_for_edge (e, size) ...@@ -776,8 +747,7 @@ alloc_aux_for_edge (e, size)
alloc_aux_for_edge for each basic edge. */ alloc_aux_for_edge for each basic edge. */
void void
alloc_aux_for_edges (size) alloc_aux_for_edges (int size)
int size;
{ {
static int initialized; static int initialized;
...@@ -809,7 +779,7 @@ alloc_aux_for_edges (size) ...@@ -809,7 +779,7 @@ alloc_aux_for_edges (size)
/* Clear AUX pointers of all edges. */ /* Clear AUX pointers of all edges. */
void void
clear_aux_for_edges () clear_aux_for_edges (void)
{ {
basic_block bb; basic_block bb;
edge e; edge e;
...@@ -825,7 +795,7 @@ clear_aux_for_edges () ...@@ -825,7 +795,7 @@ clear_aux_for_edges ()
of all edges. */ of all edges. */
void void
free_aux_for_edges () free_aux_for_edges (void)
{ {
if (!first_edge_aux_obj) if (!first_edge_aux_obj)
abort (); abort ();
...@@ -835,12 +805,12 @@ free_aux_for_edges () ...@@ -835,12 +805,12 @@ free_aux_for_edges ()
clear_aux_for_edges (); clear_aux_for_edges ();
} }
/* Verify the CFG consistency. /* Verify the CFG consistency.
Currently it does following checks edge and basic block list correctness Currently it does following checks edge and basic block list correctness
and calls into IL dependent checking then. */ and calls into IL dependent checking then. */
void void
verify_flow_info () verify_flow_info (void)
{ {
size_t *edge_checksum; size_t *edge_checksum;
int num_bb_notes, err = 0; int num_bb_notes, err = 0;
...@@ -984,9 +954,7 @@ verify_flow_info () ...@@ -984,9 +954,7 @@ verify_flow_info ()
/* Print out one basic block with live information at start and end. */ /* Print out one basic block with live information at start and end. */
void void
dump_bb (bb, outf) dump_bb (basic_block bb, FILE *outf)
basic_block bb;
FILE *outf;
{ {
edge e; edge e;
...@@ -1004,15 +972,13 @@ dump_bb (bb, outf) ...@@ -1004,15 +972,13 @@ dump_bb (bb, outf)
} }
void void
debug_bb (bb) debug_bb (basic_block bb)
basic_block bb;
{ {
dump_bb (bb, stderr); dump_bb (bb, stderr);
} }
basic_block basic_block
debug_bb_n (n) debug_bb_n (int n)
int n;
{ {
basic_block bb = BASIC_BLOCK (n); basic_block bb = BASIC_BLOCK (n);
dump_bb (bb, stderr); dump_bb (bb, stderr);
......
...@@ -46,29 +46,25 @@ struct depth_first_search_dsS { ...@@ -46,29 +46,25 @@ struct depth_first_search_dsS {
}; };
typedef struct depth_first_search_dsS *depth_first_search_ds; typedef struct depth_first_search_dsS *depth_first_search_ds;
static void flow_dfs_compute_reverse_init static void flow_dfs_compute_reverse_init (depth_first_search_ds);
PARAMS ((depth_first_search_ds)); static void flow_dfs_compute_reverse_add_bb (depth_first_search_ds,
static void flow_dfs_compute_reverse_add_bb basic_block);
PARAMS ((depth_first_search_ds, basic_block)); static basic_block flow_dfs_compute_reverse_execute (depth_first_search_ds);
static basic_block flow_dfs_compute_reverse_execute static void flow_dfs_compute_reverse_finish (depth_first_search_ds);
PARAMS ((depth_first_search_ds)); static void remove_fake_successors (basic_block);
static void flow_dfs_compute_reverse_finish static bool need_fake_edge_p (rtx);
PARAMS ((depth_first_search_ds)); static bool flow_active_insn_p (rtx);
static void remove_fake_successors PARAMS ((basic_block));
static bool need_fake_edge_p PARAMS ((rtx));
static bool flow_active_insn_p PARAMS ((rtx));
/* Like active_insn_p, except keep the return value clobber around /* Like active_insn_p, except keep the return value clobber around
even after reload. */ even after reload. */
static bool static bool
flow_active_insn_p (insn) flow_active_insn_p (rtx insn)
rtx insn;
{ {
if (active_insn_p (insn)) if (active_insn_p (insn))
return true; return true;
/* A clobber of the function return value exists for buggy /* A clobber of the function return value exists for buggy
programs that fail to return a value. Its effect is to programs that fail to return a value. Its effect is to
keep the return value from being live across the entire keep the return value from being live across the entire
function. If we allow it to be skipped, we introduce the function. If we allow it to be skipped, we introduce the
...@@ -85,8 +81,7 @@ flow_active_insn_p (insn) ...@@ -85,8 +81,7 @@ flow_active_insn_p (insn)
its single destination. */ its single destination. */
bool bool
forwarder_block_p (bb) forwarder_block_p (basic_block bb)
basic_block bb;
{ {
rtx insn; rtx insn;
...@@ -106,8 +101,7 @@ forwarder_block_p (bb) ...@@ -106,8 +101,7 @@ forwarder_block_p (bb)
/* Return nonzero if we can reach target from src by falling through. */ /* Return nonzero if we can reach target from src by falling through. */
bool bool
can_fallthru (src, target) can_fallthru (basic_block src, basic_block target)
basic_block src, target;
{ {
rtx insn = src->end; rtx insn = src->end;
rtx insn2 = target->head; rtx insn2 = target->head;
...@@ -133,7 +127,7 @@ can_fallthru (src, target) ...@@ -133,7 +127,7 @@ can_fallthru (src, target)
and heavily borrowed from flow_depth_first_order_compute. */ and heavily borrowed from flow_depth_first_order_compute. */
bool bool
mark_dfs_back_edges () mark_dfs_back_edges (void)
{ {
edge *stack; edge *stack;
int *pre; int *pre;
...@@ -217,7 +211,7 @@ mark_dfs_back_edges () ...@@ -217,7 +211,7 @@ mark_dfs_back_edges ()
/* Set the flag EDGE_CAN_FALLTHRU for edges that can be fallthru. */ /* Set the flag EDGE_CAN_FALLTHRU for edges that can be fallthru. */
void void
set_edge_can_fallthru_flag () set_edge_can_fallthru_flag (void)
{ {
basic_block bb; basic_block bb;
...@@ -252,8 +246,7 @@ set_edge_can_fallthru_flag () ...@@ -252,8 +246,7 @@ set_edge_can_fallthru_flag ()
Helper function for the flow_call_edges_add. */ Helper function for the flow_call_edges_add. */
static bool static bool
need_fake_edge_p (insn) need_fake_edge_p (rtx insn)
rtx insn;
{ {
if (!INSN_P (insn)) if (!INSN_P (insn))
return false; return false;
...@@ -282,8 +275,7 @@ need_fake_edge_p (insn) ...@@ -282,8 +275,7 @@ need_fake_edge_p (insn)
that all subsequent instructions must be executed. */ that all subsequent instructions must be executed. */
int int
flow_call_edges_add (blocks) flow_call_edges_add (sbitmap blocks)
sbitmap blocks;
{ {
int i; int i;
int blocks_split = 0; int blocks_split = 0;
...@@ -405,7 +397,7 @@ flow_call_edges_add (blocks) ...@@ -405,7 +397,7 @@ flow_call_edges_add (blocks)
block is reachable. */ block is reachable. */
void void
find_unreachable_blocks () find_unreachable_blocks (void)
{ {
edge e; edge e;
basic_block *tos, *worklist, bb; basic_block *tos, *worklist, bb;
...@@ -461,7 +453,7 @@ find_unreachable_blocks () ...@@ -461,7 +453,7 @@ find_unreachable_blocks ()
and the data structure is filled in. */ and the data structure is filled in. */
struct edge_list * struct edge_list *
create_edge_list () create_edge_list (void)
{ {
struct edge_list *elist; struct edge_list *elist;
edge e; edge e;
...@@ -499,8 +491,7 @@ create_edge_list () ...@@ -499,8 +491,7 @@ create_edge_list ()
/* This function free's memory associated with an edge list. */ /* This function free's memory associated with an edge list. */
void void
free_edge_list (elist) free_edge_list (struct edge_list *elist)
struct edge_list *elist;
{ {
if (elist) if (elist)
{ {
...@@ -512,9 +503,7 @@ free_edge_list (elist) ...@@ -512,9 +503,7 @@ free_edge_list (elist)
/* This function provides debug output showing an edge list. */ /* This function provides debug output showing an edge list. */
void void
print_edge_list (f, elist) print_edge_list (FILE *f, struct edge_list *elist)
FILE *f;
struct edge_list *elist;
{ {
int x; int x;
...@@ -541,9 +530,7 @@ print_edge_list (f, elist) ...@@ -541,9 +530,7 @@ print_edge_list (f, elist)
extra edges. */ extra edges. */
void void
verify_edge_list (f, elist) verify_edge_list (FILE *f, struct edge_list *elist)
FILE *f;
struct edge_list *elist;
{ {
int pred, succ, index; int pred, succ, index;
edge e; edge e;
...@@ -608,9 +595,7 @@ verify_edge_list (f, elist) ...@@ -608,9 +595,7 @@ verify_edge_list (f, elist)
a specified predecessor and successor. */ a specified predecessor and successor. */
int int
find_edge_index (edge_list, pred, succ) find_edge_index (struct edge_list *edge_list, basic_block pred, basic_block succ)
struct edge_list *edge_list;
basic_block pred, succ;
{ {
int x; int x;
...@@ -625,10 +610,7 @@ find_edge_index (edge_list, pred, succ) ...@@ -625,10 +610,7 @@ find_edge_index (edge_list, pred, succ)
/* Dump the list of basic blocks in the bitmap NODES. */ /* Dump the list of basic blocks in the bitmap NODES. */
void void
flow_nodes_print (str, nodes, file) flow_nodes_print (const char *str, const sbitmap nodes, FILE *file)
const char *str;
const sbitmap nodes;
FILE *file;
{ {
int node; int node;
...@@ -643,11 +625,7 @@ flow_nodes_print (str, nodes, file) ...@@ -643,11 +625,7 @@ flow_nodes_print (str, nodes, file)
/* Dump the list of edges in the array EDGE_LIST. */ /* Dump the list of edges in the array EDGE_LIST. */
void void
flow_edge_list_print (str, edge_list, num_edges, file) flow_edge_list_print (const char *str, const edge *edge_list, int num_edges, FILE *file)
const char *str;
const edge *edge_list;
int num_edges;
FILE *file;
{ {
int i; int i;
...@@ -668,8 +646,7 @@ flow_edge_list_print (str, edge_list, num_edges, file) ...@@ -668,8 +646,7 @@ flow_edge_list_print (str, edge_list, num_edges, file)
list it is in. */ list it is in. */
static void static void
remove_fake_successors (bb) remove_fake_successors (basic_block bb)
basic_block bb;
{ {
edge e; edge e;
...@@ -688,7 +665,7 @@ remove_fake_successors (bb) ...@@ -688,7 +665,7 @@ remove_fake_successors (bb)
fake predecessors. */ fake predecessors. */
void void
remove_fake_edges () remove_fake_edges (void)
{ {
basic_block bb; basic_block bb;
...@@ -701,7 +678,7 @@ remove_fake_edges () ...@@ -701,7 +678,7 @@ remove_fake_edges ()
edges to exist. */ edges to exist. */
void void
add_noreturn_fake_exit_edges () add_noreturn_fake_exit_edges (void)
{ {
basic_block bb; basic_block bb;
...@@ -722,7 +699,7 @@ add_noreturn_fake_exit_edges () ...@@ -722,7 +699,7 @@ add_noreturn_fake_exit_edges ()
nodes not reachable from the exit block. */ nodes not reachable from the exit block. */
void void
connect_infinite_loops_to_exit () connect_infinite_loops_to_exit (void)
{ {
basic_block unvisited_block; basic_block unvisited_block;
struct depth_first_search_dsS dfs_ds; struct depth_first_search_dsS dfs_ds;
...@@ -750,8 +727,7 @@ connect_infinite_loops_to_exit () ...@@ -750,8 +727,7 @@ connect_infinite_loops_to_exit ()
/* Compute reverse top sort order */ /* Compute reverse top sort order */
void void
flow_reverse_top_sort_order_compute (rts_order) flow_reverse_top_sort_order_compute (int *rts_order)
int *rts_order;
{ {
edge *stack; edge *stack;
int sp; int sp;
...@@ -819,9 +795,7 @@ flow_reverse_top_sort_order_compute (rts_order) ...@@ -819,9 +795,7 @@ flow_reverse_top_sort_order_compute (rts_order)
possible. */ possible. */
int int
flow_depth_first_order_compute (dfs_order, rc_order) flow_depth_first_order_compute (int *dfs_order, int *rc_order)
int *dfs_order;
int *rc_order;
{ {
edge *stack; edge *stack;
int sp; int sp;
...@@ -922,8 +896,7 @@ struct dfst_node ...@@ -922,8 +896,7 @@ struct dfst_node
2) Walking the resulting tree from right to left. */ 2) Walking the resulting tree from right to left. */
void void
flow_preorder_transversal_compute (pot_order) flow_preorder_transversal_compute (int *pot_order)
int *pot_order;
{ {
edge e; edge e;
edge *stack; edge *stack;
...@@ -1062,8 +1035,7 @@ flow_preorder_transversal_compute (pot_order) ...@@ -1062,8 +1035,7 @@ flow_preorder_transversal_compute (pot_order)
element on the stack. */ element on the stack. */
static void static void
flow_dfs_compute_reverse_init (data) flow_dfs_compute_reverse_init (depth_first_search_ds data)
depth_first_search_ds data;
{ {
/* Allocate stack for back-tracking up CFG. */ /* Allocate stack for back-tracking up CFG. */
data->stack = (basic_block *) xmalloc ((n_basic_blocks - (INVALID_BLOCK + 1)) data->stack = (basic_block *) xmalloc ((n_basic_blocks - (INVALID_BLOCK + 1))
...@@ -1084,9 +1056,7 @@ flow_dfs_compute_reverse_init (data) ...@@ -1084,9 +1056,7 @@ flow_dfs_compute_reverse_init (data)
block. */ block. */
static void static void
flow_dfs_compute_reverse_add_bb (data, bb) flow_dfs_compute_reverse_add_bb (depth_first_search_ds data, basic_block bb)
depth_first_search_ds data;
basic_block bb;
{ {
data->stack[data->sp++] = bb; data->stack[data->sp++] = bb;
SET_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1)); SET_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1));
...@@ -1098,8 +1068,7 @@ flow_dfs_compute_reverse_add_bb (data, bb) ...@@ -1098,8 +1068,7 @@ flow_dfs_compute_reverse_add_bb (data, bb)
available. */ available. */
static basic_block static basic_block
flow_dfs_compute_reverse_execute (data) flow_dfs_compute_reverse_execute (depth_first_search_ds data)
depth_first_search_ds data;
{ {
basic_block bb; basic_block bb;
edge e; edge e;
...@@ -1127,8 +1096,7 @@ flow_dfs_compute_reverse_execute (data) ...@@ -1127,8 +1096,7 @@ flow_dfs_compute_reverse_execute (data)
reverse graph. */ reverse graph. */
static void static void
flow_dfs_compute_reverse_finish (data) flow_dfs_compute_reverse_finish (depth_first_search_ds data)
depth_first_search_ds data;
{ {
free (data->stack); free (data->stack);
sbitmap_free (data->visited_blocks); sbitmap_free (data->visited_blocks);
...@@ -1138,13 +1106,9 @@ flow_dfs_compute_reverse_finish (data) ...@@ -1138,13 +1106,9 @@ flow_dfs_compute_reverse_finish (data)
if REVERSE, go against direction of edges. Returns number of blocks if REVERSE, go against direction of edges. Returns number of blocks
found and their list in RSLT. RSLT can contain at most RSLT_MAX items. */ found and their list in RSLT. RSLT can contain at most RSLT_MAX items. */
int int
dfs_enumerate_from (bb, reverse, predicate, rslt, rslt_max, data) dfs_enumerate_from (basic_block bb, int reverse,
basic_block bb; bool (*predicate) (basic_block, void *),
int reverse; basic_block *rslt, int rslt_max, void *data)
bool (*predicate) PARAMS ((basic_block, void *));
basic_block *rslt;
int rslt_max;
void *data;
{ {
basic_block *st, lbb; basic_block *st, lbb;
int sp = 0, tv = 0; int sp = 0, tv = 0;
......
...@@ -48,23 +48,20 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -48,23 +48,20 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h" #include "toplev.h"
#include "timevar.h" #include "timevar.h"
static int count_basic_blocks PARAMS ((rtx)); static int count_basic_blocks (rtx);
static void find_basic_blocks_1 PARAMS ((rtx)); static void find_basic_blocks_1 (rtx);
static rtx find_label_refs PARAMS ((rtx, rtx)); static rtx find_label_refs (rtx, rtx);
static void make_edges PARAMS ((rtx, basic_block, static void make_edges (rtx, basic_block, basic_block, int);
basic_block, int)); static void make_label_edge (sbitmap *, basic_block, rtx, int);
static void make_label_edge PARAMS ((sbitmap *, basic_block, static void make_eh_edge (sbitmap *, basic_block, rtx);
rtx, int)); static void find_bb_boundaries (basic_block);
static void make_eh_edge PARAMS ((sbitmap *, basic_block, rtx)); static void compute_outgoing_frequencies (basic_block);
static void find_bb_boundaries PARAMS ((basic_block));
static void compute_outgoing_frequencies PARAMS ((basic_block));
/* Return true if insn is something that should be contained inside basic /* Return true if insn is something that should be contained inside basic
block. */ block. */
bool bool
inside_basic_block_p (insn) inside_basic_block_p (rtx insn)
rtx insn;
{ {
switch (GET_CODE (insn)) switch (GET_CODE (insn))
{ {
...@@ -96,8 +93,7 @@ inside_basic_block_p (insn) ...@@ -96,8 +93,7 @@ inside_basic_block_p (insn)
the basic block. */ the basic block. */
bool bool
control_flow_insn_p (insn) control_flow_insn_p (rtx insn)
rtx insn;
{ {
rtx note; rtx note;
...@@ -138,8 +134,7 @@ control_flow_insn_p (insn) ...@@ -138,8 +134,7 @@ control_flow_insn_p (insn)
/* Count the basic blocks of the function. */ /* Count the basic blocks of the function. */
static int static int
count_basic_blocks (f) count_basic_blocks (rtx f)
rtx f;
{ {
int count = 0; int count = 0;
bool saw_insn = false; bool saw_insn = false;
...@@ -180,9 +175,7 @@ count_basic_blocks (f) ...@@ -180,9 +175,7 @@ count_basic_blocks (f)
This is used to scan the alternatives of a call placeholder. */ This is used to scan the alternatives of a call placeholder. */
static rtx static rtx
find_label_refs (f, lvl) find_label_refs (rtx f, rtx lvl)
rtx f;
rtx lvl;
{ {
rtx insn; rtx insn;
...@@ -229,11 +222,7 @@ find_label_refs (f, lvl) ...@@ -229,11 +222,7 @@ find_label_refs (f, lvl)
/* Create an edge from a basic block to a label. */ /* Create an edge from a basic block to a label. */
static void static void
make_label_edge (edge_cache, src, label, flags) make_label_edge (sbitmap *edge_cache, basic_block src, rtx label, int flags)
sbitmap *edge_cache;
basic_block src;
rtx label;
int flags;
{ {
if (GET_CODE (label) != CODE_LABEL) if (GET_CODE (label) != CODE_LABEL)
abort (); abort ();
...@@ -252,10 +241,7 @@ make_label_edge (edge_cache, src, label, flags) ...@@ -252,10 +241,7 @@ make_label_edge (edge_cache, src, label, flags)
/* Create the edges generated by INSN in REGION. */ /* Create the edges generated by INSN in REGION. */
static void static void
make_eh_edge (edge_cache, src, insn) make_eh_edge (sbitmap *edge_cache, basic_block src, rtx insn)
sbitmap *edge_cache;
basic_block src;
rtx insn;
{ {
int is_call = GET_CODE (insn) == CALL_INSN ? EDGE_ABNORMAL_CALL : 0; int is_call = GET_CODE (insn) == CALL_INSN ? EDGE_ABNORMAL_CALL : 0;
rtx handlers, i; rtx handlers, i;
...@@ -278,10 +264,7 @@ make_eh_edge (edge_cache, src, insn) ...@@ -278,10 +264,7 @@ make_eh_edge (edge_cache, src, insn)
the list of exception regions active at the end of the basic block. */ the list of exception regions active at the end of the basic block. */
static void static void
make_edges (label_value_list, min, max, update_p) make_edges (rtx label_value_list, basic_block min, basic_block max, int update_p)
rtx label_value_list;
basic_block min, max;
int update_p;
{ {
basic_block bb; basic_block bb;
sbitmap *edge_cache = NULL; sbitmap *edge_cache = NULL;
...@@ -464,8 +447,7 @@ make_edges (label_value_list, min, max, update_p) ...@@ -464,8 +447,7 @@ make_edges (label_value_list, min, max, update_p)
will be used in make_edges for use with computed gotos. */ will be used in make_edges for use with computed gotos. */
static void static void
find_basic_blocks_1 (f) find_basic_blocks_1 (rtx f)
rtx f;
{ {
rtx insn, next; rtx insn, next;
rtx bb_note = NULL_RTX; rtx bb_note = NULL_RTX;
...@@ -604,10 +586,8 @@ find_basic_blocks_1 (f) ...@@ -604,10 +586,8 @@ find_basic_blocks_1 (f)
numbers in use. */ numbers in use. */
void void
find_basic_blocks (f, nregs, file) find_basic_blocks (rtx f, int nregs ATTRIBUTE_UNUSED,
rtx f; FILE *file ATTRIBUTE_UNUSED)
int nregs ATTRIBUTE_UNUSED;
FILE *file ATTRIBUTE_UNUSED;
{ {
basic_block bb; basic_block bb;
...@@ -622,7 +602,7 @@ find_basic_blocks (f, nregs, file) ...@@ -622,7 +602,7 @@ find_basic_blocks (f, nregs, file)
tag for reuse during create_basic_block, just in case some pass tag for reuse during create_basic_block, just in case some pass
copies around basic block notes improperly. */ copies around basic block notes improperly. */
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
bb->aux = NULL; bb->aux = NULL;
VARRAY_FREE (basic_block_info); VARRAY_FREE (basic_block_info);
} }
...@@ -667,8 +647,7 @@ enum state {BLOCK_NEW = 0, BLOCK_ORIGINAL, BLOCK_TO_SPLIT}; ...@@ -667,8 +647,7 @@ enum state {BLOCK_NEW = 0, BLOCK_ORIGINAL, BLOCK_TO_SPLIT};
and create new basic blocks in the progress. */ and create new basic blocks in the progress. */
static void static void
find_bb_boundaries (bb) find_bb_boundaries (basic_block bb)
basic_block bb;
{ {
rtx insn = bb->head; rtx insn = bb->head;
rtx end = bb->end; rtx end = bb->end;
...@@ -734,8 +713,7 @@ find_bb_boundaries (bb) ...@@ -734,8 +713,7 @@ find_bb_boundaries (bb)
and probabilities of outgoing edges. */ and probabilities of outgoing edges. */
static void static void
compute_outgoing_frequencies (b) compute_outgoing_frequencies (basic_block b)
basic_block b;
{ {
edge e, f; edge e, f;
...@@ -771,8 +749,7 @@ compute_outgoing_frequencies (b) ...@@ -771,8 +749,7 @@ compute_outgoing_frequencies (b)
basic block. Update the data structure. */ basic block. Update the data structure. */
void void
find_many_sub_basic_blocks (blocks) find_many_sub_basic_blocks (sbitmap blocks)
sbitmap blocks;
{ {
basic_block bb, min, max; basic_block bb, min, max;
...@@ -826,8 +803,7 @@ find_many_sub_basic_blocks (blocks) ...@@ -826,8 +803,7 @@ find_many_sub_basic_blocks (blocks)
/* Like above but for single basic block only. */ /* Like above but for single basic block only. */
void void
find_sub_basic_blocks (bb) find_sub_basic_blocks (basic_block bb)
basic_block bb;
{ {
basic_block min, max, b; basic_block min, max, b;
basic_block next = bb->next_bb; basic_block next = bb->next_bb;
......
/* Control flow optimization code for GNU compiler. /* Control flow optimization code for GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -67,36 +67,30 @@ enum bb_flags ...@@ -67,36 +67,30 @@ enum bb_flags
#define FORWARDER_BLOCK_P(BB) (BB_FLAGS (BB) & BB_FORWARDER_BLOCK) #define FORWARDER_BLOCK_P(BB) (BB_FLAGS (BB) & BB_FORWARDER_BLOCK)
static bool try_crossjump_to_edge PARAMS ((int, edge, edge)); static bool try_crossjump_to_edge (int, edge, edge);
static bool try_crossjump_bb PARAMS ((int, basic_block)); static bool try_crossjump_bb (int, basic_block);
static bool outgoing_edges_match PARAMS ((int, static bool outgoing_edges_match (int, basic_block, basic_block);
basic_block, basic_block)); static int flow_find_cross_jump (int, basic_block, basic_block, rtx *, rtx *);
static int flow_find_cross_jump PARAMS ((int, basic_block, basic_block, static bool insns_match_p (int, rtx, rtx);
rtx *, rtx *));
static bool insns_match_p PARAMS ((int, rtx, rtx)); static bool label_is_jump_target_p (rtx, rtx);
static bool tail_recursion_label_p (rtx);
static bool label_is_jump_target_p PARAMS ((rtx, rtx)); static void merge_blocks_move_predecessor_nojumps (basic_block, basic_block);
static bool tail_recursion_label_p PARAMS ((rtx)); static void merge_blocks_move_successor_nojumps (basic_block, basic_block);
static void merge_blocks_move_predecessor_nojumps PARAMS ((basic_block, static basic_block merge_blocks (edge,basic_block,basic_block, int);
basic_block)); static bool try_optimize_cfg (int);
static void merge_blocks_move_successor_nojumps PARAMS ((basic_block, static bool try_simplify_condjump (basic_block);
basic_block)); static bool try_forward_edges (int, basic_block);
static basic_block merge_blocks PARAMS ((edge,basic_block,basic_block, static edge thread_jump (int, edge, basic_block);
int)); static bool mark_effect (rtx, bitmap);
static bool try_optimize_cfg PARAMS ((int)); static void notice_new_block (basic_block);
static bool try_simplify_condjump PARAMS ((basic_block)); static void update_forwarder_flag (basic_block);
static bool try_forward_edges PARAMS ((int, basic_block)); static int mentions_nonequal_regs (rtx *, void *);
static edge thread_jump PARAMS ((int, edge, basic_block));
static bool mark_effect PARAMS ((rtx, bitmap));
static void notice_new_block PARAMS ((basic_block));
static void update_forwarder_flag PARAMS ((basic_block));
static int mentions_nonequal_regs PARAMS ((rtx *, void *));
/* Set flags for newly created block. */ /* Set flags for newly created block. */
static void static void
notice_new_block (bb) notice_new_block (basic_block bb)
basic_block bb;
{ {
if (!bb) if (!bb)
return; return;
...@@ -108,8 +102,7 @@ notice_new_block (bb) ...@@ -108,8 +102,7 @@ notice_new_block (bb)
/* Recompute forwarder flag after block has been modified. */ /* Recompute forwarder flag after block has been modified. */
static void static void
update_forwarder_flag (bb) update_forwarder_flag (basic_block bb)
basic_block bb;
{ {
if (forwarder_block_p (bb)) if (forwarder_block_p (bb))
BB_SET_FLAG (bb, BB_FORWARDER_BLOCK); BB_SET_FLAG (bb, BB_FORWARDER_BLOCK);
...@@ -121,8 +114,7 @@ update_forwarder_flag (bb) ...@@ -121,8 +114,7 @@ update_forwarder_flag (bb)
Return true if something changed. */ Return true if something changed. */
static bool static bool
try_simplify_condjump (cbranch_block) try_simplify_condjump (basic_block cbranch_block)
basic_block cbranch_block;
{ {
basic_block jump_block, jump_dest_block, cbranch_dest_block; basic_block jump_block, jump_dest_block, cbranch_dest_block;
edge cbranch_jump_edge, cbranch_fallthru_edge; edge cbranch_jump_edge, cbranch_fallthru_edge;
...@@ -190,9 +182,7 @@ try_simplify_condjump (cbranch_block) ...@@ -190,9 +182,7 @@ try_simplify_condjump (cbranch_block)
on register. Used by jump threading. */ on register. Used by jump threading. */
static bool static bool
mark_effect (exp, nonequal) mark_effect (rtx exp, regset nonequal)
rtx exp;
regset nonequal;
{ {
int regno; int regno;
rtx dest; rtx dest;
...@@ -241,9 +231,7 @@ mark_effect (exp, nonequal) ...@@ -241,9 +231,7 @@ mark_effect (exp, nonequal)
/* Return nonzero if X is an register set in regset DATA. /* Return nonzero if X is an register set in regset DATA.
Called via for_each_rtx. */ Called via for_each_rtx. */
static int static int
mentions_nonequal_regs (x, data) mentions_nonequal_regs (rtx *x, void *data)
rtx *x;
void *data;
{ {
regset nonequal = (regset) data; regset nonequal = (regset) data;
if (REG_P (*x)) if (REG_P (*x))
...@@ -268,10 +256,7 @@ mentions_nonequal_regs (x, data) ...@@ -268,10 +256,7 @@ mentions_nonequal_regs (x, data)
if exist, NULL otherwise. */ if exist, NULL otherwise. */
static edge static edge
thread_jump (mode, e, b) thread_jump (int mode, edge e, basic_block b)
int mode;
edge e;
basic_block b;
{ {
rtx set1, set2, cond1, cond2, insn; rtx set1, set2, cond1, cond2, insn;
enum rtx_code code1, code2, reversed_code2; enum rtx_code code1, code2, reversed_code2;
...@@ -413,9 +398,7 @@ failed_exit: ...@@ -413,9 +398,7 @@ failed_exit:
Return true if successful. */ Return true if successful. */
static bool static bool
try_forward_edges (mode, b) try_forward_edges (int mode, basic_block b)
basic_block b;
int mode;
{ {
bool changed = false; bool changed = false;
edge e, next, *threaded_edges = NULL; edge e, next, *threaded_edges = NULL;
...@@ -648,8 +631,7 @@ try_forward_edges (mode, b) ...@@ -648,8 +631,7 @@ try_forward_edges (mode, b)
not apply to the fallthru case of a conditional jump. */ not apply to the fallthru case of a conditional jump. */
static bool static bool
label_is_jump_target_p (label, jump_insn) label_is_jump_target_p (rtx label, rtx jump_insn)
rtx label, jump_insn;
{ {
rtx tmp = JUMP_LABEL (jump_insn); rtx tmp = JUMP_LABEL (jump_insn);
...@@ -672,8 +654,7 @@ label_is_jump_target_p (label, jump_insn) ...@@ -672,8 +654,7 @@ label_is_jump_target_p (label, jump_insn)
/* Return true if LABEL is used for tail recursion. */ /* Return true if LABEL is used for tail recursion. */
static bool static bool
tail_recursion_label_p (label) tail_recursion_label_p (rtx label)
rtx label;
{ {
rtx x; rtx x;
...@@ -689,8 +670,7 @@ tail_recursion_label_p (label) ...@@ -689,8 +670,7 @@ tail_recursion_label_p (label)
any jumps (aside from the jump from A to B). */ any jumps (aside from the jump from A to B). */
static void static void
merge_blocks_move_predecessor_nojumps (a, b) merge_blocks_move_predecessor_nojumps (basic_block a, basic_block b)
basic_block a, b;
{ {
rtx barrier; rtx barrier;
...@@ -732,8 +712,7 @@ merge_blocks_move_predecessor_nojumps (a, b) ...@@ -732,8 +712,7 @@ merge_blocks_move_predecessor_nojumps (a, b)
any jumps (aside from the jump from A to B). */ any jumps (aside from the jump from A to B). */
static void static void
merge_blocks_move_successor_nojumps (a, b) merge_blocks_move_successor_nojumps (basic_block a, basic_block b)
basic_block a, b;
{ {
rtx barrier, real_b_end; rtx barrier, real_b_end;
...@@ -795,10 +774,7 @@ merge_blocks_move_successor_nojumps (a, b) ...@@ -795,10 +774,7 @@ merge_blocks_move_successor_nojumps (a, b)
relative ordering of these two. Hopefully it is not too common. */ relative ordering of these two. Hopefully it is not too common. */
static basic_block static basic_block
merge_blocks (e, b, c, mode) merge_blocks (edge e, basic_block b, basic_block c, int mode)
edge e;
basic_block b, c;
int mode;
{ {
basic_block next; basic_block next;
/* If C has a tail recursion label, do not merge. There is no /* If C has a tail recursion label, do not merge. There is no
...@@ -895,9 +871,7 @@ merge_blocks (e, b, c, mode) ...@@ -895,9 +871,7 @@ merge_blocks (e, b, c, mode)
/* Return true if I1 and I2 are equivalent and thus can be crossjumped. */ /* Return true if I1 and I2 are equivalent and thus can be crossjumped. */
static bool static bool
insns_match_p (mode, i1, i2) insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2)
int mode ATTRIBUTE_UNUSED;
rtx i1, i2;
{ {
rtx p1, p2; rtx p1, p2;
...@@ -1010,10 +984,8 @@ insns_match_p (mode, i1, i2) ...@@ -1010,10 +984,8 @@ insns_match_p (mode, i1, i2)
store the head of the blocks in *F1 and *F2. */ store the head of the blocks in *F1 and *F2. */
static int static int
flow_find_cross_jump (mode, bb1, bb2, f1, f2) flow_find_cross_jump (int mode ATTRIBUTE_UNUSED, basic_block bb1,
int mode ATTRIBUTE_UNUSED; basic_block bb2, rtx *f1, rtx *f2)
basic_block bb1, bb2;
rtx *f1, *f2;
{ {
rtx i1, i2, last1, last2, afterlast1, afterlast2; rtx i1, i2, last1, last2, afterlast1, afterlast2;
int ninsns = 0; int ninsns = 0;
...@@ -1122,10 +1094,7 @@ flow_find_cross_jump (mode, bb1, bb2, f1, f2) ...@@ -1122,10 +1094,7 @@ flow_find_cross_jump (mode, bb1, bb2, f1, f2)
We may assume that there exists one edge with a common destination. */ We may assume that there exists one edge with a common destination. */
static bool static bool
outgoing_edges_match (mode, bb1, bb2) outgoing_edges_match (int mode, basic_block bb1, basic_block bb2)
int mode;
basic_block bb1;
basic_block bb2;
{ {
int nehedges1 = 0, nehedges2 = 0; int nehedges1 = 0, nehedges2 = 0;
edge fallthru1 = 0, fallthru2 = 0; edge fallthru1 = 0, fallthru2 = 0;
...@@ -1394,9 +1363,7 @@ outgoing_edges_match (mode, bb1, bb2) ...@@ -1394,9 +1363,7 @@ outgoing_edges_match (mode, bb1, bb2)
(maybe the middle of) E1->SRC to (maybe the middle of) E2->SRC. */ (maybe the middle of) E1->SRC to (maybe the middle of) E2->SRC. */
static bool static bool
try_crossjump_to_edge (mode, e1, e2) try_crossjump_to_edge (int mode, edge e1, edge e2)
int mode;
edge e1, e2;
{ {
int nmatch; int nmatch;
basic_block src1 = e1->src, src2 = e2->src; basic_block src1 = e1->src, src2 = e2->src;
...@@ -1580,9 +1547,7 @@ try_crossjump_to_edge (mode, e1, e2) ...@@ -1580,9 +1547,7 @@ try_crossjump_to_edge (mode, e1, e2)
any changes made. */ any changes made. */
static bool static bool
try_crossjump_bb (mode, bb) try_crossjump_bb (int mode, basic_block bb)
int mode;
basic_block bb;
{ {
edge e, e2, nexte2, nexte, fallthru; edge e, e2, nexte2, nexte, fallthru;
bool changed; bool changed;
...@@ -1675,8 +1640,7 @@ try_crossjump_bb (mode, bb) ...@@ -1675,8 +1640,7 @@ try_crossjump_bb (mode, bb)
instructions etc. Return nonzero if changes were made. */ instructions etc. Return nonzero if changes were made. */
static bool static bool
try_optimize_cfg (mode) try_optimize_cfg (int mode)
int mode;
{ {
bool changed_overall = false; bool changed_overall = false;
bool changed; bool changed;
...@@ -1856,7 +1820,7 @@ try_optimize_cfg (mode) ...@@ -1856,7 +1820,7 @@ try_optimize_cfg (mode)
/* Delete all unreachable basic blocks. */ /* Delete all unreachable basic blocks. */
bool bool
delete_unreachable_blocks () delete_unreachable_blocks (void)
{ {
bool changed = false; bool changed = false;
basic_block b, next_bb; basic_block b, next_bb;
...@@ -1884,8 +1848,7 @@ delete_unreachable_blocks () ...@@ -1884,8 +1848,7 @@ delete_unreachable_blocks ()
/* Tidy the CFG by deleting unreachable code and whatnot. */ /* Tidy the CFG by deleting unreachable code and whatnot. */
bool bool
cleanup_cfg (mode) cleanup_cfg (int mode)
int mode;
{ {
bool changed = false; bool changed = false;
......
...@@ -34,15 +34,15 @@ extern struct cfg_hooks cfg_layout_rtl_cfg_hooks; ...@@ -34,15 +34,15 @@ extern struct cfg_hooks cfg_layout_rtl_cfg_hooks;
struct cfg_hooks *cfg_hooks; struct cfg_hooks *cfg_hooks;
/* Initialization of functions specific to the rtl IR. */ /* Initialization of functions specific to the rtl IR. */
void void
rtl_register_cfg_hooks () rtl_register_cfg_hooks (void)
{ {
cfg_hooks = &rtl_cfg_hooks; cfg_hooks = &rtl_cfg_hooks;
} }
/* Initialization of functions specific to the rtl IR. */ /* Initialization of functions specific to the rtl IR. */
void void
cfg_layout_rtl_register_cfg_hooks () cfg_layout_rtl_register_cfg_hooks (void)
{ {
cfg_hooks = &cfg_layout_rtl_cfg_hooks; cfg_hooks = &cfg_layout_rtl_cfg_hooks;
} }
...@@ -26,30 +26,30 @@ struct cfg_hooks ...@@ -26,30 +26,30 @@ struct cfg_hooks
{ {
/* Debugging. Do not use macros to hook these so they can be called from /* Debugging. Do not use macros to hook these so they can be called from
debugger! */ debugger! */
int (*cfgh_verify_flow_info) PARAMS ((void)); int (*cfgh_verify_flow_info) (void);
void (*dump_bb) PARAMS ((basic_block, FILE *)); void (*dump_bb) (basic_block, FILE *);
/* Basic CFG manipulation. */ /* Basic CFG manipulation. */
/* Redirect edge E to the given basic block B and update underlying program /* Redirect edge E to the given basic block B and update underlying program
representation. Returns false when edge is not easilly redirectable for representation. Returns false when edge is not easilly redirectable for
whatever reason. */ whatever reason. */
bool (*redirect_edge_and_branch) PARAMS ((edge e, basic_block b)); bool (*redirect_edge_and_branch) (edge e, basic_block b);
/* Same as the above but allows redirecting of fallthru edges. In that case /* Same as the above but allows redirecting of fallthru edges. In that case
newly created forwarder basic block is returned. It aborts when called newly created forwarder basic block is returned. It aborts when called
on abnormal edge. */ on abnormal edge. */
basic_block (*redirect_edge_and_branch_force)PARAMS ((edge, basic_block)); basic_block (*redirect_edge_and_branch_force) (edge, basic_block);
/* Remove given basic block and all edges possibly pointing into it. */ /* Remove given basic block and all edges possibly pointing into it. */
void (*delete_block)PARAMS ((basic_block)); void (*delete_block) (basic_block);
/* Split basic block B after specified instruction I. */ /* Split basic block B after specified instruction I. */
edge (*split_block) PARAMS ((basic_block b, void * i)); edge (*split_block) (basic_block b, void * i);
/* Higher level functions representable by primitive operations above if /* Higher level functions representable by primitive operations above if
we didn't have some oddities in RTL and Tree representations. */ we didn't have some oddities in RTL and Tree representations. */
basic_block (*cfgh_split_edge) PARAMS ((edge)); basic_block (*cfgh_split_edge) (edge);
}; };
#define redirect_edge_and_branch(e,b) cfg_hooks->redirect_edge_and_branch (e,b) #define redirect_edge_and_branch(e,b) cfg_hooks->redirect_edge_and_branch (e,b)
...@@ -65,7 +65,7 @@ extern struct cfg_hooks rtl_cfg_hooks; ...@@ -65,7 +65,7 @@ extern struct cfg_hooks rtl_cfg_hooks;
extern struct cfg_hooks *cfg_hooks; extern struct cfg_hooks *cfg_hooks;
/* Declarations. */ /* Declarations. */
extern void rtl_register_cfg_hooks PARAMS ((void)); extern void rtl_register_cfg_hooks (void);
extern void cfg_layout_rtl_register_cfg_hooks PARAMS ((void)); extern void cfg_layout_rtl_register_cfg_hooks (void);
#endif /* GCC_CFGHOOKS_H */ #endif /* GCC_CFGHOOKS_H */
/* Basic block reordering routines for the GNU compiler. /* Basic block reordering routines for the GNU compiler.
Copyright (C) 2000, 2001 Free Software Foundation, Inc. Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -42,25 +42,23 @@ extern struct obstack flow_obstack; ...@@ -42,25 +42,23 @@ extern struct obstack flow_obstack;
/* Holds the interesting trailing notes for the function. */ /* Holds the interesting trailing notes for the function. */
rtx cfg_layout_function_footer; rtx cfg_layout_function_footer;
static rtx skip_insns_after_block PARAMS ((basic_block)); static rtx skip_insns_after_block (basic_block);
static void record_effective_endpoints PARAMS ((void)); static void record_effective_endpoints (void);
static rtx label_for_bb PARAMS ((basic_block)); static rtx label_for_bb (basic_block);
static void fixup_reorder_chain PARAMS ((void)); static void fixup_reorder_chain (void);
static void set_block_levels PARAMS ((tree, int)); static void set_block_levels (tree, int);
static void change_scope PARAMS ((rtx, tree, tree)); static void change_scope (rtx, tree, tree);
void verify_insn_chain PARAMS ((void)); void verify_insn_chain (void);
static void cleanup_unconditional_jumps PARAMS ((struct loops *)); static void cleanup_unconditional_jumps (struct loops *);
static void fixup_fallthru_exit_predecessor PARAMS ((void)); static void fixup_fallthru_exit_predecessor (void);
static rtx duplicate_insn_chain PARAMS ((rtx, rtx)); static rtx duplicate_insn_chain (rtx, rtx);
static void break_superblocks PARAMS ((void)); static void break_superblocks (void);
static tree insn_scope PARAMS ((rtx)); static tree insn_scope (rtx);
rtx rtx
unlink_insn_chain (first, last) unlink_insn_chain (rtx first, rtx last)
rtx first;
rtx last;
{ {
rtx prevfirst = PREV_INSN (first); rtx prevfirst = PREV_INSN (first);
rtx nextlast = NEXT_INSN (last); rtx nextlast = NEXT_INSN (last);
...@@ -83,8 +81,7 @@ unlink_insn_chain (first, last) ...@@ -83,8 +81,7 @@ unlink_insn_chain (first, last)
we return the last one. Otherwise, we return the end of BB. */ we return the last one. Otherwise, we return the end of BB. */
static rtx static rtx
skip_insns_after_block (bb) skip_insns_after_block (basic_block bb)
basic_block bb;
{ {
rtx insn, last_insn, next_head, prev; rtx insn, last_insn, next_head, prev;
...@@ -171,8 +168,7 @@ skip_insns_after_block (bb) ...@@ -171,8 +168,7 @@ skip_insns_after_block (bb)
/* Locate or create a label for a given basic block. */ /* Locate or create a label for a given basic block. */
static rtx static rtx
label_for_bb (bb) label_for_bb (basic_block bb)
basic_block bb;
{ {
rtx label = bb->head; rtx label = bb->head;
...@@ -191,7 +187,7 @@ label_for_bb (bb) ...@@ -191,7 +187,7 @@ label_for_bb (bb)
block, as defined by skip_insns_after_block above. */ block, as defined by skip_insns_after_block above. */
static void static void
record_effective_endpoints () record_effective_endpoints (void)
{ {
rtx next_insn = get_insns (); rtx next_insn = get_insns ();
basic_block bb; basic_block bb;
...@@ -235,7 +231,7 @@ int epilogue_locator; ...@@ -235,7 +231,7 @@ int epilogue_locator;
INSN_LOCATORs. */ INSN_LOCATORs. */
void void
insn_locators_initialize () insn_locators_initialize (void)
{ {
tree block = NULL; tree block = NULL;
tree last_block = NULL; tree last_block = NULL;
...@@ -325,9 +321,7 @@ insn_locators_initialize () ...@@ -325,9 +321,7 @@ insn_locators_initialize ()
found in the block tree. */ found in the block tree. */
static void static void
set_block_levels (block, level) set_block_levels (tree block, int level)
tree block;
int level;
{ {
while (block) while (block)
{ {
...@@ -339,8 +333,7 @@ set_block_levels (block, level) ...@@ -339,8 +333,7 @@ set_block_levels (block, level)
/* Return sope resulting from combination of S1 and S2. */ /* Return sope resulting from combination of S1 and S2. */
tree tree
choose_inner_scope (s1, s2) choose_inner_scope (tree s1, tree s2)
tree s1, s2;
{ {
if (!s1) if (!s1)
return s2; return s2;
...@@ -354,9 +347,7 @@ choose_inner_scope (s1, s2) ...@@ -354,9 +347,7 @@ choose_inner_scope (s1, s2)
/* Emit lexical block notes needed to change scope from S1 to S2. */ /* Emit lexical block notes needed to change scope from S1 to S2. */
static void static void
change_scope (orig_insn, s1, s2) change_scope (rtx orig_insn, tree s1, tree s2)
rtx orig_insn;
tree s1, s2;
{ {
rtx insn = orig_insn; rtx insn = orig_insn;
tree com = NULL_TREE; tree com = NULL_TREE;
...@@ -400,8 +391,7 @@ change_scope (orig_insn, s1, s2) ...@@ -400,8 +391,7 @@ change_scope (orig_insn, s1, s2)
/* Return lexical scope block insn belong to. */ /* Return lexical scope block insn belong to. */
static tree static tree
insn_scope (insn) insn_scope (rtx insn)
rtx insn;
{ {
int max = VARRAY_ACTIVE_SIZE (block_locators_locs); int max = VARRAY_ACTIVE_SIZE (block_locators_locs);
int min = 0; int min = 0;
...@@ -429,8 +419,7 @@ insn_scope (insn) ...@@ -429,8 +419,7 @@ insn_scope (insn)
/* Return line number of the statement that produced this insn. */ /* Return line number of the statement that produced this insn. */
int int
insn_line (insn) insn_line (rtx insn)
rtx insn;
{ {
int max = VARRAY_ACTIVE_SIZE (line_locators_locs); int max = VARRAY_ACTIVE_SIZE (line_locators_locs);
int min = 0; int min = 0;
...@@ -458,8 +447,7 @@ insn_line (insn) ...@@ -458,8 +447,7 @@ insn_line (insn)
/* Return source file of the statement that produced this insn. */ /* Return source file of the statement that produced this insn. */
const char * const char *
insn_file (insn) insn_file (rtx insn)
rtx insn;
{ {
int max = VARRAY_ACTIVE_SIZE (file_locators_locs); int max = VARRAY_ACTIVE_SIZE (file_locators_locs);
int min = 0; int min = 0;
...@@ -489,7 +477,7 @@ insn_file (insn) ...@@ -489,7 +477,7 @@ insn_file (insn)
on the scope tree and the newly reordered instructions. */ on the scope tree and the newly reordered instructions. */
void void
reemit_insn_block_notes () reemit_insn_block_notes (void)
{ {
tree cur_block = DECL_INITIAL (cfun->decl); tree cur_block = DECL_INITIAL (cfun->decl);
rtx insn, note; rtx insn, note;
...@@ -512,7 +500,7 @@ reemit_insn_block_notes () ...@@ -512,7 +500,7 @@ reemit_insn_block_notes ()
this_block = NULL; this_block = NULL;
for (i = 0; i < XVECLEN (body, 0); i++) for (i = 0; i < XVECLEN (body, 0); i++)
this_block = choose_inner_scope (this_block, this_block = choose_inner_scope (this_block,
insn_scope (XVECEXP (body, 0, i))); insn_scope (XVECEXP (body, 0, i)));
} }
if (! this_block) if (! this_block)
continue; continue;
...@@ -535,7 +523,7 @@ reemit_insn_block_notes () ...@@ -535,7 +523,7 @@ reemit_insn_block_notes ()
/* Given a reorder chain, rearrange the code to match. */ /* Given a reorder chain, rearrange the code to match. */
static void static void
fixup_reorder_chain () fixup_reorder_chain (void)
{ {
basic_block bb, prev_bb; basic_block bb, prev_bb;
int index; int index;
...@@ -623,7 +611,7 @@ fixup_reorder_chain () ...@@ -623,7 +611,7 @@ fixup_reorder_chain ()
/* The degenerated case of conditional jump jumping to the next /* The degenerated case of conditional jump jumping to the next
instruction can happen on target having jumps with side instruction can happen on target having jumps with side
effects. effects.
Create temporarily the duplicated edge representing branch. Create temporarily the duplicated edge representing branch.
It will get unidentified by force_nonfallthru_and_redirect It will get unidentified by force_nonfallthru_and_redirect
...@@ -776,7 +764,7 @@ fixup_reorder_chain () ...@@ -776,7 +764,7 @@ fixup_reorder_chain ()
3. Check that get_last_insn () returns the actual end of chain. */ 3. Check that get_last_insn () returns the actual end of chain. */
void void
verify_insn_chain () verify_insn_chain (void)
{ {
rtx x, prevx, nextx; rtx x, prevx, nextx;
int insn_cnt1, insn_cnt2; int insn_cnt1, insn_cnt2;
...@@ -807,8 +795,7 @@ verify_insn_chain () ...@@ -807,8 +795,7 @@ verify_insn_chain ()
dominators. */ dominators. */
static void static void
cleanup_unconditional_jumps (loops) cleanup_unconditional_jumps (struct loops *loops)
struct loops *loops;
{ {
basic_block bb; basic_block bb;
...@@ -885,7 +872,7 @@ cleanup_unconditional_jumps (loops) ...@@ -885,7 +872,7 @@ cleanup_unconditional_jumps (loops)
/* The block falling through to exit must be the last one in the /* The block falling through to exit must be the last one in the
reordered chain. Ensure that this condition is met. */ reordered chain. Ensure that this condition is met. */
static void static void
fixup_fallthru_exit_predecessor () fixup_fallthru_exit_predecessor (void)
{ {
edge e; edge e;
basic_block bb = NULL; basic_block bb = NULL;
...@@ -913,8 +900,7 @@ fixup_fallthru_exit_predecessor () ...@@ -913,8 +900,7 @@ fixup_fallthru_exit_predecessor ()
/* Return true in case it is possible to duplicate the basic block BB. */ /* Return true in case it is possible to duplicate the basic block BB. */
bool bool
cfg_layout_can_duplicate_bb_p (bb) cfg_layout_can_duplicate_bb_p (basic_block bb)
basic_block bb;
{ {
edge s; edge s;
...@@ -951,8 +937,7 @@ cfg_layout_can_duplicate_bb_p (bb) ...@@ -951,8 +937,7 @@ cfg_layout_can_duplicate_bb_p (bb)
} }
static rtx static rtx
duplicate_insn_chain (from, to) duplicate_insn_chain (rtx from, rtx to)
rtx from, to;
{ {
rtx insn, last; rtx insn, last;
...@@ -1047,9 +1032,7 @@ duplicate_insn_chain (from, to) ...@@ -1047,9 +1032,7 @@ duplicate_insn_chain (from, to)
/* Create a duplicate of the basic block BB and redirect edge E into it. */ /* Create a duplicate of the basic block BB and redirect edge E into it. */
basic_block basic_block
cfg_layout_duplicate_bb (bb, e) cfg_layout_duplicate_bb (basic_block bb, edge e)
basic_block bb;
edge e;
{ {
rtx insn; rtx insn;
edge s, n; edge s, n;
...@@ -1141,8 +1124,7 @@ cfg_layout_duplicate_bb (bb, e) ...@@ -1141,8 +1124,7 @@ cfg_layout_duplicate_bb (bb, e)
CFG layout changes. It keeps LOOPS up-to-date if not null. */ CFG layout changes. It keeps LOOPS up-to-date if not null. */
void void
cfg_layout_initialize (loops) cfg_layout_initialize (struct loops *loops)
struct loops *loops;
{ {
/* Our algorithm depends on fact that there are now dead jumptables /* Our algorithm depends on fact that there are now dead jumptables
around the code. */ around the code. */
...@@ -1156,7 +1138,7 @@ cfg_layout_initialize (loops) ...@@ -1156,7 +1138,7 @@ cfg_layout_initialize (loops)
/* Splits superblocks. */ /* Splits superblocks. */
static void static void
break_superblocks () break_superblocks (void)
{ {
sbitmap superblocks; sbitmap superblocks;
int i, need; int i, need;
...@@ -1187,7 +1169,7 @@ break_superblocks () ...@@ -1187,7 +1169,7 @@ break_superblocks ()
compensation code, rebuild scope forest. */ compensation code, rebuild scope forest. */
void void
cfg_layout_finalize () cfg_layout_finalize (void)
{ {
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_flow_info (); verify_flow_info ();
......
/* Basic block reordering routines for the GNU compiler. /* Basic block reordering routines for the GNU compiler.
Copyright (C) 2000 Free Software Foundation, Inc. Copyright (C) 2000, 2003 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -37,9 +37,9 @@ typedef struct reorder_block_def ...@@ -37,9 +37,9 @@ typedef struct reorder_block_def
extern rtx cfg_layout_function_footer; extern rtx cfg_layout_function_footer;
extern void cfg_layout_initialize PARAMS ((struct loops *)); extern void cfg_layout_initialize (struct loops *);
extern void cfg_layout_finalize PARAMS ((void)); extern void cfg_layout_finalize (void);
extern bool cfg_layout_can_duplicate_bb_p PARAMS ((basic_block)); extern bool cfg_layout_can_duplicate_bb_p (basic_block);
extern basic_block cfg_layout_duplicate_bb PARAMS ((basic_block, edge)); extern basic_block cfg_layout_duplicate_bb (basic_block, edge);
extern void insn_locators_initialize PARAMS ((void)); extern void insn_locators_initialize (void);
extern void reemit_insn_block_notes PARAMS ((void)); extern void reemit_insn_block_notes (void);
...@@ -255,47 +255,42 @@ struct loops ...@@ -255,47 +255,42 @@ struct loops
#define LOOP_ALL 15 /* All of the above */ #define LOOP_ALL 15 /* All of the above */
/* Loop recognition. */ /* Loop recognition. */
extern int flow_loops_find PARAMS ((struct loops *, int flags)); extern int flow_loops_find (struct loops *, int flags);
extern int flow_loops_update PARAMS ((struct loops *, int flags)); extern int flow_loops_update (struct loops *, int flags);
extern void flow_loops_free PARAMS ((struct loops *)); extern void flow_loops_free (struct loops *);
extern void flow_loops_dump PARAMS ((const struct loops *, FILE *, extern void flow_loops_dump (const struct loops *, FILE *,
void (*)(const struct loop *, void (*)(const struct loop *, FILE *, int), int);
FILE *, int), int)); extern void flow_loop_dump (const struct loop *, FILE *,
extern void flow_loop_dump PARAMS ((const struct loop *, FILE *, void (*)(const struct loop *, FILE *, int), int);
void (*)(const struct loop *, extern int flow_loop_scan (struct loops *, struct loop *, int);
FILE *, int), int)); extern void flow_loop_free (struct loop *);
extern int flow_loop_scan PARAMS ((struct loops *, void mark_irreducible_loops (struct loops *);
struct loop *, int));
extern void flow_loop_free PARAMS ((struct loop *));
void mark_irreducible_loops PARAMS ((struct loops *));
/* Loop datastructure manipulation/querying. */ /* Loop datastructure manipulation/querying. */
extern void flow_loop_tree_node_add PARAMS ((struct loop *, struct loop *)); extern void flow_loop_tree_node_add (struct loop *, struct loop *);
extern void flow_loop_tree_node_remove PARAMS ((struct loop *)); extern void flow_loop_tree_node_remove (struct loop *);
extern bool flow_loop_outside_edge_p PARAMS ((const struct loop *, edge)); extern bool flow_loop_outside_edge_p (const struct loop *, edge);
extern bool flow_loop_nested_p PARAMS ((const struct loop *, extern bool flow_loop_nested_p (const struct loop *, const struct loop *);
const struct loop *)); extern bool flow_bb_inside_loop_p (const struct loop *, const basic_block);
extern bool flow_bb_inside_loop_p PARAMS ((const struct loop *, extern struct loop * find_common_loop (struct loop *, struct loop *);
const basic_block)); extern int num_loop_insns (struct loop *);
extern struct loop * find_common_loop PARAMS ((struct loop *, struct loop *)); extern int average_num_loop_insns (struct loop *);
extern int num_loop_insns PARAMS ((struct loop *));
extern int average_num_loop_insns PARAMS ((struct loop *));
/* Loops & cfg manipulation. */ /* Loops & cfg manipulation. */
extern basic_block *get_loop_body PARAMS ((const struct loop *)); extern basic_block *get_loop_body (const struct loop *);
extern edge *get_loop_exit_edges PARAMS ((const struct loop *, unsigned *)); extern edge *get_loop_exit_edges (const struct loop *, unsigned *);
extern edge loop_preheader_edge PARAMS ((const struct loop *)); extern edge loop_preheader_edge (const struct loop *);
extern edge loop_latch_edge PARAMS ((const struct loop *)); extern edge loop_latch_edge (const struct loop *);
extern void add_bb_to_loop PARAMS ((basic_block, struct loop *)); extern void add_bb_to_loop (basic_block, struct loop *);
extern void remove_bb_from_loops PARAMS ((basic_block)); extern void remove_bb_from_loops (basic_block);
extern void cancel_loop PARAMS ((struct loops *, struct loop *)); extern void cancel_loop (struct loops *, struct loop *);
extern void cancel_loop_tree PARAMS ((struct loops *, struct loop *)); extern void cancel_loop_tree (struct loops *, struct loop *);
extern basic_block loop_split_edge_with PARAMS ((edge, rtx, struct loops *)); extern basic_block loop_split_edge_with (edge, rtx, struct loops *);
extern int fix_loop_placement PARAMS ((struct loop *)); extern int fix_loop_placement (struct loop *);
enum enum
{ {
...@@ -303,42 +298,38 @@ enum ...@@ -303,42 +298,38 @@ enum
CP_INSIDE_CFGLAYOUT = 2 CP_INSIDE_CFGLAYOUT = 2
}; };
extern void create_preheaders PARAMS ((struct loops *, int)); extern void create_preheaders (struct loops *, int);
extern void force_single_succ_latches PARAMS ((struct loops *)); extern void force_single_succ_latches (struct loops *);
extern void verify_loop_structure PARAMS ((struct loops *)); extern void verify_loop_structure (struct loops *);
/* Loop analysis. */ /* Loop analysis. */
extern bool simple_loop_p PARAMS ((struct loops *, struct loop *, extern bool simple_loop_p (struct loops *, struct loop *, struct loop_desc *);
struct loop_desc *)); extern rtx count_loop_iterations (struct loop_desc *, rtx, rtx);
extern rtx count_loop_iterations PARAMS ((struct loop_desc *, rtx, rtx)); extern bool just_once_each_iteration_p (struct loops *,struct loop *,
extern bool just_once_each_iteration_p PARAMS ((struct loops *,struct loop *, basic_block);
basic_block)); extern unsigned expected_loop_iterations (const struct loop *);
extern unsigned expected_loop_iterations PARAMS ((const struct loop *));
/* Loop manipulation. */ /* Loop manipulation. */
extern bool can_duplicate_loop_p PARAMS ((struct loop *loop)); extern bool can_duplicate_loop_p (struct loop *loop);
#define DLTHE_FLAG_UPDATE_FREQ 1 /* Update frequencies in #define DLTHE_FLAG_UPDATE_FREQ 1 /* Update frequencies in
duplicate_loop_to_header_edge. */ duplicate_loop_to_header_edge. */
extern int duplicate_loop_to_header_edge PARAMS ((struct loop *, edge, extern int duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
struct loops *, unsigned, unsigned, sbitmap, edge, edge *,
sbitmap, edge, edge *, unsigned *, int);
unsigned *, int)); extern struct loop *loopify (struct loops *, edge, edge, basic_block);
extern struct loop *loopify PARAMS ((struct loops *, edge, extern void unloop (struct loops *, struct loop *);
edge, basic_block)); extern bool remove_path (struct loops *, edge);
extern void unloop PARAMS ((struct loops *, struct loop *)); extern edge split_loop_bb (struct loops *, basic_block, rtx);
extern bool remove_path PARAMS ((struct loops *, edge));
extern edge split_loop_bb PARAMS ((struct loops *, basic_block,
rtx));
/* Loop optimizer initialization. */ /* Loop optimizer initialization. */
extern struct loops *loop_optimizer_init PARAMS ((FILE *)); extern struct loops *loop_optimizer_init (FILE *);
extern void loop_optimizer_finalize PARAMS ((struct loops *, FILE *)); extern void loop_optimizer_finalize (struct loops *, FILE *);
/* Optimization passes. */ /* Optimization passes. */
extern void unswitch_loops PARAMS ((struct loops *)); extern void unswitch_loops (struct loops *);
enum enum
{ {
...@@ -347,4 +338,4 @@ enum ...@@ -347,4 +338,4 @@ enum
UAP_UNROLL_ALL = 4 /* Enables peeling of all loops. */ UAP_UNROLL_ALL = 4 /* Enables peeling of all loops. */
}; };
extern void unroll_and_peel_loops PARAMS ((struct loops *, int)); extern void unroll_and_peel_loops (struct loops *, int);
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