GCC Middle and Back End API 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"
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_info * | shared_bitmap_info_t |
typedef const struct shared_bitmap_info * | const_shared_bitmap_info_t |
Variables | |
static object_allocator< variable_info > | variable_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_t > | pointer_analysis::varmap |
vec< constraint_t > | pointer_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 const struct shared_bitmap_info* const_shared_bitmap_info_t |
typedef struct shared_bitmap_info * 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.
Clear dependence info for the clique DATA.
References MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, and TREE_CODE.
Referenced by compute_dependence_clique().
|
static |
Compute the set of independend memory references based on restrict tags and their conservative propagation to the points-to sets.
References BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_set_bit, cfun, clear_dependence_clique(), dump_file, dump_flags, pointer_analysis::escaped_id, EXECUTE_IF_SET_IN_BITMAP, FOR_EACH_BB_FN, FOR_EACH_IMM_USE_STMT, pointer_analysis::get_varinfo(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), pointer_analysis::variable_info::head, i, pointer_analysis::variable_info::id, pointer_analysis::variable_info::is_restrict_var, pointer_analysis::lookup_vi_for_tree(), maybe_set_dependence_info(), pointer_analysis::nothing_id, NULL, num_ssa_names, POINTER_TYPE_P, print_generic_expr(), pointer_analysis::variable_info::solution, ssa_name, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TDF_DETAILS, TREE_CODE, TREE_TYPE, ui, pointer_analysis::var_rep, visit_loadstore(), and walk_stmt_load_store_ops().
Referenced by 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().
|
static |
Create points-to sets for the current function. See the comments at the start of the file for an algorithmic overview.
References cfun, pointer_analysis::determine_global_memory_access(), dump_file, dump_flags, pointer_analysis::dump_sa_points_to_info(), pointer_analysis::dump_sa_stats(), dyn_cast(), ECF_CONST, ECF_NOVOPS, ECF_PURE, pt_solution::escaped, pointer_analysis::escaped_id, pointer_analysis::escaped_return_id, find_what_p_points_to(), find_what_var_points_to(), FOR_EACH_BB_FN, FOR_EACH_SSA_NAME, pointer_analysis::get_varinfo(), gimple_call_clobber_set(), gimple_call_flags(), gimple_call_use_set(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, init_alias_vars(), pointer_analysis::intra_build_constraints(), pointer_analysis::lookup_call_clobber_vi(), pointer_analysis::lookup_call_use_vi(), pt_solution::nonlocal, NULL, POINTER_TYPE_P, pointer_analysis::solve_constraints(), TDF_DETAILS, TDF_STATS, timevar_pop(), timevar_push(), and TREE_TYPE.
Referenced by compute_may_aliases().
|
static |
Delete created points-to sets.
References bitmap_obstack_release(), pointer_analysis::constraints, pointer_analysis::delete_constraint_builder(), dump_file, dump_flags, final_solutions, final_solutions_obstack, free(), NULL, pointer_analysis::pta_obstack, shared_bitmap_table, TDF_STATS, pointer_analysis::var_rep, variable_info_pool, and pointer_analysis::varmap.
Referenced by compute_may_aliases(), and ipa_pta_execute().
void dump_pta_stats | ( | FILE * | s | ) |
References HOST_WIDE_INT_PRINT_DEC, and pta_stats.
Referenced by dump_memory_report().
Given a pointer variable P, fill in its points-to set.
References DECL_STRUCT_FUNCTION, find_what_var_points_to(), get_ptr_info(), get_range_query(), pointer_analysis::lookup_vi_for_tree(), prange::nonzero_p(), pt_solution::null, ptr_info_def::pt, path_range_query::range_of_expr(), set_ptr_nonnull(), SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, and TREE_CODE.
Referenced by compute_points_to_sets(), and ipa_pta_execute().
|
static |
Compute the points-to solution *PT for the variable VI.
References pt_solution::anything, pointer_analysis::anything_id, bitmap_bit_p, bitmap_clear(), BITMAP_GGC_ALLOC, pt_solution::const_pool, pt_solution::escaped, pointer_analysis::escaped_id, EXECUTE_IF_SET_IN_BITMAP, final_solutions, final_solutions_obstack, find_what_var_points_to(), pointer_analysis::get_varinfo(), i, pointer_analysis::variable_info::id, pointer_analysis::in_ipa_mode, pointer_analysis::integer_id, pt_solution::ipa_escaped, pointer_analysis::variable_info::is_artificial_var, pt_solution::nonlocal, pointer_analysis::nonlocal_id, pointer_analysis::nothing_id, NULL, pt_solution::null, set_uids_in_ptset(), shared_bitmap_add(), shared_bitmap_lookup(), pointer_analysis::variable_info::solution, pointer_analysis::string_id, pointer_analysis::var_rep, and pt_solution::vars.
Referenced by compute_points_to_sets(), find_what_p_points_to(), find_what_var_points_to(), and ipa_pta_execute().
|
static |
Initialize things necessary to perform PTA.
References bitmap_obstack_initialize(), pointer_analysis::constraints, final_solutions, final_solutions_obstack, gcc_obstack_init, pointer_analysis::init_constraint_builder(), pointer_analysis::oldpta_obstack, pointer_analysis::pta_obstack, shared_bitmap_table, pointer_analysis::use_field_sensitive, and pointer_analysis::varmap.
Referenced by compute_points_to_sets(), and ipa_pta_execute().
|
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().
gimple_opt_pass * make_pass_build_alias | ( | gcc::context * | ctxt | ) |
gimple_opt_pass * make_pass_build_ealias | ( | gcc::context * | ctxt | ) |
simple_ipa_opt_pass * make_pass_ipa_pta | ( | gcc::context * | ctxt | ) |
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().
bool pt_solution_empty_p | ( | const pt_solution * | pt | ) |
Return true if the points-to solution *PT is empty.
References pt_solution::anything, bitmap_empty_p(), cfun, pt_solution::escaped, pt_solution::ipa_escaped, ipa_escaped_pt, pt_solution::nonlocal, pt_solution_empty_p(), and pt_solution::vars.
Referenced by dump_gimple_call(), pt_solution_empty_p(), and pt_solutions_intersect_1().
bool pt_solution_includes | ( | struct pt_solution * | pt, |
const_tree | decl ) |
|
static |
Return true if the points-to solution *PT includes the variable declaration DECL.
References pt_solution::anything, bitmap_bit_p, cfun, DECL_PT_UID, pt_solution::escaped, pt_solution::ipa_escaped, ipa_escaped_pt, is_global_var(), pt_solution::nonlocal, pt_solution_includes_1(), and pt_solution::vars.
Referenced by pt_solution_includes(), and pt_solution_includes_1().
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().
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().
|
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().
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().
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().
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().
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().
bool pt_solutions_intersect | ( | struct pt_solution * | pt1, |
struct pt_solution * | pt2 ) |
References pt_solutions_intersect_1(), and pta_stats.
Referenced by call_may_clobber_ref_p_1(), ptr_derefs_may_alias_p(), ptrs_compare_unequal(), and ref_maybe_used_by_call_p_1().
|
static |
Return true if both points-to solutions PT1 and PT2 have a non-empty intersection.
References pt_solution::anything, bitmap_intersect_p(), pt_solution::escaped, pt_solution::ipa_escaped, ipa_escaped_pt, pt_solution::nonlocal, pt_solution_empty_p(), pt_solutions_intersect_1(), pt_solution::vars, pt_solution::vars_contains_escaped, and pt_solution::vars_contains_nonlocal.
Referenced by pt_solutions_intersect(), and pt_solutions_intersect_1().
|
static |
Set bits in INTO corresponding to the variable uids in solution set FROM.
References pointer_analysis::anything_id, auto_var_in_fn_p(), bitmap_bit_p, bitmap_set_bit, pointer_analysis::variable_info::decl, decl_binds_to_current_def_p(), DECL_EXTERNAL, DECL_PT_UID, DECL_PT_UID_SET_P, DECL_UID, pointer_analysis::escaped_id, pointer_analysis::escaped_return_id, EXECUTE_IF_SET_IN_BITMAP, pointer_analysis::get_varinfo(), i, pointer_analysis::in_ipa_mode, pointer_analysis::variable_info::is_artificial_var, pointer_analysis::variable_info::is_global_var, pointer_analysis::variable_info::is_heap_var, pointer_analysis::variable_info::is_restrict_var, SET_DECL_PT_UID, pointer_analysis::variable_info::shadow_var_uid, pointer_analysis::variable_info::solution, TREE_CODE, TREE_STATIC, VAR_P, pointer_analysis::var_rep, pt_solution::vars_contains_escaped, pt_solution::vars_contains_escaped_heap, pt_solution::vars_contains_interposable, pt_solution::vars_contains_nonlocal, and pt_solution::vars_contains_restrict.
Referenced by find_what_var_points_to().
|
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().
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().
Mark "other" loads and stores as belonging to CLIQUE and with base zero.
References bitmap_bit_p, bitmap_intersect_p(), build2(), build_fold_addr_expr, build_int_cst(), pointer_analysis::escaped_id, gcc_assert, pointer_analysis::get_varinfo(), handled_component_p(), pointer_analysis::variable_info::id, is_global_var(), pointer_analysis::lookup_vi_for_tree(), MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, pointer_analysis::variable_info::solution, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, TREE_OPERAND, TREE_TYPE, VAR_P, and pointer_analysis::var_rep.
Referenced by compute_dependence_clique().
|
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().
|
static |
Referenced by delete_points_to_sets(), find_what_var_points_to(), init_alias_vars(), and ipa_pta_execute().
struct pt_solution ipa_escaped_pt |
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().
|
static |
Shared_bitmap hashtable.
Referenced by delete_points_to_sets(), init_alias_vars(), shared_bitmap_add(), and shared_bitmap_lookup().
|
static |
Pool of variable info structures.
Referenced by delete_points_to_sets(), and pointer_analysis::new_var_info().