This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: try_crossjump_bb and computed gotos


Hi,

On Tue, 28 Aug 2001, Brad Lucier wrote:
>
> I understand the principle of what try_crossjump_bb is trying to do,
> if not the details.  I'm wondering if there is a early exit that it
> could take in the presence of critical or abnormal edges;
> try_crossjump_bb checks for complex edges, but not for critical or
> abnormal ones.

abnormal edges are complex edges, so it checks for them.  Mere critical
edges can be split if needed to make cross-jumping work.  Another approach
could be to check the number of predecessors of a block, before doing the
heavy analysis, like in the (completely untested) patch below.  Play with
the number of 20.  This also pessimizes target-blocks of switches, but how
likely is it that two of those blocks share code, _and_ where it's
profitable to merge the shared parts.  It's not unlikely, but making the
compiler faster would also be nice.


Ciao,
Michael.

-- 
Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.474
diff -u -p -r1.474 flow.c
--- flow.c	2001/08/28 01:32:10	1.474
+++ flow.c	2001/08/28 17:14:34
@@ -3949,6 +3949,7 @@ try_crossjump_bb (mode, bb)
 {
   edge e, e2, nexte2, nexte, fallthru;
   bool changed;
+  int num_edges = 0;

   /* Nothing to do if there is not at least two incomming edges.  */
   if (!bb->pred || !bb->pred->pred_next)
@@ -3957,9 +3958,11 @@ try_crossjump_bb (mode, bb)
   /* It is always cheapest to redirect a block that ends in a branch to
      a block that falls through into BB, as that adds no branches to the
      program.  We'll try that combination first.  */
-  for (fallthru = bb->pred; fallthru; fallthru = fallthru->pred_next)
-    if (fallthru->flags & EDGE_FALLTHRU)
-      break;
+  for (e = bb->pred, fallthru = NULL; e; e = e->pred_next, num_edges++)
+    if (num_edges > 20)
+      return false;
+    else if (e->flags & EDGE_FALLTHRU)
+      fallthru = e;

   changed = false;
   for (e = bb->pred; e; e = nexte)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]