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]

Re: Dump info about WPA


On Sun, 30 May 2010, Jan Hubicka wrote:

> Hi,
> wpa stage currently produce empty .cgraph dump file.  This patch populates it with
> the usual before and after IPA optimization cgraph dump as well as dump about
> partitioning decisions.
> 
> Bootstrapped/regtested x86_64-linux, OK?

Ok.

Thanks,
Richard.

> Honza
> 	* cgraph.h (cgraph_dump_file): Declare.
> 	* cgraphunit.c (cgraph_dump_file): Export.
> 	* ipa.c (dump_cgraph_node_set, dump_varpool_node_set): Be less
> 	verbose.
> 
> 	* lto.c (promote_var, promote_fn, lto_wpa_write_files): Dump
> 	partitioning decisions.
> Index: cgraph.h
> ===================================================================
> --- cgraph.h	(revision 160051)
> +++ cgraph.h	(working copy)
> @@ -598,6 +598,7 @@
>  bool cgraph_edge_cannot_lead_to_return (struct cgraph_edge *);
>  
>  /* In cgraphunit.c  */
> +extern FILE *cgraph_dump_file;
>  void cgraph_finalize_function (tree, bool);
>  void cgraph_mark_if_needed (tree);
>  void cgraph_finalize_compilation_unit (void);
> Index: cgraphunit.c
> ===================================================================
> --- cgraphunit.c	(revision 160051)
> +++ cgraphunit.c	(working copy)
> @@ -145,7 +145,7 @@
>  static void cgraph_output_pending_asms (void);
>  static void cgraph_analyze_function (struct cgraph_node *);
>  
> -static FILE *cgraph_dump_file;
> +FILE *cgraph_dump_file;
>  
>  /* A vector of FUNCTION_DECLs declared as static constructors.  */
>  static GTY (()) VEC(tree, gc) *static_ctors;
> Index: ipa.c
> ===================================================================
> --- ipa.c	(revision 160051)
> +++ ipa.c	(working copy)
> @@ -1002,8 +1004,9 @@
>    for (iter = csi_start (set); !csi_end_p (iter); csi_next (&iter))
>      {
>        struct cgraph_node *node = csi_node (iter);
> -      dump_cgraph_node (f, node);
> +      fprintf (f, " %s/%i", cgraph_node_name (node), node->uid);
>      }
> +  fprintf (f, "\n");
>  }
>  
>  /* Dump content of SET to stderr.  */
> @@ -1159,8 +1162,9 @@
>    for (iter = vsi_start (set); !vsi_end_p (iter); vsi_next (&iter))
>      {
>        struct varpool_node *node = vsi_node (iter);
> -      dump_varpool_node (f, node);
> +      fprintf (f, " %s", varpool_node_name (node));
>      }
> +  fprintf (f, "\n");
>  }
>  
>  /* Dump content of SET to stderr.  */
> Index: lto/lto.c
> ===================================================================
> --- lto/lto.c	(revision 160051)
> +++ lto/lto.c	(working copy)
> @@ -636,6 +636,9 @@
>    gcc_assert (flag_wpa);
>    TREE_PUBLIC (vnode->decl) = 1;
>    DECL_VISIBILITY (vnode->decl) = VISIBILITY_HIDDEN;
> +  if (cgraph_dump_file)
> +    fprintf (cgraph_dump_file,
> +	    "Promoting var as hidden: %s\n", varpool_node_name (vnode));
>    return true;
>  }
>  
> @@ -659,6 +662,10 @@
>  	  DECL_VISIBILITY (alias->decl) = VISIBILITY_HIDDEN;
>  	}
>      }
> +  if (cgraph_dump_file)
> +    fprintf (cgraph_dump_file,
> +	     "Promoting function as hidden: %s/%i\n",
> +	     cgraph_node_name (node), node->uid);
>    return true;
>  }
>  
> @@ -862,6 +869,15 @@
>  
>        if (!quiet_flag)
>  	fprintf (stderr, " %s (%s %i insns)", temp_filename, part->name, part->insns);
> +      if (cgraph_dump_file)
> +	{
> +	  fprintf (cgraph_dump_file, "Writting partition %s to file %s, %i insns\n",
> +		   part->name, temp_filename, part->insns);
> +	  fprintf (cgraph_dump_file, "cgraph nodes:");
> +	  dump_cgraph_node_set (cgraph_dump_file, set);
> +	  fprintf (cgraph_dump_file, "varpool nodes:");
> +	  dump_varpool_node_set (cgraph_dump_file, vset);
> +	}
>        gcc_assert (cgraph_node_set_nonempty_p (set)
>  		  || varpool_node_set_nonempty_p (vset) || !i);
>  
> @@ -1632,6 +1648,12 @@
>        dump_memory_report (false);
>      }
>  
> +  if (cgraph_dump_file)
> +    {
> +      dump_cgraph (cgraph_dump_file);
> +      dump_varpool (cgraph_dump_file);
> +    }
> +
>    cgraph_function_flags_ready = true;
>    bitmap_obstack_initialize (NULL);
>    ipa_register_cgraph_hooks ();
> @@ -1639,6 +1661,12 @@
>  
>    execute_ipa_pass_list (all_regular_ipa_passes);
>  
> +  if (cgraph_dump_file)
> +    {
> +      fprintf (cgraph_dump_file, "Optimized ");
> +      dump_cgraph (cgraph_dump_file);
> +      dump_varpool (cgraph_dump_file);
> +    }
>    verify_cgraph ();
>    bitmap_obstack_release (NULL);
>  
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex


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