GCC Middle and Back End API Reference
cgraph.c File Reference

Data Structures

struct  cgraph_edge_hook_list
struct  cgraph_node_hook_list
struct  cgraph_2edge_hook_list
struct  cgraph_2node_hook_list
struct  cgraph_propagate_frequency_data

Functions

static void cgraph_node_remove_callers (struct cgraph_node *node)
static void cgraph_edge_remove_caller (struct cgraph_edge *e)
static void cgraph_edge_remove_callee (struct cgraph_edge *e)
static hashval_t cgraph_fnver_htab_hash ()
static int cgraph_fnver_htab_eq ()
struct
cgraph_function_version_info
get_cgraph_node_version ()
struct
cgraph_function_version_info
insert_new_cgraph_node_version ()
void delete_function_version ()
void record_function_versions ()
struct cgraph_edge_hook_listcgraph_add_edge_removal_hook ()
void cgraph_remove_edge_removal_hook ()
static void cgraph_call_edge_removal_hooks ()
struct cgraph_node_hook_listcgraph_add_node_removal_hook ()
void cgraph_remove_node_removal_hook ()
static void cgraph_call_node_removal_hooks ()
struct cgraph_node_hook_listcgraph_add_function_insertion_hook ()
void cgraph_remove_function_insertion_hook ()
void cgraph_call_function_insertion_hooks ()
struct cgraph_2edge_hook_listcgraph_add_edge_duplication_hook ()
void cgraph_remove_edge_duplication_hook ()
void cgraph_call_edge_duplication_hooks (struct cgraph_edge *cs1, struct cgraph_edge *cs2)
struct cgraph_2node_hook_listcgraph_add_node_duplication_hook ()
void cgraph_remove_node_duplication_hook ()
void cgraph_call_node_duplication_hooks (struct cgraph_node *node1, struct cgraph_node *node2)
static struct cgraph_nodecgraph_allocate_node ()
struct cgraph_nodecgraph_create_empty_node ()
struct cgraph_nodecgraph_create_node ()
struct cgraph_nodecgraph_get_create_node ()
struct cgraph_nodecgraph_create_function_alias ()
struct cgraph_nodecgraph_same_body_alias ()
struct cgraph_nodecgraph_add_thunk (struct cgraph_node *decl_node, tree alias, tree decl, bool this_adjusting, HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, tree virtual_offset, tree real_alias)
struct cgraph_nodecgraph_node_for_asm ()
static hashval_t edge_hash ()
static int edge_eq ()
static void cgraph_update_edge_in_call_site_hash ()
static void cgraph_add_edge_to_call_site_hash ()
struct cgraph_edgecgraph_edge ()
void cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt, bool update_speculative)
static struct cgraph_edgecgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)
struct cgraph_edgecgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, gimple call_stmt, gcov_type count, int freq)
struct cgraph_indirect_call_infocgraph_allocate_init_indirect_info ()
struct cgraph_edgecgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt, int ecf_flags, gcov_type count, int freq)
static void cgraph_edge_remove_callee ()
static void cgraph_edge_remove_caller ()
static void cgraph_free_edge ()
void cgraph_remove_edge ()
static void cgraph_set_edge_callee ()
struct cgraph_edgecgraph_turn_edge_to_speculative (struct cgraph_edge *e, struct cgraph_node *n2, gcov_type direct_count, int direct_frequency)
void cgraph_speculative_call_info (struct cgraph_edge *e, struct cgraph_edge *&direct, struct cgraph_edge *&indirect, struct ipa_ref *&reference)
void cgraph_redirect_edge_callee ()
struct cgraph_edgecgraph_resolve_speculation ()
struct cgraph_edgecgraph_make_edge_direct ()
gimple cgraph_redirect_edge_call_stmt_to_callee ()
static void cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node, gimple old_stmt, tree old_call, gimple new_stmt)
void cgraph_update_edges_for_call_stmt ()
void cgraph_node_remove_callees ()
static void cgraph_node_remove_callers ()
void release_function_body ()
void cgraph_release_function_body ()
void cgraph_remove_node ()
void cgraph_mark_address_taken_node ()
struct cgraph_local_infocgraph_local_info ()
struct cgraph_global_infocgraph_global_info ()
struct cgraph_rtl_infocgraph_rtl_info ()
const char * cgraph_inline_failed_string ()
void dump_cgraph_node ()
DEBUG_FUNCTION void debug_cgraph_node ()
void dump_cgraph ()
DEBUG_FUNCTION void debug_cgraph ()
bool cgraph_function_possibly_inlined_p ()
void cgraph_unnest_node ()
enum availability cgraph_function_body_availability ()
static bool cgraph_node_cannot_be_local_p_1 (struct cgraph_node *node, void *data)
bool cgraph_node_can_be_local_p ()
bool cgraph_for_node_thunks_and_aliases (struct cgraph_node *node, bool(*callback)(struct cgraph_node *, void *), void *data, bool include_overwritable)
bool cgraph_for_node_and_aliases (struct cgraph_node *node, bool(*callback)(struct cgraph_node *, void *), void *data, bool include_overwritable)
static bool cgraph_make_node_local_1 ()
void cgraph_make_node_local ()
static bool cgraph_set_nothrow_flag_1 ()
void cgraph_set_nothrow_flag ()
static bool cgraph_set_const_flag_1 ()
void cgraph_set_const_flag ()
static bool cgraph_set_pure_flag_1 ()
void cgraph_set_pure_flag ()
static bool cgraph_propagate_frequency_1 ()
bool cgraph_propagate_frequency ()
bool cgraph_node_cannot_return ()
bool cgraph_edge_cannot_lead_to_return ()
bool cgraph_can_remove_if_no_direct_calls_and_refs_p ()
static bool nonremovable_p ()
bool cgraph_can_remove_if_no_direct_calls_p ()
static bool used_from_object_file_p ()
bool cgraph_will_be_removed_from_program_if_no_direct_calls ()
static bool cgraph_not_only_called_directly_p_1 ()
bool cgraph_only_called_directly_p ()
static bool collect_callers_of_node_1 ()
vec< cgraph_edge_pcollect_callers_of_node ()
static bool clone_of_p ()
static bool verify_edge_count_and_frequency ()
static void cgraph_debug_gimple_stmt ()
static bool verify_edge_corresponds_to_fndecl ()
DEBUG_FUNCTION void verify_cgraph_node ()
DEBUG_FUNCTION void verify_cgraph ()
struct cgraph_nodecgraph_get_create_real_symbol_node ()
struct cgraph_nodecgraph_function_node ()
bool cgraph_get_body ()

