Main ipa-ref up to date in materialization and struct reorg

Jan Hubicka hubicka@ucw.cz
Tue May 11 11:10:00 GMT 2010


> > +/* Rebuild cgraph edges for current function node.  This needs to be run after
> > +   passes that don't update the cgraph.  */
> > +
> > +void
> > +cgraph_rebuild_references (void)
> > +{
> > +  basic_block bb;
> > +  struct cgraph_node *node = cgraph_node (current_function_decl);
> 
> A much nicer interface would have been to pass in the cgraph_node
> you want to re-build references for...

Well, the idea was to follow API of the other rebuild functions that are
generally organized as local passes.  I also have plans to clean this all
(especially the cfun/current_function_decl switching)

Honza
> 
> Richard.
> 
> > +  gimple_stmt_iterator gsi;
> > +
> > +  ipa_remove_all_references (&node->ref_list);
> > +
> > +  node->count = ENTRY_BLOCK_PTR->count;
> > +
> > +  FOR_EACH_BB (bb)
> > +    {
> > +      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> > +       {
> > +         gimple stmt = gsi_stmt (gsi);
> > +
> > +         walk_stmt_load_store_addr_ops (stmt, node, mark_load,
> > +                                        mark_store, mark_address);
> > +
> > +       }
> > +      for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))
> > +       walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node,
> > +                                      mark_load, mark_store, mark_address);
> > +    }
> > +  record_eh_tables (node, cfun);
> > +}
> > +
> >  struct gimple_opt_pass pass_rebuild_cgraph_edges =
> >  {
> >  {
> > Index: cgraph.c
> > ===================================================================
> > --- cgraph.c    (revision 159258)
> > +++ cgraph.c    (working copy)
> > @@ -1643,9 +1643,16 @@ cgraph_mark_reachable_node (struct cgrap
> >  {
> >   if (!node->reachable && node->local.finalized)
> >     {
> > -      notice_global_symbol (node->decl);
> > +      if (cgraph_global_info_ready)
> > +        {
> > +         /* Verify that function does not appear to be needed out of blue
> > +            during the optimization process.  This can happen for extern
> > +            inlines when bodies was removed after inlining.  */
> > +         gcc_assert ((node->analyzed || DECL_EXTERNAL (node->decl)));
> > +       }
> > +      else
> > +        notice_global_symbol (node->decl);
> >       node->reachable = 1;
> > -      gcc_assert (!cgraph_global_info_ready);
> >
> >       node->next_needed = cgraph_nodes_queue;
> >       cgraph_nodes_queue = node;
> > Index: cgraph.h
> > ===================================================================
> > --- cgraph.h    (revision 159257)
> > +++ cgraph.h    (working copy)
> > @@ -619,6 +619,7 @@ gimple cgraph_redirect_edge_call_stmt_to
> >  bool cgraph_propagate_frequency (struct cgraph_node *node);
> >  /* In cgraphbuild.c  */
> >  unsigned int rebuild_cgraph_edges (void);
> > +void cgraph_rebuild_references (void);
> >  void reset_inline_failed (struct cgraph_node *);
> >  int compute_call_stmt_bb_frequency (tree, basic_block bb);
> >
> > Index: tree-inline.c
> > ===================================================================
> > --- tree-inline.c       (revision 159257)
> > +++ tree-inline.c       (working copy)
> > @@ -5037,6 +5037,8 @@ tree_function_versioning (tree old_decl,
> >   pointer_set_destroy (id.statements_to_fold);
> >   fold_cond_expr_cond ();
> >   delete_unreachable_blocks_update_callgraph (&id);
> > +  if (id.dst_node->analyzed)
> > +    cgraph_rebuild_references ();
> >   update_ssa (TODO_update_ssa);
> >   free_dominance_info (CDI_DOMINATORS);
> >   free_dominance_info (CDI_POST_DOMINATORS);
> > Index: ipa-struct-reorg.c
> > ===================================================================
> > --- ipa-struct-reorg.c  (revision 159257)
> > +++ ipa-struct-reorg.c  (working copy)
> > @@ -3241,6 +3241,7 @@ do_reorg_for_func (struct cgraph_node *n
> >   create_new_accesses_for_func ();
> >   update_ssa (TODO_update_ssa);
> >   cleanup_tree_cfg ();
> > +  cgraph_rebuild_references ();
> >
> >   /* Free auxiliary data representing local variables.  */
> >   free_new_vars_htab (new_local_vars);
> >



More information about the Gcc-patches mailing list