This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: API for callgraph and IPA passes for whole program optimization
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Diego Novillo <dnovillo at google dot com>
- Cc: Jan Hubicka <jh at suse dot cz>, zadeck at naturalbridge dot com, gcc at gcc dot gnu dot org
- Date: Wed, 12 Mar 2008 12:19:18 +0100
- Subject: Re: API for callgraph and IPA passes for whole program optimization
- References: <20080217163118.GE28452@kam.mff.cuni.cz> <47BAD728.8030907@google.com> <20080309142656.GK26523@kam.mff.cuni.cz> <47D745DA.90509@google.com>
> 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.