This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Remove flow_preorder_transversal_compute.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Feb 2004 23:36:40 -0500 (EST)
- Subject: [patch] Remove flow_preorder_transversal_compute.
Hi,
Attached is a patch to remove flow_preorder_transversal_compute()
along with "struct dfst_node" as they are unused.
I also confirmd that none of 3.3, 3.4, mainline, or tree-ssa branch
uses it (although it's defined in all of them).
Bootstrapped on i686-pc-linux-gnu. OK to apply?
Kazu Hirata
2004-02-24 Kazu Hirata <kazu@cs.umass.edu>
* cfganal.c (dfst_node): Remove.
(flow_preorder_transversal_compute): Likewise.
* basic-block.h: Remove the prototype for
flow_preorder_transversal_compute.
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.191
diff -u -r1.191 basic-block.h
--- basic-block.h 17 Feb 2004 16:41:43 -0000 1.191
+++ basic-block.h 24 Feb 2004 14:37:38 -0000
@@ -376,7 +376,6 @@
extern void clear_bb_flags (void);
extern void flow_reverse_top_sort_order_compute (int *);
extern int flow_depth_first_order_compute (int *, int *);
-extern void flow_preorder_transversal_compute (int *);
extern int dfs_enumerate_from (basic_block, int,
bool (*)(basic_block, void *),
basic_block *, int, void *);
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.41
diff -u -r1.41 cfganal.c
--- cfganal.c 7 Feb 2004 14:14:51 -0000 1.41
+++ cfganal.c 24 Feb 2004 14:37:38 -0000
@@ -889,130 +889,6 @@
return dfsnum;
}
-struct dfst_node
-{
- unsigned nnodes;
- struct dfst_node **node;
- struct dfst_node *up;
-};
-
-/* Compute a preorder transversal ordering such that a sub-tree which
- is the source of a cross edge appears before the sub-tree which is
- the destination of the cross edge. This allows for easy detection
- of all the entry blocks for a loop.
-
- The ordering is compute by:
-
- 1) Generating a depth first spanning tree.
-
- 2) Walking the resulting tree from right to left. */
-
-void
-flow_preorder_transversal_compute (int *pot_order)
-{
- edge e;
- edge *stack;
- int i;
- int max_successors;
- int sp;
- sbitmap visited;
- struct dfst_node *node;
- struct dfst_node *dfst;
- basic_block bb;
-
- /* Allocate stack for back-tracking up CFG. */
- stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge));
- sp = 0;
-
- /* Allocate the tree. */
- dfst = xcalloc (last_basic_block, sizeof (struct dfst_node));
-
- FOR_EACH_BB (bb)
- {
- max_successors = 0;
- for (e = bb->succ; e; e = e->succ_next)
- max_successors++;
-
- dfst[bb->index].node
- = (max_successors
- ? xcalloc (max_successors, sizeof (struct dfst_node *)) : NULL);
- }
-
- /* Allocate bitmap to track nodes that have been visited. */
- visited = sbitmap_alloc (last_basic_block);
-
- /* None of the nodes in the CFG have been visited yet. */
- sbitmap_zero (visited);
-
- /* Push the first edge on to the stack. */
- stack[sp++] = ENTRY_BLOCK_PTR->succ;
-
- while (sp)
- {
- basic_block src;
- basic_block dest;
-
- /* Look at the edge on the top of the stack. */
- e = stack[sp - 1];
- src = e->src;
- dest = e->dest;
-
- /* Check if the edge destination has been visited yet. */
- if (dest != EXIT_BLOCK_PTR && ! TEST_BIT (visited, dest->index))
- {
- /* Mark that we have visited the destination. */
- SET_BIT (visited, dest->index);
-
- /* Add the destination to the preorder tree. */
- if (src != ENTRY_BLOCK_PTR)
- {
- dfst[src->index].node[dfst[src->index].nnodes++]
- = &dfst[dest->index];
- dfst[dest->index].up = &dfst[src->index];
- }
-
- if (dest->succ)
- /* Since the DEST node has been visited for the first
- time, check its successors. */
- stack[sp++] = dest->succ;
- }
-
- else if (e->succ_next)
- stack[sp - 1] = e->succ_next;
- else
- sp--;
- }
-
- free (stack);
- sbitmap_free (visited);
-
- /* Record the preorder transversal order by
- walking the tree from right to left. */
-
- i = 0;
- node = &dfst[ENTRY_BLOCK_PTR->next_bb->index];
- pot_order[i++] = 0;
-
- while (node)
- {
- if (node->nnodes)
- {
- node = node->node[--node->nnodes];
- pot_order[i++] = node - dfst;
- }
- else
- node = node->up;
- }
-
- /* Free the tree. */
-
- for (i = 0; i < last_basic_block; i++)
- if (dfst[i].node)
- free (dfst[i].node);
-
- free (dfst);
-}
-
/* Compute the depth first search order on the _reverse_ graph and
store in the array DFS_ORDER, marking the nodes visited in VISITED.
Returns the number of nodes visited.