2009-04-21 Taras Glek <tglek@mozilla.com>
[official-gcc.git] / gcc / tree-ssa-alias.h
blob5f951ae162527d220e5f3441536dcb3817f80e42
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 reasons a variable may escape a function. */
28 enum escape_type
30 NO_ESCAPE = 0, /* Doesn't escape. */
31 ESCAPE_STORED_IN_GLOBAL = 1 << 0,
32 ESCAPE_TO_ASM = 1 << 1, /* Passed by address to an assembly
33 statement. */
34 ESCAPE_TO_CALL = 1 << 2, /* Escapes to a function call. */
35 ESCAPE_BAD_CAST = 1 << 3, /* Cast from pointer to integer */
36 ESCAPE_TO_RETURN = 1 << 4, /* Returned from function. */
37 ESCAPE_TO_PURE_CONST = 1 << 5, /* Escapes to a pure or constant
38 function call. */
39 ESCAPE_IS_GLOBAL = 1 << 6, /* Is a global variable. */
40 ESCAPE_IS_PARM = 1 << 7, /* Is an incoming function argument. */
41 ESCAPE_UNKNOWN = 1 << 8 /* We believe it escapes for
42 some reason not enumerated
43 above. */
47 /* The points-to solution.
49 The points-to solution is a union of pt_vars and the abstract
50 sets specified by the flags. */
51 struct GTY(()) pt_solution
53 /* Nonzero if points-to analysis couldn't determine where this pointer
54 is pointing to. */
55 unsigned int anything : 1;
57 /* Nonzero if the points-to set includes any global memory. Note that
58 even if this is zero pt_vars can still include global variables. */
59 unsigned int nonlocal : 1;
61 /* Nonzero if the points-to set includes any escaped local variable. */
62 unsigned int escaped : 1;
64 /* Nonzero if the points-to set includes 'nothing', the points-to set
65 includes memory at address NULL. */
66 unsigned int null : 1;
69 /* Nonzero if the pt_vars bitmap includes a global variable. */
70 unsigned int vars_contains_global : 1;
72 /* Set of variables that this pointer may point to. */
73 bitmap vars;
77 /* In tree-ssa-alias.c */
78 extern enum escape_type is_escape_site (gimple);
79 extern bool ptr_deref_may_alias_global_p (tree);
80 extern bool refs_may_alias_p (tree, tree);
81 extern bool ref_maybe_used_by_stmt_p (gimple, tree);
82 extern bool stmt_may_clobber_ref_p (gimple, tree);
83 extern void *walk_non_aliased_vuses (tree, tree,
84 void *(*)(tree, tree, void *), void *);
85 extern unsigned int walk_aliased_vdefs (tree, tree,
86 bool (*)(tree, tree, void *), void *,
87 bitmap *);
88 extern struct ptr_info_def *get_ptr_info (tree);
89 extern void dump_alias_info (FILE *);
90 extern void debug_alias_info (void);
91 extern void dump_points_to_info_for (FILE *, tree);
92 extern void debug_points_to_info_for (tree);
93 extern void dump_alias_stats (FILE *);
96 /* In tree-ssa-structalias.c */
97 extern unsigned int compute_may_aliases (void);
98 extern void delete_alias_heapvars (void);
99 extern bool pt_solution_includes_global (struct pt_solution *);
100 extern bool pt_solution_includes (struct pt_solution *, const_tree);
101 extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *);
102 extern void pt_solution_reset (struct pt_solution *);
103 extern void dump_pta_stats (FILE *);
106 #endif /* TREE_SSA_ALIAS_H */