GCC Middle and Back End API Reference
tree-ssa-structalias.c File Reference

Data Structures

struct  constraint_stats
struct  variable_info
struct  constraint_expr
struct  constraint
struct  constraint_graph
struct  scc_info
struct  topo_info
struct  equiv_class_label
struct  equiv_class_hasher
struct  fieldoff
struct  shared_bitmap_info
struct  shared_bitmap_hasher

Typedefs

typedef struct constraint_graphconstraint_graph_t
typedef struct constraintconstraint_t
typedef struct variable_infovarinfo_t
typedef struct constraint_expr ce_s
typedef struct equiv_class_labelequiv_class_label_t
typedef struct equiv_class_labelconst_equiv_class_label_t
typedef struct fieldoff fieldoff_s
typedef struct shared_bitmap_infoshared_bitmap_info_t
typedef struct shared_bitmap_infoconst_shared_bitmap_info_t

Enumerations

enum  {
  nothing_id = 1, anything_id = 2, readonly_id = 3, escaped_id = 4,
  nonlocal_id = 5, storedanything_id = 6, integer_id = 7
}
enum  constraint_expr_type { SCALAR, DEREF, ADDRESSOF }
enum  {
  fi_clobbers = 1, fi_uses = 2, fi_static_chain = 3, fi_result = 4,
  fi_parm_base = 5
}

Functions

static unsigned int create_variable_info_for (tree, const char *)
static void unify_nodes (constraint_graph_t, unsigned int, unsigned int, bool)
static varinfo_t first_vi_for_offset (varinfo_t, unsigned HOST_WIDE_INT)
static varinfo_t first_or_preceding_vi_for_offset (varinfo_t, unsigned HOST_WIDE_INT)
static varinfo_t lookup_vi_for_tree (tree)
static bool type_can_have_subvars (const_tree)
static varinfo_t get_varinfo ()
static varinfo_t vi_next ()
static varinfo_t new_var_info ()
static varinfo_t get_call_vi ()
static varinfo_t lookup_call_use_vi ()
static varinfo_t lookup_call_clobber_vi ()
static varinfo_t get_call_use_vi ()
static varinfo_t get_call_clobber_vi ()
static void get_constraint_for_1 (tree, vec< ce_s > *, bool, bool)
static void get_constraint_for (tree, vec< ce_s > *)
static void get_constraint_for_rhs (tree, vec< ce_s > *)
static void do_deref (vec< ce_s > *)
static unsigned int find ()
static bool unite ()
static constraint_t new_constraint (const struct constraint_expr lhs, const struct constraint_expr rhs)
static void dump_constraint ()
void debug_constraint (constraint_t)
void debug_constraints (void)
void debug_constraint_graph (void)
void debug_solution_for_var (unsigned int)
void debug_sa_points_to_info (void)
DEBUG_FUNCTION void debug_constraint ()
static void dump_constraints ()
static void dump_constraint_graph ()
static bool constraint_expr_equal ()
static bool constraint_expr_less ()
static bool constraint_less ()
static bool constraint_equal ()
static constraint_t constraint_vec_find (vec< constraint_t > vec, struct constraint lookfor)
static void constraint_set_union (vec< constraint_t > *to, vec< constraint_t > *from)
static void solution_set_expand ()
static bool set_union_with_increment ()
static void insert_into_complex (constraint_graph_t graph, unsigned int var, constraint_t c)
static void merge_node_constraints (constraint_graph_t graph, unsigned int to, unsigned int from)
static void clear_edges_for_node ()
static void merge_graph_nodes (constraint_graph_t graph, unsigned int to, unsigned int from)
static void add_implicit_graph_edge (constraint_graph_t graph, unsigned int to, unsigned int from)
static void add_pred_graph_edge (constraint_graph_t graph, unsigned int to, unsigned int from)
static bool add_graph_edge (constraint_graph_t graph, unsigned int to, unsigned int from)
static void init_graph ()
static void build_pred_graph ()
static void build_succ_graph ()
static void scc_visit ()
static struct topo_infoinit_topo_info ()
static void free_topo_info ()
static void topo_visit (constraint_graph_t graph, struct topo_info *ti, unsigned int n)
static void do_sd_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
static void do_ds_constraint ()
static void do_complex_constraint ()
static struct scc_infoinit_scc_info ()
static void free_scc_info ()
static void find_indirect_cycles ()
static void compute_topo_order (constraint_graph_t graph, struct topo_info *ti)
static equiv_class_labelequiv_class_lookup_or_add ()
static void condense_visit ()
static void label_visit ()
static void dump_pred_graph ()
static struct scc_infoperform_var_substitution ()
static void free_var_substitution_info ()
static unsigned int find_equivalent_node (constraint_graph_t graph, unsigned int node, unsigned int label)
static void unite_pointer_equivalences ()
static void move_complex_constraints ()
static void rewrite_constraints (constraint_graph_t graph, struct scc_info *si)
static bool eliminate_indirect_cycles ()
static void solve_graph ()
static void insert_vi_for_tree ()
static varinfo_t lookup_vi_for_tree ()
static const char * alias_get_name ()
static varinfo_t get_vi_for_tree ()
static struct constraint_expr new_scalar_tmp_constraint_exp ()
static void get_constraint_for_ssa_var ()
static void process_constraint ()
static HOST_WIDE_INT bitpos_of_field ()
static void get_constraint_for_ptr_offset (tree ptr, tree offset, vec< ce_s > *results)
static void get_constraint_for_component_ref (tree t, vec< ce_s > *results, bool address_p, bool lhs_p)
static void do_deref ()
static void get_constraint_for_address_of ()
static void get_constraint_for ()
static void get_constraint_for_rhs ()
static void process_all_all_constraints (vec< ce_s > lhsc, vec< ce_s > rhsc)
static void do_structure_copy ()
static void make_constraints_to ()
static void make_constraint_to ()
static void make_constraint_from ()
static void make_copy_constraint ()
static void make_escape_constraint ()
static void make_transitive_closure_constraints ()
static tree build_fake_var_decl ()
static varinfo_t make_heapvar ()
static varinfo_t make_constraint_from_restrict ()
static varinfo_t make_constraint_from_global_restrict ()
static struct constraint_expr get_function_part_constraint ()
static void handle_rhs_call ()
static void handle_lhs_call (gimple stmt, tree lhs, int flags, vec< ce_s > rhsc, tree fndecl)
static void handle_const_call ()
static void handle_pure_call ()
static varinfo_t get_fi_for_callee ()
static bool find_func_aliases_for_builtin_call ()
static void find_func_aliases_for_call ()
static void find_func_aliases ()
static void process_ipa_clobber ()
static void find_func_clobbers ()
static varinfo_t first_vi_for_offset ()
static int fieldoff_compare ()
static void sort_fieldstack ()
static bool type_can_have_subvars ()
static bool var_can_have_subvars ()
static bool type_must_have_pointers ()
static bool field_must_have_pointers ()
static bool push_fields_onto_fieldstack (tree type, vec< fieldoff_s > *fieldstack, HOST_WIDE_INT offset)
static unsigned int count_num_arguments ()
static varinfo_t create_function_info_for ()
static bool check_for_overlaps ()
static varinfo_t create_variable_info_for_1 ()
static unsigned int create_variable_info_for ()
static void dump_solution_for_var ()
DEBUG_FUNCTION void debug_solution_for_var ()
static void intra_create_variable_infos ()
static bitmap shared_bitmap_lookup ()
static void shared_bitmap_add ()
static void set_uids_in_ptset ()
static struct pt_solution find_what_var_points_to ()
static void find_what_p_points_to ()
void dump_pta_stats ()
void pt_solution_reset ()
void pt_solution_set ()
void pt_solution_set_var ()
static void pt_solution_ior_into ()
bool pt_solution_empty_p ()
bool pt_solution_singleton_p ()
bool pt_solution_includes_global ()
static bool pt_solution_includes_1 ()
bool pt_solution_includes ()
static bool pt_solutions_intersect_1 ()
bool pt_solutions_intersect ()
static void dump_sa_points_to_info ()
static void init_base_vars ()
static void init_alias_vars ()
static void remove_preds_and_fake_succs ()
static void solve_constraints ()
static void compute_points_to_sets ()
static void delete_points_to_sets ()
unsigned int compute_may_aliases ()
static bool gate_tree_pta ()
gimple_opt_passmake_pass_build_alias ()
gimple_opt_passmake_pass_build_ealias ()
static bool gate_ipa_pta ()
static bool associate_varinfo_to_alias ()
static unsigned int ipa_pta_execute ()
simple_ipa_opt_passmake_pass_ipa_pta ()

