aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-03-17 13:58:49 -0800
committerJeff Law <law@gcc.gnu.org>1999-03-17 14:58:49 -0700
commit422d0fb02b54499db4147cd9f65e7fe01ecf36b2 (patch)
treec43c997d7221f644b3d173ec09c04ce2bf156966
parente41753123bcf8495387918dfc6d8b20d4297bd31 (diff)
downloadgcc-422d0fb02b54499db4147cd9f65e7fe01ecf36b2.zip
gcc-422d0fb02b54499db4147cd9f65e7fe01ecf36b2.tar.gz
gcc-422d0fb02b54499db4147cd9f65e7fe01ecf36b2.tar.bz2
flow.c (compute_immediate_dominators): New function.
* flow.c (compute_immediate_dominators): New function. * basic-block.h (compute_immediate_dominators): Declare it. From-SVN: r25831
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/basic-block.h1
-rw-r--r--gcc/flow.c40
3 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cccf21f..50681b2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -23,6 +23,9 @@ Wed Mar 17 18:20:24 1999 David S. Miller <davem@redhat.com>
Wed Mar 17 14:51:19 1999 Richard Henderson <rth@cygnus.com>
+ * flow.c (compute_immediate_dominators): New function.
+ * basic-block.h (compute_immediate_dominators): Declare it.
+
* alpha.h (HARD_REGNO_MODE_OK): Allow only 4 and 8 byte unit modes
in FP regs.
(MODES_TIEABLE_P): Define asymmetricly wrt modes illegal in FP regs.
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 2052b8c..378577f 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -249,3 +249,4 @@ extern void compute_preds_succs PROTO ((int_list_ptr *, int_list_ptr *,
extern void compute_dominators PROTO ((sbitmap *, sbitmap *,
int_list_ptr *,
int_list_ptr *));
+extern void compute_immediate_dominators PROTO ((int *, sbitmap *));
diff --git a/gcc/flow.c b/gcc/flow.c
index 1e17112..2675296 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -4560,6 +4560,46 @@ compute_dominators (dominators, post_dominators, s_preds, s_succs)
free (temp_bitmap);
}
+/* Given DOMINATORS, compute the immediate dominators into IDOM. */
+
+void
+compute_immediate_dominators (idom, dominators)
+ int *idom;
+ sbitmap *dominators;
+{
+ sbitmap *tmp;
+ int b;
+
+ tmp = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
+
+ /* Begin with tmp(n) = dom(n) - { n }. */
+ for (b = n_basic_blocks; --b >= 0; )
+ {
+ sbitmap_copy (tmp[b], dominators[b]);
+ RESET_BIT (tmp[b], b);
+ }
+
+ /* Subtract out all of our dominator's dominators. */
+ for (b = n_basic_blocks; --b >= 0; )
+ {
+ sbitmap tmp_b = tmp[b];
+ int s;
+
+ for (s = n_basic_blocks; --s >= 0; )
+ if (TEST_BIT (tmp_b, s))
+ sbitmap_difference (tmp_b, tmp_b, tmp[s]);
+ }
+
+ /* Find the one bit set in the bitmap and put it in the output array. */
+ for (b = n_basic_blocks; --b >= 0; )
+ {
+ int t;
+ EXECUTE_IF_SET_IN_SBITMAP (tmp[b], 0, t, { idom[b] = t; });
+ }
+
+ sbitmap_vector_free (tmp);
+}
+
/* Count for a single SET rtx, X. */
static void