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
This commit is contained in:
Jan Hubicka 2001-08-05 23:39:21 -07:00 committed by Richard Henderson
parent 9765f97213
commit 39f95a2c8e
6 changed files with 113 additions and 72 deletions

View File

@ -1,3 +1,15 @@
2001-08-05 Jan Hubicka <jh@suse.cz>
* 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 <neil@daikokuya.demon.co.uk> 2001-08-06 Neil Booth <neil@daikokuya.demon.co.uk>
* cpplib.c (do_line): Correct line number after pop_buffer. * cpplib.c (do_line): Correct line number after pop_buffer.
@ -333,7 +345,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka <jh@suse.cz>
(__gthread_mutex_init_function): New function for mutex initialization. (__gthread_mutex_init_function): New function for mutex initialization.
2001-08-03 Daniel Berlin <dan@cgsoftware.com> 2001-08-03 Daniel Berlin <dan@cgsoftware.com>
* Makefile.in: Revert screwed up commit. * Makefile.in: Revert screwed up commit.
2001-08-03 Stephane Carrez <Stephane.Carrez@worldnet.fr> 2001-08-03 Stephane Carrez <Stephane.Carrez@worldnet.fr>
@ -353,7 +365,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka <jh@suse.cz>
(DTORS_SECTION_FUNCTION): Likewise for __do_global_dtors. (DTORS_SECTION_FUNCTION): Likewise for __do_global_dtors.
2001-08-03 Daniel Berlin <dan@cgsoftware.com> 2001-08-03 Daniel Berlin <dan@cgsoftware.com>
* ChangeLog: Fix date on previous ChangeLog entry for GCSE. * ChangeLog: Fix date on previous ChangeLog entry for GCSE.
* Makefile.in: Add df.h to gcse.c dependencies. * Makefile.in: Add df.h to gcse.c dependencies.
@ -366,26 +378,26 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka <jh@suse.cz>
2001-08-03 Daniel Berlin <dan@cgsoftware.com> 2001-08-03 Daniel Berlin <dan@cgsoftware.com>
* gcse.c: Include df.h for use as a dataflow analyzer. * gcse.c: Include df.h for use as a dataflow analyzer.
Remove regvec. Remove regvec.
Declaration of reg_set_info: gone. Declaration of reg_set_info: gone.
New df_analyzer variable used by store motion. New df_analyzer variable used by store motion.
(reg_set_info): Deleted. (reg_set_info): Deleted.
(mark_mem_regs): New function, analyze regs used by a mem. (mark_mem_regs): New function, analyze regs used by a mem.
(store_ops_ok): Use dataflow analyzer results to determine if (store_ops_ok): Use dataflow analyzer results to determine if
necessary regs are changed in the block. necessary regs are changed in the block.
(find_moveable_store): Remove check for symbol ref, we can handle (find_moveable_store): Remove check for symbol ref, we can handle
much more complex expressions now. much more complex expressions now.
(compute_store_table): Remove most of the code, it's unnecessary (compute_store_table): Remove most of the code, it's unnecessary
now that the dataflow analyzer records the info for us. now that the dataflow analyzer records the info for us.
(store_killed_after): Add parameter to say whether to do the (store_killed_after): Add parameter to say whether to do the
store_ops_okay test, used to speed up testing when we already know 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. the answer, and just want to know if the store itself was killed.
(build_store_vector): Largely rewritten to calculate the various (build_store_vector): Largely rewritten to calculate the various
vectors properly, and somewhat optimized. vectors properly, and somewhat optimized.
(store_motion): Init the df_analyzer, get REG_DEF chains. (store_motion): Init the df_analyzer, get REG_DEF chains.
Also handle trapping expressions (since mems almost always trap) Also handle trapping expressions (since mems almost always trap)
(simple_mem): Redefine what a simple mem is. (simple_mem): Redefine what a simple mem is.
2001-08-03 DJ Delorie <dj@redhat.com> 2001-08-03 DJ Delorie <dj@redhat.com>
@ -454,7 +466,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka <jh@suse.cz>
cp/decl2.c, doc/contrib.texi, doc/cpp.texi, doc/gcc.texi, 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/install.texi, doc/invoke.texi, doc/md.texi, doc/rtl.texi,
doc/tm.texi: consistently use "VAX", "VAXen", and "MicroVAX" doc/tm.texi: consistently use "VAX", "VAXen", and "MicroVAX"
in comments and documentation. in comments and documentation.
2001-08-03 Neil Booth <neil@cat.daikokuya.demon.co.uk> 2001-08-03 Neil Booth <neil@cat.daikokuya.demon.co.uk>
@ -566,7 +578,7 @@ Sat Aug 4 13:51:36 CEST 2001 Jan Hubicka <jh@suse.cz>
2001-08-01 Robert Lipe <robertl@caldera.com> 2001-08-01 Robert Lipe <robertl@caldera.com>
* dwarfout.c: Remove reference to README.DWARF. * dwarfout.c: Remove reference to README.DWARF.
2001-08-01 Andrew MacLeod <amacleod@redhat.com> 2001-08-01 Andrew MacLeod <amacleod@redhat.com>
@ -669,7 +681,7 @@ Wed Aug 1 20:02:12 CEST 2001 Graham Stott <grahams@redhat.com>
2001-08-01 Ziemowit Laski <zlaski@apple.com> 2001-08-01 Ziemowit Laski <zlaski@apple.com>
* 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. contextualizing Objective-C class name lookup by the lexer.
(typespec_reserved_nonattr): Disable ObjC class name lookup after (typespec_reserved_nonattr): Disable ObjC class name lookup after
seeing a TYPESPEC. seeing a TYPESPEC.
@ -731,7 +743,7 @@ Wed Aug 1 20:02:12 CEST 2001 Graham Stott <grahams@redhat.com>
2001-07-31 Jeff Sturm <jsturm@one-point.com> 2001-07-31 Jeff Sturm <jsturm@one-point.com>
* 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 <mrg@eterna.com.au> 2001-07-31 matthew green <mrg@eterna.com.au>
@ -814,10 +826,10 @@ Tue Jul 31 15:33:27 CEST 2001 Jan Hubicka <jh@suse.cz>
2001-07-31 Hartmut Penner <hpenner@de.ibm.com> 2001-07-31 Hartmut Penner <hpenner@de.ibm.com>
* doc/install.texi: Add s390 and s390x as new targets. * doc/install.texi: Add s390 and s390x as new targets.
* doc/invoke.texi: Add documantation of S/390 and zSeries * doc/invoke.texi: Add documantation of S/390 and zSeries
target options. target options.
* doc/md.texi: Add documantation of S/390 and zSeries constraints. * doc/md.texi: Add documantation of S/390 and zSeries constraints.
2001-07-30 Roman Zippel <zippel@linux-m68k.org> 2001-07-30 Roman Zippel <zippel@linux-m68k.org>
@ -827,7 +839,7 @@ Tue Jul 31 15:33:27 CEST 2001 Jan Hubicka <jh@suse.cz>
Mon Jul 30 23:20:34 EDT 2001 John Wehle (john@feith.com) 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 <rth@redhat.com> 2001-07-30 Richard Henderson <rth@redhat.com>
@ -868,18 +880,18 @@ Mon Jul 30 22:16:08 CEST 2001 Jan Hubicka <jh@suse.cz>
2001-07-30 Andreas Jaeger <aj@suse.de> 2001-07-30 Andreas Jaeger <aj@suse.de>
* 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 * gcov.c (calculate_branch_probs): Use gcov_type to avoid
overflow. overflow.
(scan_for_source_files): Use long for count to avoid overflow. (scan_for_source_files): Use long for count to avoid overflow.
(output_data): Likewise. (output_data): Likewise.
(output_data): Don't use string concatatenation to silence gcc (output_data): Don't use string concatatenation to silence gcc
-traditional. -traditional.
* predict.c: Fix typos and grammar. * predict.c: Fix typos and grammar.
* gcse.c (insert_insn_end_bb): Remove unused variables. * gcse.c (insert_insn_end_bb): Remove unused variables.
@ -1122,7 +1134,7 @@ Fri Jul 27 17:53:00 CEST 2001 Jan Hubicka <jh@suse.cz>
Fri Jul 27 00:33:35 EDT 2001 John Wehle (john@feith.com) 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. target->global_live_at_start.
2001-07-26 Richard Henderson <rth@redhat.com> 2001-07-26 Richard Henderson <rth@redhat.com>
@ -1168,8 +1180,8 @@ Thu Jul 26 14:04:03 EDT 2001 John Wehle (john@feith.com)
2001-07-26 Catherine Moore <clm@redhat.com> 2001-07-26 Catherine Moore <clm@redhat.com>
* config/v850/v850.h (ENCODE_SECTION_INFO): Change order * config/v850/v850.h (ENCODE_SECTION_INFO): Change order
of conditional to avoid tree checking errors. of conditional to avoid tree checking errors.
2001-07-26 Kazu Hirata <kazu@hxi.com> 2001-07-26 Kazu Hirata <kazu@hxi.com>
@ -1248,8 +1260,8 @@ Wed Jul 25 18:00:05 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-07-25 Catherine Moore <clm@redhat.com> 2001-07-25 Catherine Moore <clm@redhat.com>
* config/v850/v850.c (v850_va_arg): Use addr * config/v850/v850.c (v850_va_arg): Use addr
instead of valist to build incr. instead of valist to build incr.
Wed Jul 25 22:48:59 CEST 2001 Jan Hubicka <jh@suse.cz> Wed Jul 25 22:48:59 CEST 2001 Jan Hubicka <jh@suse.cz>
@ -1314,11 +1326,11 @@ Wed Jul 25 08:25:01 2001 Jeffrey A Law (law@cygnus.com)
2001-07-24 Joel Sherrill <joel@OARcorp.com> 2001-07-24 Joel Sherrill <joel@OARcorp.com>
* config/sparc/rtems.h (CPP_PREDEFINES): Remove redundant * config/sparc/rtems.h (CPP_PREDEFINES): Remove redundant
-Acpu and -Amachine.h. -Acpu and -Amachine.h.
* config/sparc/rtemself.h (CPP_PREDEFINES): Likewise. * config/sparc/rtemself.h (CPP_PREDEFINES): Likewise.
Corrected header to say ELF not a.out. Corrected header to say ELF not a.out.
* config/sparc/sparc.h (CPP_CPU_SPEC): Define _SOFT_FLOAT * config/sparc/sparc.h (CPP_CPU_SPEC): Define _SOFT_FLOAT
when given -msoft-float. when given -msoft-float.
2001-07-24 Joel Sherrill <joel@OARcorp.com> 2001-07-24 Joel Sherrill <joel@OARcorp.com>

