GCC Middle and Back End API Reference
cgraph.h File Reference
#include "is-a.h"
#include "plugin-api.h"
#include "vec.h"
#include "basic-block.h"
#include "function.h"
#include "ipa-ref.h"
#include "cif-code.def"
#include "ipa-ref-inline.h"
Include dependency graph for cgraph.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  symtab_node_base
struct  cgraph_thunk_info
struct  cgraph_local_info
struct  cgraph_global_info
struct  cgraph_rtl_info
struct  ipa_replace_map
struct  cgraph_clone_info
struct  cgraph_node
struct  cgraph_function_version_info
struct  cgraph_node_set_def
struct  varpool_node_set_def
struct  cgraph_node_set_iterator
struct  varpool_node_set_iterator
struct  cgraph_indirect_call_info
struct  cgraph_edge
class  varpool_node
struct  asm_node
struct  constant_descriptor_tree

Macros

#define DEFCIFCODE(code, string)   CIF_ ## code,
#define CGRAPH_FREQ_BASE   1000
#define CGRAPH_FREQ_MAX   100000
#define FOR_EACH_SYMBOL(node)   for ((node) = symtab_nodes; (node); (node) = (node)->next)
#define FOR_EACH_VARIABLE(node)
#define FOR_EACH_STATIC_INITIALIZER(node)
#define FOR_EACH_DEFINED_VARIABLE(node)
#define FOR_EACH_DEFINED_FUNCTION(node)
#define FOR_EACH_FUNCTION(node)
#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node)

Typedefs

typedef struct ipa_replace_mapipa_replace_map_p
typedef struct cgraph_nodecgraph_node_ptr
typedef struct varpool_nodevarpool_node_ptr
typedef struct
cgraph_node_set_def
cgraph_node_set
typedef struct
varpool_node_set_def
varpool_node_set
typedef enum
cgraph_inline_failed_enum 
cgraph_inline_failed_t
typedef struct cgraph_edgecgraph_edge_p
typedef void(* cgraph_edge_hook )(struct cgraph_edge *, void *)
typedef void(* cgraph_node_hook )(struct cgraph_node *, void *)
typedef void(* varpool_node_hook )(struct varpool_node *, void *)
typedef void(* cgraph_2edge_hook )(struct cgraph_edge *, struct cgraph_edge *, void *)
typedef void(* cgraph_2node_hook )(struct cgraph_node *, struct cgraph_node *, void *)

Enumerations

enum  symtab_type { SYMTAB_SYMBOL, SYMTAB_FUNCTION, SYMTAB_VARIABLE }
enum  availability {
  AVAIL_UNSET, AVAIL_NOT_AVAILABLE, AVAIL_OVERWRITABLE, AVAIL_AVAILABLE,
  AVAIL_LOCAL
}
enum  cgraph_inline_failed_enum { DEFCIFCODE }
enum  cgraph_state {
  CGRAPH_STATE_PARSING, CGRAPH_STATE_CONSTRUCTION, CGRAPH_LTO_STREAMING, CGRAPH_STATE_IPA,
  CGRAPH_STATE_IPA_SSA, CGRAPH_STATE_EXPANSION, CGRAPH_STATE_FINISHED
}

Functions