Variables

static bool use_field_sensitive = true
static int in_ipa_mode = 0
static bitmap_obstack predbitmap_obstack
static bitmap_obstack pta_obstack
static bitmap_obstack oldpta_obstack
static bitmap_obstack iteration_obstack
static struct constraint_stats stats
static alloc_pool variable_info_pool
static pointer_map_tfinal_solutions
struct obstack final_solutions_obstack
static vec< varinfo_tvarmap
static struct pointer_map_tcall_stmt_vars
static vec< constraint_tconstraints
static alloc_pool constraint_pool
static constraint_graph_t graph
static bitmap changed
static hash_table
< equiv_class_hasher
pointer_equiv_class_table
static hash_table
< equiv_class_hasher
location_equiv_class_table
static int pointer_equiv_class
static int location_equiv_class
static struct pointer_map_tvi_for_tree
struct obstack fake_var_decl_obstack
static hash_table
< shared_bitmap_hasher
shared_bitmap_table
struct {
   unsigned HOST_WIDE_INT   pt_solution_includes_may_alias
   unsigned HOST_WIDE_INT   pt_solution_includes_no_alias
   unsigned HOST_WIDE_INT   pt_solutions_intersect_may_alias
   unsigned HOST_WIDE_INT   pt_solutions_intersect_no_alias
pta_stats
struct pt_solution ipa_escaped_pt = { true, false, false, false, false, false, NULL }

Typedef Documentation

typedef struct constraint_expr ce_s
typedef struct constraint* constraint_t
Structure used to for hash value numbering of pointer equivalence
   classes.   
typedef struct fieldoff fieldoff_s
Structure used to put solution bitmaps in a hashtable so they can
   be shared among variables with the same points-to set.   
typedef struct variable_info* varinfo_t

Enumeration Type Documentation

anonymous enum
Static IDs for the special variables.  Variable ID zero is unused
   and used as terminator for the sub-variable chain.   
Enumerator:
nothing_id 
anything_id 
readonly_id 
escaped_id 
nonlocal_id 
storedanything_id 
integer_id 
anonymous enum
In IPA mode there are varinfos for different aspects of reach
   function designator.  One for the points-to set of the return
   value, one for the variables that are clobbered by the function,
   one for its uses and one for each parameter (including a single
   glob for remaining variadic arguments).   
Enumerator:
fi_clobbers 
fi_uses 
fi_static_chain 
fi_result 
fi_parm_base 
Enumerator:
SCALAR 
DEREF 
ADDRESSOF 

Function Documentation

static bool add_graph_edge ( constraint_graph_t  graph,
unsigned int  to,
unsigned int  from 
)
static
Add a graph edge to GRAPH, going from FROM to TO if
   it doesn't exist in the graph already.
   Return false if the edge already existed, true otherwise.   

References bitmap_set_bit(), constraint_stats::num_edges, stats, and constraint_graph::succs.

Referenced by build_succ_graph(), do_ds_constraint(), and do_sd_constraint().

static void add_implicit_graph_edge ( constraint_graph_t  graph,
unsigned int  to,
unsigned int  from 
)
static
Add an indirect graph edge to GRAPH, going from TO to FROM if
   it doesn't exist in the graph already.   

References bitmap_set_bit(), constraint_graph::implicit_preds, constraint_stats::num_implicit_edges, and stats.

Referenced by build_pred_graph().

static void add_pred_graph_edge ( constraint_graph_t  graph,
unsigned int  to,
unsigned int  from 
)
static
Add a predecessor graph edge to GRAPH, going from TO to FROM if
   it doesn't exist in the graph already.
   Return false if the edge already existed, true otherwise.   

References bitmap_set_bit(), and constraint_graph::preds.

Referenced by build_pred_graph().

static const char* alias_get_name ( )
static
Return a printable name for DECL   

References dump_file, free(), and get_name().

Referenced by get_vi_for_tree(), and ipa_pta_execute().

static bool associate_varinfo_to_alias ( )
static
Associate node with varinfo DATA. Worker for
   cgraph_for_node_and_aliases.   

References symtab_node_base::alias, symtab_node_base::analyzed, symtab_node_base::decl, insert_vi_for_tree(), cgraph_node::symbol, cgraph_node::thunk, and cgraph_thunk_info::thunk_p.

Referenced by ipa_pta_execute().

static HOST_WIDE_INT bitpos_of_field ( )
static
Return the position, in bits, of FIELD_DECL from the beginning of its
   structure.   

References host_integerp().

Referenced by push_fields_onto_fieldstack().

static tree build_fake_var_decl ( )
static
Build a fake VAR_DECL acting as referrer to a DECL_UID.   

References allocate_decl_uid(), fake_var_decl_obstack, layout_decl(), memset(), and type().

Referenced by create_function_info_for(), intra_create_variable_infos(), and make_heapvar().

static bool check_for_overlaps ( )
static
Return true if FIELDSTACK contains fields that overlap.
   FIELDSTACK is assumed to be sorted by offset.   

References HOST_WIDE_INT, and fieldoff::offset.

Referenced by create_variable_info_for_1().

static void clear_edges_for_node ( )
static
Remove edges involving NODE from GRAPH.   

References constraint_graph::succs.

Referenced by merge_graph_nodes(), and perform_var_substitution().

unsigned int compute_may_aliases ( void  )
Compute points-to information for every SSA_NAME pointer in the
   current function and compute the transitive closure of escaped
   variables to re-initialize the call-clobber states of local variables.   

References cfun, compute_points_to_sets(), delete_points_to_sets(), dump_alias_info(), dump_file, function::gimple_df, gimple_df::ipa_pta, and need_ssa_update_p().

Referenced by execute_function_todo().

static void compute_topo_order ( constraint_graph_t  graph,
struct topo_info ti 
)
static
Compute a topological ordering for GRAPH, and store the result in the
   topo_info structure TI.   

References bitmap_bit_p(), find(), constraint_graph::size, topo_visit(), and topo_info::visited.

Referenced by solve_graph().

static bool constraint_equal ( )
static
Return true if two constraints A and B are equal.   

References constraint_expr_equal(), constraint::lhs, and constraint::rhs.

Referenced by constraint_vec_find(), and insert_into_complex().

static bool constraint_expr_equal ( )
static
SOLVER FUNCTIONS

