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

Data Structures

struct  varpool_node_hook_list

Functions

struct varpool_node_hook_listvarpool_add_node_removal_hook ()
void varpool_remove_node_removal_hook ()
static void varpool_call_node_removal_hooks ()
struct varpool_node_hook_listvarpool_add_variable_insertion_hook ()
void varpool_remove_variable_insertion_hook ()
void varpool_call_variable_insertion_hooks ()
struct varpool_nodevarpool_create_empty_node ()
struct varpool_nodevarpool_node_for_decl ()
void varpool_remove_node ()
void varpool_remove_initializer ()
void dump_varpool_node ()
void dump_varpool ()
DEBUG_FUNCTION void debug_varpool ()
struct varpool_nodevarpool_node_for_asm ()
tree ctor_for_folding ()
void varpool_add_new_variable ()
enum availability cgraph_variable_initializer_availability ()
void varpool_analyze_node ()
static void assemble_aliases ()
bool varpool_assemble_decl ()
static void enqueue_node ()
static void varpool_remove_unreferenced_decls ()
void varpool_finalize_named_section_flags ()
bool varpool_output_variables ()
tree add_new_static_var ()
struct varpool_nodevarpool_create_variable_alias ()
struct varpool_nodevarpool_extra_name_alias ()
bool varpool_for_node_and_aliases (struct varpool_node *node, bool(*callback)(struct varpool_node *, void *), void *data, bool include_overwritable)

Variables

struct varpool_node_hook_listfirst_varpool_node_removal_hook
struct varpool_node_hook_listfirst_varpool_variable_insertion_hook

Function Documentation

tree add_new_static_var ( )
   Create a new global variable of type TYPE.  
static void assemble_aliases ( )
static
   Assemble thunks and aliases associated to NODE.  

References targetm.

enum availability cgraph_variable_initializer_availability ( )
   Return variable availability.  See cgraph.h for description of individual
   return values.  
     If the variable can be overwritten, return OVERWRITABLE.  Takes
     care of at least one notable extension - the COMDAT variables
     used to share template instantiations in C++.  

References align_variable(), and cgraph_function_flags_ready.

