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