   The solver is a simple worklist solver, that works on the following
   algorithm:

   sbitmap changed_nodes = all zeroes;
   changed_count = 0;
   For each node that is not already collapsed:
       changed_count++;
       set bit in changed nodes

   while (changed_count > 0)
   {
     compute topological ordering for constraint graph

     find and collapse cycles in the constraint graph (updating
     changed if necessary)

     for each node (n) in the graph in topological order:
       changed_count--;

       Process each complex constraint associated with the node,
       updating changed if necessary.

       For each outgoing edge from n, propagate the solution from n to
       the destination of the edge, updating changed as necessary.

   }   
Return true if two constraint expressions A and B are equal.   

References constraint_expr::offset, constraint_expr::type, and constraint_expr::var.

Referenced by constraint_equal().

static bool constraint_expr_less ( )
static
Return true if constraint expression A is less than constraint expression
   B.  This is just arbitrary, but consistent, in order to give them an
   ordering.   

References constraint_expr::offset, constraint_expr::type, and constraint_expr::var.

Referenced by constraint_less().

static bool constraint_less ( )
static
Return true if constraint A is less than constraint B.  This is just
   arbitrary, but consistent, in order to give them an ordering.   

References constraint_expr_less(), constraint::lhs, and constraint::rhs.

Referenced by constraint_set_union(), constraint_vec_find(), and insert_into_complex().

static void constraint_set_union ( vec< constraint_t > *  to,
vec< constraint_t > *  from 
)
static
Union two constraint vectors, TO and FROM.  Put the result in TO.   

References constraint_less(), and constraint_vec_find().

Referenced by merge_node_constraints().

static constraint_t constraint_vec_find ( vec< constraint_t vec,
struct constraint  lookfor 
)
static
Find a constraint LOOKFOR in the sorted constraint vector VEC  

References constraint_equal(), and constraint_less().

Referenced by constraint_set_union().

static unsigned int count_num_arguments ( )
static
Count the number of arguments DECL has, and set IS_VARARGS to true
   if it is a varargs function.   

Referenced by create_function_info_for().

static unsigned int create_variable_info_for ( tree  ,
const char *   
)
static

Referenced by get_vi_for_tree().

void debug_constraint ( constraint_t  )
DEBUG_FUNCTION void debug_constraint ( )
Print out constraint C to stderr.   

References dump_constraint().

DEBUG_FUNCTION void debug_constraint_graph ( )
Print out the constraint graph to stderr.   

References dump_constraint_graph().

DEBUG_FUNCTION void debug_constraints ( )
Print out all constraints to stderr.   

References dump_constraints().

DEBUG_FUNCTION void debug_sa_points_to_info ( )
Debug points-to information to stderr.   

References dump_sa_points_to_info().

void debug_solution_for_var ( unsigned  int)
DEBUG_FUNCTION void debug_solution_for_var ( )
Print the points-to solution for VAR to stdout.   

References dump_solution_for_var().

static void do_complex_constraint ( )
static
Handle a non-simple (simple meaning requires no iteration),
   constraint (IE *x = &y, x = *y, *x = y, and x = y with offsets involved).   

References ADDRESSOF, bitmap_set_bit(), DEREF, do_ds_constraint(), do_sd_constraint(), get_varinfo(), variable_info::is_special_var, constraint::lhs, constraint_expr::offset, constraint::rhs, SCALAR, set_union_with_increment(), variable_info::solution, constraint_expr::type, and constraint_expr::var.

Referenced by solve_graph().

static void do_deref ( vec< ce_s > *  )
static
static void do_deref ( )
static
Dereference the constraint expression CONS, and return the result.
   DEREF (ADDRESSOF) = SCALAR
   DEREF (SCALAR) = DEREF
   DEREF (DEREF) = (temp = DEREF1; result = DEREF(temp))
   This is needed so that we can handle dereferencing DEREF constraints.   

References ADDRESSOF, DEREF, new_constraint(), new_scalar_tmp_constraint_exp(), process_constraint(), SCALAR, constraint_expr::type, and constraint_expr::var.

static void dump_constraint_graph ( )
static
static void dump_constraints ( )
static
Print out all constraints to FILE  

References dump_constraint().

Referenced by compute_points_to_sets(), debug_constraints(), and ipa_pta_execute().

static void dump_pred_graph ( )
static
void dump_pta_stats ( )
static void dump_solution_for_var ( )
static
Print out the points-to solution for VAR to FILE.   

References find(), get_varinfo(), variable_info::id, variable_info::name, and variable_info::solution.

Referenced by debug_solution_for_var(), and dump_sa_points_to_info().

static bool eliminate_indirect_cycles ( )
static
Eliminate indirect cycles involving NODE.  Return true if NODE was
   part of an SCC, false otherwise.   

References bitmap_empty_p(), find(), get_varinfo(), constraint_graph::indirect_cycles, queue, unify_nodes(), unite(), and vNULL.

Referenced by solve_graph().

static equiv_class_label* equiv_class_lookup_or_add ( )
static
Lookup a equivalence class in TABLE by the bitmap of LABELS with
   hash HAS it contains.  Sets *REF_LABELS to the bitmap LABELS
   is equivalent to.   

References bitmap_hash(), hash_table< Descriptor, Allocator >::find_slot_with_hash(), equiv_class_label::hashcode, and equiv_class_label::labels.

Referenced by label_visit(), and perform_var_substitution().

static bool field_must_have_pointers ( )
static
static int fieldoff_compare ( )
static
qsort comparison function for two fieldoff's PA and PB  

References HOST_WIDE_INT, fieldoff::offset, and fieldoff::size.

Referenced by sort_fieldstack().

static unsigned int find ( )
static
static unsigned int find_equivalent_node ( constraint_graph_t  graph,
unsigned int  node,
unsigned int  label 
)
static
Return an existing node that is equivalent to NODE, which has
   equivalence class LABEL, if one exists.  Return NODE otherwise.   

References constraint_graph::address_taken, bitmap_bit_p(), constraint_graph::eq_rep, constraint_graph::pe, constraint_graph::pe_rep, unify_nodes(), and unite().

Referenced by rewrite_constraints().

static void find_indirect_cycles ( )
static
Find indirect cycles in GRAPH that occur, using strongly connected
   components, and note them in the indirect cycles map.

