GCC Middle and Back End API Reference
ipa-reference.c File Reference

Data Structures

struct  ipa_reference_local_vars_info_d
struct  ipa_reference_global_vars_info_d
struct  ipa_reference_optimization_summary_d
struct  ipa_reference_vars_info_d

Typedefs

typedef struct
ipa_reference_local_vars_info_d
ipa_reference_local_vars_info_t
typedef struct
ipa_reference_global_vars_info_d
ipa_reference_global_vars_info_t
typedef struct
ipa_reference_optimization_summary_d
ipa_reference_optimization_summary_t
typedef struct
ipa_reference_vars_info_d
ipa_reference_vars_info_t

Functions

static void remove_node_data (struct cgraph_node *node, void *data)
static void duplicate_node_data (struct cgraph_node *src, struct cgraph_node *dst, void *data)
static ipa_reference_vars_info_t get_reference_vars_info ()
static
ipa_reference_optimization_summary_t 
get_reference_optimization_summary ()
static void set_reference_vars_info (struct cgraph_node *node, ipa_reference_vars_info_t info)
static void set_reference_optimization_summary (struct cgraph_node *node, ipa_reference_optimization_summary_t info)
bitmap ipa_reference_get_not_read_global ()
bitmap ipa_reference_get_not_written_global ()
static void add_static_var ()
static bool is_proper_for_analysis ()
static const char * get_static_name ()
static void dump_static_vars_set_to_file ()
static bool union_static_var_sets ()
static bool intersect_static_var_sets ()
static bitmap copy_static_var_set ()
static void propagate_bits ()
static void ipa_init ()
static
ipa_reference_local_vars_info_t 
init_function_info ()
static void analyze_function ()
static void remove_node_data ()
static void generate_summary ()
static void read_write_all_from_decl (struct cgraph_node *node, bool &read_all, bool &write_all)
static void get_read_write_all_from_node (struct cgraph_node *node, bool &read_all, bool &write_all)
static unsigned int propagate ()
static bool write_node_summary_p (struct cgraph_node *node, lto_symtab_encoder_t encoder, bitmap ltrans_statics)
static void stream_out_bitmap (struct lto_simple_output_block *ob, bitmap bits, bitmap ltrans_statics, int ltrans_statics_bitcount)
static void ipa_reference_write_optimization_summary ()
static void ipa_reference_read_optimization_summary ()
static bool gate_reference ()
ipa_opt_pass_dmake_pass_ipa_reference ()

Variables

static splay_tree reference_vars_to_consider
static bitmap all_module_statics
static bitmap_obstack local_info_obstack
static bitmap_obstack optimization_summary_obstack
static struct
cgraph_2node_hook_list
node_duplication_hook_holder
static struct
cgraph_node_hook_list
node_removal_hook_holder
static vec
< ipa_reference_vars_info_t
ipa_reference_vars_vector
static vec
< ipa_reference_optimization_summary_t
ipa_reference_opt_sum_vector

Typedef Documentation


Function Documentation

static void add_static_var ( )
inlinestatic
Add VAR to all_module_statics and the two
   reference_vars_to_consider* sets.   

References bitmap_set_bit(), dump_file, and reference_vars_to_consider.

Referenced by is_proper_for_analysis().

static bitmap copy_static_var_set ( )
static
Return a copy of SET on the bitmap obstack containing SET.
   But if SET is NULL or the maximum set, return that instead.   

References bitmap_copy(), copy(), and bitmap_obstack::obstack.

Referenced by duplicate_node_data(), and propagate().

static void dump_static_vars_set_to_file ( )
static
Dump a set of static vars to FILE.   

References get_static_name().

Referenced by propagate().

static void duplicate_node_data ( struct cgraph_node src,
struct cgraph_node dst,
void *  data 
)
static
static bool gate_reference ( )
static

References seen_error().

static void get_read_write_all_from_node ( struct cgraph_node node,
bool &  read_all,
bool &  write_all 
)
static
static ipa_reference_optimization_summary_t get_reference_optimization_summary ( )
inlinestatic
static ipa_reference_vars_info_t get_reference_vars_info ( )
inlinestatic
Return the ipa_reference_vars structure starting from the cgraph NODE.   

References cgraph_node::uid.

Referenced by generate_summary(), propagate(), and propagate_bits().

static const char* get_static_name ( )
static
Lookup the tree node for the static variable that has UID and
   convert the name to a string for debugging.   

References fndecl_name(), and reference_vars_to_consider.

Referenced by dump_static_vars_set_to_file(), and generate_summary().

static bool intersect_static_var_sets ( )
static
Compute X &= Y, taking into account the possibility that
   X may become the maximum set.   

References all_module_statics, bitmap_and_into(), and bitmap_equal_p().

Referenced by propagate().

static void ipa_init ( )
static
The init routine for analyzing global static variable usage.  See
   comments at top for description.   

References bitmap_obstack_initialize(), cgraph_add_node_duplication_hook(), cgraph_add_node_removal_hook(), dump_file, duplicate_node_data(), reference_vars_to_consider, and remove_node_data().

Referenced by generate_summary().

bitmap ipa_reference_get_not_read_global ( )
Return a bitmap indexed by DECL_UID for the static variables that
   are *not* read during the execution of the function FN.  Returns
   NULL if no data is available.   

References all_module_statics, cgraph_function_node(), symtab_node_base::decl, flags_from_decl_or_type(), get_reference_optimization_summary(), ipa_reference_optimization_summary_d::statics_not_read, and cgraph_node::symbol.

Referenced by ref_maybe_used_by_call_p_1().

