GCC Middle and Back End API Reference
tree-ssa-structalias.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "ssa.h"
#include "cgraph.h"
#include "tree-pretty-print.h"
#include "diagnostic-core.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "stmt.h"
#include "gimple-iterator.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
#include "gimple-walk.h"
#include "varasm.h"
#include "stringpool.h"
#include "attribs.h"
#include "tree-ssa.h"
#include "tree-cfg.h"
#include "gimple-range.h"
#include "ipa-modref-tree.h"
#include "ipa-modref.h"
#include "attr-fnspec.h"
#include "tree-ssa-structalias.h"
#include "pta-andersen.h"
#include "gimple-ssa-pta-constraints.h"
Include dependency graph for tree-ssa-structalias.cc:

Data Structures

struct  shared_bitmap_info
struct  shared_bitmap_hasher
struct  vls_data
struct  msdi_data

Namespaces

namespace  pointer_analysis

Typedefs

typedef struct shared_bitmap_infoshared_bitmap_info_t
typedef const struct shared_bitmap_infoconst_shared_bitmap_info_t

Functions

varinfo_t pointer_analysis::first_vi_for_offset (varinfo_t start, unsigned HOST_WIDE_INT offset)
varinfo_t pointer_analysis::first_or_preceding_vi_for_offset (varinfo_t start, unsigned HOST_WIDE_INT offset)
void pointer_analysis::determine_global_memory_access (gcall *stmt, bool *writes_global_memory, bool *reads_global_memory, bool *uses_global_memory)
bool pointer_analysis::fndecl_maybe_in_other_partition (tree fndecl)
varinfo_t pointer_analysis::new_var_info (tree t, const char *name, bool add_id)
void pointer_analysis::dump_constraint (FILE *file, constraint_t c)
DEBUG_FUNCTION void pointer_analysis::debug_constraint (constraint_t c)
void pointer_analysis::dump_constraints (FILE *file, int from)
DEBUG_FUNCTION void pointer_analysis::debug_constraints (void)
void pointer_analysis::dump_solution_for_var (FILE *file, unsigned int var)
DEBUG_FUNCTION void pointer_analysis::debug_solution_for_var (unsigned int var)
void pointer_analysis::dump_sa_stats (FILE *outfile)
void pointer_analysis::dump_sa_points_to_info (FILE *outfile)
DEBUG_FUNCTION void pointer_analysis::debug_sa_points_to_info (void)
void pointer_analysis::dump_varinfo (FILE *file, varinfo_t vi)
DEBUG_FUNCTION void pointer_analysis::debug_varinfo (varinfo_t vi)
void pointer_analysis::dump_varmap (FILE *file)
DEBUG_FUNCTION void pointer_analysis::debug_varmap (void)
static bitmap shared_bitmap_lookup (bitmap pt_vars)
static void shared_bitmap_add (bitmap pt_vars)
static void set_uids_in_ptset (bitmap into, bitmap from, struct pt_solution *pt, tree fndecl)
static struct pt_solution find_what_var_points_to (tree fndecl, varinfo_t orig_vi)
static void find_what_p_points_to (tree fndecl, tree p)
void dump_pta_stats (FILE *s)
void pt_solution_reset (struct pt_solution *pt)
void pt_solution_set (struct pt_solution *pt, bitmap vars, bool vars_contains_nonlocal)
void pt_solution_set_var (struct pt_solution *pt, tree var)
static void pt_solution_ior_into (struct pt_solution *dest, struct pt_solution *src)
bool pt_solution_empty_p (const pt_solution *pt)
bool pt_solution_singleton_or_null_p (struct pt_solution *pt, unsigned *uid)
bool pt_solution_includes_global (struct pt_solution *pt, bool escaped_local_p)
static bool pt_solution_includes_1 (struct pt_solution *pt, const_tree decl)
bool pt_solution_includes (struct pt_solution *pt, const_tree decl)
bool pt_solution_includes_const_pool (struct pt_solution *pt)
static bool pt_solutions_intersect_1 (struct pt_solution *pt1, struct pt_solution *pt2)
bool pt_solutions_intersect (struct pt_solution *pt1, struct pt_solution *pt2)
static void init_alias_vars (void)
static void compute_points_to_sets (void)
static void delete_points_to_sets (void)
static bool visit_loadstore (gimple *, tree base, tree ref, void *data)
static bool maybe_set_dependence_info (gimple *, tree base, tree, void *data)
static bool clear_dependence_clique (gimple *, tree base, tree, void *data)
static void compute_dependence_clique (void)
unsigned int compute_may_aliases (void)
gimple_opt_passmake_pass_build_alias (gcc::context *ctxt)
gimple_opt_passmake_pass_build_ealias (gcc::context *ctxt)
static unsigned int ipa_pta_execute (void)
simple_ipa_opt_passmake_pass_ipa_pta (gcc::context *ctxt)