Variables

symtab_node x_cgraph_nodes_queue
int cgraph_n_nodes
int cgraph_max_uid
int cgraph_edge_max_uid
bool cgraph_global_info_ready = false
enum cgraph_state cgraph_state = CGRAPH_STATE_PARSING
bool cgraph_function_flags_ready = false
struct cgraph_edge_hook_listfirst_cgraph_edge_removal_hook
struct cgraph_node_hook_listfirst_cgraph_node_removal_hook
struct cgraph_2edge_hook_listfirst_cgraph_edge_duplicated_hook
struct cgraph_2node_hook_listfirst_cgraph_node_duplicated_hook
struct cgraph_node_hook_listfirst_cgraph_function_insertion_hook
static struct cgraph_nodefree_nodes
static struct cgraph_edgefree_edges
bool cpp_implicit_aliases_done
static htab_t cgraph_fnver_htab = NULL
static struct
cgraph_function_version_info
version_info_node = NULL
const char *const cgraph_availability_names []

Function Documentation

struct cgraph_2edge_hook_list* cgraph_add_edge_duplication_hook ( )
read
struct cgraph_edge_hook_list* cgraph_add_edge_removal_hook ( )
read
static void cgraph_add_edge_to_call_site_hash ( )
inlinestatic
struct cgraph_node_hook_list* cgraph_add_function_insertion_hook ( )
read
struct cgraph_node* cgraph_add_thunk ( struct cgraph_node decl_node,
tree  alias,
tree  decl,
bool  this_adjusting,
HOST_WIDE_INT  fixed_offset,
HOST_WIDE_INT  virtual_value,
tree  virtual_offset,
tree  real_alias 
)
read
struct cgraph_indirect_call_info* cgraph_allocate_init_indirect_info ( void  )
read
Allocate cgraph_indirect_call_info and set its fields to default values.  

References cgraph_indirect_call_info::param_index.

Referenced by cgraph_create_indirect_edge().

