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