From 613172207b7ce182da93de2237405652ce34a4d6 Mon Sep 17 00:00:00 2001 From: steven Date: Sat, 15 May 2004 09:39:30 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81873 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 34 ++++++++++++++++++++++++++++++++-- gcc/basic-block.h | 4 ++-- gcc/bt-load.c | 4 ++-- gcc/combine.c | 2 +- gcc/config/ip2k/ip2k.c | 22 +++++++++++----------- gcc/config/m68hc11/m68hc11.c | 2 +- gcc/config/sh/sh.c | 2 +- gcc/flow.c | 42 ++++++++++++++++++++++-------------------- gcc/passes.c | 10 +++++----- gcc/ra.c | 2 +- gcc/reg-stack.c | 7 +++---- gcc/regrename.c | 2 +- gcc/rtl.h | 4 ++-- gcc/tree-tailcall.c | 2 +- gcc/value-prof.c | 2 +- gcc/web.c | 10 +++++++--- 16 files changed, 93 insertions(+), 58 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0365e82ade3..b16217904c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,33 @@ +2004-05-15 Steven Bosscher + + * 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 PR c/15444 @@ -21,7 +51,7 @@ * 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 @@ -4398,7 +4428,7 @@ 2004-03-24 David Edelsohn - * 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. diff --git a/gcc/basic-block.h b/gcc/basic-block.h index c64b7b0d556..f45129b591f 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -564,7 +564,7 @@ enum update_life_extent 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); @@ -618,7 +618,7 @@ extern void unlink_block (basic_block); 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); diff --git a/gcc/bt-load.c b/gcc/bt-load.c index 0008f3c7fe8..7ab8c18642e 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -1411,7 +1411,7 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save) } 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) @@ -1429,7 +1429,7 @@ branch_target_load_optimize (rtx insns, bool after_prologue_epilogue_gen) 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); diff --git a/gcc/combine.c b/gcc/combine.c index 2abd3d86c5c..5a1f89bd83d 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -750,7 +750,7 @@ combine_instructions (rtx f, unsigned int nregs) 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 diff --git a/gcc/config/ip2k/ip2k.c b/gcc/config/ip2k/ip2k.c index 05ccb614c4f..452737ec009 100644 --- a/gcc/config/ip2k/ip2k.c +++ b/gcc/config/ip2k/ip2k.c @@ -5315,7 +5315,7 @@ ip2k_reorg (void) 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); @@ -5327,7 +5327,7 @@ ip2k_reorg (void) 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); @@ -5354,7 +5354,7 @@ ip2k_reorg (void) 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); @@ -5368,14 +5368,14 @@ ip2k_reorg (void) 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); @@ -5386,14 +5386,14 @@ ip2k_reorg (void) 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; @@ -5411,21 +5411,21 @@ ip2k_reorg (void) /* 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); @@ -5434,7 +5434,7 @@ ip2k_reorg (void) 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 } diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 45ef1bcd3b0..dadbd9a08fd 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -5272,7 +5272,7 @@ m68hc11_reorg (void) } } - life_analysis (first, 0, PROP_REG_INFO | PROP_DEATH_NOTES); + life_analysis (0, PROP_REG_INFO | PROP_DEATH_NOTES); } z_replacement_completed = 2; diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 30526c2e694..128954316ca 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -9526,7 +9526,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, 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); diff --git a/gcc/flow.c b/gcc/flow.c index fa47f2d24a0..818f8eb0043 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -291,7 +291,7 @@ static int verify_wide_reg_1 (rtx *, void *); 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); @@ -351,12 +351,11 @@ first_insn_after_basic_block_note (basic_block block) return NEXT_INSN (insn); } -/* 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; @@ -403,13 +402,13 @@ life_analysis (rtx f, FILE *file, int flags) /* 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. */ @@ -782,7 +781,7 @@ free_basic_block_vars (void) /* 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; @@ -866,8 +865,9 @@ notice_stack_pointer_modification_1 (rtx x, rtx pat ATTRIBUTE_UNUSED, } 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 @@ -876,17 +876,19 @@ notice_stack_pointer_modification (rtx f) 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 diff --git a/gcc/passes.c b/gcc/passes.c index 5c8e5a6fd0f..379df57415f 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -519,7 +519,7 @@ rest_of_handle_stack_regs (tree decl, rtx insns) 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)) @@ -1044,7 +1044,7 @@ rest_of_handle_life (tree decl, rtx insns) #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 @@ -1696,7 +1696,7 @@ rest_of_compilation (tree decl) { 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); @@ -1715,7 +1715,7 @@ rest_of_compilation (tree decl) 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)); @@ -1785,7 +1785,7 @@ rest_of_compilation (tree decl) 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); diff --git a/gcc/ra.c b/gcc/ra.c index 773d79a6a7f..782d8a5df75 100644 --- a/gcc/ra.c +++ b/gcc/ra.c @@ -856,7 +856,7 @@ reg_alloc (void) /* 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); diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 8314b21ce35..add71835174 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -399,8 +399,7 @@ pop_stack (stack regstack, int regno) } /* 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 @@ -408,7 +407,7 @@ pop_stack (stack regstack, int regno) the edges. */ bool -reg_to_stack (rtx first, FILE *file) +reg_to_stack (FILE *file) { basic_block bb; int i; @@ -434,7 +433,7 @@ reg_to_stack (rtx first, FILE *file) && 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 (); diff --git a/gcc/regrename.c b/gcc/regrename.c index 0b682886f4f..c4c4e709bb6 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -1763,7 +1763,7 @@ copyprop_hardreg_forward (void) /* ??? 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 diff --git a/gcc/rtl.h b/gcc/rtl.h index 1041d020e1a..89f66836773 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2238,7 +2238,7 @@ extern void init_loop (void); #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); @@ -2339,7 +2339,7 @@ extern int local_alloc (void); /* In reg-stack.c */ #ifdef BUFSIZ -extern bool reg_to_stack (rtx, FILE *); +extern bool reg_to_stack (FILE *); #endif /* In calls.c */ diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 9321c93a541..a140d41e651 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -72,7 +72,7 @@ Boston, MA 02111-1307, USA. */ 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): diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 66b5c6589bd..514b98f5190 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -182,7 +182,7 @@ rtl_find_values_to_profile (unsigned *n_values, struct histogram_value **values) rtx insn; unsigned i; - life_analysis (get_insns (), NULL, PROP_DEATH_NOTES); + life_analysis (NULL, PROP_DEATH_NOTES); *n_values = 0; *values = NULL; diff --git a/gcc/web.c b/gcc/web.c index af006bfaf50..11f2caa6cd2 100644 --- a/gcc/web.c +++ b/gcc/web.c @@ -262,6 +262,7 @@ web_main (void) int max = max_reg_num (); char *used; char *use_addressof; + basic_block bb; rtx insn; df = df_init (); @@ -280,9 +281,12 @@ web_main (void) 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. */ -- 2.11.0