| 1 |
38 |
julius |
/* Tree based points-to analysis
|
| 2 |
|
|
Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
|
| 3 |
|
|
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
| 4 |
|
|
|
| 5 |
|
|
This file is part of GCC.
|
| 6 |
|
|
|
| 7 |
|
|
GCC is free software; you can redistribute it and/or modify
|
| 8 |
|
|
under the terms of the GNU General Public License as published by
|
| 9 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
| 10 |
|
|
(at your option) any later version.
|
| 11 |
|
|
|
| 12 |
|
|
GCC is distributed in the hope that it will be useful,
|
| 13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 |
|
|
GNU General Public License for more details.
|
| 16 |
|
|
|
| 17 |
|
|
You should have received a copy of the GNU General Public License
|
| 18 |
|
|
along with GCC; see the file COPYING3. If not see
|
| 19 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 20 |
|
|
|
| 21 |
|
|
#ifndef TREE_SSA_STRUCTALIAS_H
|
| 22 |
|
|
#define TREE_SSA_STRUCTALIAS_H
|
| 23 |
|
|
|
| 24 |
|
|
/* True if the data pointed to by PTR can alias anything. */
|
| 25 |
|
|
#define PTR_IS_REF_ALL(PTR) TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (PTR))
|
| 26 |
|
|
|
| 27 |
|
|
struct constraint;
|
| 28 |
|
|
typedef struct constraint *constraint_t;
|
| 29 |
|
|
|
| 30 |
|
|
/* Alias information used by compute_may_aliases and its helpers. */
|
| 31 |
|
|
struct alias_info
|
| 32 |
|
|
{
|
| 33 |
|
|
/* SSA names visited while collecting points-to information. If bit I
|
| 34 |
|
|
is set, it means that SSA variable with version I has already been
|
| 35 |
|
|
visited. */
|
| 36 |
|
|
sbitmap ssa_names_visited;
|
| 37 |
|
|
|
| 38 |
|
|
/* Array of SSA_NAME pointers processed by the points-to collector. */
|
| 39 |
|
|
VEC(tree,heap) *processed_ptrs;
|
| 40 |
|
|
|
| 41 |
|
|
/* ADDRESSABLE_VARS contains all the global variables and locals that
|
| 42 |
|
|
have had their address taken. */
|
| 43 |
|
|
struct alias_map_d **addressable_vars;
|
| 44 |
|
|
size_t num_addressable_vars;
|
| 45 |
|
|
|
| 46 |
|
|
/* POINTERS contains all the _DECL pointers with unique memory tags
|
| 47 |
|
|
that have been referenced in the program. */
|
| 48 |
|
|
struct alias_map_d **pointers;
|
| 49 |
|
|
size_t num_pointers;
|
| 50 |
|
|
|
| 51 |
|
|
/* Number of function calls found in the program. */
|
| 52 |
|
|
size_t num_calls_found;
|
| 53 |
|
|
|
| 54 |
|
|
/* Number of const/pure function calls found in the program. */
|
| 55 |
|
|
size_t num_pure_const_calls_found;
|
| 56 |
|
|
|
| 57 |
|
|
/* Total number of virtual operands that will be needed to represent
|
| 58 |
|
|
all the aliases of all the pointers found in the program. */
|
| 59 |
|
|
long total_alias_vops;
|
| 60 |
|
|
|
| 61 |
|
|
/* Variables that have been written to. */
|
| 62 |
|
|
bitmap written_vars;
|
| 63 |
|
|
|
| 64 |
|
|
/* Pointers that have been used in an indirect store operation. */
|
| 65 |
|
|
bitmap dereferenced_ptrs_store;
|
| 66 |
|
|
|
| 67 |
|
|
/* Pointers that have been used in an indirect load operation. */
|
| 68 |
|
|
bitmap dereferenced_ptrs_load;
|
| 69 |
|
|
|
| 70 |
|
|
/* Memory tag for all the PTR_IS_REF_ALL pointers. */
|
| 71 |
|
|
tree ref_all_symbol_mem_tag;
|
| 72 |
|
|
};
|
| 73 |
|
|
|
| 74 |
|
|
/* Keep track of how many times each pointer has been dereferenced in
|
| 75 |
|
|
the program using the aux variable. This is used by the alias
|
| 76 |
|
|
grouping heuristic in compute_flow_insensitive_aliasing. */
|
| 77 |
|
|
#define NUM_REFERENCES(ANN) ((size_t)((ANN)->common.aux))
|
| 78 |
|
|
#define NUM_REFERENCES_CLEAR(ANN) ((ANN)->common.aux) = 0
|
| 79 |
|
|
#define NUM_REFERENCES_INC(ANN) (ANN)->common.aux = (void*) (((size_t)((ANN)->common.aux)) + 1)
|
| 80 |
|
|
#define NUM_REFERENCES_SET(ANN, VAL) (ANN)->common.aux = (void*) ((void *)(VAL))
|
| 81 |
|
|
|
| 82 |
|
|
/* In tree-ssa-alias.c. */
|
| 83 |
|
|
enum escape_type is_escape_site (tree);
|
| 84 |
|
|
|
| 85 |
|
|
/* In tree-ssa-structalias.c. */
|
| 86 |
|
|
extern void compute_points_to_sets (struct alias_info *);
|
| 87 |
|
|
extern void delete_points_to_sets (void);
|
| 88 |
|
|
extern void dump_constraint (FILE *, constraint_t);
|
| 89 |
|
|
extern void dump_constraints (FILE *);
|
| 90 |
|
|
extern void debug_constraint (constraint_t);
|
| 91 |
|
|
extern void debug_constraints (void);
|
| 92 |
|
|
extern void dump_solution_for_var (FILE *, unsigned int);
|
| 93 |
|
|
extern void debug_solution_for_var (unsigned int);
|
| 94 |
|
|
extern void dump_sa_points_to_info (FILE *);
|
| 95 |
|
|
extern void debug_sa_points_to_info (void);
|
| 96 |
|
|
|
| 97 |
|
|
#endif /* TREE_SSA_STRUCTALIAS_H */
|