Variables

static object_allocator< variable_infovariable_info_pool ("Variable info pool")
static hash_map< varinfo_t, pt_solution * > * final_solutions
static struct obstack final_solutions_obstack
bool pointer_analysis::use_field_sensitive = true
int pointer_analysis::in_ipa_mode = 0
bitmap_obstack pointer_analysis::pta_obstack
bitmap_obstack pointer_analysis::oldpta_obstack
vec< varinfo_tpointer_analysis::varmap
vec< constraint_tpointer_analysis::constraints
unsigned int * pointer_analysis::var_rep
struct constraint_stats pointer_analysis::stats
static hash_table< shared_bitmap_hasher > * shared_bitmap_table
static struct { ... }  pta_stats
struct pt_solution ipa_escaped_pt

Typedef Documentation

◆ const_shared_bitmap_info_t

◆ shared_bitmap_info_t

Structure used to put solution bitmaps in a hashtable so they can
be shared among variables with the same points-to set.   

Function Documentation

◆ clear_dependence_clique()

bool clear_dependence_clique ( gimple * ,
tree base,
tree ,
void * data )
static
Clear dependence info for the clique DATA.   

References MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, and TREE_CODE.

Referenced by compute_dependence_clique().

◆ compute_dependence_clique()

◆ compute_may_aliases()

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_dependence_clique(), compute_points_to_sets(), delete_points_to_sets(), dump_alias_info(), dump_file, dump_flags, gcc_assert, need_ssa_update_p(), TDF_ALIAS, and TDF_DETAILS.

Referenced by execute_function_todo().

◆ compute_points_to_sets()

◆ delete_points_to_sets()

◆ dump_pta_stats()

void dump_pta_stats ( FILE * s)

References HOST_WIDE_INT_PRINT_DEC, and pta_stats.

Referenced by dump_memory_report().

◆ find_what_p_points_to()

◆ find_what_var_points_to()

◆ init_alias_vars()

◆ ipa_pta_execute()

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