bitmap ipa_reference_get_not_written_global ( )
Return a bitmap indexed by DECL_UID for the static variables that
   are *not* written during the execution of the function FN.  Note
   that variables written may or may not be read during the function
   call.  Returns NULL if no data is available.   

References all_module_statics, symtab_node_base::decl, flags_from_decl_or_type(), get_reference_optimization_summary(), ipa_reference_optimization_summary_d::statics_not_written, and cgraph_node::symbol.

Referenced by call_may_clobber_ref_p_1().

static bool is_proper_for_analysis ( )
inlinestatic
Return true if the variable T is the right kind of static variable to
   perform compilation unit scope escape analysis.   

References add_static_var(), and bitmap_bit_p().

Referenced by analyze_function(), and propagate().

ipa_opt_pass_d* make_pass_ipa_reference ( )
static unsigned int propagate ( )
static
static void propagate_bits ( )
static
Compute the union all of the statics read and written by every callee of X
   into X_GLOBAL->statics_read and X_GLOBAL->statics_written.  X_GLOBAL is
   actually the set representing the cycle containing X.  If the read and
   written sets of X_GLOBAL has been reduced to the maximum set, we don't
   have to look at the remaining callees.   

References all_module_statics, AVAIL_OVERWRITABLE, cgraph_edge::callee, cgraph_node::callees, cgraph_edge_cannot_lead_to_return(), cgraph_function_node(), symtab_node_base::decl, flags_from_decl_or_type(), get_reference_vars_info(), ipa_reference_vars_info_d::global, cgraph_edge::next_callee, ipa_reference_global_vars_info_d::statics_read, ipa_reference_global_vars_info_d::statics_written, cgraph_node::symbol, and union_static_var_sets().

Referenced by propagate().

static void read_write_all_from_decl ( struct cgraph_node node,
bool &  read_all,
bool &  write_all 
)
static
static void remove_node_data ( struct cgraph_node node,
void *  data 
)
static
@verbatim Callgraph based analysis of static variables.

Copyright (C) 2004-2013 Free Software Foundation, Inc. Contributed by Kenneth Zadeck zadec.nosp@m.k@na.nosp@m.tural.nosp@m.brid.nosp@m.ge.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/.

This file gathers information about how variables whose scope is
   confined to the compilation unit are used.

   The transitive call site specific clobber effects are computed
   for the variables whose scope is contained within this compilation
   unit.

   First each function and static variable initialization is analyzed
   to determine which local static variables are either read, written,
   or have their address taken.  Any local static that has its address
   taken is removed from consideration.  Once the local read and
   writes are determined, a transitive closure of this information is
   performed over the call graph to determine the worst case set of
   side effects of each call.  In later parts of the compiler, these
   local and global sets are examined to make the call clobbering less
   traumatic, promote some statics to registers, and improve aliasing
   information.   
static void set_reference_optimization_summary ( struct cgraph_node node,
ipa_reference_optimization_summary_t  info 
)
inlinestatic
Return the ipa_reference_vars structure starting from the cgraph NODE.   

References cgraph_node::uid.

Referenced by duplicate_node_data(), ipa_reference_read_optimization_summary(), propagate(), and remove_node_data().

static void set_reference_vars_info ( struct cgraph_node node,
ipa_reference_vars_info_t  info 
)
inlinestatic
Return the ipa_reference_vars structure starting from the cgraph NODE.   

References cgraph_node::uid.

Referenced by init_function_info().

static void stream_out_bitmap ( struct lto_simple_output_block ob,
bitmap  bits,
bitmap  ltrans_statics,
int  ltrans_statics_bitcount 
)
static
Stream out BITS&LTRANS_STATICS as list of decls to OB.
   LTRANS_STATICS_BITCOUNT specify number of bits in LTRANS_STATICS
   or -1.  When it is positive, just output -1 when
   BITS&LTRANS_STATICS == BITS&LTRANS_STATICS.   

References count, lto_simple_output_block::decl_state, lto_output_var_decl_index(), lto_simple_output_block::main_stream, reference_vars_to_consider, and streamer_write_hwi_stream().

Referenced by ipa_reference_write_optimization_summary().

static bool union_static_var_sets ( )
static
Compute X |= Y, taking into account the possibility that
   either X or Y is already the maximum set.
   Return true if X is the maximum set after taking the union with Y.   

References all_module_statics, bitmap_equal_p(), and bitmap_ior_into().

Referenced by propagate(), and propagate_bits().


Variable Documentation

bitmap all_module_statics
static
Set of all interesting module statics.  A bit is set for every module
   static we are considering.  This is added to the local info when asm
   code is found that clobbers all memory.   

Referenced by intersect_static_var_sets(), ipa_reference_get_not_read_global(), ipa_reference_get_not_written_global(), ipa_reference_read_optimization_summary(), propagate(), propagate_bits(), and union_static_var_sets().

vec<ipa_reference_optimization_summary_t> ipa_reference_opt_sum_vector
static
vec<ipa_reference_vars_info_t> ipa_reference_vars_vector
static
Vector where the reference var infos are actually stored. 
   Indexed by UID of call graph nodes.   
bitmap_obstack local_info_obstack
static
Obstack holding bitmaps of local analysis (live from analysis to
   propagation)   
struct cgraph_2node_hook_list* node_duplication_hook_holder
static
Holders of ipa cgraph hooks:  
struct cgraph_node_hook_list* node_removal_hook_holder
static
bitmap_obstack optimization_summary_obstack
static
Obstack holding global analysis live forever.   
splay_tree reference_vars_to_consider
static
This splay tree contains all of the static variables that are
   being considered by the compilation level alias analysis.   

Referenced by add_static_var(), get_static_name(), ipa_init(), ipa_reference_write_optimization_summary(), propagate(), and stream_out_bitmap().