static struct cgraph_node* cgraph_allocate_node ( )
staticread
Allocate new callgraph node.   

References cgraph_max_uid, free_nodes, and cgraph_node::uid.

Referenced by cgraph_create_empty_node().

void cgraph_call_edge_duplication_hooks ( struct cgraph_edge cs1,
struct cgraph_edge cs2 
)
static void cgraph_call_edge_removal_hooks ( )
static
void cgraph_call_node_duplication_hooks ( struct cgraph_node node1,
struct cgraph_node node2 
)
static void cgraph_call_node_removal_hooks ( )
static
bool cgraph_can_remove_if_no_direct_calls_and_refs_p ( )
bool cgraph_can_remove_if_no_direct_calls_p ( )
struct cgraph_node* cgraph_create_empty_node ( void  )
read
Allocate new callgraph node and insert it into basic data structures.   

References cgraph_allocate_node(), cgraph_n_nodes, cgraph_node::count_materialization_scale, NODE_FREQUENCY_NORMAL, cgraph_node::symbol, and SYMTAB_FUNCTION.

Referenced by cgraph_clone_node(), cgraph_create_node(), and input_node().

struct cgraph_node* cgraph_create_function_alias ( )
read
Mark ALIAS as an alias to DECL.  DECL_NODE is cgraph node representing
   the function body is associated with (not necessarily cgraph_node (DECL).   

References symtab_node_base::alias, symtab_node_base::alias_target, cgraph_get_create_node(), symtab_node_base::definition, lookup_attribute(), cgraph_node::symbol, and symtab_node_base::weakref.

Referenced by cgraph_same_body_alias(), handle_alias_pairs(), and symtab_nonoverwritable_alias().

static void cgraph_debug_gimple_stmt ( )
static
Switch to THIS_CFUN if needed and print STMT to stderr.   

References cfun, current_function_decl, debug_gimple_stmt(), and set_cfun().

Referenced by verify_cgraph_node().

bool cgraph_edge_cannot_lead_to_return ( )
Return true when call of E can not lead to return from caller
   and thus it is safe to ignore its side effects for IPA analysis
   when computing side effects of the caller.
   FIXME: We could actually mark all edges that have no reaching
   patch to EXIT_BLOCK_PTR or throw to get better results.   

References cgraph_edge::callee, cgraph_edge::caller, cgraph_node_cannot_return(), cgraph_indirect_call_info::ecf_flags, cgraph_edge::indirect_info, and cgraph_edge::indirect_unknown_callee.

Referenced by get_read_write_all_from_node(), propagate_bits(), and propagate_pure_const().

static void cgraph_edge_remove_callee ( struct cgraph_edge e)
inlinestatic
static void cgraph_edge_remove_callee ( )
inlinestatic
Remove the edge E from the list of the callers of the callee.   

References cgraph_edge::callee, cgraph_node::callers, cgraph_edge::indirect_unknown_callee, cgraph_edge::next_caller, and cgraph_edge::prev_caller.

static void cgraph_edge_remove_caller ( struct cgraph_edge e)
inlinestatic
static void cgraph_edge_remove_caller ( )
inlinestatic
static int cgraph_fnver_htab_eq ( )
static
eq function for cgraph_fnver_htab.   

References cgraph_function_version_info::this_node, and cgraph_node::uid.

Referenced by insert_new_cgraph_node_version().

static hashval_t cgraph_fnver_htab_hash ( )
static
Hash function for cgraph_fnver_htab.   

Referenced by insert_new_cgraph_node_version().

bool cgraph_for_node_thunks_and_aliases ( struct cgraph_node node,
bool(*)(struct cgraph_node *, void *)  callback,
void *  data,
bool  include_overwritable 
)
static void cgraph_free_edge ( )
static
bool cgraph_function_possibly_inlined_p ( )
Return true when the DECL can possibly be inlined.   

References cgraph_global_info_ready.

Referenced by gen_decl_die(), gen_subprogram_die(), and gimple_expand_cfg().

struct cgraph_node* cgraph_get_create_real_symbol_node ( )
read
Create external decl node for DECL.
   The difference i nbetween cgraph_get_create_node and
   cgraph_get_create_real_symbol_node is that cgraph_get_create_node
   may return inline clone, while cgraph_get_create_real_symbol_node
   will create a new node in this case.
   FIXME: This function should be removed once clones are put out of decl
   hash.   

References cgraph_create_node(), cgraph_get_node(), cgraph_node_name(), cgraph_node::clone_of, cgraph_node::clones, dump_file, cgraph_node::global, cgraph_global_info::inlined_to, symtab_node_base::order, cgraph_node::symbol, symtab_insert_node_to_hashtable(), and symtab_prevail_in_asm_name_hash().

Referenced by build_cgraph_edges(), canonicalize_constructor_val(), ipa_make_edge_direct_to_target(), mark_address(), mark_load(), record_eh_tables(), record_reference(), and symtab_remove_unreachable_nodes().

Return local info for the compiled function.   

References cgraph_get_node(), cgraph_global_info_ready, and cgraph_node::global.

const char* cgraph_inline_failed_string ( )
Return a string describing the failure REASON.   

References CIF_N_REASONS.

Referenced by dump_inline_edge_summary(), expand_call_inline(), and report_inline_failed_reason().

Return local info for the compiled function.   

References cgraph_get_node(), and cgraph_node::local.

Referenced by setup_incoming_promotions().

void cgraph_make_node_local ( )
Bring NODE local.   

References cgraph_for_node_thunks_and_aliases(), and cgraph_make_node_local_1().

Referenced by modify_function().

bool cgraph_node_can_be_local_p ( )
Return true if NODE can be made local for API change.
   Extern inline functions and C++ COMDAT functions can be made local
   at the expense of possible code size growth if function is used in multiple
   compilation units.   

References symtab_node_base::address_taken, cgraph_for_node_and_aliases(), cgraph_node_cannot_be_local_p_1(), and cgraph_node::symbol.

Referenced by cgraph_make_node_local_1(), and ipa_sra_preliminary_function_checks().

static bool cgraph_node_cannot_be_local_p_1 ( struct cgraph_node node,
void *  data 
)
static
bool cgraph_node_cannot_return ( )
Return true when NODE can not return or throw and thus
   it is safe to ignore its side effects for IPA analysis.   

References symtab_node_base::decl, flags_from_decl_or_type(), and cgraph_node::symbol.

Referenced by analyze_function(), cgraph_edge_cannot_lead_to_return(), ipa_ref_cannot_lead_to_return(), propagate(), and read_write_all_from_decl().

struct cgraph_node* cgraph_node_for_asm ( )
read
Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME.
   Return NULL if there's no such node.   

References dyn_cast(), cgraph_node::global, cgraph_global_info::inlined_to, and symtab_node_for_asm().

static void cgraph_node_remove_callers ( struct cgraph_node node)
static
@verbatim Callgraph handling code.

Copyright (C) 2003-2013 Free Software Foundation, Inc. Contributed by Jan Hubicka

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

This file contains basic routines manipulating call graph

    The call-graph is a data structure designed for intra-procedural optimization.
    It represents a multi-graph where nodes are functions and edges are call sites.  
FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this.   

Referenced by cgraph_remove_node().

static void cgraph_node_remove_callers ( )
static
static bool cgraph_not_only_called_directly_p_1 ( )
static
Worker for cgraph_only_called_directly_p.   

References cgraph_only_called_directly_or_aliased_p().

Referenced by cgraph_only_called_directly_p().

bool cgraph_only_called_directly_p ( )
Return true when function NODE and all its aliases are only called
   directly.
   i.e. it is not externally visible, address was not taken and
   it is not used in any other non-standard way.   

References cgraph_for_node_and_aliases(), cgraph_function_or_thunk_node(), and cgraph_not_only_called_directly_p_1().

Referenced by cgraph_will_be_removed_from_program_if_no_direct_calls(), gimple_gen_ic_func_profiler(), init_node_map(), and ipa_reverse_postorder().

void cgraph_release_function_body ( )
Release memory used to represent body of function NODE.
   Use this only for functions that are released before being translated to
   target code (i.e. RTL).  Functions that are compiled to RTL and beyond
   are free'd in final.c via free_after_compilation().   

References CGRAPH_STATE_PARSING, symtab_node_base::decl, cgraph_node::ipa_transforms_to_apply, release_function_body(), cgraph_node::symbol, and cgraph_node::used_as_abstract_origin.

Referenced by cgraph_materialize_clone(), cgraph_remove_node(), expand_function(), free_lang_data_in_decl(), lto_cgraph_replace_node(), and symtab_remove_unreachable_nodes().

void cgraph_remove_edge_duplication_hook ( )
Remove ENTRY from the list of hooks called on duplicating edges.   

References first_cgraph_edge_duplicated_hook, free(), and cgraph_2edge_hook_list::next.

Referenced by inline_free_summary(), ipa_unregister_cgraph_hooks(), and ipcp_driver().

void cgraph_remove_edge_removal_hook ( )
Remove ENTRY from the list of hooks called on removing edges.   

References first_cgraph_edge_removal_hook, free(), and cgraph_edge_hook_list::next.

Referenced by inline_free_summary(), inline_small_functions(), and ipa_unregister_cgraph_hooks().

void cgraph_remove_function_insertion_hook ( )
Remove ENTRY from the list of hooks called on inserted nodes.   

References first_cgraph_function_insertion_hook, free(), and cgraph_node_hook_list::next.

Referenced by inline_free_summary(), ipa_unregister_cgraph_hooks(), and propagate().

void cgraph_remove_node_duplication_hook ( )
Remove ENTRY from the list of hooks called on duplicating nodes.   

References first_cgraph_node_duplicated_hook, free(), and cgraph_2node_hook_list::next.

Referenced by inline_free_summary(), ipa_unregister_cgraph_hooks(), and propagate().

void cgraph_remove_node_removal_hook ( )
Remove ENTRY from the list of hooks called on removing nodes.   

References first_cgraph_node_removal_hook, free(), and cgraph_node_hook_list::next.

Referenced by inline_free_summary(), ipa_unregister_cgraph_hooks(), and propagate().

struct cgraph_rtl_info* cgraph_rtl_info ( )
read
Return local info for the compiled function.   

References cgraph_get_node(), current_function_decl, symtab_node_base::decl, cgraph_node::rtl, and cgraph_node::symbol.

Referenced by expand_call(), and rest_of_clean_state().

struct cgraph_node* cgraph_same_body_alias ( )
read
Attempt to mark ALIAS as an alias to DECL.  Return alias node if successful
   and NULL otherwise.
   Same body aliases are output whenever the body of DECL is output,
   and cgraph_get_node (ALIAS) transparently returns cgraph_get_node (DECL).   

References cgraph_create_function_alias(), cgraph_get_node(), cgraph_global_info_ready, symtab_node_base::cpp_implicit_alias, cpp_implicit_aliases_done, cgraph_node::symbol, and symtab_resolve_alias().

Referenced by ipa_tm_create_version_alias().

void cgraph_set_const_flag ( )
Set TREE_READONLY on NODE's decl and on aliases of NODE
   if any to READONLY.   

References cgraph_for_node_thunks_and_aliases(), and cgraph_set_const_flag_1().

Referenced by local_pure_const(), propagate_pure_const(), and tree_profiling().

static bool cgraph_set_const_flag_1 ( )
static
Worker to set const flag.   

References symtab_node_base::decl, and cgraph_node::symbol.

Referenced by cgraph_set_const_flag().

static void cgraph_set_edge_callee ( )
static
Set callee of call graph edge E and add it to the corresponding set of
   callers.  

References cgraph_edge::callee, cgraph_node::callers, cgraph_edge::next_caller, and cgraph_edge::prev_caller.

Referenced by cgraph_make_edge_direct(), and cgraph_redirect_edge_callee().

void cgraph_set_nothrow_flag ( )
Set TREE_NOTHROW on NODE's decl and on aliases of NODE
   if any to NOTHROW.   

References cgraph_for_node_thunks_and_aliases(), and cgraph_set_nothrow_flag_1().

Referenced by local_pure_const(), propagate_nothrow(), and set_nothrow_function_flags().

static bool cgraph_set_nothrow_flag_1 ( )
static
void cgraph_set_pure_flag ( )
Set DECL_PURE_P on NODE's decl and on aliases of NODE
   if any to PURE.   

References cgraph_for_node_thunks_and_aliases(), and cgraph_set_pure_flag_1().

Referenced by local_pure_const(), propagate_pure_const(), and tree_profiling().

static bool cgraph_set_pure_flag_1 ( )
static
Worker to set pure flag.   

References symtab_node_base::decl, and cgraph_node::symbol.

Referenced by cgraph_set_pure_flag().

void cgraph_speculative_call_info ( struct cgraph_edge e,
struct cgraph_edge *&  direct,
struct cgraph_edge *&  indirect,
struct ipa_ref *&  reference 
)
Speculative call consist of three components:
   1) an indirect edge representing the original call
   2) an direct edge representing the new call
   3) ADDR_EXPR reference representing the speculative check.
   All three components are attached to single statement (the indirect
   call) and if one of them exists, all of them must exist.

   Given speculative call edge E, return all three components. 

