+2004-05-15 Steven Bosscher <stevenb@suse.de>
+
+ * basic-block.h (life_analysis, delete_noop_moves):
+ Update prototypes.
+ * bt-load.c (branch_target_load_optimize): Don't take the
+ insns stream as an argument. Update the life_analysis calls.
+ * combine.c (combine_instructions): Update delete_noop_moves
+ calls.
+ * flow.c (notice_stack_pointer_modification): Don't take the
+ insns stream as an argument. Work on the flow graph.
+ (life_analysis): Likewise.
+ (delete_noop_moves): Likewise.
+ * passes.c (rest_of_handle_stack_regs): Update reg_to_stack call.
+ (rest_of_handle_life): Update life_analysis call.
+ (rest_of_compilation): Likewise, and also update
+ branch_target_load_optimize call.
+ * ra.c (reg_alloc): Update life_analysis call.
+ * reg-stack.c (reg_to_stack): Likewise. Also, don't take
+ the insns stream as an argument.
+ * regrename.c (copyprop_hardreg_forward): Update delete_noop_moves
+ call.
+ * rtl.c (branch_target_load_optimize, reg_to_stack): Update
+ prototypes.
+ * value-profile.c (branch_prob): Update life_analysis call.
+ * web.c (web_main): Work on the CFG, not on the insns stream.
+
+ * config/ip2k/ip2k.c (ip2k_reorg): Update life_analysis calls.
+ * config/m68hc11/m68hc11.c (m68hc11_reorg): Likewise.
+ * config/sh/sh.c (sh_output_mi_thunk): Likewise.
+
2004-05-15 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/15444
* tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't even
bother marking bypassed virtuals for out-of-ssa. Instead merge
- bypassed virtuals into vars_to_rename just before into-ssa pass.
+ bypassed virtuals into vars_to_rename just before into-ssa pass.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Reorganize
so that it picks up more opportunities to eliminate ABS expressions
2004-03-24 David Edelsohn <edelsohn@gnu.org>
- * doc/invoke.texi (-frename-registers: Add enabled at -O3.
+ * doc/invoke.texi (-frename-registers): Add enabled at -O3.
(-fprofile-values): Add enabled with profile-{generate,use}.
(-fvpt): Same.
(-ftracer): Add enabled with profile-use.
insns. */
#define CLEANUP_CFGLAYOUT 256 /* Do cleanup in cfglayout mode. */
#define CLEANUP_LOG_LINKS 512 /* Update log links. */
-extern void life_analysis (rtx, FILE *, int);
+extern void life_analysis (FILE *, int);
extern int update_life_info (sbitmap, enum update_life_extent, int);
extern int update_life_info_in_dirty_blocks (enum update_life_extent, int);
extern int count_or_remove_death_notes (sbitmap, int);
extern void compact_blocks (void);
extern basic_block alloc_block (void);
extern void find_unreachable_blocks (void);
-extern int delete_noop_moves (rtx);
+extern int delete_noop_moves (void);
extern basic_block force_nonfallthru (edge);
extern rtx block_label (basic_block);
extern bool forwarder_block_p (basic_block);
}
void
-branch_target_load_optimize (rtx insns, bool after_prologue_epilogue_gen)
+branch_target_load_optimize (bool after_prologue_epilogue_gen)
{
enum reg_class class = targetm.branch_target_register_class ();
if (class != NO_REGS)
cleanup_cfg (optimize ? CLEANUP_EXPENSIVE : 0);
#endif
- life_analysis (insns, NULL, 0);
+ life_analysis (NULL, 0);
/* Dominator info is also needed for migrate_btr_def. */
calculate_dominance_info (CDI_DOMINATORS);
EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, i,
BASIC_BLOCK (i)->flags |= BB_DIRTY);
new_direct_jump_p |= purge_all_dead_edges (0);
- delete_noop_moves (f);
+ delete_noop_moves ();
update_life_info_in_dirty_blocks (UPDATE_LIFE_GLOBAL_RM_NOTES,
PROP_DEATH_NOTES | PROP_SCAN_DEAD_CODE
things in such a way that another go will win. Do so now! */
reload_cse_regs (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_REG_INFO | PROP_DEATH_NOTES);
+ life_analysis (0, PROP_REG_INFO | PROP_DEATH_NOTES);
/* Look for where absurd things are happening with DP. */
mdr_try_dp_reload_elim (first_insn);
reload_cse_regs (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_REG_INFO | PROP_DEATH_NOTES);
+ life_analysis (0, PROP_REG_INFO | PROP_DEATH_NOTES);
if (flag_peephole2)
peephole2_optimize (NULL);
mdr_try_move_pushes (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
mdr_try_propagate_move (first_insn);
mdr_resequence_xy_yx (first_insn);
reload_cse_regs (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
if (flag_peephole2)
peephole2_optimize (NULL);
mdr_try_propagate_move (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
ip2k_reorg_split_simode = 1;
split_all_insns (0);
reload_cse_regs (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
if (flag_peephole2)
peephole2_optimize (NULL);
mdr_try_propagate_move (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
ip2k_reorg_split_himode = 1;
ip2k_reorg_merge_qimode = 1;
/* Call to jump_optimize (...) was here, but now I removed it. */
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
if (flag_peephole2)
peephole2_optimize (NULL);
mdr_try_propagate_move (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
mdr_try_remove_redundant_insns (first_insn);
mdr_try_propagate_clr (first_insn);
mdr_try_propagate_move (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
ip2k_reorg_split_qimode = 1;
split_all_insns (0);
mdr_try_propagate_move (first_insn);
find_basic_blocks (first_insn, max_reg_num (), 0);
- life_analysis (first_insn, 0, PROP_FINAL);
+ life_analysis (0, PROP_FINAL);
#endif
}
}
}
- life_analysis (first, 0, PROP_REG_INFO | PROP_DEATH_NOTES);
+ life_analysis (0, PROP_REG_INFO | PROP_DEATH_NOTES);
}
z_replacement_completed = 2;
if (optimize > 0 && flag_schedule_insns_after_reload)
{
find_basic_blocks (insns, max_reg_num (), dump_file);
- life_analysis (insns, dump_file, PROP_FINAL);
+ life_analysis (dump_file, PROP_FINAL);
split_all_insns (1);
static void verify_wide_reg (int, basic_block);
static void verify_local_live_at_start (regset, basic_block);
static void notice_stack_pointer_modification_1 (rtx, rtx, void *);
-static void notice_stack_pointer_modification (rtx);
+static void notice_stack_pointer_modification (void);
static void mark_reg (rtx, void *);
static void mark_regs_live_at_end (regset);
static void calculate_global_regs_live (sbitmap, sbitmap, int);
return NEXT_INSN (insn);
}
\f
-/* Perform data flow analysis.
- F is the first insn of the function; FLAGS is a set of PROP_* flags
- to be used in accumulating flow info. */
+/* Perform data flow analysis for the whole control flow graph.
+ FLAGS is a set of PROP_* flags to be used in accumulating flow info. */
void
-life_analysis (rtx f, FILE *file, int flags)
+life_analysis (FILE *file, int flags)
{
#ifdef ELIMINABLE_REGS
int i;
/* Always remove no-op moves. Do this before other processing so
that we don't have to keep re-scanning them. */
- delete_noop_moves (f);
+ delete_noop_moves ();
/* Some targets can emit simpler epilogues if they know that sp was
not ever modified during the function. After reload, of course,
we've already emitted the epilogue so there's no sense searching. */
if (! reload_completed)
- notice_stack_pointer_modification (f);
+ notice_stack_pointer_modification ();
/* Allocate and zero out data structures that will record the
data from lifetime analysis. */
/* Delete any insns that copy a register to itself. */
int
-delete_noop_moves (rtx f ATTRIBUTE_UNUSED)
+delete_noop_moves (void)
{
rtx insn, next;
basic_block bb;
}
static void
-notice_stack_pointer_modification (rtx f)
+notice_stack_pointer_modification (void)
{
+ basic_block bb;
rtx insn;
/* Assume that the stack pointer is unchanging if alloca hasn't
if (! current_function_sp_is_unchanging)
return;
- for (insn = f; insn; insn = NEXT_INSN (insn))
- {
- if (INSN_P (insn))
- {
- /* Check if insn modifies the stack pointer. */
- note_stores (PATTERN (insn), notice_stack_pointer_modification_1,
- NULL);
- if (! current_function_sp_is_unchanging)
- return;
- }
- }
+ FOR_EACH_BB (bb)
+ FOR_BB_INSNS (bb, insn)
+ {
+ if (INSN_P (insn))
+ {
+ /* Check if insn modifies the stack pointer. */
+ note_stores (PATTERN (insn),
+ notice_stack_pointer_modification_1,
+ NULL);
+ if (! current_function_sp_is_unchanging)
+ return;
+ }
+ }
}
/* Mark a register in SET. Hard registers in large modes get all
timevar_push (TV_REG_STACK);
open_dump_file (DFI_stack, decl);
- if (reg_to_stack (insns, dump_file) && optimize)
+ if (reg_to_stack (dump_file) && optimize)
{
if (cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
| (flag_crossjumping ? CLEANUP_CROSSJUMP : 0))
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
- life_analysis (insns, dump_file, PROP_FINAL);
+ life_analysis (dump_file, PROP_FINAL);
if (optimize)
cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_UPDATE_LIFE
| CLEANUP_LOG_LINKS
{
open_dump_file (DFI_branch_target_load, decl);
- branch_target_load_optimize (insns, false);
+ branch_target_load_optimize (/*after_prologue_epilogue_gen=*/false);
close_dump_file (DFI_branch_target_load, print_rtl_with_bb, insns);
if (optimize)
{
- life_analysis (insns, dump_file, PROP_POSTRELOAD);
+ life_analysis (dump_file, PROP_POSTRELOAD);
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
| (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
open_dump_file (DFI_branch_target_load, decl);
- branch_target_load_optimize (insns, true);
+ branch_target_load_optimize (/*after_prologue_epilogue_gen=*/true);
close_dump_file (DFI_branch_target_load, print_rtl_with_bb, insns);
/* Cleanup the flow graph. */
if ((debug_new_regalloc & DUMP_LAST_FLOW) == 0)
dump_file = NULL;
- life_analysis (get_insns (), dump_file,
+ life_analysis (dump_file,
PROP_DEATH_NOTES | PROP_LOG_LINKS | PROP_REG_INFO);
cleanup_cfg (CLEANUP_EXPENSIVE);
recompute_reg_usage (get_insns (), TRUE);
}
\f
/* Convert register usage from "flat" register file usage to a "stack
- register file. FIRST is the first insn in the function, FILE is the
- dump file, if used.
+ register file. FILE is the dump file, if used.
Construct a CFG and run life analysis. Then convert each insn one
by one. Run a last cleanup_cfg pass, if optimizing, to eliminate
the edges. */
bool
-reg_to_stack (rtx first, FILE *file)
+reg_to_stack (FILE *file)
{
basic_block bb;
int i;
&& flag_schedule_insns_after_reload))
{
count_or_remove_death_notes (NULL, 1);
- life_analysis (first, file, PROP_DEATH_NOTES);
+ life_analysis (file, PROP_DEATH_NOTES);
}
mark_dfs_back_edges ();
/* ??? Irritatingly, delete_noop_moves does not take a set of blocks
to scan, so we have to do a life update with no initial set of
blocks Just In Case. */
- delete_noop_moves (get_insns ());
+ delete_noop_moves ();
update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
PROP_DEATH_NOTES
| PROP_SCAN_DEAD_CODE
#ifdef BUFSIZ
extern void loop_optimize (rtx, FILE *, int);
#endif
-extern void branch_target_load_optimize (rtx, bool);
+extern void branch_target_load_optimize (bool);
/* In function.c */
extern void reposition_prologue_and_epilogue_notes (rtx);
/* In reg-stack.c */
#ifdef BUFSIZ
-extern bool reg_to_stack (rtx, FILE *);
+extern bool reg_to_stack (FILE *);
#endif
/* In calls.c */
omit the accumulator.
There are three cases how the function may exit. The first one is
- handled in adjust_return_value, the other two in adjust_accumulator_values
+ handled in adjust_return_value, the later two in adjust_accumulator_values
(the second case is actually a special case of the third one and we
present it separately just for clarity):
rtx insn;
unsigned i;
- life_analysis (get_insns (), NULL, PROP_DEATH_NOTES);
+ life_analysis (NULL, PROP_DEATH_NOTES);
*n_values = 0;
*values = NULL;
int max = max_reg_num ();
char *used;
char *use_addressof;
+ basic_block bb;
rtx insn;
df = df_init ();
union_defs (df, df->uses[i], def_entry, use_entry);
/* We can not safely rename registers whose address is taken. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (INSN_P (insn))
- for_each_rtx (&PATTERN (insn), mark_addressof, use_addressof);
+ FOR_EACH_BB (bb)
+ FOR_BB_INSNS (bb, insn)
+ {
+ if (INSN_P (insn))
+ for_each_rtx (&PATTERN (insn), mark_addressof, use_addressof);
+ }
/* Update the instruction stream, allocating new registers for split pseudos
in progress. */