References allocate_decl_uid(), pt_solution::anything, pointer_analysis::anything_id, auto_var_in_fn_p(), auto_var_p(), bitmap_bit_p, cgraph_node::clone_of, pointer_analysis::variable_info::decl, symtab_node::decl, DECL_STRUCT_FUNCTION, delete_points_to_sets(), pointer_analysis::dump_constraints(), dump_file, dump_flags, pointer_analysis::dump_sa_points_to_info(), pointer_analysis::dump_sa_stats(), dyn_cast(), ECF_CONST, ECF_NOVOPS, ECF_PURE, pointer_analysis::escaped_id, EXECUTE_IF_SET_IN_BITMAP, pointer_analysis::fi_clobbers, pointer_analysis::fi_parm_base, pointer_analysis::fi_uses, final_solutions, final_solutions_obstack, find_what_p_points_to(), find_what_var_points_to(), pointer_analysis::first_vi_for_offset(), pointer_analysis::fndecl_maybe_in_other_partition(), FOR_EACH_BB_FN, FOR_EACH_DEFINED_FUNCTION, FOR_EACH_VEC_ELT, gcc_obstack_init, gcc_unreachable, pointer_analysis::get_fi_for_callee(), pointer_analysis::get_varinfo(), gimple_call_arg(), gimple_call_builtin_p(), gimple_call_clobber_set(), gimple_call_flags(), gimple_call_fndecl(), gimple_call_use_set(), function::gimple_df, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), cgraph_node::has_gimple_body_p(), i, pointer_analysis::variable_info::id, pointer_analysis::in_ipa_mode, symtab_node::in_other_partition, init_alias_vars(), pointer_analysis::ipa_build_constraints(), pt_solution::ipa_escaped, ipa_escaped_pt, gimple_df::ipa_pta, pointer_analysis::variable_info::is_fn_info, pointer_analysis::variable_info::is_global_var, pointer_analysis::lookup_call_clobber_vi(), pointer_analysis::lookup_call_use_vi(), pointer_analysis::lookup_vi_for_tree(), pt_solution::nonlocal, pointer_analysis::nonlocal_id, NULL, NULL_TREE, POINTER_TYPE_P, pt_solution_ior_into(), pt_solution_reset(), pointer_analysis::variable_info::shadow_var_uid, pointer_analysis::variable_info::solution, pointer_analysis::solve_constraints(), gimple_df::ssa_names, symtab, TDF_DETAILS, TDF_STATS, TREE_OPERAND, TREE_TYPE, pointer_analysis::var_rep, pointer_analysis::varmap, and pointer_analysis::vi_next().

◆ make_pass_build_alias()

gimple_opt_pass * make_pass_build_alias ( gcc::context * ctxt)

◆ make_pass_build_ealias()

gimple_opt_pass * make_pass_build_ealias ( gcc::context * ctxt)

◆ make_pass_ipa_pta()

simple_ipa_opt_pass * make_pass_ipa_pta ( gcc::context * ctxt)

◆ maybe_set_dependence_info()

bool maybe_set_dependence_info ( gimple * ,
tree base,
tree ,
void * data )
static
If BASE is a MEM_REF then assign a clique, base pair to it, updating
CLIQUE, *RESTRICT_VAR and LAST_RUID as passed via DATA.
Return whether dependence info was assigned to BASE.   

References cfun, MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, pointer_analysis::variable_info::ruid, TREE_CODE, and TREE_OPERAND.

Referenced by compute_dependence_clique().

◆ pt_solution_empty_p()

◆ pt_solution_includes()

◆ pt_solution_includes_1()

bool pt_solution_includes_1 ( struct pt_solution * pt,
const_tree decl )
static

◆ pt_solution_includes_const_pool()

bool pt_solution_includes_const_pool ( struct pt_solution * pt)
Return true if the points-to solution *PT contains a reference to a
constant pool entry.   

References cfun, pt_solution::const_pool, pt_solution::escaped, pt_solution::ipa_escaped, ipa_escaped_pt, and pt_solution::nonlocal.

Referenced by ptrs_compare_unequal().

◆ pt_solution_includes_global()

bool pt_solution_includes_global ( struct pt_solution * pt,
bool escaped_local_p )
Return true if the points-to solution *PT includes global memory.
If ESCAPED_LOCAL_P is true then escaped local variables are also
considered global.   

References pt_solution::anything, cfun, pt_solution::escaped, pt_solution::ipa_escaped, ipa_escaped_pt, pt_solution::nonlocal, pt_solution_includes_global(), pt_solution::vars_contains_escaped, pt_solution::vars_contains_escaped_heap, and pt_solution::vars_contains_nonlocal.

Referenced by pt_solution_includes_global(), and ptr_deref_may_alias_global_p().

◆ pt_solution_ior_into()

