aboutsummaryrefslogtreecommitdiff
path: root/gcc/graphds.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/graphds.cc')
-rw-r--r--gcc/graphds.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/graphds.cc b/gcc/graphds.cc
index 91a2ca5..2a108fd 100644
--- a/gcc/graphds.cc
+++ b/gcc/graphds.cc
@@ -281,7 +281,14 @@ graphds_dfs (struct graph *g, int *qs, int nq, vec<int> *qt,
numbers assigned by the previous pass. If SUBGRAPH is not NULL, it
specifies the subgraph of G whose strongly connected components we want
to determine. If SKIP_EDGE_P is not NULL, it points to a callback function.
- Edge E will be skipped if callback function returns true.
+ Edge E will be skipped if callback function returns true. If SCC_GROUPING
+ is not null, the nodes will be added to it in the following order:
+
+ - If SCC A is a direct or indirect predecessor of SCC B in the SCC dag,
+ A's nodes come before B's nodes.
+
+ - All of an SCC's nodes are listed consecutively, although the order
+ of the nodes within an SCC is not really meaningful.
After running this function, v->component is the number of the strongly
connected component for each vertex of G. Returns the number of the
@@ -289,7 +296,7 @@ graphds_dfs (struct graph *g, int *qs, int nq, vec<int> *qt,
int
graphds_scc (struct graph *g, bitmap subgraph,
- skip_edge_callback skip_edge_p)
+ skip_edge_callback skip_edge_p, vec<int> *scc_grouping)
{
int *queue = XNEWVEC (int, g->n_vertices);
vec<int> postorder = vNULL;
@@ -317,7 +324,7 @@ graphds_scc (struct graph *g, bitmap subgraph,
for (i = 0; i < nq; i++)
queue[i] = postorder[nq - i - 1];
- comp = graphds_dfs (g, queue, nq, NULL, true, subgraph, skip_edge_p);
+ comp = graphds_dfs (g, queue, nq, scc_grouping, true, subgraph, skip_edge_p);
free (queue);
postorder.release ();