OSDN Git Service

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