struct
cgraph_function_version_info
get_cgraph_node_version (struct cgraph_node *node)
struct
cgraph_function_version_info
insert_new_cgraph_node_version (struct cgraph_node *node)
void record_function_versions (tree decl1, tree decl2)
void delete_function_version (tree decl)
void symtab_register_node (symtab_node)
void symtab_unregister_node (symtab_node)
void symtab_remove_node (symtab_node)
symtab_node symtab_get_node (const_tree)
symtab_node symtab_node_for_asm (const_tree asmname)
const char * symtab_node_asm_name (symtab_node)
const char * symtab_node_name (symtab_node)
void symtab_insert_node_to_hashtable (symtab_node)
void symtab_add_to_same_comdat_group (symtab_node, symtab_node)
void symtab_dissolve_same_comdat_group_list (symtab_node node)
void dump_symtab (FILE *)
void debug_symtab (void)
void dump_symtab_node (FILE *, symtab_node)
void debug_symtab_node (symtab_node)
void dump_symtab_base (FILE *, symtab_node)
void verify_symtab (void)
void verify_symtab_node (symtab_node)
bool verify_symtab_base (symtab_node)
bool symtab_used_from_object_file_p (symtab_node)
void symtab_make_decl_local (tree)
symtab_node symtab_alias_ultimate_target (symtab_node, enum availability *avail=NULL)
bool symtab_resolve_alias (symtab_node node, symtab_node target)
void fixup_same_cpp_alias_visibility (symtab_node node, symtab_node target)
bool symtab_for_node_and_aliases (symtab_node, bool(*)(symtab_node, void *), void *, bool)
symtab_node symtab_nonoverwritable_alias (symtab_node)
enum availability symtab_node_availability (symtab_node)
bool symtab_semantically_equivalent_p (symtab_node, symtab_node)
void dump_cgraph (FILE *)
void debug_cgraph (void)
void dump_cgraph_node (FILE *, struct cgraph_node *)
void debug_cgraph_node (struct cgraph_node *)
void cgraph_remove_edge (struct cgraph_edge *)
void cgraph_remove_node (struct cgraph_node *)
void cgraph_release_function_body (struct cgraph_node *)
void release_function_body (tree)
void cgraph_node_remove_callees (struct cgraph_node *node)
struct cgraph_edgecgraph_create_edge (struct cgraph_node *, struct cgraph_node *, gimple, gcov_type, int)
struct cgraph_edgecgraph_create_indirect_edge (struct cgraph_node *, gimple, int, gcov_type, int)
struct cgraph_indirect_call_infocgraph_allocate_init_indirect_info (void)
struct cgraph_nodecgraph_create_node (tree)
struct cgraph_nodecgraph_create_empty_node (void)
struct cgraph_nodecgraph_get_create_node (tree)
struct cgraph_nodecgraph_get_create_real_symbol_node (tree)
struct cgraph_nodecgraph_same_body_alias (struct cgraph_node *, tree, tree)
struct cgraph_nodecgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT, HOST_WIDE_INT, tree, tree)
struct cgraph_nodecgraph_node_for_asm (tree)
struct cgraph_edgecgraph_edge (struct cgraph_node *, gimple)
void cgraph_set_call_stmt (struct cgraph_edge *, gimple, bool update_speculative=true)
void cgraph_update_edges_for_call_stmt (gimple, tree, gimple)
struct cgraph_local_infocgraph_local_info (tree)
struct cgraph_global_infocgraph_global_info (tree)
struct cgraph_rtl_infocgraph_rtl_info (tree)
struct cgraph_nodecgraph_create_function_alias (tree, tree)
void cgraph_call_node_duplication_hooks (struct cgraph_node *, struct cgraph_node *)
void cgraph_call_edge_duplication_hooks (struct cgraph_edge *, struct cgraph_edge *)
void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *)
struct cgraph_edgecgraph_make_edge_direct (struct cgraph_edge *, struct cgraph_node *)
bool cgraph_only_called_directly_p (struct cgraph_node *)
bool cgraph_function_possibly_inlined_p (tree)
void cgraph_unnest_node (struct cgraph_node *)
enum availability cgraph_function_body_availability (struct cgraph_node *)
void cgraph_add_new_function (tree, bool)
const char * cgraph_inline_failed_string (cgraph_inline_failed_t)
void cgraph_set_nothrow_flag (struct cgraph_node *, bool)
void cgraph_set_const_flag (struct cgraph_node *, bool, bool)
void cgraph_set_pure_flag (struct cgraph_node *, bool, bool)
bool cgraph_node_cannot_return (struct cgraph_node *)
bool cgraph_edge_cannot_lead_to_return (struct cgraph_edge *)
bool cgraph_will_be_removed_from_program_if_no_direct_calls (struct cgraph_node *node)
bool cgraph_can_remove_if_no_direct_calls_and_refs_p (struct cgraph_node *node)
bool cgraph_can_remove_if_no_direct_calls_p (struct cgraph_node *node)
bool resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution)
bool cgraph_for_node_thunks_and_aliases (struct cgraph_node *, bool(*)(struct cgraph_node *, void *), void *, bool)
bool cgraph_for_node_and_aliases (struct cgraph_node *, bool(*)(struct cgraph_node *, void *), void *, bool)
vec< cgraph_edge_pcollect_callers_of_node (struct cgraph_node *node)
void verify_cgraph (void)
void verify_cgraph_node (struct cgraph_node *)
void cgraph_mark_address_taken_node (struct cgraph_node *)
struct cgraph_edge_hook_listcgraph_add_edge_removal_hook (cgraph_edge_hook, void *)
void cgraph_remove_edge_removal_hook (struct cgraph_edge_hook_list *)
struct cgraph_node_hook_listcgraph_add_node_removal_hook (cgraph_node_hook, void *)
void cgraph_remove_node_removal_hook (struct cgraph_node_hook_list *)
struct varpool_node_hook_listvarpool_add_node_removal_hook (varpool_node_hook, void *)
void varpool_remove_node_removal_hook (struct varpool_node_hook_list *)
struct cgraph_node_hook_listcgraph_add_function_insertion_hook (cgraph_node_hook, void *)
void cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list *)
struct varpool_node_hook_listvarpool_add_variable_insertion_hook (varpool_node_hook, void *)
void varpool_remove_variable_insertion_hook (struct varpool_node_hook_list *)
void cgraph_call_function_insertion_hooks (struct cgraph_node *node)
struct cgraph_2edge_hook_listcgraph_add_edge_duplication_hook (cgraph_2edge_hook, void *)
void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *)
struct cgraph_2node_hook_listcgraph_add_node_duplication_hook (cgraph_2node_hook, void *)
void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *)
gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *)
struct cgraph_nodecgraph_function_node (struct cgraph_node *, enum availability *avail=NULL)
bool cgraph_get_body (struct cgraph_node *node)
struct cgraph_edgecgraph_turn_edge_to_speculative (struct cgraph_edge *, struct cgraph_node *, gcov_type, int)
void cgraph_speculative_call_info (struct cgraph_edge *, struct cgraph_edge *&, struct cgraph_edge *&, struct ipa_ref *&)
bool gimple_check_call_matching_types (gimple, tree, bool)
struct asm_nodeadd_asm_node (tree)
void cgraph_finalize_function (tree, bool)
void finalize_compilation_unit (void)
void compile (void)
void init_cgraph (void)
bool cgraph_process_new_functions (void)
void cgraph_process_same_body_aliases (void)
void fixup_same_cpp_alias_visibility (symtab_node, symtab_node target, tree)
basic_block init_lowered_empty_function (tree, bool)
void cgraph_reset_node (struct cgraph_node *)
bool expand_thunk (struct cgraph_node *, bool)
struct cgraph_edgecgraph_clone_edge (struct cgraph_edge *, struct cgraph_node *, gimple, unsigned, gcov_type, int, bool)
struct cgraph_nodecgraph_clone_node (struct cgraph_node *, tree, gcov_type, int, bool, vec< cgraph_edge_p >, bool, struct cgraph_node *)
tree clone_function_name (tree decl, const char *)
struct cgraph_nodecgraph_create_virtual_clone (struct cgraph_node *old_node, vec< cgraph_edge_p >, vec< ipa_replace_map_p, va_gc > *tree_map, bitmap args_to_skip, const char *clone_name)
struct cgraph_nodecgraph_find_replacement_node (struct cgraph_node *)
bool cgraph_remove_node_and_inline_clones (struct cgraph_node *, struct cgraph_node *)
void cgraph_set_call_stmt_including_clones (struct cgraph_node *, gimple, gimple, bool update_speculative=true)
void cgraph_create_edge_including_clones (struct cgraph_node *, struct cgraph_node *, gimple, gimple, gcov_type, int, cgraph_inline_failed_t)
void cgraph_materialize_all_clones (void)
struct cgraph_nodecgraph_copy_node_for_versioning (struct cgraph_node *, tree, vec< cgraph_edge_p >, bitmap)
struct cgraph_nodecgraph_function_versioning (struct cgraph_node *, vec< cgraph_edge_p >, vec< ipa_replace_map_p, va_gc > *, bitmap, bool, bitmap, basic_block, const char *)
void tree_function_versioning (tree, tree, vec< ipa_replace_map_p, va_gc > *, bool, bitmap, bool, bitmap, basic_block)
struct cgraph_edgecgraph_resolve_speculation (struct cgraph_edge *, tree)
unsigned int rebuild_cgraph_edges (void)
void cgraph_rebuild_references (void)
int compute_call_stmt_bb_frequency (tree, basic_block bb)
void record_references_in_initializer (tree, bool)
void ipa_record_stmt_references (struct cgraph_node *, gimple)
bool symtab_remove_unreachable_nodes (bool, FILE *)
cgraph_node_set cgraph_node_set_new (void)
cgraph_node_set_iterator cgraph_node_set_find (cgraph_node_set, struct cgraph_node *)
void cgraph_node_set_add (cgraph_node_set, struct cgraph_node *)
void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *)
void dump_cgraph_node_set (FILE *, cgraph_node_set)
void debug_cgraph_node_set (cgraph_node_set)
void free_cgraph_node_set (cgraph_node_set)
void cgraph_build_static_cdtor (char which, tree body, int priority)
varpool_node_set varpool_node_set_new (void)
varpool_node_set_iterator varpool_node_set_find (varpool_node_set, struct varpool_node *)
void varpool_node_set_add (varpool_node_set, struct varpool_node *)
void varpool_node_set_remove (varpool_node_set, struct varpool_node *)
void dump_varpool_node_set (FILE *, varpool_node_set)
void debug_varpool_node_set (varpool_node_set)
void free_varpool_node_set (varpool_node_set)
void ipa_discover_readonly_nonaddressable_vars (void)
bool varpool_externally_visible_p (struct varpool_node *)
bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e)
bool cgraph_optimize_for_size_p (struct cgraph_node *)
struct varpool_nodevarpool_create_empty_node (void)
struct varpool_nodevarpool_node_for_decl (tree)
struct varpool_nodevarpool_node_for_asm (tree asmname)
void varpool_mark_needed_node (struct varpool_node *)
void debug_varpool (void)
void dump_varpool (FILE *)
void dump_varpool_node (FILE *, struct varpool_node *)
void varpool_finalize_decl (tree)
enum availability cgraph_variable_initializer_availability (struct varpool_node *)
void cgraph_make_node_local (struct cgraph_node *)
bool cgraph_node_can_be_local_p (struct cgraph_node *)
void varpool_remove_node (struct varpool_node *node)
void varpool_finalize_named_section_flags (struct varpool_node *node)
bool varpool_output_variables (void)
bool varpool_assemble_decl (struct varpool_node *node)
void varpool_analyze_node (struct varpool_node *)
struct varpool_nodevarpool_extra_name_alias (tree, tree)
struct varpool_nodevarpool_create_variable_alias (tree, tree)
void varpool_reset_queue (void)
tree ctor_for_folding (tree)
bool varpool_for_node_and_aliases (struct varpool_node *, bool(*)(struct varpool_node *, void *), void *, bool)
void varpool_add_new_variable (tree)
void symtab_initialize_asm_name_hash (void)
void symtab_prevail_in_asm_name_hash (symtab_node node)
void varpool_remove_initializer (struct varpool_node *)
static struct cgraph_nodecgraph ()
static struct varpool_nodevarpool ()
static struct cgraph_nodecgraph_get_node ()
static struct varpool_nodevarpool_get_node ()
static const char * cgraph_node_asm_name ()
static const char * varpool_node_asm_name ()
static const char * cgraph_node_name ()
static const char * varpool_node_name ()
static struct varpool_nodevarpool_first_variable ()
static struct varpool_nodevarpool_next_variable ()
static struct varpool_nodevarpool_first_static_initializer ()
static struct varpool_nodevarpool_next_static_initializer ()
static struct varpool_nodevarpool_first_defined_variable ()
static struct varpool_nodevarpool_next_defined_variable ()
static struct cgraph_nodecgraph_first_defined_function ()
static struct cgraph_nodecgraph_next_defined_function ()
static struct cgraph_nodecgraph_first_function ()
static struct cgraph_nodecgraph_next_function ()
static bool cgraph_function_with_gimple_body_p ()
static struct cgraph_nodecgraph_first_function_with_gimple_body ()
static struct cgraph_nodecgraph_next_function_with_gimple_body ()
tree add_new_static_var (tree type)
static bool csi_end_p ()
static void csi_next ()
static struct cgraph_nodecsi_node ()
static cgraph_node_set_iterator csi_start ()
static bool cgraph_node_in_set_p ()
static size_t cgraph_node_set_size ()
static bool vsi_end_p ()
static void vsi_next ()
static struct varpool_nodevsi_node ()
static varpool_node_set_iterator vsi_start ()
static bool varpool_node_in_set_p ()
static size_t varpool_node_set_size ()
static bool cgraph_node_set_nonempty_p ()
static bool varpool_node_set_nonempty_p ()
static bool cgraph_only_called_directly_or_aliased_p ()
static bool varpool_can_remove_if_no_refs ()
static bool varpool_all_refs_explicit_p ()
htab_t constant_pool_htab (void)
static symtab_node symtab_alias_target ()
static struct cgraph_nodecgraph_alias_target ()
static struct varpool_nodevarpool_alias_target ()
static struct cgraph_nodecgraph_function_or_thunk_node (struct cgraph_node *node, enum availability *availability=NULL)
static struct varpool_nodevarpool_variable_node (struct varpool_node *node, enum availability *availability=NULL)
static bool cgraph_edge_recursive_p ()
static bool decl_is_tm_clone ()
static void cgraph_mark_force_output_node ()
static bool symtab_real_symbol_p ()
static bool symtab_can_be_discarded ()

