Create startup files from the GCC sources and drop our versions.
[dragonfly.git] / contrib / gcc-4.0 / gcc / tree-flow-inline.h
1 /* Inline functions for tree-flow.h
2    Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
3    Contributed by Diego Novillo <dnovillo@redhat.com>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #ifndef _TREE_FLOW_INLINE_H
23 #define _TREE_FLOW_INLINE_H 1
24
25 /* Inline functions for manipulating various data structures defined in
26    tree-flow.h.  See tree-flow.h for documentation.  */
27
28 /* Return the variable annotation for T, which must be a _DECL node.
29    Return NULL if the variable annotation doesn't already exist.  */
30 static inline var_ann_t
31 var_ann (tree t)
32 {
33   gcc_assert (t);
34   gcc_assert (DECL_P (t));
35   gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
36
37   return (var_ann_t) t->common.ann;
38 }
39
40 /* Return the variable annotation for T, which must be a _DECL node.
41    Create the variable annotation if it doesn't exist.  */
42 static inline var_ann_t
43 get_var_ann (tree var)
44 {
45   var_ann_t ann = var_ann (var);
46   return (ann) ? ann : create_var_ann (var);
47 }
48
49 /* Return the statement annotation for T, which must be a statement
50    node.  Return NULL if the statement annotation doesn't exist.  */
51 static inline stmt_ann_t
52 stmt_ann (tree t)
53 {
54 #ifdef ENABLE_CHECKING
55   gcc_assert (is_gimple_stmt (t));
56 #endif
57   return (stmt_ann_t) t->common.ann;
58 }
59
60 /* Return the statement annotation for T, which must be a statement
61    node.  Create the statement annotation if it doesn't exist.  */
62 static inline stmt_ann_t
63 get_stmt_ann (tree stmt)
64 {
65   stmt_ann_t ann = stmt_ann (stmt);
66   return (ann) ? ann : create_stmt_ann (stmt);
67 }
68
69
70 /* Return the annotation type for annotation ANN.  */
71 static inline enum tree_ann_type
72 ann_type (tree_ann_t ann)
73 {
74   return ann->common.type;
75 }
76
77 /* Return the basic block for statement T.  */
78 static inline basic_block
79 bb_for_stmt (tree t)
80 {
81   stmt_ann_t ann;
82
83   if (TREE_CODE (t) == PHI_NODE)
84     return PHI_BB (t);
85
86   ann = stmt_ann (t);
87   return ann ? ann->bb : NULL;
88 }
89
90 /* Return the may_aliases varray for variable VAR, or NULL if it has
91    no may aliases.  */
92 static inline varray_type
93 may_aliases (tree var)
94 {
95   var_ann_t ann = var_ann (var);
96   return ann ? ann->may_aliases : NULL;
97 }
98
99 /* Return the line number for EXPR, or return -1 if we have no line
100    number information for it.  */
101 static inline int
102 get_lineno (tree expr)
103 {
104   if (expr == NULL_TREE)
105     return -1;
106
107   if (TREE_CODE (expr) == COMPOUND_EXPR)
108     expr = TREE_OPERAND (expr, 0);
109
110   if (! EXPR_HAS_LOCATION (expr))
111     return -1;
112
113   return EXPR_LINENO (expr);
114 }
115
116 /* Return the file name for EXPR, or return "???" if we have no
117    filename information.  */
118 static inline const char *
119 get_filename (tree expr)
120 {
121   const char *filename;
122   if (expr == NULL_TREE)
123     return "???";
124
125   if (TREE_CODE (expr) == COMPOUND_EXPR)
126     expr = TREE_OPERAND (expr, 0);
127
128   if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
129     return filename;
130   else
131     return "???";
132 }
133
134 /* Return true if T is a noreturn call.  */
135 static inline bool
136 noreturn_call_p (tree t)
137 {
138   tree call = get_call_expr_in (t);
139   return call != 0 && (call_expr_flags (call) & ECF_NORETURN) != 0;
140 }
141
142 /* Mark statement T as modified.  */
143 static inline void
144 modify_stmt (tree t)
145 {
146   stmt_ann_t ann = stmt_ann (t);
147   if (ann == NULL)
148     ann = create_stmt_ann (t);
149   else if (noreturn_call_p (t))
150     VEC_safe_push (tree, modified_noreturn_calls, t);
151   ann->modified = 1;
152 }
153
154 /* Mark statement T as unmodified.  */
155 static inline void
156 unmodify_stmt (tree t)
157 {
158   stmt_ann_t ann = stmt_ann (t);
159   if (ann == NULL)
160     ann = create_stmt_ann (t);
161   ann->modified = 0;
162 }
163
164 /* Return true if T is marked as modified, false otherwise.  */
165 static inline bool
166 stmt_modified_p (tree t)
167 {
168   stmt_ann_t ann = stmt_ann (t);
169
170   /* Note that if the statement doesn't yet have an annotation, we consider it
171      modified.  This will force the next call to get_stmt_operands to scan the
172      statement.  */
173   return ann ? ann->modified : true;
174 }
175
176 /* Return the definitions present in ANN, a statement annotation.
177    Return NULL if this annotation contains no definitions.  */
178 static inline def_optype
179 get_def_ops (stmt_ann_t ann)
180 {
181   return ann ? ann->operands.def_ops : NULL;
182 }
183
184 /* Return the uses present in ANN, a statement annotation.
185    Return NULL if this annotation contains no uses.  */
186 static inline use_optype
187 get_use_ops (stmt_ann_t ann)
188 {
189   return ann ? ann->operands.use_ops : NULL;
190 }
191
192 /* Return the virtual may-defs present in ANN, a statement
193    annotation.
194    Return NULL if this annotation contains no virtual may-defs.  */
195 static inline v_may_def_optype
196 get_v_may_def_ops (stmt_ann_t ann)
197 {
198   return ann ? ann->operands.v_may_def_ops : NULL;
199 }
200
201 /* Return the virtual uses present in ANN, a statement annotation.
202    Return NULL if this annotation contains no virtual uses.  */
203 static inline vuse_optype
204 get_vuse_ops (stmt_ann_t ann)
205 {
206   return ann ? ann->operands.vuse_ops : NULL;
207 }
208
209 /* Return the virtual must-defs present in ANN, a statement
210    annotation.  Return NULL if this annotation contains no must-defs.*/
211 static inline v_must_def_optype
212 get_v_must_def_ops (stmt_ann_t ann)
213 {
214   return ann ? ann->operands.v_must_def_ops : NULL;
215 }
216
217 /* Return the tree pointer to by USE.  */ 
218 static inline tree
219 get_use_from_ptr (use_operand_p use)
220
221   return *(use.use);
222
223
224 /* Return the tree pointer to by DEF.  */
225 static inline tree
226 get_def_from_ptr (def_operand_p def)
227 {
228   return *(def.def);
229 }
230
231 /* Return a pointer to the tree that is at INDEX in the USES array.  */
232 static inline use_operand_p
233 get_use_op_ptr (use_optype uses, unsigned int index)
234 {
235   gcc_assert (index < uses->num_uses);
236   return uses->uses[index];
237 }
238
239 /* Return a def_operand_p pointer for element INDEX of DEFS.  */
240 static inline def_operand_p
241 get_def_op_ptr (def_optype defs, unsigned int index)
242 {
243   gcc_assert (index < defs->num_defs);
244   return defs->defs[index];
245 }
246
247
248 /* Return the def_operand_p that is the V_MAY_DEF_RESULT for the V_MAY_DEF
249    at INDEX in the V_MAY_DEFS array.  */
250 static inline def_operand_p
251 get_v_may_def_result_ptr(v_may_def_optype v_may_defs, unsigned int index)
252 {
253   def_operand_p op;
254   gcc_assert (index < v_may_defs->num_v_may_defs);
255   op.def = &(v_may_defs->v_may_defs[index].def);
256   return op;
257 }
258
259 /* Return a use_operand_p that is the V_MAY_DEF_OP for the V_MAY_DEF at
260    INDEX in the V_MAY_DEFS array.  */
261 static inline use_operand_p
262 get_v_may_def_op_ptr(v_may_def_optype v_may_defs, unsigned int index)
263 {
264   use_operand_p op;
265   gcc_assert (index < v_may_defs->num_v_may_defs);
266   op.use = &(v_may_defs->v_may_defs[index].use);
267   return op;
268 }
269
270 /* Return a use_operand_p that is at INDEX in the VUSES array.  */
271 static inline use_operand_p
272 get_vuse_op_ptr(vuse_optype vuses, unsigned int index)
273 {
274   use_operand_p op;
275   gcc_assert (index < vuses->num_vuses);
276   op.use = &(vuses->vuses[index]);
277   return op;
278 }
279
280 /* Return a def_operand_p that is the V_MUST_DEF_RESULT for the
281    V_MUST_DEF at INDEX in the V_MUST_DEFS array.  */
282 static inline def_operand_p
283 get_v_must_def_result_ptr (v_must_def_optype v_must_defs, unsigned int index)
284 {
285   def_operand_p op;
286   gcc_assert (index < v_must_defs->num_v_must_defs);
287   op.def = &(v_must_defs->v_must_defs[index].def);
288   return op;
289 }
290
291 /* Return a use_operand_p that is the V_MUST_DEF_KILL for the 
292    V_MUST_DEF at INDEX in the V_MUST_DEFS array.  */
293 static inline use_operand_p
294 get_v_must_def_kill_ptr (v_must_def_optype v_must_defs, unsigned int index)
295 {
296   use_operand_p op;
297   gcc_assert (index < v_must_defs->num_v_must_defs);
298   op.use = &(v_must_defs->v_must_defs[index].use);
299   return op;
300 }
301
302 /* Return a def_operand_p pointer for the result of PHI.  */
303 static inline def_operand_p
304 get_phi_result_ptr (tree phi)
305 {
306   def_operand_p op;
307   op.def = &(PHI_RESULT_TREE (phi));
308   return op;
309 }
310
311 /* Return a use_operand_p pointer for argument I of phinode PHI.  */
312 static inline use_operand_p
313 get_phi_arg_def_ptr (tree phi, int i)
314 {
315   use_operand_p op;
316   op.use = &(PHI_ARG_DEF_TREE (phi, i));
317   return op;
318 }
319  
320 /* Return the bitmap of addresses taken by STMT, or NULL if it takes
321    no addresses.  */
322 static inline bitmap
323 addresses_taken (tree stmt)
324 {
325   stmt_ann_t ann = stmt_ann (stmt);
326   return ann ? ann->addresses_taken : NULL;
327 }
328
329 /* Return the immediate uses of STMT, or NULL if this information is
330    not computed.  */
331 static dataflow_t
332 get_immediate_uses (tree stmt)
333 {
334   stmt_ann_t ann;
335
336   if (TREE_CODE (stmt) == PHI_NODE)
337     return PHI_DF (stmt);
338
339   ann = stmt_ann (stmt);
340   return ann ? ann->df : NULL;
341 }
342
343 /* Return the number of immediate uses present in the dataflow
344    information at DF.  */
345 static inline int
346 num_immediate_uses (dataflow_t df)
347 {
348   varray_type imm;
349
350   if (!df)
351     return 0;
352
353   imm = df->immediate_uses;
354   if (!imm)
355     return df->uses[1] ? 2 : 1;
356
357   return VARRAY_ACTIVE_SIZE (imm) + 2;
358 }
359
360 /* Return the tree that is at NUM in the immediate use DF array.  */
361 static inline tree
362 immediate_use (dataflow_t df, int num)
363 {
364   if (!df)
365     return NULL_TREE;
366
367 #ifdef ENABLE_CHECKING
368   gcc_assert (num < num_immediate_uses (df));
369 #endif
370   if (num < 2)
371     return df->uses[num];
372   return VARRAY_TREE (df->immediate_uses, num - 2);
373 }
374
375 /* Return the basic_block annotation for BB.  */
376 static inline bb_ann_t
377 bb_ann (basic_block bb)
378 {
379   return (bb_ann_t)bb->tree_annotations;
380 }
381
382 /* Return the PHI nodes for basic block BB, or NULL if there are no
383    PHI nodes.  */
384 static inline tree
385 phi_nodes (basic_block bb)
386 {
387   return bb_ann (bb)->phi_nodes;
388 }
389
390 /* Set list of phi nodes of a basic block BB to L.  */
391
392 static inline void
393 set_phi_nodes (basic_block bb, tree l)
394 {
395   tree phi;
396
397   bb_ann (bb)->phi_nodes = l;
398   for (phi = l; phi; phi = PHI_CHAIN (phi))
399     set_bb_for_stmt (phi, bb);
400 }
401
402 /* Mark VAR as used, so that it'll be preserved during rtl expansion.  */
403
404 static inline void
405 set_is_used (tree var)
406 {
407   var_ann_t ann = get_var_ann (var);
408   ann->used = 1;
409 }
410
411
412 /*  -----------------------------------------------------------------------  */
413
414 /* Return true if T is an executable statement.  */
415 static inline bool
416 is_exec_stmt (tree t)
417 {
418   return (t && !IS_EMPTY_STMT (t) && t != error_mark_node);
419 }
420
421
422 /* Return true if this stmt can be the target of a control transfer stmt such
423    as a goto.  */
424 static inline bool
425 is_label_stmt (tree t)
426 {
427   if (t)
428     switch (TREE_CODE (t))
429       {
430         case LABEL_DECL:
431         case LABEL_EXPR:
432         case CASE_LABEL_EXPR:
433           return true;
434         default:
435           return false;
436       }
437   return false;
438 }
439
440 /* Set the default definition for VAR to DEF.  */
441 static inline void
442 set_default_def (tree var, tree def)
443 {
444   var_ann_t ann = get_var_ann (var);
445   ann->default_def = def;
446 }
447
448 /* Return the default definition for variable VAR, or NULL if none
449    exists.  */
450 static inline tree
451 default_def (tree var)
452 {
453   var_ann_t ann = var_ann (var);
454   return ann ? ann->default_def : NULL_TREE;
455 }
456
457 /* PHI nodes should contain only ssa_names and invariants.  A test
458    for ssa_name is definitely simpler; don't let invalid contents
459    slip in in the meantime.  */
460
461 static inline bool
462 phi_ssa_name_p (tree t)
463 {
464   if (TREE_CODE (t) == SSA_NAME)
465     return true;
466 #ifdef ENABLE_CHECKING
467   gcc_assert (is_gimple_min_invariant (t));
468 #endif
469   return false;
470 }
471
472 /*  -----------------------------------------------------------------------  */
473
474 /* Return a block_stmt_iterator that points to beginning of basic
475    block BB.  */
476 static inline block_stmt_iterator
477 bsi_start (basic_block bb)
478 {
479   block_stmt_iterator bsi;
480   if (bb->stmt_list)
481     bsi.tsi = tsi_start (bb->stmt_list);
482   else
483     {
484       gcc_assert (bb->index < 0);
485       bsi.tsi.ptr = NULL;
486       bsi.tsi.container = NULL;
487     }
488   bsi.bb = bb;
489   return bsi;
490 }
491
492 /* Return a block statement iterator that points to the last label in
493    block BB.  */
494
495 static inline block_stmt_iterator
496 bsi_after_labels (basic_block bb)
497 {
498   block_stmt_iterator bsi;
499   tree_stmt_iterator next;
500
501   bsi.bb = bb;
502
503   if (!bb->stmt_list)
504     {
505       gcc_assert (bb->index < 0);
506       bsi.tsi.ptr = NULL;
507       bsi.tsi.container = NULL;
508       return bsi;
509     }
510
511   bsi.tsi = tsi_start (bb->stmt_list);
512   if (tsi_end_p (bsi.tsi))
513     return bsi;
514
515   /* Ensure that there are some labels.  The rationale is that we want
516      to insert after the bsi that is returned, and these insertions should
517      be placed at the start of the basic block.  This would not work if the
518      first statement was not label; rather fail here than enable the user
519      proceed in wrong way.  */
520   gcc_assert (TREE_CODE (tsi_stmt (bsi.tsi)) == LABEL_EXPR);
521
522   next = bsi.tsi;
523   tsi_next (&next);
524
525   while (!tsi_end_p (next)
526          && TREE_CODE (tsi_stmt (next)) == LABEL_EXPR)
527     {
528       bsi.tsi = next;
529       tsi_next (&next);
530     }
531
532   return bsi;
533 }
534
535 /* Return a block statement iterator that points to the end of basic
536    block BB.  */
537 static inline block_stmt_iterator
538 bsi_last (basic_block bb)
539 {
540   block_stmt_iterator bsi;
541   if (bb->stmt_list)
542     bsi.tsi = tsi_last (bb->stmt_list);
543   else
544     {
545       gcc_assert (bb->index < 0);
546       bsi.tsi.ptr = NULL;
547       bsi.tsi.container = NULL;
548     }
549   bsi.bb = bb;
550   return bsi;
551 }
552
553 /* Return true if block statement iterator I has reached the end of
554    the basic block.  */
555 static inline bool
556 bsi_end_p (block_stmt_iterator i)
557 {
558   return tsi_end_p (i.tsi);
559 }
560
561 /* Modify block statement iterator I so that it is at the next
562    statement in the basic block.  */
563 static inline void
564 bsi_next (block_stmt_iterator *i)
565 {
566   tsi_next (&i->tsi);
567 }
568
569 /* Modify block statement iterator I so that it is at the previous
570    statement in the basic block.  */
571 static inline void
572 bsi_prev (block_stmt_iterator *i)
573 {
574   tsi_prev (&i->tsi);
575 }
576
577 /* Return the statement that block statement iterator I is currently
578    at.  */
579 static inline tree
580 bsi_stmt (block_stmt_iterator i)
581 {
582   return tsi_stmt (i.tsi);
583 }
584
585 /* Return a pointer to the statement that block statement iterator I
586    is currently at.  */
587 static inline tree *
588 bsi_stmt_ptr (block_stmt_iterator i)
589 {
590   return tsi_stmt_ptr (i.tsi);
591 }
592
593 /* Returns the loop of the statement STMT.  */
594
595 static inline struct loop *
596 loop_containing_stmt (tree stmt)
597 {
598   basic_block bb = bb_for_stmt (stmt);
599   if (!bb)
600     return NULL;
601
602   return bb->loop_father;
603 }
604
605 /* Return true if VAR is a clobbered by function calls.  */
606 static inline bool
607 is_call_clobbered (tree var)
608 {
609   return is_global_var (var)
610          || bitmap_bit_p (call_clobbered_vars, var_ann (var)->uid);
611 }
612
613 /* Mark variable VAR as being clobbered by function calls.  */
614 static inline void
615 mark_call_clobbered (tree var)
616 {
617   var_ann_t ann = var_ann (var);
618   /* If VAR is a memory tag, then we need to consider it a global
619      variable.  This is because the pointer that VAR represents has
620      been found to point to either an arbitrary location or to a known
621      location in global memory.  */
622   if (ann->mem_tag_kind != NOT_A_TAG)
623     DECL_EXTERNAL (var) = 1;
624   bitmap_set_bit (call_clobbered_vars, ann->uid);
625   ssa_call_clobbered_cache_valid = false;
626   ssa_ro_call_cache_valid = false;
627 }
628
629 /* Clear the call-clobbered attribute from variable VAR.  */
630 static inline void
631 clear_call_clobbered (tree var)
632 {
633   var_ann_t ann = var_ann (var);
634   if (ann->mem_tag_kind != NOT_A_TAG)
635     DECL_EXTERNAL (var) = 0;
636   bitmap_clear_bit (call_clobbered_vars, ann->uid);
637   ssa_call_clobbered_cache_valid = false;
638   ssa_ro_call_cache_valid = false;
639 }
640
641 /* Mark variable VAR as being non-addressable.  */
642 static inline void
643 mark_non_addressable (tree var)
644 {
645   bitmap_clear_bit (call_clobbered_vars, var_ann (var)->uid);
646   TREE_ADDRESSABLE (var) = 0;
647   ssa_call_clobbered_cache_valid = false;
648   ssa_ro_call_cache_valid = false;
649 }
650
651 /* Return the common annotation for T.  Return NULL if the annotation
652    doesn't already exist.  */
653 static inline tree_ann_t
654 tree_ann (tree t)
655 {
656   return t->common.ann;
657 }
658
659 /* Return a common annotation for T.  Create the constant annotation if it
660    doesn't exist.  */
661 static inline tree_ann_t
662 get_tree_ann (tree t)
663 {
664   tree_ann_t ann = tree_ann (t);
665   return (ann) ? ann : create_tree_ann (t);
666 }
667
668 /*  -----------------------------------------------------------------------  */
669
670 /* The following set of routines are used to iterator over various type of
671    SSA operands.  */
672
673 /* Return true if PTR is finished iterating.  */
674 static inline bool
675 op_iter_done (ssa_op_iter *ptr)
676 {
677   return ptr->done;
678 }
679
680 /* Get the next iterator use value for PTR.  */
681 static inline use_operand_p
682 op_iter_next_use (ssa_op_iter *ptr)
683 {
684   if (ptr->use_i < ptr->num_use)
685     {
686       return USE_OP_PTR (ptr->ops->use_ops, (ptr->use_i)++);
687     }
688   if (ptr->vuse_i < ptr->num_vuse)
689     {
690       return VUSE_OP_PTR (ptr->ops->vuse_ops, (ptr->vuse_i)++);
691     }
692   if (ptr->v_mayu_i < ptr->num_v_mayu)
693     {
694       return V_MAY_DEF_OP_PTR (ptr->ops->v_may_def_ops,
695                                (ptr->v_mayu_i)++);
696     }
697   if (ptr->v_mustu_i < ptr->num_v_mustu)
698     {
699       return V_MUST_DEF_KILL_PTR (ptr->ops->v_must_def_ops,
700                                   (ptr->v_mustu_i)++);
701     }
702   ptr->done = true;
703   return NULL_USE_OPERAND_P;
704 }
705
706 /* Get the next iterator def value for PTR.  */
707 static inline def_operand_p
708 op_iter_next_def (ssa_op_iter *ptr)
709 {
710   if (ptr->def_i < ptr->num_def)
711     {
712       return DEF_OP_PTR (ptr->ops->def_ops, (ptr->def_i)++);
713     }
714   if (ptr->v_mustd_i < ptr->num_v_mustd)
715     {
716       return V_MUST_DEF_RESULT_PTR (ptr->ops->v_must_def_ops, 
717                                         (ptr->v_mustd_i)++);
718     }
719   if (ptr->v_mayd_i < ptr->num_v_mayd)
720     {
721       return V_MAY_DEF_RESULT_PTR (ptr->ops->v_may_def_ops,
722                                            (ptr->v_mayd_i)++);
723     }
724   ptr->done = true;
725   return NULL_DEF_OPERAND_P;
726 }
727
728 /* Get the next iterator tree value for PTR.  */
729 static inline tree
730 op_iter_next_tree (ssa_op_iter *ptr)
731 {
732   if (ptr->use_i < ptr->num_use)
733     {
734       return USE_OP (ptr->ops->use_ops, (ptr->use_i)++);
735     }
736   if (ptr->vuse_i < ptr->num_vuse)
737     {
738       return VUSE_OP (ptr->ops->vuse_ops, (ptr->vuse_i)++);
739     }
740   if (ptr->v_mayu_i < ptr->num_v_mayu)
741     {
742       return V_MAY_DEF_OP (ptr->ops->v_may_def_ops, (ptr->v_mayu_i)++);
743     }
744   if (ptr->v_mustu_i < ptr->num_v_mustu)
745     {
746       return V_MUST_DEF_KILL (ptr->ops->v_must_def_ops, (ptr->v_mustu_i)++);
747     }
748   if (ptr->def_i < ptr->num_def)
749     {
750       return DEF_OP (ptr->ops->def_ops, (ptr->def_i)++);
751     }
752   if (ptr->v_mustd_i < ptr->num_v_mustd)
753     {
754       return V_MUST_DEF_RESULT (ptr->ops->v_must_def_ops, 
755                                         (ptr->v_mustd_i)++);
756     }
757   if (ptr->v_mayd_i < ptr->num_v_mayd)
758     {
759       return V_MAY_DEF_RESULT (ptr->ops->v_may_def_ops,
760                                            (ptr->v_mayd_i)++);
761     }
762   ptr->done = true;
763   return NULL;
764 }
765
766 /* Initialize the iterator PTR to the virtual defs in STMT.  */
767 static inline void
768 op_iter_init (ssa_op_iter *ptr, tree stmt, int flags)
769 {
770   stmt_operands_p ops;
771   stmt_ann_t ann = get_stmt_ann (stmt);
772
773   ops = &(ann->operands);
774   ptr->done = false;
775   ptr->ops = ops;
776   ptr->num_def = (flags & SSA_OP_DEF) ? NUM_DEFS (ops->def_ops) : 0;
777   ptr->num_use = (flags & SSA_OP_USE) ? NUM_USES (ops->use_ops) : 0;
778   ptr->num_vuse = (flags & SSA_OP_VUSE) ? NUM_VUSES (ops->vuse_ops) : 0;
779   ptr->num_v_mayu = (flags & SSA_OP_VMAYUSE)
780                      ?  NUM_V_MAY_DEFS (ops->v_may_def_ops) : 0;
781   ptr->num_v_mayd = (flags & SSA_OP_VMAYDEF) 
782                      ?  NUM_V_MAY_DEFS (ops->v_may_def_ops) : 0;
783   ptr->num_v_mustu = (flags & SSA_OP_VMUSTDEFKILL)
784                      ? NUM_V_MUST_DEFS (ops->v_must_def_ops) : 0;
785   ptr->num_v_mustd = (flags & SSA_OP_VMUSTDEF) 
786                      ? NUM_V_MUST_DEFS (ops->v_must_def_ops) : 0;
787   ptr->def_i = 0;
788   ptr->use_i = 0;
789   ptr->vuse_i = 0;
790   ptr->v_mayu_i = 0;
791   ptr->v_mayd_i = 0;
792   ptr->v_mustu_i = 0;
793   ptr->v_mustd_i = 0;
794 }
795
796 /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
797    the first use.  */
798 static inline use_operand_p
799 op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags)
800 {
801   op_iter_init (ptr, stmt, flags);
802   return op_iter_next_use (ptr);
803 }
804
805 /* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
806    the first def.  */
807 static inline def_operand_p
808 op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags)
809 {
810   op_iter_init (ptr, stmt, flags);
811   return op_iter_next_def (ptr);
812 }
813
814 /* Initialize iterator PTR to the operands in STMT based on FLAGS. Return
815    the first operand as a tree.  */
816 static inline tree
817 op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags)
818 {
819   op_iter_init (ptr, stmt, flags);
820   return op_iter_next_tree (ptr);
821 }
822
823 /* Get the next iterator mustdef value for PTR, returning the mustdef values in
824    KILL and DEF.  */
825 static inline void
826 op_iter_next_mustdef (use_operand_p *kill, def_operand_p *def, ssa_op_iter *ptr)
827 {
828   if (ptr->v_mustu_i < ptr->num_v_mustu)
829     {
830       *def = V_MUST_DEF_RESULT_PTR (ptr->ops->v_must_def_ops, ptr->v_mustu_i);
831       *kill = V_MUST_DEF_KILL_PTR (ptr->ops->v_must_def_ops, (ptr->v_mustu_i)++);
832       return;
833     }
834   else
835     {
836       *def = NULL_DEF_OPERAND_P;
837       *kill = NULL_USE_OPERAND_P;
838     }
839   ptr->done = true;
840   return;
841 }
842 /* Get the next iterator maydef value for PTR, returning the maydef values in
843    USE and DEF.  */
844 static inline void
845 op_iter_next_maydef (use_operand_p *use, def_operand_p *def, ssa_op_iter *ptr)
846 {
847   if (ptr->v_mayu_i < ptr->num_v_mayu)
848     {
849       *def = V_MAY_DEF_RESULT_PTR (ptr->ops->v_may_def_ops, ptr->v_mayu_i);
850       *use = V_MAY_DEF_OP_PTR (ptr->ops->v_may_def_ops, (ptr->v_mayu_i)++);
851       return;
852     }
853   else
854     {
855       *def = NULL_DEF_OPERAND_P;
856       *use = NULL_USE_OPERAND_P;
857     }
858   ptr->done = true;
859   return;
860 }
861
862 /* Initialize iterator PTR to the operands in STMT.  Return the first operands
863    in USE and DEF.  */
864 static inline void
865 op_iter_init_maydef (ssa_op_iter *ptr, tree stmt, use_operand_p *use, 
866                      def_operand_p *def)
867 {
868   op_iter_init (ptr, stmt, SSA_OP_VMAYUSE);
869   op_iter_next_maydef (use, def, ptr);
870 }
871
872 /* Initialize iterator PTR to the operands in STMT.  Return the first operands
873    in KILL and DEF.  */
874 static inline void
875 op_iter_init_mustdef (ssa_op_iter *ptr, tree stmt, use_operand_p *kill, 
876                      def_operand_p *def)
877 {
878   op_iter_init (ptr, stmt, SSA_OP_VMUSTDEFKILL);
879   op_iter_next_mustdef (kill, def, ptr);
880 }
881 #endif /* _TREE_FLOW_INLINE_H  */