   This technique comes from Ben Hardekopf and Calvin Lin,
   "It Pays to be Lazy: Fast and Accurate Pointer Analysis for Millions of
   Lines of Code", submitted to PLDI 2007.   

References bitmap_bit_p(), find(), free_scc_info(), init_scc_info(), scc_visit(), si, constraint_graph::size, and scc_info::visited.

Referenced by solve_constraints().

static void find_what_p_points_to ( )
static
Given a pointer variable P, fill in its points-to set.   

References find_what_var_points_to(), get_ptr_info(), lookup_vi_for_tree(), and ptr_info_def::pt.

Referenced by compute_points_to_sets(), and ipa_pta_execute().

static varinfo_t first_or_preceding_vi_for_offset ( varinfo_t  start,
unsigned HOST_WIDE_INT  offset 
)
static
Find the first varinfo in the same variable as START that overlaps with
   OFFSET.  If there is no such varinfo the varinfo directly preceding
   OFFSET is returned.   

References get_varinfo(), variable_info::head, variable_info::next, variable_info::offset, variable_info::size, and vi_next().

Referenced by get_constraint_for_ptr_offset(), and set_union_with_increment().

static varinfo_t first_vi_for_offset ( varinfo_t  ,
unsigned  HOST_WIDE_INT 
)
static
static varinfo_t first_vi_for_offset ( )
static
Find the first varinfo in the same variable as START that overlaps with
   OFFSET.  Return NULL if we can't find one.   

References variable_info::fullsize, get_varinfo(), variable_info::head, variable_info::offset, variable_info::size, and vi_next().

static void free_scc_info ( )
static
static void free_topo_info ( )
static
Free the topological sort info pointed to by TI.   

References free(), sbitmap_free(), topo_info::topo_order, and topo_info::visited.

Referenced by solve_graph().

static bool gate_ipa_pta ( )
static
Return true if we should execute IPA PTA.   

References seen_error().

static bool gate_tree_pta ( )
static
static varinfo_t get_call_clobber_vi ( )
static
Lookup or create the variable for the call statement CALL representing
   the clobbers.   

References get_call_vi(), and vi_next().

Referenced by find_func_aliases_for_builtin_call(), and handle_rhs_call().

static varinfo_t get_call_use_vi ( )
static
Lookup or create the variable for the call statement CALL representing
   the uses.   

References get_call_vi().

Referenced by handle_const_call(), handle_pure_call(), and handle_rhs_call().

static varinfo_t get_call_vi ( )
static
static void get_constraint_for ( tree  ,
vec< ce_s > *   
)
static
static void get_constraint_for ( )
static
Given a gimple tree T, return the constraint expression vector for it.   

References get_constraint_for_1().

static void get_constraint_for_address_of ( )
static
Given a tree T, return the constraint expression for taking the
   address of it.   

References ADDRESSOF, DEREF, get_constraint_for_1(), SCALAR, and constraint_expr::type.

Referenced by find_func_aliases_for_call(), find_func_clobbers(), get_constraint_for_1(), and handle_rhs_call().

static void get_constraint_for_component_ref ( tree  t,
vec< ce_s > *  results,
bool  address_p,
bool  lhs_p 
)
static
Given a COMPONENT_REF T, return the constraint_expr vector for it.
   If address_p is true the result will be taken its address of.
   If lhs_p is true then the constraint expression is assumed to be used
   as the lhs.   

References ADDRESSOF, anything_id, DEREF, dump_file, dump_flags, variable_info::fullsize, get_constraint_for_1(), get_ref_base_and_extent(), get_varinfo(), handled_component_p(), HOST_WIDE_INT, variable_info::id, integer_id, integer_zerop(), variable_info::is_full_var, variable_info::next, variable_info::offset, constraint_expr::offset, ranges_overlap_p(), SCALAR, variable_info::size, constraint_expr::type, constraint_expr::var, and vi_next().

Referenced by get_constraint_for_1().

static void get_constraint_for_rhs ( )
static
Given a gimple tree T, return the constraint expression vector for it
   to be used as the rhs of a constraint.   

References get_constraint_for_1().

static void get_constraint_for_ssa_var ( )
static
static varinfo_t get_fi_for_callee ( )
static
static struct constraint_expr get_function_part_constraint ( )
staticread
static varinfo_t get_vi_for_tree ( )
static
Find the variable id for tree T in the map.
   If T doesn't exist in the map, create an entry for it and return it.   

References alias_get_name(), create_variable_info_for(), get_varinfo(), and pointer_map_contains().

Referenced by find_func_aliases(), find_func_aliases_for_builtin_call(), get_constraint_for_ssa_var(), get_fi_for_callee(), intra_create_variable_infos(), and ipa_pta_execute().

static void handle_const_call ( )
static
static void handle_lhs_call ( gimple  stmt,
tree  lhs,
int  flags,
vec< ce_s rhsc,
tree  fndecl 
)
static
static void handle_pure_call ( )
static
static void init_graph ( )
static
static struct scc_info* init_scc_info ( )
staticread
static struct topo_info* init_topo_info ( )
staticread
Initialize and return a topological info structure.   

References bitmap_clear(), sbitmap_alloc(), constraint_graph::size, topo_info::topo_order, and topo_info::visited.

Referenced by solve_graph().

static void insert_into_complex ( constraint_graph_t  graph,
unsigned int  var,
constraint_t  c 
)
static
Insert constraint C into the list of complex constraints for graph
   node VAR.   

References constraint_graph::complex, constraint_equal(), and constraint_less().

Referenced by move_complex_constraints().

static void insert_vi_for_tree ( )
static
Insert ID as the variable id for tree T in the vi_for_tree map.   

References pointer_map_insert().

Referenced by associate_varinfo_to_alias(), create_function_info_for(), create_variable_info_for(), intra_create_variable_infos(), and make_heapvar().

static unsigned int ipa_pta_execute ( )
static
Execute the driver for IPA PTA.   

References symtab_node_base::alias, alias_get_name(), symtab_node_base::analyzed, pt_solution::anything, anything_id, associate_varinfo_to_alias(), bitmap_bit_p(), cgraph_edge::call_stmt, cgraph_node::callers, cgraph_for_node_and_aliases(), cgraph_function_with_gimple_body_p(), cgraph_get_body(), cgraph_node_name(), cgraph_node::clone_of, create_function_info_for(), symtab_node_base::decl, delete_points_to_sets(), dump_constraints(), dump_file, dump_flags, dump_symtab(), escaped_id, symtab_node_base::externally_visible, fi_clobbers, fi_result, fi_uses, find(), find_func_aliases(), find_func_clobbers(), find_what_p_points_to(), find_what_var_points_to(), first_vi_for_offset(), symtab_node_base::force_output, get_fi_for_callee(), get_varinfo(), get_vi_for_tree(), gimple_call_clobber_set(), gimple_call_flags(), gimple_call_fndecl(), gimple_call_use_set(), function::gimple_df, gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), variable_info::id, in_ipa_mode, init_alias_vars(), intra_create_variable_infos(), pt_solution::ipa_escaped, ipa_escaped_pt, gimple_df::ipa_pta, variable_info::is_fn_info, is_gimple_call(), lookup_call_clobber_vi(), lookup_call_use_vi(), lookup_vi_for_tree(), memset(), new_constraint(), cgraph_edge::next_caller, pt_solution::nonlocal, nonlocal_id, variable_info::offset, constraint_expr::offset, pop_cfun(), process_constraint(), pt_solution_ior_into(), pt_solution_reset(), push_cfun(), SCALAR, variable_info::solution, solve_constraints(), gimple_df::ssa_names, cgraph_node::symbol, varpool_node::symbol, constraint_expr::type, symtab_node_base::used_from_other_partition, constraint_expr::var, and virtual_operand_p().

