This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH] Make ipa_reduced_postorder number SCCs


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;

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;




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