References cgraph_edge::call_stmt, cgraph_node::callees, cgraph_edge::caller, cgraph_edge(), cgraph_node::indirect_calls, cgraph_edge::indirect_unknown_callee, ipa_ref::lto_stmt_uid, cgraph_edge::lto_stmt_uid, cgraph_edge::next_callee, symtab_node_base::ref_list, ipa_ref::speculative, cgraph_edge::speculative, ipa_ref::stmt, and cgraph_node::symbol.

Referenced by cgraph_redirect_edge_call_stmt_to_callee(), cgraph_resolve_speculation(), cgraph_set_call_stmt(), cgraph_set_call_stmt_including_clones(), copy_bb(), and speculation_useful_p().

struct cgraph_edge* cgraph_turn_edge_to_speculative ( struct cgraph_edge e,
struct cgraph_node n2,
gcov_type  direct_count,
int  direct_frequency 
)
read
Turn edge E into speculative call calling N2. Update
   the profile so the direct call is taken COUNT times
   with FREQUENCY.  

   At clone materialization time, the indirect call E will
   be expanded as:

   if (call_dest == N2)
     n2 ();
   else
     call call_dest

   At this time the function just creates the direct call,
   the referencd representing the if conditional and attaches
   them all to the orginal indirect call statement.  

   Return direct edge created.   