static varinfo_t lookup_call_clobber_vi ( )
static
Lookup the variable for the call statement CALL representing
   the clobbers.  Returns NULL if there is nothing special about this call.   

References lookup_call_use_vi(), and vi_next().

Referenced by compute_points_to_sets(), find_func_clobbers(), and ipa_pta_execute().

static varinfo_t lookup_call_use_vi ( )
static
Lookup the variable for the call statement CALL representing
   the uses.  Returns NULL if there is nothing special about this call.   

References pointer_map_contains().

Referenced by compute_points_to_sets(), find_func_clobbers(), ipa_pta_execute(), and lookup_call_clobber_vi().

static varinfo_t lookup_vi_for_tree ( )
static
Find the variable info for tree T in VI_FOR_TREE.  If T does not
   exist in the map, return NULL, otherwise, return the varinfo we found.   

References pointer_map_contains().

static varinfo_t make_constraint_from_global_restrict ( )
static
Create a new artificial heap variable with NAME and make a
   constraint from it to LHS.  Set flags according to a tag used
   for tracking restrict pointers and make the artificial heap
   point to global memory.   

References make_constraint_from_restrict(), make_copy_constraint(), and nonlocal_id.

Referenced by create_variable_info_for(), and intra_create_variable_infos().

static varinfo_t make_constraint_from_restrict ( )
static
Create a new artificial heap variable with NAME and make a
   constraint from it to LHS.  Set flags according to a tag used
   for tracking restrict pointers.   

References variable_info::id, variable_info::is_global_var, make_constraint_from(), make_heapvar(), and variable_info::may_have_pointers.

Referenced by make_constraint_from_global_restrict().

static void make_constraint_to ( )
static
static void make_constraints_to ( )
static
static void make_escape_constraint ( )
static
Make constraints necessary to make OP escape.   

References escaped_id, and make_constraint_to().

Referenced by find_func_aliases(), and handle_rhs_call().

gimple_opt_pass* make_pass_build_alias ( )
gimple_opt_pass* make_pass_build_ealias ( )
simple_ipa_opt_pass* make_pass_ipa_pta ( )
static void make_transitive_closure_constraints ( )
static
Add constraints to that the solution of VI is transitively closed.   

References DEREF, variable_info::id, new_constraint(), constraint_expr::offset, process_constraint(), SCALAR, constraint_expr::type, and constraint_expr::var.

Referenced by handle_const_call(), handle_pure_call(), and handle_rhs_call().

static void merge_graph_nodes ( constraint_graph_t  graph,
unsigned int  to,
unsigned int  from 
)
static
Merge GRAPH nodes FROM and TO into node TO.   

References bitmap_ior_into(), clear_edges_for_node(), constraint_graph::indirect_cycles, and constraint_graph::succs.

Referenced by unify_nodes().

static void merge_node_constraints ( constraint_graph_t  graph,
unsigned int  to,
unsigned int  from 
)
static
Condense two variable nodes into a single variable node, by moving
   all associated info from SRC to TO.   

References constraint_graph::complex, constraint_set_union(), DEREF, find(), constraint::lhs, constraint::rhs, constraint_expr::type, and constraint_expr::var.

Referenced by unify_nodes().

static void move_complex_constraints ( )
static
static struct constraint_expr new_scalar_tmp_constraint_exp ( )
staticread
Get a scalar constraint expression for a new temporary variable.   

References new_var_info(), constraint_expr::offset, SCALAR, constraint_expr::type, and constraint_expr::var.

Referenced by do_deref(), process_all_all_constraints(), and process_constraint().

static void process_all_all_constraints ( vec< ce_s lhsc,
vec< ce_s rhsc 
)
static
Efficiently generates constraints from all entries in *RHSC to all
   entries in *LHSC.   

References new_constraint(), new_scalar_tmp_constraint_exp(), and process_constraint().

Referenced by do_structure_copy(), find_func_aliases(), find_func_aliases_for_builtin_call(), and handle_lhs_call().

static void process_ipa_clobber ( )
static
Create a constraint adding to the clobber set of FI the memory
   pointed to by PTR.   

References fi_clobbers, get_constraint_for_rhs(), get_function_part_constraint(), new_constraint(), process_constraint(), and vNULL.

Referenced by find_func_clobbers().

bool pt_solution_includes ( )
static bool pt_solution_includes_1 ( )
static
static void pt_solution_ior_into ( )
static
Computes the union of the points-to solutions *DEST and *SRC and
   stores the result in *DEST.  This changes the points-to bitmap
   of *DEST and thus may not be used if that might be shared.
   The points-to bitmap of *SRC and *DEST will not be shared after
   this function if they were not before.   

References pt_solution::anything, bitmap_ior_into(), pt_solution::escaped, pt_solution::ipa_escaped, pt_solution::nonlocal, pt_solution::null, pt_solution_reset(), pt_solution::vars, and pt_solution::vars_contains_global.

Referenced by ipa_pta_execute().

void pt_solution_reset ( )
Reset the points-to solution *PT to a conservative default
   (point to anything).   

References pt_solution::anything, and memset().

void pt_solution_set ( )
Set the points-to solution *PT to point only to the variables
   in VARS.  VARS_CONTAINS_GLOBAL specifies whether that contains
   global variables and VARS_CONTAINS_RESTRICT specifies whether
   it contains restrict tag variables.   

References memset(), pt_solution::vars, and pt_solution::vars_contains_global.

void pt_solution_set_var ( )
Set the points-to solution *PT to point only to the variable VAR.   

References bitmap_set_bit(), is_global_var(), memset(), pt_solution::vars, and pt_solution::vars_contains_global.

bool pt_solution_singleton_p ( )
Return true if the points-to solution *PT only point to a single var, and
   return the var uid in *UID.   

References pt_solution::anything, bitmap_first_set_bit(), bitmap_single_bit_set_p(), pt_solution::escaped, pt_solution::ipa_escaped, pt_solution::nonlocal, pt_solution::null, and pt_solution::vars.

