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: [RFC PATCH, LTO] Linked list of stmt uids->stmts fixup hooks


Hi,

On Wed, Nov 04, 2009 at 10:45:03AM +0100, Richard Guenther wrote:
> On Tue, 3 Nov 2009, Martin Jambor wrote:
> 
> > Hi,
> > 
> > while working on streaming of indirect inlinining information I
> > need to turn gimple stmt uids into gimple statements in the same way
> > this is done for call graph edges.  
> > 
> > I can either call a function in ipa-prop.c doing this directly from
> > input_function() in lto-streamer-in.c or add some generic simplisitc
> > infrastructure like what is in the patch below.  I simply added a
> > linked list of hooks that I envision will consist of static
> > structures, one per running IPA pass that needs this.
> > 
> > Alternatively, running fixup_call_stmt_edges() after IPA decisions are
> > made (and inlining decisions in particular).  So far I assumed it was
> > called before in non-wpa mode on purpose.
> > 
> > The patch is untested.  What do you think about this approach?
> 
> Shouldn't this maybe be a IPA pass lto hook instead?
> 

I don't really care.  On one hand, if more IPA-passes need this (or
other fixups which could be bundled together into a big one) it would
certainly make sense.  On the other hand, I have written the first and
for the forseeable future the only user yesterday and even that one
will probably go away in 4.6 because (AFAIK) Honza plans to turn the
param call notes into special cgraph edges (with an unknown callee)
connected to the cgraph node directly.  That is a good idea as it will
enable us to put IPA information on it (jump functions etc) in the
usual way.

But I did not have the guts to make this change in stage 3 and
streaming the notes so far seems easy so I proposed this meanwhile.

Neverhteless, the bottom line is that I can turn this into an IPA-pass
standard hook if a maintainer decides that is a way to go.

Thanks,

Martin


> Richard.
> 
> > Thanks,
> > 
> > Martin
> > 
> > 2009-11-03  Martin Jambor  <mjambor@suse.cz>
> > 
> > 	* lto-streamer.h (struct lto_stmt_fixup_hook_list_element): New type.
> > 	(lto_stmt_fixup_hook_list) Declare.
> > 
> > 	* lto-streamer-in.c (input_function): Call all stmt fixup hooks in
> > 	lto_stmt_fixup_hook_list.
> > 	(lto_stmt_fixup_hook_list) New variable.
> > 
> > Index: icln/gcc/lto-streamer-in.c
> > ===================================================================
> > --- icln.orig/gcc/lto-streamer-in.c
> > +++ icln/gcc/lto-streamer-in.c
> > @@ -59,6 +59,9 @@ struct string_slot
> >  /* The table to hold the file names.  */
> >  static htab_t file_name_hash_table;
> >  
> > +/* Linked list of pointers to stmt uids -> stmts fixup functions.  */
> > +struct lto_stmt_fixup_hook_list_element *lto_stmt_fixup_hook_list;
> > +
> >  
> >  /* Check that tag ACTUAL has one of the given values.  NUM_TAGS is the
> >     number of valid tag values to check.  */
> > @@ -1261,6 +1264,9 @@ input_function (tree fn_decl, struct dat
> >    gimple *stmts;
> >    basic_block bb;
> >    struct bitpack_d *bp;
> > +  struct cgraph_node *node;
> > +  struct lto_stmt_fixup_hook_list_element *fixup_hook;
> > +
> >  
> >    fn = DECL_STRUCT_FUNCTION (fn_decl);
> >    tag = input_record_start (ib);
> > @@ -1340,7 +1346,12 @@ input_function (tree fn_decl, struct dat
> >      gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest));
> >    }
> >  
> > -  fixup_call_stmt_edges (cgraph_node (fn_decl), stmts);
> > +  node = cgraph_node (fn_decl);
> > +  fixup_call_stmt_edges (node, stmts);
> > +  for (fixup_hook = lto_stmt_fixup_hook_list;
> > +       fixup_hook;
> > +       fixup_hook = fixup_hook->next)
> > +    fixup_hook->hook (node, stmts);
> >  
> >    update_ssa (TODO_update_ssa_only_virtuals); 
> >    free_dominance_info (CDI_DOMINATORS);
> > Index: icln/gcc/lto-streamer.h
> > ===================================================================
> > --- icln.orig/gcc/lto-streamer.h
> > +++ icln/gcc/lto-streamer.h
> > @@ -689,6 +689,13 @@ struct data_in
> >    struct lto_streamer_cache_d *reader_cache;
> >  };
> >  
> > +/* Add-only linked list of functions that turn gimple statement uids into
> > +   gimple statements in IPA-pass info.  */
> > +struct lto_stmt_fixup_hook_list_element
> > +{
> > +  void (*hook)(struct cgraph_node *, gimple *);
> > +  struct lto_stmt_fixup_hook_list_element *next;
> > +};
> >  
> >  /* In lto-section-in.c  */
> >  extern struct lto_input_block * lto_create_simple_input_block (
> > @@ -803,6 +810,8 @@ extern void lto_check_version (int, int)
> >  
> >  
> >  /* In lto-streamer-in.c */
> > +extern struct lto_stmt_fixup_hook_list_element *lto_stmt_fixup_hook_list;
> > +
> >  extern void lto_input_cgraph (struct lto_file_decl_data *, const char *);
> >  extern void lto_init_reader (void);
> >  extern tree lto_input_tree (struct lto_input_block *, struct data_in *);
> > 
> > 
> 
> -- 
> 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]