Fix PR42930.
[official-gcc/constexpr.git] / gcc / tree-ssa-alias.h
blob289fb86d04ca45d60d6d784a7082d255827da0bb
1 /* Tree based alias analysis and alias oracle.
2 Copyright (C) 2008 Free Software Foundation, Inc.
3 Contributed by Richard Guenther <rguenther@suse.de>
5 This file is part of GCC.
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.
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.
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/>. */
21 #ifndef TREE_SSA_ALIAS_H
22 #define TREE_SSA_ALIAS_H
24 #include "coretypes.h"
27 /* The points-to solution.
29 The points-to solution is a union of pt_vars and the abstract
30 sets specified by the flags. */
31 struct GTY(()) pt_solution
33 /* Nonzero if points-to analysis couldn't determine where this pointer
34 is pointing to. */
35 unsigned int anything : 1;
37 /* Nonzero if the points-to set includes any global memory. Note that
38 even if this is zero pt_vars can still include global variables. */
39 unsigned int nonlocal : 1;
41 /* Nonzero if the points-to set includes any escaped local variable. */
42 unsigned int escaped : 1;
44 /* Nonzero if the points-to set includes 'nothing', the points-to set
45 includes memory at address NULL. */
46 unsigned int null : 1;
49 /* Nonzero if the pt_vars bitmap includes a global variable. */
50 unsigned int vars_contains_global : 1;
52 /* Nonzero if the pt_vars bitmap includes a restrict tag variable. */
53 unsigned int vars_contains_restrict : 1;
55 /* Set of variables that this pointer may point to. */
56 bitmap vars;
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
65 /* The original full memory reference tree or NULL_TREE if that is
66 not available. */
67 tree ref;
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. */
73 tree base;
74 /* The offset relative to the base. */
75 HOST_WIDE_INT offset;
76 /* The size of the access. */
77 HOST_WIDE_INT size;
78 /* The maximum possible extent of the access or -1 if unconstrained. */
79 HOST_WIDE_INT max_size;
81 /* The alias set of the access or -1 if not yet computed. */
82 alias_set_type ref_alias_set;
84 /* The alias set of the base object or -1 if not yet computed. */
85 alias_set_type base_alias_set;
86 } ao_ref;
89 /* In tree-ssa-alias.c */
90 extern void ao_ref_init (ao_ref *, tree);
91 extern void ao_ref_init_from_ptr_and_size (ao_ref *, tree, tree);
92 extern tree ao_ref_base (ao_ref *);
93 extern alias_set_type ao_ref_alias_set (ao_ref *);
94 extern bool ptr_deref_may_alias_global_p (tree);
95 extern bool refs_may_alias_p (tree, tree);
96 extern bool refs_may_alias_p_1 (ao_ref *, ao_ref *, bool);
97 extern bool refs_anti_dependent_p (tree, tree);
98 extern bool refs_output_dependent_p (tree, tree);
99 extern bool ref_maybe_used_by_stmt_p (gimple, tree);
100 extern bool stmt_may_clobber_ref_p (gimple, tree);
101 extern bool stmt_may_clobber_ref_p_1 (gimple, ao_ref *);
102 extern tree get_continuation_for_phi (gimple, ao_ref *, bitmap *);
103 extern void *walk_non_aliased_vuses (ao_ref *, tree,
104 void *(*)(ao_ref *, tree, void *),
105 void *(*)(ao_ref *, tree, void *), void *);
106 extern unsigned int walk_aliased_vdefs (ao_ref *, tree,
107 bool (*)(ao_ref *, tree, void *),
108 void *, bitmap *);
109 extern struct ptr_info_def *get_ptr_info (tree);
110 extern void dump_alias_info (FILE *);
111 extern void debug_alias_info (void);
112 extern void dump_points_to_solution (FILE *, struct pt_solution *);
113 extern void dump_points_to_info_for (FILE *, tree);
114 extern void debug_points_to_info_for (tree);
115 extern void dump_alias_stats (FILE *);
118 /* In tree-ssa-structalias.c */
119 extern unsigned int compute_may_aliases (void);
120 extern void delete_alias_heapvars (void);
121 extern bool pt_solution_includes_global (struct pt_solution *);
122 extern bool pt_solution_includes (struct pt_solution *, const_tree);
123 extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *);
124 extern bool pt_solutions_same_restrict_base (struct pt_solution *,
125 struct pt_solution *);
126 extern void pt_solution_reset (struct pt_solution *);
127 extern void pt_solution_set (struct pt_solution *, bitmap);
128 extern void dump_pta_stats (FILE *);
131 #endif /* TREE_SSA_ALIAS_H */