/* Tree based points-to analysis
|
/* Tree based points-to analysis
|
Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
|
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
|
|
This file is part of GCC.
|
This file is part of GCC.
|
|
|
GCC is free software; you can redistribute it and/or modify
|
GCC is free software; you can redistribute it and/or modify
|
under the terms of the GNU General Public License as published by
|
under the terms of the GNU General Public License as published by
|
the Free Software Foundation; either version 3 of the License, or
|
the Free Software Foundation; either version 3 of the License, or
|
(at your option) any later version.
|
(at your option) any later version.
|
|
|
GCC is distributed in the hope that it will be useful,
|
GCC is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU General Public License for more details.
|
GNU General Public License for more details.
|
|
|
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with GCC; see the file COPYING3. If not see
|
along with GCC; see the file COPYING3. If not see
|
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
|
|
#ifndef TREE_SSA_STRUCTALIAS_H
|
#ifndef TREE_SSA_STRUCTALIAS_H
|
#define TREE_SSA_STRUCTALIAS_H
|
#define TREE_SSA_STRUCTALIAS_H
|
|
|
/* True if the data pointed to by PTR can alias anything. */
|
/* 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))
|
#define PTR_IS_REF_ALL(PTR) TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (PTR))
|
|
|
struct constraint;
|
struct constraint;
|
typedef struct constraint *constraint_t;
|
typedef struct constraint *constraint_t;
|
|
|
/* Alias information used by compute_may_aliases and its helpers. */
|
/* Alias information used by compute_may_aliases and its helpers. */
|
struct alias_info
|
struct alias_info
|
{
|
{
|
/* SSA names visited while collecting points-to information. If bit I
|
/* SSA names visited while collecting points-to information. If bit I
|
is set, it means that SSA variable with version I has already been
|
is set, it means that SSA variable with version I has already been
|
visited. */
|
visited. */
|
sbitmap ssa_names_visited;
|
sbitmap ssa_names_visited;
|
|
|
/* Array of SSA_NAME pointers processed by the points-to collector. */
|
/* Array of SSA_NAME pointers processed by the points-to collector. */
|
VEC(tree,heap) *processed_ptrs;
|
VEC(tree,heap) *processed_ptrs;
|
|
|
/* ADDRESSABLE_VARS contains all the global variables and locals that
|
/* ADDRESSABLE_VARS contains all the global variables and locals that
|
have had their address taken. */
|
have had their address taken. */
|
struct alias_map_d **addressable_vars;
|
struct alias_map_d **addressable_vars;
|
size_t num_addressable_vars;
|
size_t num_addressable_vars;
|
|
|
/* POINTERS contains all the _DECL pointers with unique memory tags
|
/* POINTERS contains all the _DECL pointers with unique memory tags
|
that have been referenced in the program. */
|
that have been referenced in the program. */
|
struct alias_map_d **pointers;
|
struct alias_map_d **pointers;
|
size_t num_pointers;
|
size_t num_pointers;
|
|
|
/* Number of function calls found in the program. */
|
/* Number of function calls found in the program. */
|
size_t num_calls_found;
|
size_t num_calls_found;
|
|
|
/* Number of const/pure function calls found in the program. */
|
/* Number of const/pure function calls found in the program. */
|
size_t num_pure_const_calls_found;
|
size_t num_pure_const_calls_found;
|
|
|
/* Total number of virtual operands that will be needed to represent
|
/* Total number of virtual operands that will be needed to represent
|
all the aliases of all the pointers found in the program. */
|
all the aliases of all the pointers found in the program. */
|
long total_alias_vops;
|
long total_alias_vops;
|
|
|
/* Variables that have been written to. */
|
/* Variables that have been written to. */
|
bitmap written_vars;
|
bitmap written_vars;
|
|
|
/* Pointers that have been used in an indirect store operation. */
|
/* Pointers that have been used in an indirect store operation. */
|
bitmap dereferenced_ptrs_store;
|
bitmap dereferenced_ptrs_store;
|
|
|
/* Pointers that have been used in an indirect load operation. */
|
/* Pointers that have been used in an indirect load operation. */
|
bitmap dereferenced_ptrs_load;
|
bitmap dereferenced_ptrs_load;
|
|
|
/* Memory tag for all the PTR_IS_REF_ALL pointers. */
|
/* Memory tag for all the PTR_IS_REF_ALL pointers. */
|
tree ref_all_symbol_mem_tag;
|
tree ref_all_symbol_mem_tag;
|
};
|
};
|
|
|
/* Keep track of how many times each pointer has been dereferenced in
|
/* Keep track of how many times each pointer has been dereferenced in
|
the program using the aux variable. This is used by the alias
|
the program using the aux variable. This is used by the alias
|
grouping heuristic in compute_flow_insensitive_aliasing. */
|
grouping heuristic in compute_flow_insensitive_aliasing. */
|
#define NUM_REFERENCES(ANN) ((size_t)((ANN)->common.aux))
|
#define NUM_REFERENCES(ANN) ((size_t)((ANN)->common.aux))
|
#define NUM_REFERENCES_CLEAR(ANN) ((ANN)->common.aux) = 0
|
#define NUM_REFERENCES_CLEAR(ANN) ((ANN)->common.aux) = 0
|
#define NUM_REFERENCES_INC(ANN) (ANN)->common.aux = (void*) (((size_t)((ANN)->common.aux)) + 1)
|
#define NUM_REFERENCES_INC(ANN) (ANN)->common.aux = (void*) (((size_t)((ANN)->common.aux)) + 1)
|
#define NUM_REFERENCES_SET(ANN, VAL) (ANN)->common.aux = (void*) ((void *)(VAL))
|
#define NUM_REFERENCES_SET(ANN, VAL) (ANN)->common.aux = (void*) ((void *)(VAL))
|
|
|
/* In tree-ssa-alias.c. */
|
/* In tree-ssa-alias.c. */
|
enum escape_type is_escape_site (tree);
|
enum escape_type is_escape_site (tree);
|
|
|
/* In tree-ssa-structalias.c. */
|
/* In tree-ssa-structalias.c. */
|
extern void compute_points_to_sets (struct alias_info *);
|
extern void compute_points_to_sets (struct alias_info *);
|
extern void delete_points_to_sets (void);
|
extern void delete_points_to_sets (void);
|
extern void dump_constraint (FILE *, constraint_t);
|
extern void dump_constraint (FILE *, constraint_t);
|
extern void dump_constraints (FILE *);
|
extern void dump_constraints (FILE *);
|
extern void debug_constraint (constraint_t);
|
extern void debug_constraint (constraint_t);
|
extern void debug_constraints (void);
|
extern void debug_constraints (void);
|
extern void dump_solution_for_var (FILE *, unsigned int);
|
extern void dump_solution_for_var (FILE *, unsigned int);
|
extern void debug_solution_for_var (unsigned int);
|
extern void debug_solution_for_var (unsigned int);
|
extern void dump_sa_points_to_info (FILE *);
|
extern void dump_sa_points_to_info (FILE *);
|
extern void debug_sa_points_to_info (void);
|
extern void debug_sa_points_to_info (void);
|
|
|
#endif /* TREE_SSA_STRUCTALIAS_H */
|
#endif /* TREE_SSA_STRUCTALIAS_H */
|
|
|