tree ctor_for_folding ( )
   Return if DECL is constant and its initial value is known (so we can do
   constant folding using DECL_INITIAL (decl)).
   Return ERROR_MARK_NODE when value is unknown.  
     Do not care about automatic variables.  Those are never initialized
     anyway, because gimplifier exapnds the code
     See if we are dealing with alias.
     In most cases alias is just alternative symbol pointing to a given
     constructor.  This allows us to use interposition rules of DECL
     constructor of REAL_NODE.  However weakrefs are special by being just
     alternative name of their target (if defined).  
     Vtables are defined by their types and must match no matter of interposition
     rules.  
     If thre is no constructor, we have nothing to do.  
     Non-readonly alias of readonly variable is also de-facto readonly,
     because the variable itself is in readonly section.  
     We also honnor READONLY flag on alias assuming that user knows
     what he is doing.  
     Variables declared 'const' without an initializer
     have zero as the initializer if they may not be
     overridden at link or run time.  
     Variables declared `const' with an initializer are considered
     to not be overwritable with different initializer by default. 

     ??? Previously we behaved so for scalar variables but not for array
     accesses.  
DEBUG_FUNCTION void debug_varpool ( void  )
   Dump the variable pool to stderr.  
void dump_varpool ( )
   Dump the variable pool.  

References dyn_cast(), and symtab_node_for_asm().

void dump_varpool_node ( )
   Dump given cgraph node.  

References dump_varpool_node().

static void enqueue_node ( )
static
   Add NODE to queue starting at FIRST. 
   The queue is linked via AUX pointers and terminated by pointer to 1.  

References symtab_node_base::analyzed, dyn_cast(), symtab_node_base::next, and symtab_node_base::same_comdat_group.

Referenced by varpool_remove_unreferenced_decls().

void varpool_add_new_variable ( )
   Add the variable DECL to the varpool.
   Unlike varpool_finalize_decl function is intended to be used
   by middle end and allows insertion of new variable at arbitrary point
   of compilation.  
struct varpool_node_hook_list* varpool_add_node_removal_hook ( )
read
   Register HOOK to be called with DATA on each removed node.  
struct varpool_node_hook_list* varpool_add_variable_insertion_hook ( )
read
   Register HOOK to be called with DATA on each inserted node.  
void varpool_analyze_node ( )
     When reading back varpool at LTO time, we re-construct the queue in order
     to have "needed" list right by inserting all needed nodes into varpool.
     We however don't want to re-analyze already analyzed nodes.  
         Compute the alignment early so function body expanders are
         already informed about increased alignment.  
bool varpool_assemble_decl ( )
   Output one variable, if necessary.  Return whether we output it.  
     Aliases are outout when their target is produced or by
     output_weakrefs.  
     Constant pool is output from RTL land when the reference
     survive till this level.  
     Decls with VALUE_EXPR should not be in the varpool at all.  They
     are not real variables, but just info for debugging and codegen.
     Unfortunately at the moment emutls is not updating varpool correctly
     after turning real vars into value_expr vars.  
     Hard register vars do not need to be output.  
static void varpool_call_node_removal_hooks ( )
static
   Call all node removal hooks.  

Referenced by varpool_node_for_decl().

void varpool_call_variable_insertion_hooks ( )
   Call all node insertion hooks.  

References SYMTAB_VARIABLE.

struct varpool_node* varpool_create_empty_node ( void  )
read
   Allocate new callgraph node and insert it into basic data structures.  
struct varpool_node* varpool_create_variable_alias ( )
read
   Attempt to mark ALIAS as an alias to DECL.  Return TRUE if successful.
   Extra name aliases are output whenever DECL is output.  

References AVAIL_OVERWRITABLE, cgraph_variable_initializer_availability(), IPA_REF_ALIAS, ipa_ref_referring_varpool_node(), symtab_node_base::ref_list, and varpool_for_node_and_aliases().

struct varpool_node* varpool_extra_name_alias ( )
read
   Attempt to mark ALIAS as an alias to DECL.  Return TRUE if successful.
   Extra name aliases are output whenever DECL is output.  
     If aliases aren't supported by the assembler, fail.  
     Extra name alias mechanizm creates aliases really late
     via DECL_ASSEMBLER_NAME mechanizm.
     This is unfortunate because they are not going through the
     standard channels.  Ensure they get output.  
void varpool_finalize_named_section_flags ( )
   For variables in named sections make sure get_variable_section
   is called before we switch to those sections.  Then section
   conflicts between read-only and read-only requiring relocations
   sections can be resolved.  
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().

struct varpool_node* varpool_node_for_asm ( )
read
   Given an assembler name, lookup node.  
struct varpool_node* varpool_node_for_decl ( )
read
   Return varpool node assigned to DECL.  Create new one when needed.  

References ctor_for_folding(), symtab_node_base::decl, symtab_unregister_node(), varpool_call_node_removal_hooks(), and varpool_remove_initializer().

bool varpool_output_variables ( void  )
void varpool_remove_initializer ( )
   Renove node initializer when it is no longer needed.  
         Keep vtables for BINFO folding.  
         FIXME: http://gcc.gnu.org/PR55395 
         When doing declaration merging we have duplicate
         entries for given decl.  Do not attempt to remove
         the boides, or we will end up remiving
         wrong one.  

References cgraph_availability_names, cgraph_function_flags_ready, cgraph_variable_initializer_availability(), ctor_for_folding(), symtab_node_base::decl, dump_symtab_base(), and varpool_node::output.

void varpool_remove_node ( )
   Remove node from the varpool.  
     Because we remove references from external functions before final compilation,
     we may end up removing useful constructors.
     FIXME: We probably want to trace boundaries better.  
void varpool_remove_node_removal_hook ( )
   Remove ENTRY from the list of hooks called on removing nodes.  
static void varpool_remove_unreferenced_decls ( )
static
   Optimization of function bodies might've rendered some variables as
   unnecessary so we want to avoid these from being compiled.  Re-do
   reachability starting from variables that are either externally visible
   or was referred from the asm output routines.  
                 We just expanded all function bodies.  See if any of
                 them needed the variable.  

References symtab_node_base::alias, symtab_node_base::analyzed, symtab_node_base::decl, dyn_cast(), enqueue_node(), and ipa_ref::referred.

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

References varpool_node_hook_list::data, first_varpool_variable_insertion_hook, varpool_node_hook_list::hook, and varpool_node_hook_list::next.


Variable Documentation

struct varpool_node_hook_list* first_varpool_node_removal_hook
   List of hooks triggered when a node is removed.  
struct varpool_node_hook_list* first_varpool_variable_insertion_hook
   List of hooks triggered when an variable is inserted.  

Referenced by varpool_remove_variable_insertion_hook().