This is the mail archive of the gcc@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: API for callgraph and IPA passes for whole program optimization


> On 3/9/08 7:26 AM, Jan Hubicka wrote:
> 
> >compensate testsuite and documentation for the removal of RTL dump
> >letters so I would rather do that just once.  Does this seem OK?
> 
> Yup, thanks for doing this.
> 
> 
> >The patch include the read/write methods that will be just placeholders
> >on mainline.  Naturally I can remove them for time being at least as
> >long as we think the RTL_PASS/TREE_PASS macros are good idea.
> 
> Nitpick on the name, can you s/TREE/GIMPLE/?

Sure. Though gimplifier itself might end up being GIMPLE_PASS but it is
not big deal I guess.

> 
> 
> >quite easilly see that those are stepping back from plan not making
> >passmanager poluted by ugly macros, but on the other hand since the PM
> >is now doing RTL/IPA/tree passes it needs at least a little of
> >flexibility to be able update API of one without affecting others.
> 
> How about doing the simple hierarchy as you outlined in your last 
> message?  Both gimple and rtl passes would inherit everything from base, 
> and ipa would have the additional hooks for summary generation and whatnot.

OK, I something like this?

Index: tree-pass.h
===================================================================
--- tree-pass.h	(revision 133036)
+++ tree-pass.h	(working copy)
@@ -88,9 +88,19 @@ extern const char *dump_file_name;
 /* Return the dump_file_info for the given phase.  */
 extern struct dump_file_info *get_dump_file_info (enum tree_dump_index);
 
+/* Forward declare so we don't need to bring in cgraph and varpool include.  */
+struct cgraph_node;
+struct varpool_node;
+
 /* Describe one pass.  */
-struct tree_opt_pass
+struct opt_pass
 {
+  enum pass_type {
+	  GIMPLE_PASS,
+	  RTL_PASS,
+	  SIMPLE_IPA_PASS,
+	  IPA_PASS
+  } pass_type;
   /* Terse name of the pass used as a fragment of the dump file name.  */
   const char *name;
 
@@ -124,11 +134,51 @@ struct tree_opt_pass
   /* Flags indicating common sets things to do before and after.  */
   unsigned int todo_flags_start;
   unsigned int todo_flags_finish;
+};
+
+struct gimple_pass
+{
+   struct opt_pass;
+};
+
+struct rtl_pass
+{
+   struct opt_pass;
+};
 
-  /* Letter for RTL dumps.  */
-  char letter;
+struct simple_ipa_pass
+{
+   struct opt_pass;
 };
 
+struct ipa_pass
+{
+  struct opt_pass;
+
+  /* IPA passes can analyze function body and variable initializers using this
+     hook and produce summary.  */
+  void (*function_generate_summary) (struct cgraph_node *);
+  void (*variable_generate_summary) (struct varpool_node *);
+
+  /* These hooks will be used to serialize IPA summaries on disk.  For a moment
+     they are just placeholders.  */
+  void (*function_write_summary) (struct cgraph_node *);
+  void (*variable_write_summary) (struct varpool_node *);
+  void (*function_read_summary) (struct cgraph_node *);
+  void (*variable_read_summary) (struct varpool_node *);
+
+  /* Results of interprocedural propagation of an IPA pass is applied to
+     function body via this hook.  */
+  void (*function_transform) (struct cgraph_node *);
+  void (*variable_transform) (struct varpool_node *);
+};
+
 /* Define a tree dump switch.  */
 struct dump_file_info
 {
@@ -138,7 +188,6 @@ struct dump_file_info
   int flags;                    /* user flags */
   int state;                    /* state of play */
   int num;                      /* dump file number */
-  int letter;                   /* enabling letter for RTL dumps */
 };
 
 /* Pass properties.  */
> 
> 
> Diego.


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