1 /* Tree based points-to analysis
2 Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3 Contributed by Daniel Berlin <dberlin@dberlin.org>
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 2 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; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef TREE_ALIAS_COMMON
23 #define TREE_ALIAS_COMMON
25 #include "tree-alias-type.h"
27 /* Alias analysis function pointers.
28 Functions implemented by the actual alias analysis algorithms in
29 order for them to work with the common points-to structure. */
33 Called right before we start using the other functions. */
34 void (*init
) (struct tree_alias_ops
*);
37 Called when we are finished with the alias analyzer. */
38 void (*cleanup
) (struct tree_alias_ops
*);
41 Called when we want to inform the alias analyzer about a new
42 variable we've found. */
43 alias_var (*add_var
) (struct tree_alias_ops
*, tree
);
45 /* Add variable equivalent to existing one.
46 Called when we want to inform the alias analyzer about a new
47 variable that has the same points-to set as an existing
49 alias_var (*add_var_same
) (struct tree_alias_ops
*, tree
,
52 /* Process a simple assignment (a = b).
53 Called to process simple assignment statements of the form a = b,
54 where a and b are both variables. */
55 void (*simple_assign
) (struct tree_alias_ops
*, alias_var
,
57 /* Process an address assignment (a = &b).
58 Called to process address assignment statements of the form a =
59 &b, where a and b are both variables. */
60 void (*addr_assign
) (struct tree_alias_ops
*, alias_var
, alias_var
);
62 /* Process a pointer assignment (a = *b).
63 Called to process pointer assignment statements of the form a =
64 *b, where a and b are both variables. */
65 void (*ptr_assign
) (struct tree_alias_ops
*, alias_var
, alias_var
);
67 /* Process an operator assignment (a = op (...))
68 Called to process operators of the form a = op(...), where a is a
70 void (*op_assign
) (struct tree_alias_ops
*, alias_var
, varray_type
,
72 /* Process a heap assignment (a = alloc (...))
73 Called to process a heap assignment of the form a = alloc
74 (...), where a is a variable, and *alloc is a function that
75 returns new memory. */
76 void (*heap_assign
) (struct tree_alias_ops
*, alias_var
);
78 /* Process an assignment to a pointer (*a = b)
79 Called to process assignment to pointer statements of the form
80 *a = b, where a and b are both variables. */
81 void (*assign_ptr
) (struct tree_alias_ops
*, alias_var
, alias_var
);
83 /* Process a function definition.
84 Called to inform the alias analyzer about a new function
86 void (*function_def
) (struct tree_alias_ops
*, alias_var
,
87 varray_type
, alias_var
);
89 /* Process a function call.
90 Return 1 if we need to assume conservative side-effects. */
91 int (*function_call
) (struct tree_alias_ops
*, alias_var
,
92 alias_var
, varray_type
, bitmap
);
94 /* Determine if two alias variables may alias. */
95 bool (*may_alias
) (struct tree_alias_ops
*, alias_var
, alias_var
);
97 /* Determine if two alias variables have the same points-to set. */
98 bool (*same_points_to_set
) (struct tree_alias_ops
*, alias_var
,
101 /* Determine if the alias variable has an empty points-to set. */
102 bool (*empty_points_to_set
) (struct tree_alias_ops
*, alias_var
);
107 /* Interprocedural. */
110 /* Can do conservative interprocedural analysis if we save the
112 unsigned int ip_partial
:1;
116 extern struct tree_alias_ops
*current_alias_ops
;
117 extern void init_alias_vars (void);
118 extern bool ptr_may_alias_var (tree
, tree
);
119 extern bool same_points_to_set (tree
, tree
);
120 extern bool empty_points_to_set (tree
);
121 extern const char *alias_get_name (tree
);
123 #endif /* TREE_ALIAS_COMMON */