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

Data Structures

struct  searchc_env
struct  postorder_stack

Functions

void ipa_print_order (FILE *out, const char *note, struct cgraph_node **order, int count)
static void searchc (struct searchc_env *env, struct cgraph_node *v, bool(*ignore_edge)(struct cgraph_edge *))
int ipa_reduced_postorder (struct cgraph_node **order, bool reduce, bool allow_overwritable, bool(*ignore_edge)(struct cgraph_edge *))
void ipa_free_postorder_info ()
vec< cgraph_node_ptripa_get_nodes_in_cycle ()
bool ipa_edge_within_scc ()
int ipa_reverse_postorder ()
tree get_base_var ()
cgraph_node_set cgraph_node_set_new ()
void cgraph_node_set_add ()
void cgraph_node_set_remove ()
cgraph_node_set_iterator cgraph_node_set_find ()
void dump_cgraph_node_set ()
DEBUG_FUNCTION void debug_cgraph_node_set ()
void free_cgraph_node_set ()
varpool_node_set varpool_node_set_new ()
void varpool_node_set_add ()
void varpool_node_set_remove ()
varpool_node_set_iterator varpool_node_set_find ()
void dump_varpool_node_set ()
void free_varpool_node_set ()
DEBUG_FUNCTION void debug_varpool_node_set ()
void ipa_merge_profiles (struct cgraph_node *dst, struct cgraph_node *src)
bool recursive_call_p ()

Function Documentation

void cgraph_node_set_add ( )
   Add cgraph_node NODE to cgraph_node_set SET.  
     Insert into node vector.  
cgraph_node_set_iterator cgraph_node_set_find ( )
   Find NODE in SET and return an iterator to it if found.  A null iterator
   is returned if NODE is not in SET.  
cgraph_node_set cgraph_node_set_new ( void  )
   Create a new cgraph node set.  

References pointer_map_insert().

void cgraph_node_set_remove ( )
   Remove cgraph_node NODE from cgraph_node_set SET.  
     Remove from vector. We do this by swapping node with the last element
     of the vector.  
         Move the last element to the original spot of NODE.  
     Remove element from hash table.  

References pointer_map_contains().

DEBUG_FUNCTION void debug_cgraph_node_set ( )
   Dump content of SET to stderr.  
DEBUG_FUNCTION void debug_varpool_node_set ( )
void dump_cgraph_node_set ( )
   Dump content of SET to file F.  

References free(), and pointer_map_destroy().

void dump_varpool_node_set ( )
   Dump content of SET to file F.  

References cgraph_node::count, symtab_node_base::decl, and symtab_node_base::definition.

void free_cgraph_node_set ( )
   Free varpool node set.  

References pointer_map_insert().

void free_varpool_node_set ( )
   Free varpool node set.  

References cgraph_dump_file, cgraph_node_name(), and symtab_node_base::order.

tree get_base_var ( )
   Given a memory reference T, will return the variable at the bottom
   of the access.  Unlike get_base_address, this will recurse through
   INDIRECT_REFS.  

References cgraph_node_set_def::map, cgraph_node_set_def::nodes, and pointer_map_create().

bool ipa_edge_within_scc ( )
   Return true iff the CS is an edge within a strongly connected component as
   computed by ipa_reduced_postorder.  

Referenced by add_value_to_lattice().

void ipa_free_postorder_info ( void  )
   Deallocate all ipa_dfs_info structures pointed to by the aux pointer of call
   graph nodes.  
         Get rid of the aux information.  

References symtab_node_base::aux, and free().

vec<cgraph_node_ptr> ipa_get_nodes_in_cycle ( )
   Get the set of nodes for the cycle in the reduced call graph starting
   from NODE.  
void ipa_merge_profiles ( struct cgraph_node dst,
struct cgraph_node src 
)
   SRC and DST are going to be merged.  Take SRC's profile and merge it into
   DST so it is not going to be lost.  Destroy SRC's body on the way.  
     This is ugly.  We need to get both function bodies into memory.
     If declaration is merged, we need to duplicate it to be able
     to load body that is being replaced.  This makes symbol table
     temporarily inconsistent.  
         We are going to move the decl, we want to remove its file decl data.
         and link these with the new decl. 
         Duplicate the decl and be sure it does not link into body of DST.  
         Associate the decl state with new declaration, so LTO streamer
         can look it up.  
         TODO: merge also statement histograms.  
     TODO: if there is no match, we can scale up.  