bool pt_solutions_intersect ( )
static bool pt_solutions_intersect_1 ( )
static
static bool push_fields_onto_fieldstack ( tree  type,
vec< fieldoff_s > *  fieldstack,
HOST_WIDE_INT  offset 
)
static
Given a TYPE, and a vector of field offsets FIELDSTACK, push all
   the fields of TYPE onto fieldstack, recording their offsets along
   the way.

   OFFSET is used to keep track of the offset in this entire
   structure, rather than just the immediately containing structure.
   Returns false if the caller is supposed to handle the field we
   recursed for.   

References bitpos_of_field(), field_must_have_pointers(), fieldoff::has_unknown_size, host_integerp(), HOST_WIDE_INT, integer_zerop(), fieldoff::may_have_pointers, fieldoff::must_have_pointers, fieldoff::offset, fieldoff::only_restrict_pointers, fieldoff::size, and var_can_have_subvars().

Referenced by create_variable_info_for_1().

static void remove_preds_and_fake_succs ( )
static
Remove the REF and ADDRESS edges from GRAPH, as well as all the
   predecessor edges.   

References bitmap_clear_range(), bitmap_obstack_release(), free(), constraint_graph::implicit_preds, constraint_graph::preds, constraint_graph::size, and constraint_graph::succs.

Referenced by solve_constraints().

static void rewrite_constraints ( constraint_graph_t  graph,
struct scc_info si 
)
static
Optimize and rewrite complex constraints while performing
   collapsing of equivalent nodes.  SI is the SCC_INFO that is the
   result of perform_variable_substitution.   

References dump_constraint(), dump_file, dump_flags, find(), find_equivalent_node(), get_varinfo(), constraint::lhs, variable_info::name, scc_info::node_mapping, constraint_graph::pointer_label, constraint::rhs, constraint_graph::size, and constraint_expr::var.

Referenced by solve_constraints().

static void scc_visit ( )
static
Recursive routine to find strongly connected components in GRAPH.
   SI is the SCC info to store the information in, and N is the id of current
   graph node we are processing.

   This is Tarjan's strongly connected component finding algorithm, as
   modified by Nuutila to keep only non-root nodes on the stack.
   The algorithm can be found in "On finding the strongly connected
   connected components in a directed graph" by Esko Nuutila and Eljas
   Soisalon-Soininen, in Information Processing Letters volume 49,
   number 1, pages 9-14.   

References bitmap_bit_p(), bitmap_first_set_bit(), bitmap_set_bit(), scc_info::current_index, scc_info::deleted, scc_info::dfs, find(), constraint_graph::indirect_cycles, scc_info::scc_stack, constraint_graph::succs, unify_nodes(), unite(), and scc_info::visited.

Referenced by find_indirect_cycles().

static void set_uids_in_ptset ( )
static
static void shared_bitmap_add ( )
static
static bitmap shared_bitmap_lookup ( )
static
Lookup a bitmap in the shared bitmap hashtable, and return an already
   existing instance if there is one, NULL otherwise.   

References bitmap_hash(), hash_table< Descriptor, Allocator >::find_slot_with_hash(), shared_bitmap_info::hashcode, and shared_bitmap_info::pt_vars.

Referenced by find_what_var_points_to().

static void solution_set_expand ( )
static
static void solve_graph ( )
static
Solve the constraint graph GRAPH using our worklist solver.
   This is based on the PW* family of solvers from the "Efficient Field
   Sensitive Pointer Analysis for C" paper.
   It works by iterating over all the graph nodes, processing the complex
   constraints and propagating the copy constraints, until everything stops
   changed.  This corresponds to steps 6-8 in the solving list given above.   

References anything_id, bitmap_and_compl(), bitmap_bit_p(), bitmap_clear_bit(), bitmap_copy(), bitmap_empty_p(), bitmap_ior_into(), bitmap_obstack_initialize(), bitmap_obstack_release(), bitmap_set_bit(), constraint_graph::complex, compute_topo_order(), DEREF, do_complex_constraint(), eliminate_indirect_cycles(), escaped_id, find(), free_topo_info(), get_varinfo(), init_topo_info(), constraint_stats::iterations, constraint::lhs, variable_info::oldsolution, constraint::rhs, constraint_graph::size, variable_info::solution, stats, constraint_graph::succs, topo_info::topo_order, constraint_expr::type, and constraint_expr::var.

Referenced by solve_constraints().

static void sort_fieldstack ( )
static
Sort a fieldstack according to the field offset and sizes.   

References fieldoff_compare().

Referenced by create_variable_info_for_1().

static void topo_visit ( constraint_graph_t  graph,
struct topo_info ti,
unsigned int  n 
)
static
Visit the graph in topological order, and store the order in the
   topo_info structure.   

References bitmap_bit_p(), bitmap_set_bit(), constraint_graph::succs, topo_info::topo_order, and topo_info::visited.

Referenced by compute_topo_order().

static bool type_can_have_subvars ( const_tree  )
inlinestatic
static bool type_can_have_subvars ( )
inlinestatic
Return true if T is a type that can have subvars.   
static bool type_must_have_pointers ( )
static
Return true if T is a type that does contain pointers.   

Referenced by field_must_have_pointers().

static void unify_nodes ( constraint_graph_t  graph,
unsigned int  to,
unsigned int  from,
bool  update_changed 
)
static
static bool unite ( )
static
Union the TO and FROM nodes to the TO nodes.
   Note that at some point in the future, we may want to do
   union-by-rank, in which case we are going to have to return the
   node we unified to.   

References constraint_graph::rep.

Referenced by eliminate_indirect_cycles(), find_equivalent_node(), scc_visit(), and unite_pointer_equivalences().

static void unite_pointer_equivalences ( )
static
Unite pointer equivalent but not location equivalent nodes in
   GRAPH.  This may only be performed once variable substitution is
   finished.   

References find(), constraint_graph::pe, constraint_graph::pe_rep, unify_nodes(), and unite().

Referenced by solve_constraints().

static bool var_can_have_subvars ( )
inlinestatic
Return true if V is a tree that we can have subvars for.
   Normally, this is any aggregate type.  Also complex
   types which are not gimple registers can have subvars.   

References type_can_have_subvars().

Referenced by create_variable_info_for_1(), and push_fields_onto_fieldstack().


Variable Documentation

struct pointer_map_t* call_stmt_vars
static
A map mapping call statements to per-stmt variables for uses
   and clobbers specific to the call.   
bitmap changed
static
Changed variables on the last iteration.   