void pt_solution_ior_into ( struct pt_solution * dest,
struct pt_solution * src )
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_GGC_ALLOC, bitmap_ior_into(), pt_solution::const_pool, pt_solution::escaped, pt_solution::ipa_escaped, pt_solution::nonlocal, pt_solution::null, pt_solution_reset(), pt_solution::vars, pt_solution::vars_contains_escaped, pt_solution::vars_contains_escaped_heap, and pt_solution::vars_contains_nonlocal.

Referenced by ipa_pta_execute().

◆ pt_solution_reset()

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

References pt_solution::anything, and pt_solution::null.

Referenced by delete_tree_ssa(), expand_call_inline(), get_ptr_info(), gimple_call_reset_alias_info(), init_tree_ssa(), ipa_pta_execute(), parallelize_loops(), and pt_solution_ior_into().

◆ pt_solution_set()

void pt_solution_set ( struct pt_solution * pt,
bitmap vars,
bool vars_contains_nonlocal )
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 bitmap_intersect_p(), cfun, pt_solution::vars, pt_solution::vars_contains_escaped, and pt_solution::vars_contains_nonlocal.

Referenced by update_alias_info_with_stack_vars().

◆ pt_solution_set_var()

void pt_solution_set_var ( struct pt_solution * pt,
tree var )
Set the points-to solution *PT to point only to the variable VAR.   

References bitmap_bit_p, BITMAP_GGC_ALLOC, bitmap_set_bit, cfun, DECL_PT_UID, is_global_var(), pt_solution::vars, pt_solution::vars_contains_escaped, and pt_solution::vars_contains_nonlocal.

Referenced by copy_ref_info().

◆ pt_solution_singleton_or_null_p()

bool pt_solution_singleton_or_null_p ( struct pt_solution * pt,
unsigned * uid )
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, NULL, and pt_solution::vars.

Referenced by fold_builtin_alloca_with_align(), and same_addr_size_stores_p().

◆ pt_solutions_intersect()

◆ pt_solutions_intersect_1()

◆ set_uids_in_ptset()

◆ shared_bitmap_add()

void shared_bitmap_add ( bitmap pt_vars)
static
Add a bitmap to the shared bitmap hashtable.   

References bitmap_hash(), gcc_assert, shared_bitmap_info::hashcode, shared_bitmap_info::pt_vars, and shared_bitmap_table.

Referenced by find_what_var_points_to().

◆ shared_bitmap_lookup()

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

References bitmap_hash(), shared_bitmap_info::hashcode, NULL, shared_bitmap_info::pt_vars, and shared_bitmap_table.

Referenced by find_what_var_points_to().

◆ visit_loadstore()

Variable Documentation

◆ final_solutions

hash_map<varinfo_t, pt_solution *>* final_solutions
static
Map varinfo to final pt_solution.   

Referenced by delete_points_to_sets(), find_what_var_points_to(), init_alias_vars(), and ipa_pta_execute().

◆ final_solutions_obstack

struct obstack final_solutions_obstack
static

◆ ipa_escaped_pt

struct pt_solution ipa_escaped_pt
Initial value:
= { true, false, false, false, false, false,
false, false, false, false, false, NULL }
#define NULL
Definition system.h:50
IPA PTA solutions for ESCAPED.   

Referenced by ipa_pta_execute(), pt_solution_empty_p(), pt_solution_includes_1(), pt_solution_includes_const_pool(), pt_solution_includes_global(), pt_solutions_intersect_1(), and walk_non_aliased_vuses().

◆ []

struct { ... } pta_stats
Query statistics for points-to solutions.   

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

◆ shared_bitmap_table

hash_table<shared_bitmap_hasher>* shared_bitmap_table
static

◆ variable_info_pool

object_allocator< variable_info > variable_info_pool("Variable info pool") ( "Variable info pool" )
static
Pool of variable info structures.   

Referenced by delete_points_to_sets(), and pointer_analysis::new_var_info().