void ipa_print_order ( FILE *  out,
const char *  note,
struct cgraph_node **  order,
int  count 
)
@verbatim 

Utilities for ipa analysis. Copyright (C) 2005-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/.

   Debugging function for postorder and inorder code. NOTE is a string
   that is printed before the nodes are printed.  ORDER is an array of
   cgraph_nodes that has COUNT useful nodes in it.  

References dump_cgraph_node(), and dump_file.

int ipa_reduced_postorder ( struct cgraph_node **  order,
bool  reduce,
bool  allow_overwritable,
bool(*)(struct cgraph_edge *)  ignore_edge 
)
   Topsort the call graph by caller relation.  Put the result in ORDER.

   The REDUCE flag is true if you want the cycles reduced to single nodes.
   You can use ipa_get_nodes_in_cycle to obtain a vector containing all real
   call graph nodes in a reduced node.

   Set ALLOW_OVERWRITABLE if nodes with such availability should be included.
   IGNORE_EDGE, if non-NULL is a hook that may make some edges insignificant
   for the topological sort.   
             Reuse the info if it is already there.  
int ipa_reverse_postorder ( )
   Fill array order with all nodes with output flag set in the reverse
   topological order.  Return the number of elements in the array.
   FIXME: While walking, consider aliases, too.  
     We have to deal with cycles nicely, so use a depth first traversal
     output algorithm.  Ignore the fact that some functions won't need
     to be output and put them into order as well, so we get dependencies
     right through inline functions.  
                         Break possible cycles involving always-inline
                         functions by ignoring edges from always-inline
                         functions to non-always-inline functions.  

References symtab_node_base::aux, cgraph_edge::callee, cgraph_edge::caller, cgraph_node::callers, cgraph_function_node(), symtab_node_base::decl, postorder_stack::edge, IPA_REF_ALIAS, ipa_ref_referring_node(), cgraph_edge::next_caller, postorder_stack::node, and postorder_stack::ref.

bool recursive_call_p ( )
   Return true if call to DEST is known to be self-recusive call withing FUNC.   
static void searchc ( struct searchc_env env,
struct cgraph_node v,
bool(*)(struct cgraph_edge *)  ignore_edge 
)
static
   This is an implementation of Tarjan's strongly connected region
   finder as reprinted in Aho Hopcraft and Ullman's The Design and
   Analysis of Computer Programs (1975) pages 192-193.  This version
   has been customized for cgraph_nodes.  The env parameter is because
   it is recursive and there are no nested functions here.  This
   function should only be called from itself or
   ipa_reduced_postorder.  ENV is a stack env and would be
   unnecessary if C had nested functions.  V is the node to start
   searching from.  
     mark node as old 

References searchc_env::allow_overwritable, symtab_node_base::aux, AVAIL_OVERWRITABLE, cgraph_edge::callee, cgraph_function_or_thunk_node(), ipa_dfs_info::dfn_number, ignore_edge(), ipa_dfs_info::low_link, ipa_dfs_info::new_node, and ipa_dfs_info::on_stack.

void varpool_node_set_add ( )
   Add varpool_node NODE to varpool_node_set SET.  
     Insert into node vector.  
varpool_node_set_iterator varpool_node_set_find ( )
   Find NODE in SET and return an iterator to it if found.  A null iterator
   is returned if NODE is not in SET.  

References free(), and pointer_map_destroy().

varpool_node_set varpool_node_set_new ( void  )
   Create a new varpool node set.  
void varpool_node_set_remove ( )
   Remove varpool_node NODE from varpool_node_set SET.  
     Remove from vector. We do this by swapping node with the last element
     of the vector.  
         Move the last element to the original spot of NODE.  
     Remove element from hash table.