190792Sgshapiro/* Tree based points-to analysis 290792Sgshapiro Copyright (C) 2002, 2003 Free Software Foundation, Inc. 3285303Sgshapiro Contributed by Daniel Berlin <dberlin@dberlin.org> 490792Sgshapiro 590792SgshapiroThis file is part of GCC. 690792Sgshapiro 790792SgshapiroGCC is free software; you can redistribute it and/or modify 890792Sgshapirounder the terms of the GNU General Public License as published by 990792Sgshapirothe Free Software Foundation; either version 2 of the License, or 1090792Sgshapiro(at your option) any later version. 1190792Sgshapiro 1290792SgshapiroGCC is distributed in the hope that it will be useful, 1390792Sgshapirobut WITHOUT ANY WARRANTY; without even the implied warranty of 1490792SgshapiroMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1590792SgshapiroGNU General Public License for more details. 1690792Sgshapiro 1790792SgshapiroYou should have received a copy of the GNU General Public License 18266692Sgshapiroalong with GCC; if not, write to the Free Software 1990792SgshapiroFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 2090792Sgshapiro*/ 2190792Sgshapiro 2294334Sgshapiro#ifndef TREE_SSA_STRUCTALIAS_H 23110560Sgshapiro#define TREE_SSA_STRUCTALIAS_H 24110560Sgshapiro 25285303Sgshapiro/* True if the data pointed to by PTR can alias anything. */ 26110560Sgshapiro#define PTR_IS_REF_ALL(PTR) TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (PTR)) 27 28struct constraint; 29typedef struct constraint *constraint_t; 30 31/* Alias information used by compute_may_aliases and its helpers. */ 32struct alias_info 33{ 34 /* SSA names visited while collecting points-to information. If bit I 35 is set, it means that SSA variable with version I has already been 36 visited. */ 37 sbitmap ssa_names_visited; 38 39 /* Array of SSA_NAME pointers processed by the points-to collector. */ 40 VEC(tree,heap) *processed_ptrs; 41 42 /* ADDRESSABLE_VARS contains all the global variables and locals that 43 have had their address taken. */ 44 struct alias_map_d **addressable_vars; 45 size_t num_addressable_vars; 46 47 /* POINTERS contains all the _DECL pointers with unique memory tags 48 that have been referenced in the program. */ 49 struct alias_map_d **pointers; 50 size_t num_pointers; 51 52 /* Number of function calls found in the program. */ 53 size_t num_calls_found; 54 55 /* Number of const/pure function calls found in the program. */ 56 size_t num_pure_const_calls_found; 57 58 /* Total number of virtual operands that will be needed to represent 59 all the aliases of all the pointers found in the program. */ 60 long total_alias_vops; 61 62 /* Variables that have been written to. */ 63 bitmap written_vars; 64 65 /* Pointers that have been used in an indirect store operation. */ 66 bitmap dereferenced_ptrs_store; 67 68 /* Pointers that have been used in an indirect load operation. */ 69 bitmap dereferenced_ptrs_load; 70 71 /* Memory tag for all the PTR_IS_REF_ALL pointers. */ 72 tree ref_all_symbol_mem_tag; 73}; 74 75/* Keep track of how many times each pointer has been dereferenced in 76 the program using the aux variable. This is used by the alias 77 grouping heuristic in compute_flow_insensitive_aliasing. */ 78#define NUM_REFERENCES(ANN) ((size_t)((ANN)->common.aux)) 79#define NUM_REFERENCES_CLEAR(ANN) ((ANN)->common.aux) = 0 80#define NUM_REFERENCES_INC(ANN) (ANN)->common.aux = (void*) (((size_t)((ANN)->common.aux)) + 1) 81#define NUM_REFERENCES_SET(ANN, VAL) (ANN)->common.aux = (void*) ((void *)(VAL)) 82 83/* In tree-ssa-alias.c. */ 84enum escape_type is_escape_site (tree); 85 86/* In tree-ssa-structalias.c. */ 87extern void compute_points_to_sets (struct alias_info *); 88extern void delete_points_to_sets (void); 89extern void dump_constraint (FILE *, constraint_t); 90extern void dump_constraints (FILE *); 91extern void debug_constraint (constraint_t); 92extern void debug_constraints (void); 93extern void dump_solution_for_var (FILE *, unsigned int); 94extern void debug_solution_for_var (unsigned int); 95extern void dump_sa_points_to_info (FILE *); 96extern void debug_sa_points_to_info (void); 97 98#endif /* TREE_SSA_STRUCTALIAS_H */ 99