References cgraph_edge::call_stmt, cgraph_edge::caller, cgraph_edge::can_throw_external, cgraph_call_edge_duplication_hooks(), cgraph_create_edge(), cgraph_mark_address_taken_node(), cgraph_node_name(), cgraph_edge::count, symtab_node_base::decl, dump_file, cgraph_edge::frequency, initialize_inline_failed(), ipa_record_reference(), IPA_REF_ADDR, ipa_ref::lto_stmt_uid, cgraph_edge::lto_stmt_uid, symtab_node_base::order, ipa_ref::speculative, cgraph_edge::speculative, and cgraph_node::symbol.

Referenced by ipa_profile().

void cgraph_unnest_node ( )
NODE is no longer nested function; update cgraph accordingly.   

References cgraph_node::nested, cgraph_node::next_nested, and cgraph_node::origin.

Referenced by unnest_nesting_tree_1().

static void cgraph_update_edge_in_call_site_hash ( )
inlinestatic
Add call graph edge E to call site hash of its caller.   

References cgraph_node::call_site_hash, cgraph_edge::call_stmt, and cgraph_edge::caller.

Referenced by cgraph_redirect_edge_call_stmt_to_callee(), and cgraph_resolve_speculation().

void cgraph_update_edges_for_call_stmt ( )
Update or remove the corresponding cgraph edge if a GIMPLE_CALL
   OLD_STMT changed into NEW_STMT.  OLD_DECL is gimple_call_fndecl
   of OLD_STMT before it was updated (updating can happen inplace).   