Referenced by add_scope_conflicts(), analyze_functions(), associate_plusminus(), bitmap_and(), bitmap_and_compl(), bitmap_and_compl_into(), bitmap_and_into(), bitmap_and_or(), bitmap_elt_copy(), bitmap_elt_ior(), bitmap_ior(), bitmap_ior_and_compl(), bitmap_ior_and_compl_into(), bitmap_ior_and_into(), bitmap_ior_into(), bitmap_or_and(), bitmap_xor(), bypass_conditional_jumps(), canonicalize_induction_variables(), ccp_fold_stmt(), cgraph_propagate_frequency(), cleanup_all_empty_eh(), cleanup_cfg(), cleanup_subreg_operands(), cleanup_tree_cfg(), cleanup_tree_cfg_noloop(), combine_cond_exprs(), compute_antic(), compute_antic_aux(), compute_bb_dataflow(), compute_code_hoist_vbeinout(), compute_out(), compute_partial_antic_aux(), copyprop_hardreg_forward_1(), cprop_insn(), cse_extended_basic_block(), dataflow_set_preserve_mem_locs(), dataflow_set_remove_mem_locs(), defs_to_varying(), delete_slot_part(), delete_unreachable_blocks(), delete_unreachable_blocks_update_callgraph(), df_compute_regs_ever_live(), df_lr_confluence_n(), df_rd_confluence_n(), df_rd_transfer_function(), df_update_entry_block_defs(), df_update_exit_block_uses(), df_word_lr_mark_ref(), df_word_lr_simulate_defs(), df_worklist_dataflow_doublequeue(), df_worklist_propagate_backward(), df_worklist_propagate_forward(), drop_overlapping_mem_locs(), execute_cleanup_eh_1(), execute_optimize_bswap(), execute_rtl_cprop(), execute_rtl_hoist(), execute_rtl_pre(), expand_omp_taskreg(), fixup_noreturn_call(), fold_rtx(), fold_stmt_1(), fold_stmt_inplace(), fold_ternary_loc(), gimple_fold_call(), gimple_purge_all_dead_abnormal_call_edges(), gimple_purge_all_dead_eh_edges(), gimple_purge_dead_abnormal_call_edges(), gimple_purge_dead_eh_edges(), gimple_value_profile_transformations(), gimplify_modify_expr_rhs(), graphds_domtree(), hoist_code(), init_alias_analysis(), instantiate_virtual_regs_in_insn(), instantiate_virtual_regs_in_rtx(), ipa_propagate_indirect_call_infos(), local_cprop_pass(), local_pure_const(), main_tree_if_conversion(), mark_regno_dead(), mark_regno_live(), match_asm_constraints_1(), maybe_fold_tmr(), mention_regs(), merge_phi_nodes(), move2add_use_add2_insn(), move2add_use_add3_insn(), one_code_hoisting_pass(), one_cprop_pass(), one_pre_gcse_pass(), output_address(), output_min_issue_delay_table(), parallelize_loops(), peel_loops_completely(), phi_translate_1(), pre_delete(), pre_gcse(), process_scc(), reload_cse_move2add(), remove_exits_and_undefined_stmts(), remove_redundant_iv_tests(), rename_uses(), replace_oldest_value_addr(), rewrite_commutative_reductions_out_of_ssa(), rewrite_commutative_reductions_out_of_ssa_loop(), rewrite_cross_bb_scalar_deps_out_of_ssa(), set_union_with_increment(), shrink_wrap_conditional_dead_built_in_calls(), simplify_comparison(), simplify_plus_minus(), simplify_using_outer_evolutions(), split_all_insns(), split_bbs_on_noreturn_calls(), ssa_forward_propagate_and_combine(), symtab_remove_unreachable_nodes(), tail_duplicate(), tm_memopt_compute_available(), tracer(), tree_if_conversion(), tree_loop_distribution(), tree_optimize_tail_calls_1(), tree_simplify_using_condition_1(), tree_ssa_iv_optimize_loop(), tree_ssa_unswitch_loops(), tree_unroll_loops_completely(), tree_unroll_loops_completely_1(), tree_unswitch_single_loop(), try_crossjump_bb(), try_forward_edges(), try_head_merge_bb(), try_optimize_cfg(), undistribute_ops_list(), unroll_and_peel_loops(), unsplit_all_eh(), unswitch_loops(), varpool_output_variables(), visit_nary_op(), visit_phi(), visit_reference_op_call(), visit_reference_op_load(), visit_reference_op_store(), visit_use(), and vt_find_locations().

alloc_pool constraint_pool
static
struct obstack fake_var_decl_obstack
Temporary storage for fake var decls.   

Referenced by build_fake_var_decl(), delete_points_to_sets(), and init_alias_vars().

pointer_map_t* final_solutions
static
Map varinfo to final pt_solution.   
struct obstack final_solutions_obstack
struct pt_solution ipa_escaped_pt = { true, false, false, false, false, false, NULL }
bitmap_obstack iteration_obstack
static
Used for per-solver-iteration bitmaps.   
int location_equiv_class
static
Current maximum location equivalence class id.   

Referenced by perform_var_substitution().

hash_table<equiv_class_hasher> location_equiv_class_table
static
A hashtable for mapping a bitmap of labels->location equivalence
   classes.   
bitmap_obstack oldpta_obstack
static
Used for oldsolution members of variables.  
int pointer_equiv_class
static
Perform offline variable substitution.

   This is a worst case quadratic time way of identifying variables
   that must have equivalent points-to sets, including those caused by
   static cycles, and single entry subgraphs, in the constraint graph.

   The technique is described in "Exploiting Pointer and Location
   Equivalence to Optimize Pointer Analysis. In the 14th International
   Static Analysis Symposium (SAS), August 2007."  It is known as the
   "HU" algorithm, and is equivalent to value numbering the collapsed
   constraint graph including evaluating unions.

   The general method of finding equivalence classes is as follows:
   Add fake nodes (REF nodes) and edges for *a = b and a = *b constraints.
   Initialize all non-REF nodes to be direct nodes.
   For each constraint a = a U {b}, we set pts(a) = pts(a) u {fresh
   variable}
   For each constraint containing the dereference, we also do the same
   thing.

   We then compute SCC's in the graph and unify nodes in the same SCC,
   including pts sets.

   For each non-collapsed node x:
    Visit all unvisited explicit incoming edges.
    Ignoring all non-pointers, set pts(x) = Union of pts(a) for y
    where y->x.
    Lookup the equivalence class for pts(x).
     If we found one, equivalence_class(x) = found class.
     Otherwise, equivalence_class(x) = new class, and new_class is
    added to the lookup table.

   All direct nodes with the same equivalence class can be replaced
   with a single representative node.
   All unlabeled nodes (label == 0) are not pointers and all edges
   involving them can be eliminated.
   We perform these optimizations during rewrite_constraints

   In addition to pointer equivalence class finding, we also perform
   location equivalence class finding.  This is the set of variables
   that always appear together in points-to sets.  We use this to
   compress the size of the points-to sets.   
Current maximum pointer equivalence class id.   

Referenced by label_visit(), and perform_var_substitution().

hash_table<equiv_class_hasher> pointer_equiv_class_table
static
A hashtable for mapping a bitmap of labels->pointer equivalence
   classes.   
