annotate gcc/gimple-walk.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Header file for gimple statement walk support.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2013-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #ifndef GCC_GIMPLE_WALK_H
kono
parents:
diff changeset
21 #define GCC_GIMPLE_WALK_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 /* Convenience routines to walk all statements of a gimple function.
kono
parents:
diff changeset
24 Note that this is useful exclusively before the code is converted
kono
parents:
diff changeset
25 into SSA form. Once the program is in SSA form, the standard
kono
parents:
diff changeset
26 operand interface should be used to analyze/modify statements. */
kono
parents:
diff changeset
27 struct walk_stmt_info
kono
parents:
diff changeset
28 {
kono
parents:
diff changeset
29 /* Points to the current statement being walked. */
kono
parents:
diff changeset
30 gimple_stmt_iterator gsi;
kono
parents:
diff changeset
31 gimple *stmt;
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 /* Additional data that the callback functions may want to carry
kono
parents:
diff changeset
34 through the recursion. */
kono
parents:
diff changeset
35 void *info;
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 /* Pointer map used to mark visited tree nodes when calling
kono
parents:
diff changeset
38 walk_tree on each operand. If set to NULL, duplicate tree nodes
kono
parents:
diff changeset
39 will be visited more than once. */
kono
parents:
diff changeset
40 hash_set<tree> *pset;
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 /* Operand returned by the callbacks. This is set when calling
kono
parents:
diff changeset
43 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
kono
parents:
diff changeset
44 returns non-NULL, this field will contain the tree returned by
kono
parents:
diff changeset
45 the last callback. */
kono
parents:
diff changeset
46 tree callback_result;
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 /* Indicates whether the operand being examined may be replaced
kono
parents:
diff changeset
49 with something that matches is_gimple_val (if true) or something
kono
parents:
diff changeset
50 slightly more complicated (if false). "Something" technically
kono
parents:
diff changeset
51 means the common subset of is_gimple_lvalue and is_gimple_rhs,
kono
parents:
diff changeset
52 but we never try to form anything more complicated than that, so
kono
parents:
diff changeset
53 we don't bother checking.
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 Also note that CALLBACK should update this flag while walking the
kono
parents:
diff changeset
56 sub-expressions of a statement. For instance, when walking the
kono
parents:
diff changeset
57 statement 'foo (&var)', the flag VAL_ONLY will initially be set
kono
parents:
diff changeset
58 to true, however, when walking &var, the operand of that
kono
parents:
diff changeset
59 ADDR_EXPR does not need to be a GIMPLE value. */
kono
parents:
diff changeset
60 BOOL_BITFIELD val_only : 1;
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 /* True if we are currently walking the LHS of an assignment. */
kono
parents:
diff changeset
63 BOOL_BITFIELD is_lhs : 1;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 /* Optional. Set to true by the callback functions if they made any
kono
parents:
diff changeset
66 changes. */
kono
parents:
diff changeset
67 BOOL_BITFIELD changed : 1;
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 /* True if we're interested in location information. */
kono
parents:
diff changeset
70 BOOL_BITFIELD want_locations : 1;
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 /* True if we've removed the statement that was processed. */
kono
parents:
diff changeset
73 BOOL_BITFIELD removed_stmt : 1;
kono
parents:
diff changeset
74 };
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 /* Callback for walk_gimple_stmt. Called for every statement found
kono
parents:
diff changeset
77 during traversal. The first argument points to the statement to
kono
parents:
diff changeset
78 walk. The second argument is a flag that the callback sets to
kono
parents:
diff changeset
79 'true' if it the callback handled all the operands and
kono
parents:
diff changeset
80 sub-statements of the statement (the default value of this flag is
kono
parents:
diff changeset
81 'false'). The third argument is an anonymous pointer to data
kono
parents:
diff changeset
82 to be used by the callback. */
kono
parents:
diff changeset
83 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
kono
parents:
diff changeset
84 struct walk_stmt_info *);
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 extern gimple *walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
kono
parents:
diff changeset
87 struct walk_stmt_info *);
kono
parents:
diff changeset
88 extern gimple *walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
kono
parents:
diff changeset
89 struct walk_stmt_info *);
kono
parents:
diff changeset
90 extern tree walk_gimple_op (gimple *, walk_tree_fn, struct walk_stmt_info *);
kono
parents:
diff changeset
91 extern tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn,
kono
parents:
diff changeset
92 walk_tree_fn, struct walk_stmt_info *);
kono
parents:
diff changeset
93 typedef bool (*walk_stmt_load_store_addr_fn) (gimple *, tree, tree, void *);
kono
parents:
diff changeset
94 extern bool walk_stmt_load_store_addr_ops (gimple *, void *,
kono
parents:
diff changeset
95 walk_stmt_load_store_addr_fn,
kono
parents:
diff changeset
96 walk_stmt_load_store_addr_fn,
kono
parents:
diff changeset
97 walk_stmt_load_store_addr_fn);
kono
parents:
diff changeset
98 extern bool walk_stmt_load_store_ops (gimple *, void *,
kono
parents:
diff changeset
99 walk_stmt_load_store_addr_fn,
kono
parents:
diff changeset
100 walk_stmt_load_store_addr_fn);
kono
parents:
diff changeset
101 #endif /* GCC_GIMPLE_WALK_H */