References cfun, cgraph_get_node(), cgraph_update_edges_for_call_stmt_node(), cgraph_node::clone_of, cgraph_node::clones, function::decl, and cgraph_node::next_sibling_clone.

Referenced by fold_marked_statements().

static void cgraph_update_edges_for_call_stmt_node ( struct cgraph_node node,
gimple  old_stmt,
tree  old_call,
gimple  new_stmt 
)
static
Update or remove the corresponding cgraph edge if a GIMPLE_CALL
   OLD_STMT changed into NEW_STMT.  OLD_CALL is gimple_call_fndecl
   of OLD_STMT if it was previously call statement.
   If NEW_STMT is NULL, the call has been dropped without any
   replacement.   

References cgraph_edge::callee, cgraph_create_edge(), cgraph_edge(), cgraph_get_create_node(), cgraph_remove_edge(), cgraph_set_call_stmt(), cgraph_node::clone_of, compute_call_stmt_bb_frequency(), count, basic_block_def::count, cgraph_edge::count, current_function_decl, symtab_node_base::decl, cgraph_node::former_clone_of, frequency, cgraph_edge::frequency, gimple_bb(), gimple_call_fndecl(), cgraph_edge::inline_failed, is_gimple_call(), and cgraph_node::symbol.

Referenced by cgraph_update_edges_for_call_stmt().