bitmap_obstack predbitmap_obstack
static
Used for predecessor bitmaps.  
unsigned HOST_WIDE_INT pt_solution_includes_may_alias
unsigned HOST_WIDE_INT pt_solution_includes_no_alias
unsigned HOST_WIDE_INT pt_solutions_intersect_may_alias
unsigned HOST_WIDE_INT pt_solutions_intersect_no_alias
bitmap_obstack pta_obstack
static
Used for points-to sets.   
struct { ... } pta_stats
Query statistics for points-to solutions.   

Referenced by dump_pta_stats(), pt_solution_includes(), and pt_solutions_intersect().

hash_table<shared_bitmap_hasher> shared_bitmap_table
static
Shared_bitmap hashtable.   
bool use_field_sensitive = true
static
Tree based points-to analysis
   Copyright (C) 2005-2013 Free Software Foundation, Inc.
   Contributed by Daniel Berlin <dberlin@dberlin.org>

   This file is part of GCC.

   GCC is free software; you can redistribute it and/or modify
   under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, 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 idea behind this analyzer is to generate set constraints from the
   program, then solve the resulting constraints in order to generate the
   points-to sets.

   Set constraints are a way of modeling program analysis problems that
   involve sets.  They consist of an inclusion constraint language,
   describing the variables (each variable is a set) and operations that
   are involved on the variables, and a set of rules that derive facts
   from these operations.  To solve a system of set constraints, you derive
   all possible facts under the rules, which gives you the correct sets
   as a consequence.

   See  "Efficient Field-sensitive pointer analysis for C" by "David
   J. Pearce and Paul H. J. Kelly and Chris Hankin, at
   http://citeseer.ist.psu.edu/pearce04efficient.html

   Also see "Ultra-fast Aliasing Analysis using CLA: A Million Lines
   of C Code in a Second" by ""Nevin Heintze and Olivier Tardieu" at
   http://citeseer.ist.psu.edu/heintze01ultrafast.html

   There are three types of real constraint expressions, DEREF,
   ADDRESSOF, and SCALAR.  Each constraint expression consists
   of a constraint type, a variable, and an offset.

   SCALAR is a constraint expression type used to represent x, whether
   it appears on the LHS or the RHS of a statement.
   DEREF is a constraint expression type used to represent *x, whether
   it appears on the LHS or the RHS of a statement.
   ADDRESSOF is a constraint expression used to represent &x, whether
   it appears on the LHS or the RHS of a statement.

   Each pointer variable in the program is assigned an integer id, and
   each field of a structure variable is assigned an integer id as well.

   Structure variables are linked to their list of fields through a "next
   field" in each variable that points to the next field in offset
   order.
   Each variable for a structure field has

   1. "size", that tells the size in bits of that field.
   2. "fullsize, that tells the size in bits of the entire structure.
   3. "offset", that tells the offset in bits from the beginning of the
   structure to this field.

   Thus,
   struct f
   {
     int a;
     int b;
   } foo;
   int *bar;

   looks like

   foo.a -> id 1, size 32, offset 0, fullsize 64, next foo.b
   foo.b -> id 2, size 32, offset 32, fullsize 64, next NULL
   bar -> id 3, size 32, offset 0, fullsize 32, next NULL


  In order to solve the system of set constraints, the following is
  done:

  1. Each constraint variable x has a solution set associated with it,
  Sol(x).

  2. Constraints are separated into direct, copy, and complex.
  Direct constraints are ADDRESSOF constraints that require no extra
  processing, such as P = &Q
  Copy constraints are those of the form P = Q.
  Complex constraints are all the constraints involving dereferences
  and offsets (including offsetted copies).

  3. All direct constraints of the form P = &Q are processed, such
  that Q is added to Sol(P)

  4. All complex constraints for a given constraint variable are stored in a
  linked list attached to that variable's node.

  5. A directed graph is built out of the copy constraints. Each
  constraint variable is a node in the graph, and an edge from
  Q to P is added for each copy constraint of the form P = Q

  6. The graph is then walked, and solution sets are
  propagated along the copy edges, such that an edge from Q to P
  causes Sol(P) <- Sol(P) union Sol(Q).

  7.  As we visit each node, all complex constraints associated with
  that node are processed by adding appropriate copy edges to the graph, or the
  appropriate variables to the solution set.

  8. The process of walking the graph is iterated until no solution
  sets change.

  Prior to walking the graph in steps 6 and 7, We perform static
  cycle elimination on the constraint graph, as well
  as off-line variable substitution.

  TODO: Adding offsets to pointer-to-structures can be handled (IE not punted
  on and turned into anything), but isn't.  You can just see what offset
  inside the pointed-to struct it's going to access.

  TODO: Constant bounded arrays can be handled as if they were structs of the
  same number of elements.

  TODO: Modeling heap and incoming pointers becomes much better if we
  add fields to them as we discover them, which we could do.

  TODO: We could handle unions, but to be honest, it's probably not
  worth the pain or slowdown.   
IPA-PTA optimizations possible.

   When the indirect function called is ANYTHING we can add disambiguation
   based on the function signatures (or simply the parameter count which
   is the varinfo size).  We also do not need to consider functions that
   do not have their address taken.

   The is_global_var bit which marks escape points is overly conservative
   in IPA mode.  Split it to is_escape_point and is_global_var - only
   externally visible globals are escape points in IPA mode.  This is
   also needed to fix the pt_solution_includes_global predicate
   (and thus ptr_deref_may_alias_global_p).

   The way we introduce DECL_PT_UID to avoid fixing up all points-to
   sets in the translation unit when we copy a DECL during inlining
   pessimizes precision.  The advantage is that the DECL_PT_UID keeps
   compile-time and memory usage overhead low - the points-to sets
   do not grow or get unshared as they would during a fixup phase.
   An alternative solution is to delay IPA PTA until after all
   inlining transformations have been applied.

   The way we propagate clobber/use information isn't optimized.
   It should use a new complex constraint that properly filters
   out local variables of the callee (though that would make
   the sets invalid after inlining).  OTOH we might as well
   admit defeat to WHOPR and simply do all the clobber/use analysis
   and propagation after PTA finished but before we threw away
   points-to information for memory variables.  WHOPR and PTA
   do not play along well anyway - the whole constraint solving
   would need to be done in WPA phase and it will be very interesting
   to apply the results to local SSA names during LTRANS phase.

   We probably should compute a per-function unit-ESCAPE solution
   propagating it simply like the clobber / uses solutions.  The
   solution can go alongside the non-IPA espaced solution and be
   used to query which vars escape the unit through a function.

   We never put function decls in points-to sets so we do not
   keep the set of called functions for indirect calls.

   And probably more.   

Referenced by create_variable_info_for_1(), get_constraint_for_ptr_offset(), and init_alias_vars().

alloc_pool variable_info_pool
static
Pool of variable info structures.   
vec<varinfo_t> varmap
static
Table of variable info structures for constraint variables.
   Indexed directly by variable info id.   
struct pointer_map_t* vi_for_tree
static
Map from trees to variable infos.