Variables

const char *const cgraph_availability_names []
const char *const ld_plugin_symbol_resolution_names []
symtab_node symtab_nodes
int cgraph_n_nodes
int cgraph_max_uid
int cgraph_edge_max_uid
bool cgraph_global_info_ready
enum cgraph_state cgraph_state
bool cgraph_function_flags_ready
cgraph_node_set cgraph_new_nodes
struct asm_nodeasm_nodes
int symtab_order
bool cpp_implicit_aliases_done
FILE * cgraph_dump_file

Macro Definition Documentation

#define CGRAPH_FREQ_MAX   100000
#define DEFCIFCODE (   code,
  string 
)    CIF_ ## code,
#define FOR_EACH_DEFINED_FUNCTION (   node)
Value:
for ((node) = cgraph_first_defined_function (); (node); \
(node) = cgraph_next_defined_function ((node)))

Walk all functions with body defined.

Referenced by duplicate_node_data(), gcc::pass_manager::pass_manager(), and possible_polymorphic_call_target_p().

#define FOR_EACH_DEFINED_VARIABLE (   node)
Value:
for ((node) = varpool_first_defined_variable (); (node); \

Walk all variables with definitions in current unit.

#define FOR_EACH_FUNCTION (   node)
Value:
for ((node) = cgraph_first_function (); (node); \
(node) = cgraph_next_function ((node)))

Walk all functions.

Referenced by cgraph_materialize_clone().

#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (   node)
Value:

Walk all functions with body defined.

Referenced by spread_undeadness().

#define FOR_EACH_STATIC_INITIALIZER (   node)
Value:
for ((node) = varpool_first_static_initializer (); (node); \

Walk all static variables with initializer set.

#define FOR_EACH_SYMBOL (   node)    for ((node) = symtab_nodes; (node); (node) = (node)->next)

Walk all symbols.

#define FOR_EACH_VARIABLE (   node)
Value:
for ((node) = varpool_first_variable (); \
(node); \
(node) = varpool_next_variable ((node)))

Walk all variables.

Referenced by dump_varpool_node().


Typedef Documentation

typedef void(* cgraph_2edge_hook)(struct cgraph_edge *, struct cgraph_edge *, void *)
typedef void(* cgraph_2node_hook)(struct cgraph_node *, struct cgraph_node *, void *)
typedef void(* cgraph_edge_hook)(struct cgraph_edge *, void *)
typedef struct cgraph_edge* cgraph_edge_p

Reasons for inlining failures.

typedef void(* cgraph_node_hook)(struct cgraph_node *, void *)
typedef struct cgraph_node* cgraph_node_ptr
typedef void(* varpool_node_hook)(struct varpool_node *, void *)
typedef struct varpool_node* varpool_node_ptr

Enumeration Type Documentation

Enumerator:
AVAIL_UNSET 

Not yet set by cgraph_function_body_availability.

AVAIL_NOT_AVAILABLE 

Function body/variable initializer is unknown.

AVAIL_OVERWRITABLE 

Function body/variable initializer is known but might be replaced by a different one from other compilation unit and thus needs to be dealt with a care. Like AVAIL_NOT_AVAILABLE it can have arbitrary side effects on escaping variables and functions, while like AVAILABLE it might access static variables.

AVAIL_AVAILABLE 

Function body/variable initializer is known and will be used in final program.

AVAIL_LOCAL 

Function body/variable initializer is known and all it's uses are explicitly visible within current unit (ie it's address is never taken and it is not exported to other units). Currently used only for functions.

Reasons for inlining failures.

Enumerator:
DEFCIFCODE 

This file contains the definitions of the cgraph_inline_failed_t enums used in GCC.

Copyright (C) 2008-2013 Free Software Foundation, Inc. Contributed by Doug Kwan dougk.nosp@m.wan@.nosp@m.googl.nosp@m.e.co.nosp@m.m

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/. The format of this file is DEFCIFCODE(code, string).

Where symbol is the enumeration name without the ``''. The argument STRING is a explain the failure. Except for OK, which is a NULL pointer. Inlining successful. This must be the first code.

Enumerator:
CGRAPH_STATE_PARSING 

Frontend is parsing and finalizing functions.

CGRAPH_STATE_CONSTRUCTION 

Callgraph is being constructed. It is safe to add new functions.

CGRAPH_LTO_STREAMING 

Callgraph is being at LTO time.

CGRAPH_STATE_IPA 

Callgraph is built and IPA passes are being run.

CGRAPH_STATE_IPA_SSA 

Callgraph is built and all functions are transformed to SSA form.

CGRAPH_STATE_EXPANSION 

Functions are now ordered and being passed to RTL expanders.

CGRAPH_STATE_FINISHED 

All cgraph expansion is done.

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/. Symbol table consists of functions and variables. TODO: add labels and CONST_DECLs.

Enumerator:
SYMTAB_SYMBOL 
SYMTAB_FUNCTION 
SYMTAB_VARIABLE 

Function Documentation

struct asm_node* add_asm_node ( tree  )
read
tree add_new_static_var ( tree  type)

Create a new static variable of type TYPE.

static struct cgraph_node* cgraph ( )
staticread

Return callgraph node for given symbol and check it is a function.

Referenced by input_overwrite_node().

struct cgraph_2edge_hook_list* cgraph_add_edge_duplication_hook ( cgraph_2edge_hook  ,
void *   
)
read
struct cgraph_edge_hook_list* cgraph_add_edge_removal_hook ( cgraph_edge_hook  ,
void *   
)
read
struct cgraph_node_hook_list* cgraph_add_function_insertion_hook ( cgraph_node_hook  ,
void *   
)
read
void cgraph_add_new_function ( tree  ,
bool   
)
struct cgraph_2node_hook_list* cgraph_add_node_duplication_hook ( cgraph_2node_hook  ,
void *   
)
read
struct cgraph_node_hook_list* cgraph_add_node_removal_hook ( cgraph_node_hook  ,
void *   
)
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

Add thunk alias into callgraph. The alias declaration is ALIAS and it aliases DECL with an adjustments made into the first parameter. See comments in thunk_adjust for detail on the parameters.

static struct cgraph_node* cgraph_alias_target ( )
staticread
struct cgraph_indirect_call_info* cgraph_allocate_init_indirect_info ( void  )
read
void cgraph_build_static_cdtor ( char  which,
tree  body,
int  priority 
)

Referenced by tsan_pass().

void cgraph_call_edge_duplication_hooks ( struct cgraph_edge cs1,
struct cgraph_edge cs2 
)
void cgraph_call_function_insertion_hooks ( struct cgraph_node node)
void cgraph_call_node_duplication_hooks ( struct cgraph_node node1,
struct cgraph_node node2 
)
bool cgraph_can_remove_if_no_direct_calls_and_refs_p ( struct cgraph_node node)
bool cgraph_can_remove_if_no_direct_calls_p ( struct cgraph_node node)
struct cgraph_edge* cgraph_clone_edge ( struct cgraph_edge e,
struct cgraph_node n,
gimple  call_stmt,
unsigned  stmt_uid,
gcov_type  count_scale,
int  freq_scale,
bool  update_original 
)
read

In cgraphclones.c

Callgraph clones 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 module provide facilities for clonning functions. I.e. creating new functions based on existing functions with simple modifications, such as replacement of parameters.

To allow whole program optimization without actual presence of function bodies, an additional infrastructure is provided for so-called virtual clones

A virtual clone in the callgraph is a function that has no associated body, just a description of how to create its body based on a different function (which itself may be a virtual clone).

The description of function modifications includes adjustments to the function's signature (which allows, for example, removing or adding function arguments), substitutions to perform on the function body, and, for inlined functions, a pointer to the function that it will be inlined into.

It is also possible to redirect any edge of the callgraph from a function to its virtual clone. This implies updating of the call site to adjust for the new function signature.

Most of the transformations performed by inter-procedural optimizations can be represented via virtual clones. For instance, a constant propagation pass can produce a virtual clone of the function which replaces one of its arguments by a constant. The inliner can represent its decisions by producing a clone of a function whose body will be later integrated into a given function.

Using virtual clones, the program can be easily updated during the Execute stage, solving most of pass interactions problems that would otherwise occur during Transform.

Virtual clones are later materialized in the LTRANS stage and turned into real functions. Passes executed after the virtual clone were introduced also perform their Transform stage on new functions, so for a pass there is no significant difference between operating on a real function or a virtual clone introduced before its Execute stage.

Optimization passes then work on virtual clones introduced before their Execute stage as if they were real functions. The only difference is that clones are not visible during the Generate Summary stage. Create clone of E in the node N represented by CALL_EXPR the callgraph.

We do not want to ignore loop nest after frequency drops to 0.

 Clone flags that depend on call_stmt availability manually.   

References apply_probability(), cgraph_edge::call_stmt_cannot_inline_p, cgraph_edge::callee, cgraph_edge::can_throw_external, cgraph_call_edge_duplication_hooks(), cgraph_create_edge(), cgraph_create_indirect_edge(), CGRAPH_FREQ_BASE, CGRAPH_FREQ_MAX, cgraph_get_node(), count, cgraph_edge::count, cgraph_indirect_call_info::ecf_flags, cgraph_edge::frequency, gcc_checking_assert, gimple_call_fndecl(), cgraph_edge::indirect_info, cgraph_edge::indirect_inlining_edge, cgraph_edge::indirect_unknown_callee, cgraph_edge::inline_failed, cgraph_edge::lto_stmt_uid, and cgraph_edge::speculative.

Referenced by update_call_expr().

struct cgraph_node* cgraph_clone_node ( struct cgraph_node n,
tree  decl,
gcov_type  count,
int  freq,
bool  update_original,
vec< cgraph_edge_p redirect_callers,
bool  call_duplication_hook,
struct cgraph_node new_inlined_to 
)
read

Create node representing clone of N executed COUNT times. Decrease the execution counts from original node too. The new clone will have decl set to DECL that may or may not be the same as decl of N.

When UPDATE_ORIGINAL is true, the counts are subtracted from the original function's profile to reflect the fact that part of execution is handled by node. When CALL_DUPLICATOIN_HOOK is true, the ipa passes are acknowledged about the new clone. Otherwise the caller is responsible for doing so later.

If the new node is being inlined into another one, NEW_INLINED_TO should be the outline function the new one is (even indirectly) inlined to. All hooks will see this in node's global.inlined_to, when invoked. Can be NULL if the node is not inlined.

Redirect calls to the old version node to point to its new version.

Referenced by clone_inlined_nodes(), and input_overwrite_node().

struct cgraph_node* cgraph_copy_node_for_versioning ( struct cgraph_node old_version,
tree  new_decl,
vec< cgraph_edge_p redirect_callers,
bitmap  bbs_to_copy 
)
read

Create a new cgraph node which is the new version of OLD_VERSION node. REDIRECT_CALLERS holds the callers edges which should be redirected to point to NEW_VERSION. ALL the callees edges of OLD_VERSION are cloned to the new version node. Return the new version node.

If non-NULL BLOCK_TO_COPY determine what basic blocks was copied to prevent duplications of calls that are dead in the clone.

Redirect calls to the old version node to point to its new version.

struct cgraph_edge* cgraph_create_edge ( struct cgraph_node caller,
struct cgraph_node callee,
gimple  call_stmt,
gcov_type  count,
int  freq 
)
read

Create edge from CALLER to CALLEE in the cgraph.

Referenced by build_cgraph_edges(), cgraph_clone_edge(), and ipa_tm_diagnose_tm_safe().

void cgraph_create_edge_including_clones ( struct cgraph_node orig,
struct cgraph_node callee,
gimple  old_stmt,
gimple  stmt,
gcov_type  count,
int  freq,
cgraph_inline_failed_t  reason 
)

Like cgraph_create_edge walk the clone tree and update all clones sharing same function body. If clones already have edge for OLD_STMT; only update the edge same way as cgraph_set_call_stmt_including_clones does.

TODO: COUNT and LOOP_DEPTH should be properly distributed based on relative frequencies of the clones.

It is possible that clones already contain the edge while master didn't. Either we promoted indirect call into direct call in the clone or we are processing clones of unreachable master where edges has been removed.

struct cgraph_node* cgraph_create_function_alias ( tree  ,
tree   
)
read
struct cgraph_edge* cgraph_create_indirect_edge ( struct cgraph_node caller,
gimple  call_stmt,
int  ecf_flags,
gcov_type  count,
int  freq 
)
read

Create an indirect edge with a yet-undetermined callee where the call statement destination is a formal parameter of the caller with index PARAM_INDEX.

Record polymorphic call info.

     Only record types can have virtual calls.   

References free_edges, ggc_free(), cgraph_edge::indirect_info, NEXT_FREE_EDGE, and cgraph_edge::uid.

Referenced by build_cgraph_edges(), and cgraph_clone_edge().

struct cgraph_node* cgraph_create_node ( tree  )
read
struct cgraph_node* cgraph_create_virtual_clone ( struct cgraph_node old_node,
vec< cgraph_edge_p redirect_callers,
vec< ipa_replace_map_p, va_gc > *  tree_map,
bitmap  args_to_skip,
const char *  suffix 
)
read

Create callgraph node clone with new declaration. The actual body will be copied later at compilation stage.

TODO: after merging in ipa-sra use function call notes instead of args_to_skip bitmap interface.

 Make a new FUNCTION_DECL tree node  
 These pointers represent function body and will be populated only when clone
 is materialized.   
 We can not do DECL_RESULT (new_decl) = NULL; here because of LTO partitioning
 sometimes storing only clone decl instead of original.   
 Generate a new name for the new version.  
 Update the properties.
 Make clone visible only within this translation unit.  Make sure
 that is not weak also.
 ??? We cannot use COMDAT linkage because there is no
 ABI support for this.   
 Clones of global symbols or symbols with unique names are unique.   
struct cgraph_edge* cgraph_edge ( struct cgraph_node ,
gimple   
)
read
bool cgraph_edge_cannot_lead_to_return ( struct cgraph_edge )
static bool cgraph_edge_recursive_p ( )
inlinestatic

Return true when the edge E represents a direct recursion.

Referenced by remap_hint_predicate().

void cgraph_finalize_function ( tree  ,
bool   
)
struct cgraph_node* cgraph_find_replacement_node ( struct cgraph_node )
read
static struct cgraph_node* cgraph_first_defined_function ( )
staticread

Return first function with body defined.

static struct cgraph_node* cgraph_first_function ( )
staticread

Return first function.

static struct cgraph_node* cgraph_first_function_with_gimple_body ( )
staticread

Return first function with body defined.

bool cgraph_for_node_and_aliases ( struct cgraph_node node,
bool(*)(struct cgraph_node *, void *)  callback,
void *  data,
bool  include_overwritable 
)

Call calback on NODE and aliases associated to NODE. When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are skipped.

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

Referenced by cgraph_set_const_flag_1(), cgraph_set_nothrow_flag_1(), cgraph_set_pure_flag_1(), contains_hot_call_p(), and debug_cgraph().

bool cgraph_for_node_thunks_and_aliases ( struct cgraph_node node,
bool(*)(struct cgraph_node *, void *)  callback,
void *  data,
bool  include_overwritable 
)

Call calback on NODE, thunks and aliases associated to NODE. When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are skipped.

Referenced by cgraph_function_body_availability().

enum availability cgraph_function_body_availability ( struct cgraph_node )
struct cgraph_node* cgraph_function_node ( struct cgraph_node ,
enum availability avail = NULL 
)
read
static struct cgraph_node* cgraph_function_or_thunk_node ( struct cgraph_node node,
enum availability availability = NULL 
)
staticread

Given NODE, walk the alias chain to return the function NODE is alias of. Do not walk through thunks. When AVAILABILITY is non-NULL, get minimal availability in the chain.

Referenced by cgraph_set_pure_flag_1(), report_inline_failed_reason(), and searchc().

bool cgraph_function_possibly_inlined_p ( tree  )
struct cgraph_node* cgraph_function_versioning ( struct cgraph_node old_version_node,
vec< cgraph_edge_p redirect_callers,
vec< ipa_replace_map_p, va_gc > *  tree_map,
bitmap  args_to_skip,
bool  skip_return,
bitmap  bbs_to_copy,
basic_block  new_entry_block,
const char *  clone_name 
)
read

Perform function versioning. Function versioning includes copying of the tree and a callgraph update (creating a new cgraph node and updating its callees and callers).

REDIRECT_CALLERS varray includes the edges to be redirected to the new version.

TREE_MAP is a mapping of tree nodes we want to replace with new ones (according to results of prior analysis). OLD_VERSION_NODE is the node that is versioned.

If non-NULL ARGS_TO_SKIP determine function parameters to remove from new version. If SKIP_RETURN is true, the new version will return void. If non-NULL BLOCK_TO_COPY determine what basic blocks to copy. If non_NULL NEW_ENTRY determine new entry BB of the clone.

Return the new version's cgraph node.

 Make a new FUNCTION_DECL tree node for the new version.  
 Generate a new name for the new version.  
 When the old decl was a con-/destructor make sure the clone isn't.   
 Create the new version's call-graph node.
 and update the edges of the new node.  
 Copy the OLD_VERSION_NODE function tree to the new version.   
 Update the new version's properties.
 Make The new version visible only within this translation unit.  Make sure
 that is not weak also.
 ??? We cannot use COMDAT linkage because there is no
 ABI support for this.   
 Clones of global symbols or symbols with unique names are unique.   
 Update the call_expr on the edges to call the new version node.  
static bool cgraph_function_with_gimple_body_p ( )
inlinestatic

Return true when NODE is a function with Gimple body defined in current unit. Functions can also be define externally or they can be thunks with no Gimple representation.

Note that at WPA stage, the function body may not be present in memory.

Referenced by init_alias_vars(), ipcp_versionable_function_p(), and propagate_aggs_accross_jump_function().

bool cgraph_get_body ( struct cgraph_node node)
struct cgraph_node* cgraph_get_create_node ( tree  )
read
struct cgraph_node* cgraph_get_create_real_symbol_node ( tree  )
read
const char* cgraph_inline_failed_string ( cgraph_inline_failed_t  )
struct cgraph_edge* cgraph_make_edge_direct ( struct cgraph_edge ,
struct cgraph_node  
)
read
void cgraph_make_node_local ( struct cgraph_node )
void cgraph_mark_address_taken_node ( struct cgraph_node )
static void cgraph_mark_force_output_node ( )
inlinestatic

Likewise indicate that a node is needed, i.e. reachable via some external means.

Referenced by process_common_attributes().

void cgraph_materialize_all_clones ( void  )

Once all functions from compilation unit are in memory, produce all clones and update all calls. We might also do this on demand if we don't want to bring all functions to memory prior compilation, but current WHOPR implementation does that and it is is bit easier to keep everything right in this order.

We can also do topological order, but number of iterations should be bounded by number of IPA passes since single IPA pass is probably not going to create clones of clones it created itself.

bool cgraph_maybe_hot_edge_p ( struct cgraph_edge e)
static struct cgraph_node* cgraph_next_defined_function ( )
staticread

Return next function with body defined after NODE.

static struct cgraph_node* cgraph_next_function ( )
staticread

Return next function.

static struct cgraph_node* cgraph_next_function_with_gimple_body ( )
staticread

Return next reachable static variable with initializer after NODE.

static const char* cgraph_node_asm_name ( )
inlinestatic

Return asm name of cgraph node.

Referenced by remove_node_data().

bool cgraph_node_can_be_local_p ( struct cgraph_node )
bool cgraph_node_cannot_return ( struct cgraph_node )
struct cgraph_node* cgraph_node_for_asm ( tree  )
read
static bool cgraph_node_in_set_p ( )
inlinestatic

Return true if SET contains NODE.

void cgraph_node_remove_callees ( struct cgraph_node node)
void cgraph_node_set_add ( cgraph_node_set  ,
struct cgraph_node  
)
cgraph_node_set_iterator cgraph_node_set_find ( cgraph_node_set  ,
struct cgraph_node  
)
cgraph_node_set cgraph_node_set_new ( void  )

Create a new cgraph node set.

References gcc_checking_assert, and pointer_map_insert().

static bool cgraph_node_set_nonempty_p ( )
inlinestatic

Return true if set is nonempty.

void cgraph_node_set_remove ( cgraph_node_set  ,
struct cgraph_node  
)
static size_t cgraph_node_set_size ( )
inlinestatic

Return number of nodes in SET.

static bool cgraph_only_called_directly_or_aliased_p ( )
inlinestatic

Return true when function NODE is only called directly or it has alias. i.e. it is not externally visible, address was not taken and it is not used in any other non-standard way.

Referenced by cgraph_set_const_flag().

bool cgraph_only_called_directly_p ( struct cgraph_node )
bool cgraph_optimize_for_size_p ( struct cgraph_node )
bool cgraph_process_new_functions ( void  )

Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these functions into callgraph in a way so they look like ordinary reachable functions inserted into callgraph already at construction time.

  Note that this queue may grow as its being processed, as the new
  functions may generate new ones.   
         At construction time we just need to finalize function and move
         it into reachable functions list.   
         When IPA optimization already started, do all essential
         transformations that has been already performed on the whole
         cgraph but not on this function.   
         Functions created during expansion shall be compiled
         directly.   

References analyze_function(), symtab_node_base::analyzed, CDI_DOMINATORS, CDI_POST_DOMINATORS, cgraph_call_function_insertion_hooks(), cgraph_finalize_function(), CGRAPH_STATE_CONSTRUCTION, CGRAPH_STATE_EXPANSION, CGRAPH_STATE_IPA, CGRAPH_STATE_IPA_SSA, compute_inline_parameters(), DECL_STRUCT_FUNCTION, enqueue_node(), gcc::pass_manager::execute_early_local_passes(), expand_function(), free_dominance_info(), g, gcc_unreachable, gcc::context::get_passes(), gimple_in_ssa_p(), gimple_register_cfg_hooks(), inline_summary_vec, NULL, pop_cfun(), cgraph_node::process, and push_cfun().

void cgraph_process_same_body_aliases ( void  )

C++ frontend produce same body aliases all over the place, even before PCH gets streamed out. It relies on us linking the aliases with their function in order to do the fixups, but ipa-ref is not PCH safe. Consequentely we first produce aliases without links, but once C++ FE is sure he won't sream PCH we build the links via this function.

void cgraph_rebuild_references ( void  )

Rebuild cgraph edges for current function node. This needs to be run after passes that don't update the cgraph.

Keep speculative references for further cgraph edge expansion.

gimple cgraph_redirect_edge_call_stmt_to_callee ( struct cgraph_edge )
void cgraph_redirect_edge_callee ( struct cgraph_edge ,
struct cgraph_node  
)
void cgraph_release_function_body ( struct cgraph_node )
void cgraph_remove_edge ( struct cgraph_edge )
void cgraph_remove_edge_duplication_hook ( struct cgraph_2edge_hook_list )
void cgraph_remove_edge_removal_hook ( struct cgraph_edge_hook_list )
void cgraph_remove_function_insertion_hook ( struct cgraph_node_hook_list )
void cgraph_remove_node ( struct cgraph_node )
bool cgraph_remove_node_and_inline_clones ( struct cgraph_node ,
struct cgraph_node  
)

Referenced by replace_locals_op().

void cgraph_remove_node_duplication_hook ( struct cgraph_2node_hook_list )
void cgraph_remove_node_removal_hook ( struct cgraph_node_hook_list )
void cgraph_reset_node ( struct cgraph_node )

Referenced by referred_to_p().

struct cgraph_edge* cgraph_resolve_speculation ( struct cgraph_edge ,
tree   
)
read
struct cgraph_rtl_info* cgraph_rtl_info ( tree  )
read
struct cgraph_node* cgraph_same_body_alias ( struct cgraph_node ,
tree  ,
tree   
)
read
void cgraph_set_call_stmt ( struct cgraph_edge e,
gimple  new_stmt,
bool  update_speculative 
)

Change field call_stmt of edge E to NEW_STMT. If UPDATE_SPECULATIVE and E is any component of speculative edge, then update all components.

 Speculative edges has three component, update all of them
 when asked to.   
 Only direct speculative edges go to call_site_hash.   
     Constant propagation (and possibly also inlining?) can turn an
     indirect call into a direct one.   
void cgraph_set_call_stmt_including_clones ( struct cgraph_node orig,
gimple  old_stmt,
gimple  new_stmt,
bool  update_speculative 
)

Like cgraph_set_call_stmt but walk the clone tree and update all clones sharing the same function body. When WHOLE_SPECULATIVE_EDGES is true, all three components of speculative edge gets updated. Otherwise we update only direct call.

If UPDATE_SPECULATIVE is false, it means that we are turning speculative call into a real code sequence. Update the callgraph edges.

void cgraph_set_const_flag ( struct cgraph_node ,
bool  ,
bool   
)
void cgraph_set_nothrow_flag ( struct cgraph_node ,
bool   
)
void cgraph_set_pure_flag ( struct cgraph_node ,
bool  ,
bool   
)
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.

We can take advantage of the call stmt hash.   

Speculative edge always consist of all three components - direct edge, indirect and reference.

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.

void cgraph_unnest_node ( struct cgraph_node )
void cgraph_update_edges_for_call_stmt ( gimple  ,
tree  ,
gimple   
)
enum availability cgraph_variable_initializer_availability ( struct varpool_node )
bool cgraph_will_be_removed_from_program_if_no_direct_calls ( struct cgraph_node node)
tree clone_function_name ( tree  decl,
const char *   
)
vec<cgraph_edge_p> collect_callers_of_node ( struct cgraph_node node)
void compile ( void  )

Perform simple optimizations based on callgraph.

 If LTO is enabled, initialize the streamer hooks needed by GIMPLE.   
 Don't run the IPA passes if there was any error or sorry messages.   
 Do nothing else if any IPA pass found errors or if we are just streaming LTO.   
 This pass remove bodies of extern inline functions we never inlined.
 Do this later so other IPA passes see what is really going on.   
 Output everything.   
 When weakref support is missing, we autmatically translate all
 references to NODE to references to its ultimate alias target.
 The renaming mechanizm uses flag IDENTIFIER_TRANSPARENT_ALIAS and
 TREE_CHAIN.

 Set up this mapping before we output any assembler but once we are sure
 that all symbol renaming is done.

 FIXME: All this uglyness can go away if we just do renaming at gimple
 level by physically rewritting the IL.  At the moment we can only redirect
 calls, so we need infrastructure for renaming references as well.   

References dump_cgraph_node().

htab_t constant_pool_htab ( void  )

Constant pool accessor function.

static bool csi_end_p ( )
inlinestatic

Return true if iterator CSI points to nothing.

Referenced by enqueue_node().

static void csi_next ( )
inlinestatic

Advance iterator CSI.

Referenced by enqueue_node().

static struct cgraph_node* csi_node ( )
staticread

Return the node pointed to by CSI.

Referenced by enqueue_node().

static cgraph_node_set_iterator csi_start ( )
inlinestatic

Return an iterator to the first node in SET.

Referenced by enqueue_node().

tree ctor_for_folding ( tree  )
void debug_cgraph ( void  )
void debug_cgraph_node ( struct cgraph_node )
void debug_cgraph_node_set ( cgraph_node_set  )
void debug_symtab ( void  )

Dump symbol table to stderr.

References symtab_node_base::decl, error(), and symtab_get_node().

void debug_symtab_node ( symtab_node  )
void debug_varpool ( void  )

Dump the variable pool to stderr.

References error_mark_node, and TREE_CODE.

void debug_varpool_node_set ( varpool_node_set  )
static bool decl_is_tm_clone ( )
inlinestatic

Return true if the TM_CLONE bit is set for a given FNDECL.

void delete_function_version ( tree  decl)

Remove the cgraph_function_version_info and cgraph_node for DECL. This DECL is a duplicate declaration.

void dump_cgraph ( FILE *  )
void dump_cgraph_node ( FILE *  ,
struct cgraph_node  
)
void dump_cgraph_node_set ( FILE *  ,
cgraph_node_set   
)
void dump_symtab ( FILE *  )

Referenced by init_cgraph().

void dump_symtab_base ( FILE *  ,
symtab_node   
)
void dump_symtab_node ( FILE *  ,
symtab_node   
)
void dump_varpool ( FILE *  )
void dump_varpool_node ( FILE *  ,
struct varpool_node  
)

Referenced by dump_varpool_node().

void dump_varpool_node_set ( FILE *  ,
varpool_node_set   
)
bool expand_thunk ( struct cgraph_node ,
bool   
)
void finalize_compilation_unit ( void  )

Analyze the whole compilation unit once it is parsed completely.

 If we're here there's no current function anymore.  Some frontends
 are lazy in clearing these.   
 Do not skip analyzing the functions if there were errors, we
 miss diagnostics for following functions otherwise.   
 Emit size functions we didn't inline.   
 Mark alias targets necessary and emit diagnostics.   
 Gimplify and lower all functions, compute reachability and
 remove unreachable nodes.   
 Mark alias targets necessary and emit diagnostics.   
 Gimplify and lower thunks.   
 Finally drive the pass manager.   
void fixup_same_cpp_alias_visibility ( symtab_node  node,
symtab_node  target 
)
void fixup_same_cpp_alias_visibility ( symtab_node  ,
symtab_node  target,
tree   
)
void free_cgraph_node_set ( cgraph_node_set  )
void free_varpool_node_set ( varpool_node_set  )
struct cgraph_function_version_info* get_cgraph_node_version ( struct cgraph_node node)
read

Get the cgraph_function_version_info node corresponding to node.

bool gimple_check_call_matching_types ( gimple  call_stmt,
tree  callee,
bool  args_count_match 
)

Verify if the type of the argument and lhs of CALL_STMT matches that of the function declaration CALLEE. If ARGS_COUNT_MATCH is true, the arg count needs to be the same. If we cannot verify this or there is a mismatch, return false.

void init_cgraph ( void  )

Initialize callgraph dump file.

References cgraph_dump_file, and dump_symtab().

basic_block init_lowered_empty_function ( tree  ,
bool   
)

Initialize datastructures so DECL is a function in lowered gimple form. IN_SSA is true if the gimple is in SSA.

struct cgraph_function_version_info* insert_new_cgraph_node_version ( struct cgraph_node node)
read

Insert a new cgraph_function_version_info node into cgraph_fnver_htab corresponding to cgraph_node NODE.

void ipa_discover_readonly_nonaddressable_vars ( void  )

Discover variables that have no longer address taken or that are read only and update their flags.

FIXME: This can not be done in between gimplify and omp_expand since readonly flag plays role on what is shared and what is not. Currently we do this transformation as part of whole program visibility and re-do at ipa-reference pass (to take into account clonning), but it would make sense to do it before early optimizations.

Making variable in explicit section readonly can cause section type conflict. See e.g. gcc.c-torture/compile/pr23237.c

References symtab_node_base::decl, dump_file, TREE_READONLY, and varpool_node_name().

void ipa_record_stmt_references ( struct cgraph_node ,
gimple   
)
unsigned int rebuild_cgraph_edges ( void  )

In cgraphbuild.c

Rebuild cgraph edges for current function node. This needs to be run after passes that don't update the cgraph.

Referenced by gate_tm_memopt().

void record_function_versions ( tree  decl1,
tree  decl2 
)

Record that DECL1 and DECL2 are semantically identical function versions.

void record_references_in_initializer ( tree  ,
bool   
)
void release_function_body ( tree  )
bool resolution_used_from_other_file_p ( enum  ld_plugin_symbol_resolution)
void symtab_add_to_same_comdat_group ( symtab_node  new_node,
symtab_node  old_node 
)

Add NEW_ to the same comdat group that OLD is in.

References symtab_node_base::next, NULL, and symtab_node_base::same_comdat_group.

static symtab_node symtab_alias_target ( )
inlinestatic

FIXME: inappropriate dependency of cgraph on IPA. Return node that alias N is aliasing.

Referenced by output_weakrefs().

symtab_node symtab_alias_ultimate_target ( symtab_node  ,
enum availability avail = NULL 
)
static bool symtab_can_be_discarded ( )
inlinestatic

Return true if NODE can be discarded by linker from the binary.

void symtab_dissolve_same_comdat_group_list ( symtab_node  node)

Referenced by clone_inlined_nodes().

bool symtab_for_node_and_aliases ( symtab_node  node,
bool(*)(symtab_node, void *)  callback,
void *  data,
bool  include_overwritable 
)

Call calback on NODE and aliases associated to NODE. When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are skipped.

Referenced by symtab_resolve_alias().

symtab_node symtab_get_node ( const_tree  )
void symtab_initialize_asm_name_hash ( void  )

Initalize asm name hash unless.

Referenced by symtab_remove_node().

void symtab_insert_node_to_hashtable ( symtab_node  )
void symtab_make_decl_local ( tree  )

Referenced by cgraph_unnest_node().

const char* symtab_node_asm_name ( symtab_node  )
enum availability symtab_node_availability ( symtab_node  )
symtab_node symtab_node_for_asm ( const_tree  asmname)

Referenced by dump_varpool().

const char* symtab_node_name ( symtab_node  )
symtab_node symtab_nonoverwritable_alias ( symtab_node  )
void symtab_prevail_in_asm_name_hash ( symtab_node  node)
static bool symtab_real_symbol_p ( )
inlinestatic

Return true when the symbol is real symbol, i.e. it is not inline clone or abstract function kept for debug info purposes only.

void symtab_register_node ( symtab_node  )
void symtab_remove_node ( symtab_node  )
bool symtab_remove_unreachable_nodes ( bool  ,
FILE *   
)

In ipa.c

Referenced by execute_function_todo().

bool symtab_resolve_alias ( symtab_node  node,
symtab_node  target 
)
bool symtab_semantically_equivalent_p ( symtab_node  a,
symtab_node  b 
)

Return true if A and B represents semantically equivalent symbols.

Equivalent functions are equivalent.

 If symbol is not overwritable by different implementation,
 walk to the base object it defines.   
void symtab_unregister_node ( symtab_node  )
bool symtab_used_from_object_file_p ( symtab_node  )
void tree_function_versioning ( tree  old_decl,
tree  new_decl,
vec< ipa_replace_map_p, va_gc > *  tree_map,
bool  update_clones,
bitmap  args_to_skip,
bool  skip_return,
bitmap  blocks_to_copy,
basic_block  new_entry 
)

Create a copy of a function's tree. OLD_DECL and NEW_DECL are FUNCTION_DECL tree nodes of the original function and the new copied function respectively. In case we want to replace a DECL tree with another tree while duplicating the function's body, TREE_MAP represents the mapping between these trees. If UPDATE_CLONES is set, the call_stmt fields of edges of clones of the function will be updated.

If non-NULL ARGS_TO_SKIP determine function parameters to remove from new version. If SKIP_RETURN is true, the new version will return void. If non-NULL BLOCK_TO_COPY determine what basic blocks to copy. If non_NULL NEW_ENTRY determine new entry BB of the clone.

 Copy over debug args.   
 Output the inlining info for this abstract function, since it has been
 inlined.  If we don't do this now, we can lose the information about the
 variables in the function when the blocks get blown away as soon as we
 remove the cgraph node.   
 Prepare the data structures for the tree copy.   
 Generate a new name for the new version.  
 Copy the function's static chain.   
 If there's a tree_map, prepare for substitution.   
 Copy the function's arguments.   
   Add local vars.   
 Set up the destination functions loop tree.   
 Copy the Function's body.   
 Renumber the lexical scoping (non-code) blocks consecutively.   
 We want to create the BB unconditionally, so that the addition of
 debug stmts doesn't affect BB count, which may in the end cause
 codegen differences.   
 Remap the nonlocal_goto_save_area, if any.   
 Clean up.   
 After partial cloning we need to rescale frequencies, so they are
 within proper range in the cloned function.   
static struct varpool_node* varpool ( )
staticread

Return varpool node for given symbol and check it is a variable.

Referenced by ipa_ref_referring_node().

void varpool_add_new_variable ( tree  )
struct varpool_node_hook_list* varpool_add_node_removal_hook ( varpool_node_hook  ,
void *   
)
read
struct varpool_node_hook_list* varpool_add_variable_insertion_hook ( varpool_node_hook  ,
void *   
)
read
static struct varpool_node* varpool_alias_target ( )
staticread
static bool varpool_all_refs_explicit_p ( )
inlinestatic

Return true when all references to VNODE must be visible in ipa_ref_list. i.e. if the variable is not externally visible or not used in some magic way (asm statement or such). The magic uses are all summarized in force_output flag.

void varpool_analyze_node ( struct varpool_node )
bool varpool_assemble_decl ( struct varpool_node node)

Referenced by expand_all_functions().

static bool varpool_can_remove_if_no_refs ( )
inlinestatic

Return true when function NODE can be removed from callgraph if all direct calls are eliminated.

struct varpool_node* varpool_create_empty_node ( void  )
read

In varpool.c

Allocate new callgraph node and insert it into basic data structures.

struct varpool_node* varpool_create_variable_alias ( tree  ,
tree   
)
read
bool varpool_externally_visible_p ( struct varpool_node )
struct varpool_node* varpool_extra_name_alias ( tree  ,
tree   
)
read
void varpool_finalize_decl ( tree  )
void varpool_finalize_named_section_flags ( struct varpool_node node)
static struct varpool_node* varpool_first_defined_variable ( )
staticread

Return first reachable static variable with initializer.

static struct varpool_node* varpool_first_static_initializer ( )
staticread

Return first reachable static variable with initializer.

static struct varpool_node* varpool_first_variable ( )
staticread

Return first variable.

bool varpool_for_node_and_aliases ( struct varpool_node node,
bool(*)(struct varpool_node *, void *)  callback,
void *  data,
bool  include_overwritable 
)

Call calback on NODE and aliases associated to NODE. When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are skipped.

Referenced by varpool_create_variable_alias().

static struct varpool_node* varpool_get_node ( )
staticread

Return varpool node for given symbol and check it is a function.

Referenced by default_select_section(), maybe_record_node(), and type_tag().

void varpool_mark_needed_node ( struct varpool_node )
static struct varpool_node* varpool_next_defined_variable ( )
staticread

Return next reachable static variable with initializer after NODE.

static struct varpool_node* varpool_next_static_initializer ( )
staticread

Return next reachable static variable with initializer after NODE.

static struct varpool_node* varpool_next_variable ( )
staticread

Return next variable after NODE.

static const char* varpool_node_asm_name ( )
inlinestatic

Return asm name of varpool node.

struct varpool_node* varpool_node_for_asm ( tree  asmname)
read
struct varpool_node* varpool_node_for_decl ( tree  )
read
static bool varpool_node_in_set_p ( )
inlinestatic

Return true if SET contains NODE.

static const char* varpool_node_name ( )
inlinestatic

Return name of varpool node.

Referenced by ipa_discover_readonly_nonaddressable_vars().

void varpool_node_set_add ( varpool_node_set  ,
struct varpool_node  
)
varpool_node_set_iterator varpool_node_set_find ( varpool_node_set  ,
struct varpool_node  
)
varpool_node_set varpool_node_set_new ( void  )

Create a new varpool node set.

static bool varpool_node_set_nonempty_p ( )
inlinestatic

Return true if set is nonempty.

void varpool_node_set_remove ( varpool_node_set  ,
struct varpool_node  
)
static size_t varpool_node_set_size ( )
inlinestatic

Return number of nodes in SET.

void varpool_remove_initializer ( struct varpool_node )

Referenced by varpool_node_for_decl().

void varpool_remove_node ( struct varpool_node node)
void varpool_remove_node_removal_hook ( struct varpool_node_hook_list )
void varpool_remove_variable_insertion_hook ( struct varpool_node_hook_list )
void varpool_reset_queue ( void  )
static struct varpool_node* varpool_variable_node ( struct varpool_node node,
enum availability availability = NULL 
)
staticread

Given NODE, walk the alias chain to return the function NODE is alias of. Do not walk through thunks. When AVAILABILITY is non-NULL, get minimal availability in the chain.

void verify_cgraph ( void  )

Verify whole cgraph structure.

Referenced by cgraph_materialize_clone().

void verify_cgraph_node ( struct cgraph_node )
void verify_symtab ( void  )

Verify symbol table for internal consistency.

bool verify_symtab_base ( symtab_node  )
void verify_symtab_node ( symtab_node  )
static bool vsi_end_p ( )
inlinestatic

Return true if iterator VSI points to nothing.

static void vsi_next ( )
inlinestatic

Advance iterator VSI.

static struct varpool_node* vsi_node ( )
staticread

Return the node pointed to by VSI.

static varpool_node_set_iterator vsi_start ( )
inlinestatic

Return an iterator to the first node in SET.


Variable Documentation

struct asm_node* asm_nodes

Linked list of cgraph asm nodes.

const char* const cgraph_availability_names[]

Names used to print out the availability enum.

Referenced by varpool_remove_initializer().

int cgraph_edge_max_uid

Maximal uid used in cgraph edges.

Referenced by ipcp_propagate_stage().

bool cgraph_function_flags_ready

Set when the cgraph is fully build and the basic flags are computed.

Referenced by cgraph_variable_initializer_availability(), and varpool_remove_initializer().

bool cgraph_global_info_ready

Set when whole unit has been analyzed so we can access global info.

int cgraph_max_uid

Maximal uid used in cgraph nodes.

int cgraph_n_nodes

Number of nodes in existence.

Referenced by cgraph_remove_node_duplication_hook().

cgraph_node_set cgraph_new_nodes

Driver of optimization process 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 module implements main driver of compilation process.

The main scope of this file is to act as an interface in between tree based frontends and the backend.

The front-end is supposed to use following functionality:

  • cgraph_finalize_function

    This function is called once front-end has parsed whole body of function and it is certain that the function body nor the declaration will change.

    (There is one exception needed for implementing GCC extern inline function.)

  • varpool_finalize_decl

    This function has same behavior as the above but is used for static variables.

  • add_asm_node

    Insert new toplevel ASM statement

  • finalize_compilation_unit

    This function is called once (source level) compilation unit is finalized and it will no longer change.

    The symbol table is constructed starting from the trivially needed symbols finalized by the frontend. Functions are lowered into GIMPLE representation and callgraph/reference lists are constructed. Those are used to discover other necessary functions and variables.

    At the end the bodies of unreachable functions are removed.

    The function can be called multiple times when multiple source level compilation units are combined.

  • compile

    This passes control to the back-end. Optimizations are performed and final assembler is generated. This is done in the following way. Note that with link time optimization the process is split into three stages (compile time, linktime analysis and parallel linktime as indicated bellow).

    Compile time:

    1) Inter-procedural optimization. (ipa_passes)

    This part is further split into:

    a) early optimizations. These are local passes executed in the topological order on the callgraph.

    The purpose of early optimiations is to optimize away simple things that may otherwise confuse IP analysis. Very simple propagation across the callgraph is done i.e. to discover functions without side effects and simple inlining is performed.

    b) early small interprocedural passes.

    Those are interprocedural passes executed only at compilation time. These include, for example, transational memory lowering, unreachable code removal and other simple transformations.

    c) IP analysis stage. All interprocedural passes do their analysis.

    Interprocedural passes differ from small interprocedural passes by their ability to operate across whole program at linktime. Their analysis stage is performed early to both reduce linking times and linktime memory usage by not having to represent whole program in memory.

    d) LTO sreaming. When doing LTO, everything important gets streamed into the object file.

    Compile time and or linktime analysis stage (WPA):

       At linktime units gets streamed back and symbol table is
       merged.  Function bodies are not streamed in and not
       available.
    e) IP propagation stage.  All IP passes execute their
       IP propagation. This is done based on the earlier analysis
       without having function bodies at hand.
    f) Ltrans streaming.  When doing WHOPR LTO, the program
       is partitioned and streamed into multple object files.
    
       Compile time and/or parallel linktime stage (ltrans)
    
       Each of the object files is streamed back and compiled
       separately.  Now the function bodies becomes available
       again.
    
         2) Virtual clone materialization
            (cgraph_materialize_clone)
    
            IP passes can produce copies of existing functoins (such
            as versioned clones or inline clones) without actually
            manipulating their bodies by creating virtual clones in
            the callgraph. At this time the virtual clones are
            turned into real functions
         3) IP transformation
    
            All IP passes transform function bodies based on earlier
            decision of the IP propagation.
    
         4) late small IP passes
    
            Simple IP passes working within single program partition.
    
         5) Expansion
            (expand_all_functions)
    
            At this stage functions that needs to be output into
            assembler are identified and compiled in topological order
         6) Output of variables and aliases
            Now it is known what variable references was not optimized
            out and thus all variables are output to the file.
    
            Note that with -fno-toplevel-reorder passes 5 and 6
            are combined together in cgraph_output_in_order.  
    

Finally there are functions to manipulate the callgraph from backend.

  • cgraph_add_new_function is used to add backend produced functions introduced after the unit is finalized. The functions are enqueue for later processing and inserted into callgraph with cgraph_process_new_functions.
  • cgraph_function_versioning

    produces a copy of function into new one (a version) and apply simple transformations Queue of cgraph nodes scheduled to be added into cgraph. This is a secondary queue used during optimization to accommodate passes that may generate new functions that need to be optimized and expanded.

What state callgraph is in right now.

bool cpp_implicit_aliases_done

Did procss_same_body_aliases run?

const char* const ld_plugin_symbol_resolution_names[]

Symbol table. Copyright (C) 2012-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/.

symtab_node symtab_nodes

Linked list of symbol table nodes.

int symtab_order

The order index of the next symtab node to be created. This is used so that we can sort the cgraph nodes in order by when we saw them, to support -fno-toplevel-reorder.

Referenced by input_overwrite_node().