PR 30735 PR 31090 * doc/invoke.texi: Document --params max-aliased-vops and avg-aliased-vops. * tree-ssa-operands.h (get_mpt_for, dump_memory_partitions, debug_memory_partitions): Move to tree-flow.h * params.h (AVG_ALIASED_VOPS): Define. * tree-ssa-alias.c (struct mp_info_def): Remove. Update all users. (mp_info_t): Likewise. (get_mem_sym_stats_for): New. (set_memory_partition): Move from tree-flow-inline.h. (mark_non_addressable): Only clear the set of symbols for the partition if it exists. (dump_memory_partitions): Move from tree-ssa-operands.c (debug_memory_partitions): Likewise. (need_to_partition_p): New. (dump_mem_ref_stats): New. (debug_mem_ref_stats): New. (dump_mem_sym_stats): New. (debug_mem_sym_stats): New. (update_mem_sym_stats_from_stmt): New. (compare_mp_info_entries): New. (mp_info_cmp): Call it. (sort_mp_info): Change argument to a list of mem_sym_stats_t objects. (get_mpt_for): Move from tree-ssa-operands.c. (find_partition_for): New. (create_partition_for): Remove. (estimate_vop_reduction): New. (update_reference_counts): New. (build_mp_info): New. (compute_memory_partitions): Refactor. Document new heuristic. Call build_mp_info, update_reference_counts, find_partition_for and estimate_vop_reduction. (compute_may_aliases): Populate virtual operands before calling debugging dumps. (delete_mem_sym_stats): New. (delete_mem_ref_stats): New. (init_mem_ref_stats): New. (init_alias_info): Call it. (maybe_create_global_var): Remove alias_info argument. Get number of call sites and number of pure/const call sites from gimple_mem_ref_stats(). (dump_alias_info): Call dump_memory_partitions first. (dump_points_to_info_for): Show how many times a pointer has been dereferenced. * opts.c (decode_options): For -O2 set --param max-aliased-vops to 500. For -O3 set --param max-aliased-vops to 1000 and --param avg-aliased-vops to 3. * fortran/options.c (gfc_init_options): Remove assignment to MAX_ALIASED_VOPS. * tree-flow-inline.h (gimple_mem_ref_stats): New. * tree-dfa.c (dump_variable): Dump memory reference statistics. Dump NO_ALIAS* settings. (referenced_var_lookup): Tidy. (mem_sym_stats): New. * tree-ssa-copy.c (may_propagate_copy): Return true if DEST and ORIG are different SSA names for a memory partition. * tree-ssa.c (delete_tree_ssa): Call delete_mem_ref_stats. * tree-flow.h (struct mem_sym_stats_d): Define. (mem_sym_stats_t): Define. (struct mem_ref_stats_d): Define. (struct gimple_df): Add field mem_ref_stats. (enum noalias_state): Define. (struct var_ann_d): Add bitfield noalias_state. (mem_sym_stats, delete_mem_ref_stats, dump_mem_ref_stats, debug_mem_ref_stats, debug_memory_partitions, debug_mem_sym_stats): Declare. * tree-ssa-structalias.c (update_alias_info): Update call sites, pure/const call sites and asm sites in structure returned by gimple_mem_ref_stats. Remove local variable IS_POTENTIAL_DEREF. Increase NUM_DEREFS if the memory expression is a potential dereference. Call update_mem_sym_stats_from_stmt. If the memory references memory, call update_mem_sym_stats_from_stmt for all the direct memory symbol references found. (intra_create_variable_infos): Set noalias_state field for pointer arguments according to the value of flag_argument_noalias. * tree-ssa-structalias.h (struct alias_info): Remove fields num_calls_found and num_pure_const_calls_found. (update_mem_sym_stats_from_stmt): Declare. * params.def (PARAM_MAX_ALIASED_VOPS): Change description. Set default value to 100. (PARAM_AVG_ALIASED_VOPS): Define. From-SVN: r123719
84 lines
2.9 KiB
C
84 lines
2.9 KiB
C
/* Tree based points-to analysis
|
|
Copyright (C) 2002, 2003 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 2 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; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef TREE_SSA_STRUCTALIAS_H
|
|
#define TREE_SSA_STRUCTALIAS_H
|
|
|
|
/* True if the data pointed to by PTR can alias anything. */
|
|
#define PTR_IS_REF_ALL(PTR) TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (PTR))
|
|
|
|
struct constraint;
|
|
typedef struct constraint *constraint_t;
|
|
|
|
/* Alias information used by compute_may_aliases and its helpers. */
|
|
struct alias_info
|
|
{
|
|
/* SSA names visited while collecting points-to information. If bit I
|
|
is set, it means that SSA variable with version I has already been
|
|
visited. */
|
|
sbitmap ssa_names_visited;
|
|
|
|
/* Array of SSA_NAME pointers processed by the points-to collector. */
|
|
VEC(tree,heap) *processed_ptrs;
|
|
|
|
/* ADDRESSABLE_VARS contains all the global variables and locals that
|
|
have had their address taken. */
|
|
struct alias_map_d **addressable_vars;
|
|
size_t num_addressable_vars;
|
|
|
|
/* POINTERS contains all the _DECL pointers with unique memory tags
|
|
that have been referenced in the program. */
|
|
struct alias_map_d **pointers;
|
|
size_t num_pointers;
|
|
|
|
/* Variables that have been written to directly (i.e., not through a
|
|
pointer dereference). */
|
|
struct pointer_set_t *written_vars;
|
|
|
|
/* Pointers that have been used in an indirect store operation. */
|
|
struct pointer_set_t *dereferenced_ptrs_store;
|
|
|
|
/* Pointers that have been used in an indirect load operation. */
|
|
struct pointer_set_t *dereferenced_ptrs_load;
|
|
|
|
/* Memory tag for all the PTR_IS_REF_ALL pointers. */
|
|
tree ref_all_symbol_mem_tag;
|
|
};
|
|
|
|
/* In tree-ssa-alias.c. */
|
|
enum escape_type is_escape_site (tree);
|
|
void update_mem_sym_stats_from_stmt (tree, tree, long, long);
|
|
|
|
/* In tree-ssa-structalias.c. */
|
|
extern void compute_points_to_sets (struct alias_info *);
|
|
extern void delete_points_to_sets (void);
|
|
extern void dump_constraint (FILE *, constraint_t);
|
|
extern void dump_constraints (FILE *);
|
|
extern void debug_constraint (constraint_t);
|
|
extern void debug_constraints (void);
|
|
extern void dump_solution_for_var (FILE *, unsigned int);
|
|
extern void debug_solution_for_var (unsigned int);
|
|
extern void dump_sa_points_to_info (FILE *);
|
|
extern void debug_sa_points_to_info (void);
|
|
extern void set_used_smts (void);
|
|
|
|
#endif /* TREE_SSA_STRUCTALIAS_H */
|