diff mbox

Make ipa_reduced_postorder number SCCs

Message ID 20110530181442.GB8867@virgil.arch.suse.de
State New
Headers show

Commit Message

Martin Jambor May 30, 2011, 6:14 p.m. UTC
Hi,

for an IPA-CP rewrite that I now work on, it is often useful to look
at a call graph edge and see whether both ends are in the same
strongly connected component.  At the moment ipa_reduced_postorder
does not offer such capabilities but it is easy to add.  It is enough
to save the lowest DFS number of the component when constructing the
linked list of nodes in it.  And this is exactly what the patch below
does.

Bootstrapped and tested on x86_64-linux.  OK for trunk?

Thanks,

Martin


2011-05-19  Martin Jambor  <mjambor@suse.cz>

	* ipa-utils.c (ipa_dfs_info): New field scc_no;
	* ipa-utils.c (searchc): Set scc_no;

Comments

Jan Hubicka May 31, 2011, 8:35 a.m. UTC | #1
> Hi,
> 
> for an IPA-CP rewrite that I now work on, it is often useful to look
> at a call graph edge and see whether both ends are in the same
> strongly connected component.  At the moment ipa_reduced_postorder
> does not offer such capabilities but it is easy to add.  It is enough
> to save the lowest DFS number of the component when constructing the
> linked list of nodes in it.  And this is exactly what the patch below
> does.
> 
> Bootstrapped and tested on x86_64-linux.  OK for trunk?
> 
> Thanks,
> 
> Martin
> 
> 
> 2011-05-19  Martin Jambor  <mjambor@suse.cz>
> 
> 	* ipa-utils.c (ipa_dfs_info): New field scc_no;
> 	* ipa-utils.c (searchc): Set scc_no;
OK.
thanks,
Honza
diff mbox

Patch

Index: src/gcc/ipa-utils.c
===================================================================
--- src.orig/gcc/ipa-utils.c
+++ src/gcc/ipa-utils.c
@@ -138,6 +138,7 @@  searchc (struct searchc_env* env, struct
 	x = env->stack[--(env->stack_size)];
 	x_info = (struct ipa_dfs_info *) x->aux;
 	x_info->on_stack = false;
+	x_info->scc_no = v_info->dfn_number;
 
 	if (env->reduce)
 	  {
Index: src/gcc/ipa-utils.h
===================================================================
--- src.orig/gcc/ipa-utils.h
+++ src/gcc/ipa-utils.h
@@ -26,6 +26,9 @@  along with GCC; see the file COPYING3.
 struct ipa_dfs_info {
   int dfn_number;
   int low_link;
+  /* This field will have the samy value for any two nodes in the same strongly
+     connected component.  */
+  int scc_no;
   bool new_node;
   bool on_stack;
   struct cgraph_node* next_cycle;