bool cgraph_will_be_removed_from_program_if_no_direct_calls ( )
Return true when function NODE can be expected to be removed
   from program when direct calls in this compilation unit are removed.

   As a special case COMDAT functions are
   cgraph_can_remove_if_no_direct_calls_p while the are not
   cgraph_only_called_directly_p (it is possible they are called from other
   unit)

   This function behaves as cgraph_only_called_directly_p because eliminating
   all uses of COMDAT function does not make it necessarily disappear from
   the program unless we are compiling whole program or we do LTO.  In this
   case we know we win since dynamic linking will not really discard the
   linkonce section.   

References cgraph_can_remove_if_no_direct_calls_p(), cgraph_for_node_and_aliases(), cgraph_only_called_directly_p(), symtab_node_base::decl, cgraph_node::global, cgraph_global_info::inlined_to, cgraph_node::symbol, and used_from_object_file_p().

Referenced by do_estimate_growth(), estimate_local_effects(), and identify_dead_nodes().

static bool clone_of_p ( )
static
Return TRUE if NODE2 is equivalent to NODE or its clone.   

References cgraph_function_or_thunk_node(), and cgraph_node::clone_of.

Referenced by verify_edge_corresponds_to_fndecl().

vec<cgraph_edge_p> collect_callers_of_node ( )
Collect all callers of NODE and its aliases that are known to lead to NODE
   (i.e. are not overwritable).   

References cgraph_for_node_and_aliases(), collect_callers_of_node_1(), and vNULL.

Referenced by decide_whether_version_node(), and modify_function().

static bool collect_callers_of_node_1 ( )
static
Collect all callers of NODE.  Worker for collect_callers_of_node.   

References AVAIL_OVERWRITABLE, cgraph_node::callers, cgraph_function_or_thunk_node(), cgraph_edge::indirect_inlining_edge, and cgraph_edge::next_caller.

Referenced by collect_callers_of_node().

DEBUG_FUNCTION void debug_cgraph ( void  )
Dump the call graph to stderr.   

References dump_cgraph().

DEBUG_FUNCTION void debug_cgraph_node ( )
Dump call graph node NODE to stderr.   

References dump_cgraph_node().

void delete_function_version ( )
Remove the cgraph_function_version_info and cgraph_node for DECL.  This
   DECL is a duplicate declaration.   

References cgraph_fnver_htab, cgraph_get_node(), cgraph_remove_node(), get_cgraph_node_version(), cgraph_function_version_info::next, and cgraph_function_version_info::prev.

void dump_cgraph ( )
Dump the callgraph to file F.   

References dump_cgraph_node().

Referenced by debug_cgraph(), propagate(), propagate_nothrow(), and propagate_pure_const().

static int edge_eq ( )
static
Return nonzero if the call_stmt of of cgraph_edge X is stmt *Y.   

Referenced by cgraph_edge().

static hashval_t edge_hash ( )
static
Returns a hash value for X (which really is a cgraph_edge).   

Referenced by cgraph_edge().

struct cgraph_function_version_info* get_cgraph_node_version ( )
read
Get the cgraph_function_version_info node corresponding to node.   

References cgraph_fnver_htab, and cgraph_function_version_info::this_node.

Referenced by analyze_function(), delete_function_version(), and record_function_versions().

struct cgraph_function_version_info* insert_new_cgraph_node_version ( )
read
Insert a new cgraph_function_version_info node into cgraph_fnver_htab
   corresponding to cgraph_node NODE.   

References cgraph_fnver_htab, cgraph_fnver_htab_eq(), cgraph_fnver_htab_hash(), cgraph_function_version_info::this_node, and version_info_node.

Referenced by record_function_versions().

static bool nonremovable_p ( )
static
Worker for cgraph_can_remove_if_no_direct_calls_p.   

