aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorloki <loki@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-16 15:56:47 +0000
committerloki <loki@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-16 15:56:47 +0000
commit89140b26d39e4c4ca40cced9acb7ab6c89ed7821 (patch)
treeaf252562b35a549f3d69775cbe66df0b0efcfb90 /gcc/cfgcleanup.c
parent7e50ecaeb4fe7c6b78cf5bbd8709ec113231235e (diff)
2006-01-16 Gabor Loki <loki@gcc.gnu.org>
* rtl-factoring.c : Add sequence abstraction algorithm. * cfgcleanup.c (outgoing_edges_match): Extra checks. (try_crossjump_to_edge): Avoid deleting preserve label when redirecting ABNORMAL edges. (block_has_preserve_label): New function. * common.opt: Register new pass. * Makefile.in: Ditto. * passes.c: Ditto. * timevar.def: Ditto. * tree-pass.h: Ditto. * emit-rtl.c (make_jump_insn_raw): Remove forward decl. * rtl.h (make_jump_insn_raw): Add forward decl. * doc/invoke.texi: Add documentation for -frtl-abstract-sequences. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109750 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 8bc49a2abd8..4f0c9d4de8a 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1589,11 +1589,43 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2)
return false;
}
- /* We don't need to match the rest of edges as above checks should be enough
- to ensure that they are equivalent. */
+ /* The same checks as in try_crossjump_to_edge. It is required for RTL
+ version of sequence abstraction. */
+ FOR_EACH_EDGE (e1, ei, bb2->succs)
+ {
+ edge e2;
+ edge_iterator ei;
+ basic_block d1 = e1->dest;
+
+ if (FORWARDER_BLOCK_P (d1))
+ d1 = EDGE_SUCC (d1, 0)->dest;
+
+ FOR_EACH_EDGE (e2, ei, bb1->succs)
+ {
+ basic_block d2 = e2->dest;
+ if (FORWARDER_BLOCK_P (d2))
+ d2 = EDGE_SUCC (d2, 0)->dest;
+ if (d1 == d2)
+ break;
+ }
+
+ if (!e2)
+ return false;
+ }
+
return true;
}
+/* Returns true if BB basic block has a preserve label. */
+
+static bool
+block_has_preserve_label (basic_block bb)
+{
+ return (bb
+ && block_label (bb)
+ && LABEL_PRESERVE_P (block_label (bb)));
+}
+
/* E1 and E2 are edges with the same destination block. Search their
predecessors for common code. If found, redirect control flow from
(maybe the middle of) E1->SRC to (maybe the middle of) E2->SRC. */
@@ -1669,6 +1701,11 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
&& (newpos1 != BB_HEAD (src1)))
return false;
+ /* Avoid deleting preseve label when redirecting ABNORMAL edeges. */
+ if (block_has_preserve_label (e1->dest)
+ && (e1->flags & EDGE_ABNORMAL))
+ return false;
+
/* Here we know that the insns in the end of SRC1 which are common with SRC2
will be deleted.
If we have tablejumps in the end of SRC1 and SRC2