aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2002-03-07 16:38:00 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2002-03-07 15:38:00 +0000
commit068473ec92aa0bca1066db130b95abef40c6d418 (patch)
treec7a003366839afcd2db5a7c045eff45c5926c4b0 /gcc/gcse.c
parenta9a437be8dc325ab24c33c3e2ebec3115b3ee53d (diff)
downloadgcc-068473ec92aa0bca1066db130b95abef40c6d418.zip
gcc-068473ec92aa0bca1066db130b95abef40c6d418.tar.gz
gcc-068473ec92aa0bca1066db130b95abef40c6d418.tar.bz2
basic-block.h (fixup_abnormal_edges): Declare.
* basic-block.h (fixup_abnormal_edges): Declare. * reload1.c (fixup_abnormal_edges): New function. * reg-stack.c (convert_regs): Use it. * gcse.c (insert_insn_end_bb): Handle trapping insns. * gcse.c (hash_scan_set): Refuse instructions with EH edges. From-SVN: r50405
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 52013c1..d78f82e 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2189,6 +2189,10 @@ hash_scan_set (pat, insn, set_p)
&& regno >= FIRST_PSEUDO_REGISTER
/* Don't GCSE something if we can't do a reg/reg copy. */
&& can_copy_p [GET_MODE (dest)]
+ /* GCSE commonly inserts instruction after the insn. We can't
+ do that easily for EH_REGION notes so disable GCSE on these
+ for now. */
+ && !find_reg_note (insn, REG_EH_REGION, NULL_RTX)
/* Is SET_SRC something we want to gcse? */
&& want_to_gcse_p (src)
/* Don't CSE a nop. */
@@ -4609,13 +4613,23 @@ insert_insn_end_bb (expr, bb, pre)
pat = process_insert_insn (expr);
/* If the last insn is a jump, insert EXPR in front [taking care to
- handle cc0, etc. properly]. */
+ handle cc0, etc. properly]. Similary we need to care trapping
+ instructions in presence of non-call exceptions. */
- if (GET_CODE (insn) == JUMP_INSN)
+ if (GET_CODE (insn) == JUMP_INSN
+ || (GET_CODE (insn) == INSN
+ && (bb->succ->succ_next || (bb->succ->flags & EDGE_ABNORMAL))))
{
#ifdef HAVE_cc0
rtx note;
#endif
+ /* It should always be the case that we can put these instructions
+ anywhere in the basic block with performing PRE optimizations.
+ Check this. */
+ if (GET_CODE (insn) == insn && pre
+ && !TEST_BIT (antloc[bb->index], expr->bitmap_index)
+ && !TEST_BIT (transp[bb->index], expr->bitmap_index))
+ abort ();
/* If this is a jump table, then we can't insert stuff here. Since
we know the previous real insn must be the tablejump, we insert
@@ -4645,7 +4659,8 @@ insert_insn_end_bb (expr, bb, pre)
/* Likewise if the last insn is a call, as will happen in the presence
of exception handling. */
- else if (GET_CODE (insn) == CALL_INSN)
+ else if (GET_CODE (insn) == CALL_INSN
+ && (bb->succ->succ_next || (bb->succ->flags & EDGE_ABNORMAL)))
{
/* Keeping in mind SMALL_REGISTER_CLASSES and parameters in registers,
we search backward and place the instructions before the first