References cgraph_can_remove_if_no_direct_calls_and_refs_p().

Referenced by cgraph_can_remove_if_no_direct_calls_p().

void record_function_versions ( )
Record that DECL1 and DECL2 are semantically identical function
   versions.   

References cgraph_get_create_node(), get_cgraph_node_version(), insert_new_cgraph_node_version(), cgraph_function_version_info::next, and cgraph_function_version_info::prev.

void release_function_body ( )
Helper function for cgraph_release_function_body and free_lang_data.
   It releases body from function DECL without having to inspect its
   possibly non-existent symtab node.   

References function::cfg, cfun, clear_edges(), function::curr_properties, delete_tree_cfg_annotations(), delete_tree_ssa(), DOM_NONE, function::eh, free_histograms(), ggc_free(), function::gimple_df, gimple_set_body(), loop_optimizer_finalize(), pop_cfun(), push_cfun(), and function::value_histograms.

Referenced by cgraph_release_function_body(), and free_lang_data_in_decl().

static bool used_from_object_file_p ( )
static
Worker for cgraph_can_remove_if_no_direct_calls_p.   

References symtab_used_from_object_file_p().

Referenced by cgraph_will_be_removed_from_program_if_no_direct_calls().

DEBUG_FUNCTION void verify_cgraph ( void  )
Verify whole cgraph structure.   

References seen_error(), and verify_cgraph_node().

Referenced by cgraph_materialize_all_clones(), and ipa_tm_execute().

static bool verify_edge_corresponds_to_fndecl ( )
static

Variable Documentation

const char* const cgraph_availability_names[]
Initial value:
{"unset", "not_available", "overwritable", "available", "local"}
Names used to print out the availability enum.   

Referenced by dump_varpool_node().

htab_t cgraph_fnver_htab = NULL
static
Map a cgraph_node to cgraph_function_version_info using this htab.
   The cgraph_function_version_info has a THIS_NODE field that is the
   corresponding cgraph_node..   

Referenced by delete_function_version(), get_cgraph_node_version(), and insert_new_cgraph_node_version().

bool cgraph_function_flags_ready = false
What state callgraph is in right now.   
bool cpp_implicit_aliases_done
struct cgraph_2edge_hook_list* first_cgraph_edge_duplicated_hook
List of hooks triggered when an edge is duplicated.   

Referenced by cgraph_add_edge_duplication_hook(), cgraph_call_edge_duplication_hooks(), and cgraph_remove_edge_duplication_hook().

struct cgraph_edge_hook_list* first_cgraph_edge_removal_hook
List of hooks triggered when an edge is removed.   

Referenced by cgraph_add_edge_removal_hook(), cgraph_call_edge_removal_hooks(), and cgraph_remove_edge_removal_hook().

struct cgraph_node_hook_list* first_cgraph_function_insertion_hook
List of hooks triggered when an function is inserted.   

Referenced by cgraph_add_function_insertion_hook(), cgraph_call_function_insertion_hooks(), and cgraph_remove_function_insertion_hook().

struct cgraph_2node_hook_list* first_cgraph_node_duplicated_hook
List of hooks triggered when a node is duplicated.   

Referenced by cgraph_add_node_duplication_hook(), cgraph_call_node_duplication_hooks(), and cgraph_remove_node_duplication_hook().

struct cgraph_node_hook_list* first_cgraph_node_removal_hook
List of hooks triggered when a node is removed.   

Referenced by cgraph_add_node_removal_hook(), cgraph_call_node_removal_hooks(), and cgraph_remove_node_removal_hook().

struct cgraph_edge* free_edges
static
Head of a linked list of unused (freed) call graph edges.
   Do not  this list so UIDs gets reliably recycled.   

Referenced by cgraph_create_edge_1(), and cgraph_free_edge().

struct cgraph_node* free_nodes
static
Head of a linked list of unused (freed) call graph nodes.
   Do not  this list so UIDs gets reliably recycled.   

Referenced by cgraph_allocate_node(), and cgraph_remove_node().

struct cgraph_function_version_info* version_info_node = NULL
static
Mark as GC root all allocated nodes.   

Referenced by insert_new_cgraph_node_version().

symtab_node x_cgraph_nodes_queue
Queue of cgraph nodes scheduled to be lowered.