GCC Middle and Back End API Reference
tree-ssa-alias.h
Go to the documentation of this file.
1 /* Tree based alias analysis and alias oracle.
2  Copyright (C) 2008-2013 Free Software Foundation, Inc.
3  Contributed by Richard Guenther <rguenther@suse.de>
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_ALIAS_H
22 #define TREE_SSA_ALIAS_H
23 
24 /* The points-to solution.
25 
26  The points-to solution is a union of pt_vars and the abstract
27  sets specified by the flags. */
28 struct GTY(()) pt_solution
29 {
30  /* Nonzero if points-to analysis couldn't determine where this pointer
31  is pointing to. */
32  unsigned int anything : 1;
33 
34  /* Nonzero if the points-to set includes any global memory. Note that
35  even if this is zero pt_vars can still include global variables. */
36  unsigned int nonlocal : 1;
37 
38  /* Nonzero if the points-to set includes the local escaped solution by
39  reference. */
40  unsigned int escaped : 1;
41 
42  /* Nonzero if the points-to set includes the IPA escaped solution by
43  reference. */
44  unsigned int ipa_escaped : 1;
45 
46  /* Nonzero if the points-to set includes 'nothing', the points-to set
47  includes memory at address NULL. */
48  unsigned int null : 1;
49 
50 
51  /* Nonzero if the pt_vars bitmap includes a global variable. */
52  unsigned int vars_contains_global : 1;
53 
54 
55  /* Set of variables that this pointer may point to. */
57 };
58 
59 
60 /* Simplified and cached information about a memory reference tree.
61  Used by the alias-oracle internally and externally in alternate
62  interfaces. */
63 typedef struct ao_ref_s
64 {
65  /* The original full memory reference tree or NULL_TREE if that is
66  not available. */
68 
69  /* The following fields are the decomposed reference as returned
70  by get_ref_base_and_extent. */
71  /* The base object of the memory reference or NULL_TREE if all of
72  the following fields are not yet computed. */
74  /* The offset relative to the base. */
76  /* The size of the access. */
78  /* The maximum possible extent of the access or -1 if unconstrained. */
80 
81  /* The alias set of the access or -1 if not yet computed. */
83 
84  /* The alias set of the base object or -1 if not yet computed. */
86 
87  /* Whether the memory is considered a volatile access. */
88  bool volatile_p;
89 } ao_ref;
90 
91 
92 /* In tree-ssa-alias.c */
93 extern void ao_ref_init (ao_ref *, tree);
95 extern tree ao_ref_base (ao_ref *);
98 extern bool ptr_derefs_may_alias_p (tree, tree);
99 extern bool ref_may_alias_global_p (tree);
100 extern bool refs_may_alias_p (tree, tree);
101 extern bool refs_may_alias_p_1 (ao_ref *, ao_ref *, bool);
102 extern bool refs_anti_dependent_p (tree, tree);
103 extern bool refs_output_dependent_p (tree, tree);
104 extern bool ref_maybe_used_by_stmt_p (gimple, tree);
105 extern bool stmt_may_clobber_global_p (gimple);
106 extern bool stmt_may_clobber_ref_p (gimple, tree);
107 extern bool stmt_may_clobber_ref_p_1 (gimple, ao_ref *);
108 extern bool call_may_clobber_ref_p (gimple, tree);
109 extern bool stmt_kills_ref_p (gimple, tree);
111  unsigned int *, bitmap *, bool);
112 extern void *walk_non_aliased_vuses (ao_ref *, tree,
113  void *(*)(ao_ref *, tree,
114  unsigned int, void *),
115  void *(*)(ao_ref *, tree, void *), void *);
116 extern unsigned int walk_aliased_vdefs (ao_ref *, tree,
117  bool (*)(ao_ref *, tree, void *),
118  void *, bitmap *);
119 extern struct ptr_info_def *get_ptr_info (tree);
120 extern void dump_alias_info (FILE *);
121 extern void debug_alias_info (void);
122 extern void dump_points_to_solution (FILE *, struct pt_solution *);
123 extern void debug (pt_solution &ref);
124 extern void debug (pt_solution *ptr);
125 extern void dump_points_to_info_for (FILE *, tree);
126 extern void debug_points_to_info_for (tree);
127 extern void dump_alias_stats (FILE *);
128 
129 
130 /* In tree-ssa-structalias.c */
131 extern unsigned int compute_may_aliases (void);
132 extern bool pt_solution_empty_p (struct pt_solution *);
133 extern bool pt_solution_singleton_p (struct pt_solution *, unsigned *);
134 extern bool pt_solution_includes_global (struct pt_solution *);
135 extern bool pt_solution_includes (struct pt_solution *, const_tree);
136 extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *);
137 extern void pt_solution_reset (struct pt_solution *);
138 extern void pt_solution_set (struct pt_solution *, bitmap, bool);
139 extern void pt_solution_set_var (struct pt_solution *, tree);
140 
141 extern void dump_pta_stats (FILE *);
142 
143 extern GTY(()) struct pt_solution ipa_escaped_pt;
144 
145 
146 #endif /* TREE_SSA_ALIAS_H */