View File

@ -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) 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) \ 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 \ 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 \ 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 \ $(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) $(RECOG_H) reload.h $(EXPR_H) toplev.h $(TM_P_H)

View File

@ -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 bool redirect_edge_and_branch PARAMS ((edge, basic_block));
extern rtx block_label PARAMS ((basic_block)); extern rtx block_label PARAMS ((basic_block));
extern bool forwarder_block_p PARAMS ((basic_block)); extern bool forwarder_block_p PARAMS ((basic_block));
extern void purge_all_dead_edges PARAMS ((void)); extern bool purge_all_dead_edges PARAMS ((void));
extern void purge_dead_edges PARAMS ((basic_block)); extern bool purge_dead_edges PARAMS ((basic_block));
extern void find_sub_basic_blocks PARAMS ((basic_block)); extern void find_sub_basic_blocks PARAMS ((basic_block));

View File

@ -10187,26 +10187,28 @@ init_flow ()
} }
/* Assume that the preceeding pass has possibly eliminated jump instructions /* 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) purge_dead_edges (bb)
basic_block bb; basic_block bb;
{ {
edge e, next; edge e, next;
rtx insn = bb->end; rtx insn = bb->end;
bool purged = false;
if (GET_CODE (insn) == JUMP_INSN && !simplejump_p (insn)) if (GET_CODE (insn) == JUMP_INSN && !simplejump_p (insn))
return; return false;
if (GET_CODE (insn) == JUMP_INSN) if (GET_CODE (insn) == JUMP_INSN)
{ {
int removed = 0;
rtx note; rtx note;
edge b,f; edge b,f;
/* We do care only about conditional jumps and simplejumps. */ /* We do care only about conditional jumps and simplejumps. */
if (!any_condjump_p (insn) if (!any_condjump_p (insn)
&& !returnjump_p (insn) && !returnjump_p (insn)
&& !simplejump_p (insn)) && !simplejump_p (insn))
return; return false;
for (e = bb->succ; e; e = next) for (e = bb->succ; e; e = next)
{ {
next = e->succ_next; next = e->succ_next;
@ -10221,15 +10223,15 @@ purge_dead_edges (bb)
if (e->dest == EXIT_BLOCK_PTR if (e->dest == EXIT_BLOCK_PTR
&& returnjump_p (insn)) && returnjump_p (insn))
continue; continue;
removed = 1; purged = true;
remove_edge (e); remove_edge (e);
} }
if (!bb->succ || !removed) if (!bb->succ || !purged)
return; return false;
if (rtl_dump_file) if (rtl_dump_file)
fprintf (rtl_dump_file, "Purged edges from bb %i\n", bb->index); fprintf (rtl_dump_file, "Purged edges from bb %i\n", bb->index);
if (!optimize) if (!optimize)
return; return purged;
/* Redistribute probabilities. */ /* Redistribute probabilities. */
if (!bb->succ->succ_next) if (!bb->succ->succ_next)
@ -10241,7 +10243,7 @@ purge_dead_edges (bb)
{ {
note = find_reg_note (insn, REG_BR_PROB, NULL); note = find_reg_note (insn, REG_BR_PROB, NULL);
if (!note) if (!note)
return; return purged;
b = BRANCH_EDGE (bb); b = BRANCH_EDGE (bb);
f = FALLTHRU_EDGE (bb); f = FALLTHRU_EDGE (bb);
b->probability = INTVAL (XEXP (note, 0)); b->probability = INTVAL (XEXP (note, 0));
@ -10249,8 +10251,22 @@ purge_dead_edges (bb)
b->count = bb->count * b->probability / REG_BR_PROB_BASE; b->count = bb->count * b->probability / REG_BR_PROB_BASE;
f->count = bb->count * f->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 /* 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, 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 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)); for (e = bb->succ; e && (e->flags & (EDGE_COMPLEX | EDGE_FALLTHRU));
e = e->succ_next); e = e->succ_next);
if (!e) if (!e)
return; return purged;
for (e = bb->succ; e; e = next) for (e = bb->succ; e; e = next)
{ {
next = e->succ_next; next = e->succ_next;
if (!(e->flags & EDGE_FALLTHRU)) if (!(e->flags & EDGE_FALLTHRU))
remove_edge (e); remove_edge (e), purged = true;
} }
if (!bb->succ || bb->succ->succ_next) if (!bb->succ || bb->succ->succ_next)
abort (); abort ();
@ -10274,15 +10290,19 @@ purge_dead_edges (bb)
if (rtl_dump_file) if (rtl_dump_file)
fprintf (rtl_dump_file, "Purged non-fallthru edges from bb %i\n", fprintf (rtl_dump_file, "Purged non-fallthru edges from bb %i\n",
bb->index); 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 () purge_all_dead_edges ()
{ {
int i; int i, purged = false;
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < n_basic_blocks; i++)
purge_dead_edges (BASIC_BLOCK (i)); purged |= purge_dead_edges (BASIC_BLOCK (i));
return purged;
} }

View File

@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. */
#include "cselib.h" #include "cselib.h"
#include "real.h" #include "real.h"
#include "toplev.h" #include "toplev.h"
#include "except.h"
#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY #if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY
#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
@ -9506,7 +9507,11 @@ fixup_abnormal_edges ()
for (e = bb->succ; e; e = e->succ_next) for (e = bb->succ; e; e = e->succ_next)
if (e->flags & EDGE_FALLTHRU) if (e->flags & EDGE_FALLTHRU)
break; 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); insn = PREV_INSN (insn);
if (GET_CODE (insn) != CALL_INSN && !can_throw_internal (insn)) if (GET_CODE (insn) != CALL_INSN && !can_throw_internal (insn))
abort (); abort ();

View File

@ -3267,6 +3267,10 @@ rest_of_compilation (decl)
rebuild_jump_labels_after_combine rebuild_jump_labels_after_combine
= combine_instructions (insns, max_reg_num ()); = 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 /* Combining insns may have turned an indirect jump into a
direct jump. Rebuid the JUMP_LABEL fields of jumping direct jump. Rebuid the JUMP_LABEL fields of jumping
instructions. */ instructions. */
@ -3277,7 +3281,6 @@ rest_of_compilation (decl)
timevar_pop (TV_JUMP); timevar_pop (TV_JUMP);
timevar_push (TV_FLOW); timevar_push (TV_FLOW);
purge_all_dead_edges ();
cleanup_cfg (CLEANUP_EXPENSIVE); cleanup_cfg (CLEANUP_EXPENSIVE);
/* Blimey. We've got to have the CFG up to date for the call to /* Blimey. We've got to have the CFG up to date for the call to