From 39f95a2c8e36fcfbaaed01fda58429b7f536cefa Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 5 Aug 2001 23:39:21 -0700 Subject: [PATCH] Makefile.in (reload1.o): Add dedendancy on except.h * Makefile.in (reload1.o): Add dedendancy on except.h * basic-block.h (purge_all_dead_edges, purge_dead_edges): Update prototypes. * flow.c (purge_dead_edges, purge_all_dead_edges): Return bool indicating wehther edges has been cleaned up. * reload1.c: Inlucde except.h (fixup_abnormal_edges): Accept deleted insns. * toplev.c (rest_of_compilation): Purge dead edges unconditionally after combine. From-SVN: r44654 --- gcc/ChangeLog | 110 +++++++++++++++++++++++++--------------------- gcc/Makefile.in | 3 +- gcc/basic-block.h | 4 +- gcc/flow.c | 56 +++++++++++++++-------- gcc/reload1.c | 7 ++- gcc/toplev.c | 5 ++- 6 files changed, 113 insertions(+), 72 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8ff3e3ac89..293b81df950 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2001-08-05 Jan Hubicka + + * Makefile.in (reload1.o): Add dedendancy on except.h + * basic-block.h (purge_all_dead_edges, purge_dead_edges): Update + prototypes. + * flow.c (purge_dead_edges, purge_all_dead_edges): Return bool + indicating wehther edges has been cleaned up. + * reload1.c: Inlucde except.h + (fixup_abnormal_edges): Accept deleted insns. + * toplev.c (rest_of_compilation): Purge dead edges unconditionally + after combine. + 2001-08-06 Neil Booth * cpplib.c (do_line): Correct line number after pop_buffer. @@ -333,7 +345,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka (__gthread_mutex_init_function): New function for mutex initialization. 2001-08-03 Daniel Berlin - + * Makefile.in: Revert screwed up commit. 2001-08-03 Stephane Carrez @@ -353,7 +365,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka (DTORS_SECTION_FUNCTION): Likewise for __do_global_dtors. 2001-08-03 Daniel Berlin - + * ChangeLog: Fix date on previous ChangeLog entry for GCSE. * Makefile.in: Add df.h to gcse.c dependencies. @@ -366,26 +378,26 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka 2001-08-03 Daniel Berlin - * gcse.c: Include df.h for use as a dataflow analyzer. - Remove regvec. - Declaration of reg_set_info: gone. - New df_analyzer variable used by store motion. - (reg_set_info): Deleted. - (mark_mem_regs): New function, analyze regs used by a mem. - (store_ops_ok): Use dataflow analyzer results to determine if - necessary regs are changed in the block. - (find_moveable_store): Remove check for symbol ref, we can handle - much more complex expressions now. - (compute_store_table): Remove most of the code, it's unnecessary - now that the dataflow analyzer records the info for us. - (store_killed_after): Add parameter to say whether to do the - store_ops_okay test, used to speed up testing when we already know - the answer, and just want to know if the store itself was killed. - (build_store_vector): Largely rewritten to calculate the various - vectors properly, and somewhat optimized. - (store_motion): Init the df_analyzer, get REG_DEF chains. - Also handle trapping expressions (since mems almost always trap) - (simple_mem): Redefine what a simple mem is. + * gcse.c: Include df.h for use as a dataflow analyzer. + Remove regvec. + Declaration of reg_set_info: gone. + New df_analyzer variable used by store motion. + (reg_set_info): Deleted. + (mark_mem_regs): New function, analyze regs used by a mem. + (store_ops_ok): Use dataflow analyzer results to determine if + necessary regs are changed in the block. + (find_moveable_store): Remove check for symbol ref, we can handle + much more complex expressions now. + (compute_store_table): Remove most of the code, it's unnecessary + now that the dataflow analyzer records the info for us. + (store_killed_after): Add parameter to say whether to do the + store_ops_okay test, used to speed up testing when we already know + the answer, and just want to know if the store itself was killed. + (build_store_vector): Largely rewritten to calculate the various + vectors properly, and somewhat optimized. + (store_motion): Init the df_analyzer, get REG_DEF chains. + Also handle trapping expressions (since mems almost always trap) + (simple_mem): Redefine what a simple mem is. 2001-08-03 DJ Delorie @@ -454,7 +466,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka cp/decl2.c, doc/contrib.texi, doc/cpp.texi, doc/gcc.texi, doc/install.texi, doc/invoke.texi, doc/md.texi, doc/rtl.texi, doc/tm.texi: consistently use "VAX", "VAXen", and "MicroVAX" - in comments and documentation. + in comments and documentation. 2001-08-03 Neil Booth @@ -566,7 +578,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka 2001-08-01 Robert Lipe - * dwarfout.c: Remove reference to README.DWARF. + * dwarfout.c: Remove reference to README.DWARF. 2001-08-01 Andrew MacLeod @@ -669,7 +681,7 @@ Wed Aug 1 20:02:12 CEST 2001 Graham Stott 2001-08-01 Ziemowit Laski - * c-parse.in (OBJC_NEED_RAW_IDENTIFIER): Define macro and flag for + * c-parse.in (OBJC_NEED_RAW_IDENTIFIER): Define macro and flag for contextualizing Objective-C class name lookup by the lexer. (typespec_reserved_nonattr): Disable ObjC class name lookup after seeing a TYPESPEC. @@ -731,7 +743,7 @@ Wed Aug 1 20:02:12 CEST 2001 Graham Stott 2001-07-31 Jeff Sturm - * except.c (duplicate_eh_regions): Test n_array[i] for NULL. + * except.c (duplicate_eh_regions): Test n_array[i] for NULL. 2001-07-31 matthew green @@ -814,10 +826,10 @@ Tue Jul 31 15:33:27 CEST 2001 Jan Hubicka 2001-07-31 Hartmut Penner - * doc/install.texi: Add s390 and s390x as new targets. - * doc/invoke.texi: Add documantation of S/390 and zSeries - target options. - * doc/md.texi: Add documantation of S/390 and zSeries constraints. + * doc/install.texi: Add s390 and s390x as new targets. + * doc/invoke.texi: Add documantation of S/390 and zSeries + target options. + * doc/md.texi: Add documantation of S/390 and zSeries constraints. 2001-07-30 Roman Zippel @@ -827,7 +839,7 @@ Tue Jul 31 15:33:27 CEST 2001 Jan Hubicka Mon Jul 30 23:20:34 EDT 2001 John Wehle (john@feith.com) - * flow.c (merge_blocks): Return 1 if an extra jump is inserted. + * flow.c (merge_blocks): Return 1 if an extra jump is inserted. 2001-07-30 Richard Henderson @@ -868,18 +880,18 @@ Mon Jul 30 22:16:08 CEST 2001 Jan Hubicka 2001-07-30 Andreas Jaeger - * jump.c: Add prototype for mark_modified_reg. + * jump.c: Add prototype for mark_modified_reg. - * cse.c (set_live_p): Add unused attribute. + * cse.c (set_live_p): Add unused attribute. - * gcov.c (calculate_branch_probs): Use gcov_type to avoid - overflow. - (scan_for_source_files): Use long for count to avoid overflow. - (output_data): Likewise. - (output_data): Don't use string concatatenation to silence gcc - -traditional. + * gcov.c (calculate_branch_probs): Use gcov_type to avoid + overflow. + (scan_for_source_files): Use long for count to avoid overflow. + (output_data): Likewise. + (output_data): Don't use string concatatenation to silence gcc + -traditional. - * predict.c: Fix typos and grammar. + * predict.c: Fix typos and grammar. * gcse.c (insert_insn_end_bb): Remove unused variables. @@ -1122,7 +1134,7 @@ Fri Jul 27 17:53:00 CEST 2001 Jan Hubicka Fri Jul 27 00:33:35 EDT 2001 John Wehle (john@feith.com) - * flow.c (redirect_edge_and_branch_force): Test + * flow.c (redirect_edge_and_branch_force): Test target->global_live_at_start. 2001-07-26 Richard Henderson @@ -1168,8 +1180,8 @@ Thu Jul 26 14:04:03 EDT 2001 John Wehle (john@feith.com) 2001-07-26 Catherine Moore - * config/v850/v850.h (ENCODE_SECTION_INFO): Change order - of conditional to avoid tree checking errors. + * config/v850/v850.h (ENCODE_SECTION_INFO): Change order + of conditional to avoid tree checking errors. 2001-07-26 Kazu Hirata @@ -1248,8 +1260,8 @@ Wed Jul 25 18:00:05 2001 Richard Kenner 2001-07-25 Catherine Moore - * config/v850/v850.c (v850_va_arg): Use addr - instead of valist to build incr. + * config/v850/v850.c (v850_va_arg): Use addr + instead of valist to build incr. Wed Jul 25 22:48:59 CEST 2001 Jan Hubicka @@ -1314,11 +1326,11 @@ Wed Jul 25 08:25:01 2001 Jeffrey A Law (law@cygnus.com) 2001-07-24 Joel Sherrill - * config/sparc/rtems.h (CPP_PREDEFINES): Remove redundant + * config/sparc/rtems.h (CPP_PREDEFINES): Remove redundant -Acpu and -Amachine.h. - * config/sparc/rtemself.h (CPP_PREDEFINES): Likewise. - Corrected header to say ELF not a.out. - * config/sparc/sparc.h (CPP_CPU_SPEC): Define _SOFT_FLOAT + * config/sparc/rtemself.h (CPP_PREDEFINES): Likewise. + Corrected header to say ELF not a.out. + * config/sparc/sparc.h (CPP_CPU_SPEC): Define _SOFT_FLOAT when given -msoft-float. 2001-07-24 Joel Sherrill diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 9b8bc19f0a8..48dbd575f2c 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1510,7 +1510,8 @@ reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h output.h $(EXPR_H) function.h real.h toplev.h $(TM_P_H) reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) real.h flags.h $(EXPR_H) \ reload.h $(REGS_H) hard-reg-set.h insn-config.h \ - $(BASIC_BLOCK_H) $(RECOG_H) output.h function.h toplev.h cselib.h $(TM_P_H) + $(BASIC_BLOCK_H) $(RECOG_H) output.h function.h toplev.h cselib.h $(TM_P_H) \ + except.h caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h \ $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) function.h \ $(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H) diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 810071509ce..dc2d1902cd9 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -615,8 +615,8 @@ extern basic_block redirect_edge_and_branch_force PARAMS ((edge, basic_block)); extern bool redirect_edge_and_branch PARAMS ((edge, basic_block)); extern rtx block_label PARAMS ((basic_block)); extern bool forwarder_block_p PARAMS ((basic_block)); -extern void purge_all_dead_edges PARAMS ((void)); -extern void purge_dead_edges PARAMS ((basic_block)); +extern bool purge_all_dead_edges PARAMS ((void)); +extern bool purge_dead_edges PARAMS ((basic_block)); extern void find_sub_basic_blocks PARAMS ((basic_block)); diff --git a/gcc/flow.c b/gcc/flow.c index c602fb179d0..c01d56ff47f 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -10187,26 +10187,28 @@ init_flow () } /* Assume that the preceeding pass has possibly eliminated jump instructions - or converted the unconditional jumps. Eliminate the edges from CFG. */ + or converted the unconditional jumps. Eliminate the edges from CFG. + Return true if any edges are eliminated. */ -void +bool purge_dead_edges (bb) basic_block bb; { edge e, next; rtx insn = bb->end; + bool purged = false; + if (GET_CODE (insn) == JUMP_INSN && !simplejump_p (insn)) - return; + return false; if (GET_CODE (insn) == JUMP_INSN) { - int removed = 0; rtx note; edge b,f; /* We do care only about conditional jumps and simplejumps. */ if (!any_condjump_p (insn) && !returnjump_p (insn) && !simplejump_p (insn)) - return; + return false; for (e = bb->succ; e; e = next) { next = e->succ_next; @@ -10221,15 +10223,15 @@ purge_dead_edges (bb) if (e->dest == EXIT_BLOCK_PTR && returnjump_p (insn)) continue; - removed = 1; + purged = true; remove_edge (e); } - if (!bb->succ || !removed) - return; + if (!bb->succ || !purged) + return false; if (rtl_dump_file) fprintf (rtl_dump_file, "Purged edges from bb %i\n", bb->index); if (!optimize) - return; + return purged; /* Redistribute probabilities. */ if (!bb->succ->succ_next) @@ -10241,7 +10243,7 @@ purge_dead_edges (bb) { note = find_reg_note (insn, REG_BR_PROB, NULL); if (!note) - return; + return purged; b = BRANCH_EDGE (bb); f = FALLTHRU_EDGE (bb); b->probability = INTVAL (XEXP (note, 0)); @@ -10249,8 +10251,22 @@ purge_dead_edges (bb) b->count = bb->count * b->probability / REG_BR_PROB_BASE; f->count = bb->count * f->probability / REG_BR_PROB_BASE; } - return; + return purged; } + + /* Cleanup abnormal edges caused by throwing insns that have been + eliminated. */ + if (! can_throw_internal (bb->end)) + for (e = bb->succ; e; e = next) + { + next = e->succ_next; + if (e->flags & EDGE_EH) + { + remove_edge (e); + purged = true; + } + } + /* If we don't see a jump insn, we don't know exactly why the block would have been broken at this point. Look for a simple, non-fallthru edge, as these are only created by conditional branches. If we find such an @@ -10259,12 +10275,12 @@ purge_dead_edges (bb) for (e = bb->succ; e && (e->flags & (EDGE_COMPLEX | EDGE_FALLTHRU)); e = e->succ_next); if (!e) - return; + return purged; for (e = bb->succ; e; e = next) { next = e->succ_next; if (!(e->flags & EDGE_FALLTHRU)) - remove_edge (e); + remove_edge (e), purged = true; } if (!bb->succ || bb->succ->succ_next) abort (); @@ -10274,15 +10290,19 @@ purge_dead_edges (bb) if (rtl_dump_file) fprintf (rtl_dump_file, "Purged non-fallthru edges from bb %i\n", bb->index); - return; + return purged; } -/* Search all basic blocks for potentionally dead edges and purge them. */ +/* Search all basic blocks for potentionally dead edges and purge them. + + Return true ifif some edge has been elliminated. + */ -void +bool purge_all_dead_edges () { - int i; + int i, purged = false; for (i = 0; i < n_basic_blocks; i++) - purge_dead_edges (BASIC_BLOCK (i)); + purged |= purge_dead_edges (BASIC_BLOCK (i)); + return purged; } diff --git a/gcc/reload1.c b/gcc/reload1.c index 09ef4ef9977..b2131de22e0 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. */ #include "cselib.h" #include "real.h" #include "toplev.h" +#include "except.h" #if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY @@ -9506,7 +9507,11 @@ fixup_abnormal_edges () for (e = bb->succ; e; e = e->succ_next) if (e->flags & EDGE_FALLTHRU) break; - while (GET_CODE (insn) == INSN && !can_throw_internal (insn)) + /* Get past the new insns generated. Allow notes, as the insns may + be already deleted. */ + while ((GET_CODE (insn) == INSN || GET_CODE (insn) == NOTE) + && !can_throw_internal (insn) + && insn != bb->head) insn = PREV_INSN (insn); if (GET_CODE (insn) != CALL_INSN && !can_throw_internal (insn)) abort (); diff --git a/gcc/toplev.c b/gcc/toplev.c index b69ea3f4fb5..a2d489da8ff 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3267,6 +3267,10 @@ rest_of_compilation (decl) rebuild_jump_labels_after_combine = combine_instructions (insns, max_reg_num ()); + /* Always purge dead edges, as we may eliminate an insn throwing + exception. */ + rebuild_jump_labels_after_combine |= purge_all_dead_edges (); + /* Combining insns may have turned an indirect jump into a direct jump. Rebuid the JUMP_LABEL fields of jumping instructions. */ @@ -3277,7 +3281,6 @@ rest_of_compilation (decl) timevar_pop (TV_JUMP); timevar_push (TV_FLOW); - purge_all_dead_edges (); cleanup_cfg (CLEANUP_EXPENSIVE); /* Blimey. We've got to have the CFG up to date for the call to -- 2.30.2