annotate gcc/gimple-iterator.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 iterators.
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_ITERATOR_H
kono
parents:
diff changeset
21 #define GCC_GIMPLE_ITERATOR_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 /* Iterator object for GIMPLE statement sequences. */
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 struct gimple_stmt_iterator
kono
parents:
diff changeset
26 {
kono
parents:
diff changeset
27 /* Sequence node holding the current statement. */
kono
parents:
diff changeset
28 gimple_seq_node ptr;
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 /* Sequence and basic block holding the statement. These fields
kono
parents:
diff changeset
31 are necessary to handle edge cases such as when statement is
kono
parents:
diff changeset
32 added to an empty basic block or when the last statement of a
kono
parents:
diff changeset
33 block/sequence is removed. */
kono
parents:
diff changeset
34 gimple_seq *seq;
kono
parents:
diff changeset
35 basic_block bb;
kono
parents:
diff changeset
36 };
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 /* Iterator over GIMPLE_PHI statements. */
kono
parents:
diff changeset
39 struct gphi_iterator : public gimple_stmt_iterator
kono
parents:
diff changeset
40 {
kono
parents:
diff changeset
41 gphi *phi () const
kono
parents:
diff changeset
42 {
kono
parents:
diff changeset
43 return as_a <gphi *> (ptr);
kono
parents:
diff changeset
44 }
kono
parents:
diff changeset
45 };
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 enum gsi_iterator_update
kono
parents:
diff changeset
48 {
kono
parents:
diff changeset
49 GSI_NEW_STMT, /* Only valid when single statement is added, move
kono
parents:
diff changeset
50 iterator to it. */
kono
parents:
diff changeset
51 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
kono
parents:
diff changeset
52 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
kono
parents:
diff changeset
53 for linking other statements in the same
kono
parents:
diff changeset
54 direction. */
kono
parents:
diff changeset
55 };
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 extern void gsi_insert_seq_before_without_update (gimple_stmt_iterator *,
kono
parents:
diff changeset
58 gimple_seq,
kono
parents:
diff changeset
59 enum gsi_iterator_update);
kono
parents:
diff changeset
60 extern void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
kono
parents:
diff changeset
61 enum gsi_iterator_update);
kono
parents:
diff changeset
62 extern void gsi_insert_seq_after_without_update (gimple_stmt_iterator *,
kono
parents:
diff changeset
63 gimple_seq,
kono
parents:
diff changeset
64 enum gsi_iterator_update);
kono
parents:
diff changeset
65 extern void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
kono
parents:
diff changeset
66 enum gsi_iterator_update);
kono
parents:
diff changeset
67 extern gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
kono
parents:
diff changeset
68 extern void gsi_set_stmt (gimple_stmt_iterator *, gimple *);
kono
parents:
diff changeset
69 extern void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
kono
parents:
diff changeset
70 extern bool gsi_replace (gimple_stmt_iterator *, gimple *, bool);
kono
parents:
diff changeset
71 extern void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
kono
parents:
diff changeset
72 extern void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple *,
kono
parents:
diff changeset
73 enum gsi_iterator_update);
kono
parents:
diff changeset
74 extern void gsi_insert_before (gimple_stmt_iterator *, gimple *,
kono
parents:
diff changeset
75 enum gsi_iterator_update);
kono
parents:
diff changeset
76 extern void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple *,
kono
parents:
diff changeset
77 enum gsi_iterator_update);
kono
parents:
diff changeset
78 extern void gsi_insert_after (gimple_stmt_iterator *, gimple *,
kono
parents:
diff changeset
79 enum gsi_iterator_update);
kono
parents:
diff changeset
80 extern bool gsi_remove (gimple_stmt_iterator *, bool);
kono
parents:
diff changeset
81 extern gimple_stmt_iterator gsi_for_stmt (gimple *);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
82 extern gimple_stmt_iterator gsi_for_stmt (gimple *, gimple_seq *);
111
kono
parents:
diff changeset
83 extern gphi_iterator gsi_for_phi (gphi *);
kono
parents:
diff changeset
84 extern void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
kono
parents:
diff changeset
85 extern void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
kono
parents:
diff changeset
86 extern void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
kono
parents:
diff changeset
87 extern void gsi_insert_on_edge (edge, gimple *);
kono
parents:
diff changeset
88 extern void gsi_insert_seq_on_edge (edge, gimple_seq);
kono
parents:
diff changeset
89 extern basic_block gsi_insert_on_edge_immediate (edge, gimple *);
kono
parents:
diff changeset
90 extern basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
kono
parents:
diff changeset
91 extern void gsi_commit_edge_inserts (void);
kono
parents:
diff changeset
92 extern void gsi_commit_one_edge_insert (edge, basic_block *);
kono
parents:
diff changeset
93 extern gphi_iterator gsi_start_phis (basic_block);
kono
parents:
diff changeset
94 extern void update_modified_stmts (gimple_seq);
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 static inline gimple_stmt_iterator
kono
parents:
diff changeset
99 gsi_start_1 (gimple_seq *seq)
kono
parents:
diff changeset
100 {
kono
parents:
diff changeset
101 gimple_stmt_iterator i;
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 i.ptr = gimple_seq_first (*seq);
kono
parents:
diff changeset
104 i.seq = seq;
kono
parents:
diff changeset
105 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 return i;
kono
parents:
diff changeset
108 }
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 #define gsi_start(x) gsi_start_1 (&(x))
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 static inline gimple_stmt_iterator
kono
parents:
diff changeset
113 gsi_none (void)
kono
parents:
diff changeset
114 {
kono
parents:
diff changeset
115 gimple_stmt_iterator i;
kono
parents:
diff changeset
116 i.ptr = NULL;
kono
parents:
diff changeset
117 i.seq = NULL;
kono
parents:
diff changeset
118 i.bb = NULL;
kono
parents:
diff changeset
119 return i;
kono
parents:
diff changeset
120 }
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 /* Return a new iterator pointing to the first statement in basic block BB. */
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 static inline gimple_stmt_iterator
kono
parents:
diff changeset
125 gsi_start_bb (basic_block bb)
kono
parents:
diff changeset
126 {
kono
parents:
diff changeset
127 gimple_stmt_iterator i;
kono
parents:
diff changeset
128 gimple_seq *seq;
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 seq = bb_seq_addr (bb);
kono
parents:
diff changeset
131 i.ptr = gimple_seq_first (*seq);
kono
parents:
diff changeset
132 i.seq = seq;
kono
parents:
diff changeset
133 i.bb = bb;
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 return i;
kono
parents:
diff changeset
136 }
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 gimple_stmt_iterator gsi_start_edge (edge e);
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 static inline gimple_stmt_iterator
kono
parents:
diff changeset
143 gsi_last_1 (gimple_seq *seq)
kono
parents:
diff changeset
144 {
kono
parents:
diff changeset
145 gimple_stmt_iterator i;
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 i.ptr = gimple_seq_last (*seq);
kono
parents:
diff changeset
148 i.seq = seq;
kono
parents:
diff changeset
149 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 return i;
kono
parents:
diff changeset
152 }
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 #define gsi_last(x) gsi_last_1 (&(x))
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 /* Return a new iterator pointing to the last statement in basic block BB. */
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 static inline gimple_stmt_iterator
kono
parents:
diff changeset
159 gsi_last_bb (basic_block bb)
kono
parents:
diff changeset
160 {
kono
parents:
diff changeset
161 gimple_stmt_iterator i;
kono
parents:
diff changeset
162 gimple_seq *seq;
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 seq = bb_seq_addr (bb);
kono
parents:
diff changeset
165 i.ptr = gimple_seq_last (*seq);
kono
parents:
diff changeset
166 i.seq = seq;
kono
parents:
diff changeset
167 i.bb = bb;
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 return i;
kono
parents:
diff changeset
170 }
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 /* Return true if I is at the end of its sequence. */
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 static inline bool
kono
parents:
diff changeset
175 gsi_end_p (gimple_stmt_iterator i)
kono
parents:
diff changeset
176 {
kono
parents:
diff changeset
177 return i.ptr == NULL;
kono
parents:
diff changeset
178 }
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 /* Return true if I is one statement before the end of its sequence. */
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 static inline bool
kono
parents:
diff changeset
183 gsi_one_before_end_p (gimple_stmt_iterator i)
kono
parents:
diff changeset
184 {
kono
parents:
diff changeset
185 return i.ptr != NULL && i.ptr->next == NULL;
kono
parents:
diff changeset
186 }
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 /* Advance the iterator to the next gimple statement. */
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 static inline void
kono
parents:
diff changeset
191 gsi_next (gimple_stmt_iterator *i)
kono
parents:
diff changeset
192 {
kono
parents:
diff changeset
193 i->ptr = i->ptr->next;
kono
parents:
diff changeset
194 }
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 /* Advance the iterator to the previous gimple statement. */
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 static inline void
kono
parents:
diff changeset
199 gsi_prev (gimple_stmt_iterator *i)
kono
parents:
diff changeset
200 {
kono
parents:
diff changeset
201 gimple *prev = i->ptr->prev;
kono
parents:
diff changeset
202 if (prev->next)
kono
parents:
diff changeset
203 i->ptr = prev;
kono
parents:
diff changeset
204 else
kono
parents:
diff changeset
205 i->ptr = NULL;
kono
parents:
diff changeset
206 }
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 /* Return the current stmt. */
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 static inline gimple *
kono
parents:
diff changeset
211 gsi_stmt (gimple_stmt_iterator i)
kono
parents:
diff changeset
212 {
kono
parents:
diff changeset
213 return i.ptr;
kono
parents:
diff changeset
214 }
kono
parents:
diff changeset
215
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
216 /* Return a block statement iterator that points to the first
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
217 non-label statement in block BB. */
111
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 static inline gimple_stmt_iterator
kono
parents:
diff changeset
220 gsi_after_labels (basic_block bb)
kono
parents:
diff changeset
221 {
kono
parents:
diff changeset
222 gimple_stmt_iterator gsi = gsi_start_bb (bb);
kono
parents:
diff changeset
223
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
224 for (; !gsi_end_p (gsi); )
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
225 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
226 if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
227 gsi_next (&gsi);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
228 else
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
229 break;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
230 }
111
kono
parents:
diff changeset
231
kono
parents:
diff changeset
232 return gsi;
kono
parents:
diff changeset
233 }
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 /* Advance the iterator to the next non-debug gimple statement. */
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 static inline void
kono
parents:
diff changeset
238 gsi_next_nondebug (gimple_stmt_iterator *i)
kono
parents:
diff changeset
239 {
kono
parents:
diff changeset
240 do
kono
parents:
diff changeset
241 {
kono
parents:
diff changeset
242 gsi_next (i);
kono
parents:
diff changeset
243 }
kono
parents:
diff changeset
244 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
kono
parents:
diff changeset
245 }
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 /* Advance the iterator to the previous non-debug gimple statement. */
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 static inline void
kono
parents:
diff changeset
250 gsi_prev_nondebug (gimple_stmt_iterator *i)
kono
parents:
diff changeset
251 {
kono
parents:
diff changeset
252 do
kono
parents:
diff changeset
253 {
kono
parents:
diff changeset
254 gsi_prev (i);
kono
parents:
diff changeset
255 }
kono
parents:
diff changeset
256 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
kono
parents:
diff changeset
257 }
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 /* Return a new iterator pointing to the first non-debug statement in
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
260 SEQ. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
261
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
262 static inline gimple_stmt_iterator
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
263 gsi_start_nondebug (gimple_seq seq)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
264 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
265 gimple_stmt_iterator gsi = gsi_start (seq);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
266 if (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi)))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
267 gsi_next_nondebug (&gsi);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
268
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
269 return gsi;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
270 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
271
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
272 /* Return a new iterator pointing to the first non-debug statement in
111
kono
parents:
diff changeset
273 basic block BB. */
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 static inline gimple_stmt_iterator
kono
parents:
diff changeset
276 gsi_start_nondebug_bb (basic_block bb)
kono
parents:
diff changeset
277 {
kono
parents:
diff changeset
278 gimple_stmt_iterator i = gsi_start_bb (bb);
kono
parents:
diff changeset
279
kono
parents:
diff changeset
280 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
kono
parents:
diff changeset
281 gsi_next_nondebug (&i);
kono
parents:
diff changeset
282
kono
parents:
diff changeset
283 return i;
kono
parents:
diff changeset
284 }
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 /* Return a new iterator pointing to the first non-debug non-label statement in
kono
parents:
diff changeset
287 basic block BB. */
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 static inline gimple_stmt_iterator
kono
parents:
diff changeset
290 gsi_start_nondebug_after_labels_bb (basic_block bb)
kono
parents:
diff changeset
291 {
kono
parents:
diff changeset
292 gimple_stmt_iterator i = gsi_after_labels (bb);
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
kono
parents:
diff changeset
295 gsi_next_nondebug (&i);
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 return i;
kono
parents:
diff changeset
298 }
kono
parents:
diff changeset
299
kono
parents:
diff changeset
300 /* Return a new iterator pointing to the last non-debug statement in
kono
parents:
diff changeset
301 basic block BB. */
kono
parents:
diff changeset
302
kono
parents:
diff changeset
303 static inline gimple_stmt_iterator
kono
parents:
diff changeset
304 gsi_last_nondebug_bb (basic_block bb)
kono
parents:
diff changeset
305 {
kono
parents:
diff changeset
306 gimple_stmt_iterator i = gsi_last_bb (bb);
kono
parents:
diff changeset
307
kono
parents:
diff changeset
308 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
kono
parents:
diff changeset
309 gsi_prev_nondebug (&i);
kono
parents:
diff changeset
310
kono
parents:
diff changeset
311 return i;
kono
parents:
diff changeset
312 }
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314 /* Return true if I is followed only by debug statements in its
kono
parents:
diff changeset
315 sequence. */
kono
parents:
diff changeset
316
kono
parents:
diff changeset
317 static inline bool
kono
parents:
diff changeset
318 gsi_one_nondebug_before_end_p (gimple_stmt_iterator i)
kono
parents:
diff changeset
319 {
kono
parents:
diff changeset
320 if (gsi_one_before_end_p (i))
kono
parents:
diff changeset
321 return true;
kono
parents:
diff changeset
322 if (gsi_end_p (i))
kono
parents:
diff changeset
323 return false;
kono
parents:
diff changeset
324 gsi_next_nondebug (&i);
kono
parents:
diff changeset
325 return gsi_end_p (i);
kono
parents:
diff changeset
326 }
kono
parents:
diff changeset
327
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
328 /* Advance I statement iterator to the next non-virtual GIMPLE_PHI
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
329 statement. */
111
kono
parents:
diff changeset
330
kono
parents:
diff changeset
331 static inline void
kono
parents:
diff changeset
332 gsi_next_nonvirtual_phi (gphi_iterator *i)
kono
parents:
diff changeset
333 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
334 do
111
kono
parents:
diff changeset
335 {
kono
parents:
diff changeset
336 gsi_next (i);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
337 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
338 while (!gsi_end_p (*i) && virtual_operand_p (gimple_phi_result (i->phi ())));
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
339 }
111
kono
parents:
diff changeset
340
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
341 /* Return a new iterator pointing to the first non-virtual phi statement in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
342 basic block BB. */
111
kono
parents:
diff changeset
343
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
344 static inline gphi_iterator
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
345 gsi_start_nonvirtual_phis (basic_block bb)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
346 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
347 gphi_iterator i = gsi_start_phis (bb);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
348
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
349 if (!gsi_end_p (i) && virtual_operand_p (gimple_phi_result (i.phi ())))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
350 gsi_next_nonvirtual_phi (&i);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
351
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
352 return i;
111
kono
parents:
diff changeset
353 }
kono
parents:
diff changeset
354
kono
parents:
diff changeset
355 /* Return the basic block associated with this iterator. */
kono
parents:
diff changeset
356
kono
parents:
diff changeset
357 static inline basic_block
kono
parents:
diff changeset
358 gsi_bb (gimple_stmt_iterator i)
kono
parents:
diff changeset
359 {
kono
parents:
diff changeset
360 return i.bb;
kono
parents:
diff changeset
361 }
kono
parents:
diff changeset
362
kono
parents:
diff changeset
363 /* Return the sequence associated with this iterator. */
kono
parents:
diff changeset
364
kono
parents:
diff changeset
365 static inline gimple_seq
kono
parents:
diff changeset
366 gsi_seq (gimple_stmt_iterator i)
kono
parents:
diff changeset
367 {
kono
parents:
diff changeset
368 return *i.seq;
kono
parents:
diff changeset
369 }
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371 /* Determine whether SEQ is a nondebug singleton. */
kono
parents:
diff changeset
372
kono
parents:
diff changeset
373 static inline bool
kono
parents:
diff changeset
374 gimple_seq_nondebug_singleton_p (gimple_seq seq)
kono
parents:
diff changeset
375 {
kono
parents:
diff changeset
376 gimple_stmt_iterator gsi;
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 /* Find a nondebug gimple. */
kono
parents:
diff changeset
379 gsi.ptr = gimple_seq_first (seq);
kono
parents:
diff changeset
380 gsi.seq = &seq;
kono
parents:
diff changeset
381 gsi.bb = NULL;
kono
parents:
diff changeset
382 while (!gsi_end_p (gsi)
kono
parents:
diff changeset
383 && is_gimple_debug (gsi_stmt (gsi)))
kono
parents:
diff changeset
384 gsi_next (&gsi);
kono
parents:
diff changeset
385
kono
parents:
diff changeset
386 /* No nondebug gimple found, not a singleton. */
kono
parents:
diff changeset
387 if (gsi_end_p (gsi))
kono
parents:
diff changeset
388 return false;
kono
parents:
diff changeset
389
kono
parents:
diff changeset
390 /* Find a next nondebug gimple. */
kono
parents:
diff changeset
391 gsi_next (&gsi);
kono
parents:
diff changeset
392 while (!gsi_end_p (gsi)
kono
parents:
diff changeset
393 && is_gimple_debug (gsi_stmt (gsi)))
kono
parents:
diff changeset
394 gsi_next (&gsi);
kono
parents:
diff changeset
395
kono
parents:
diff changeset
396 /* Only a singleton if there's no next nondebug gimple. */
kono
parents:
diff changeset
397 return gsi_end_p (gsi);
kono
parents:
diff changeset
398 }
kono
parents:
diff changeset
399
kono
parents:
diff changeset
400 #endif /* GCC_GIMPLE_ITERATOR_H */