* varasm.c (named_section): Use xstrdup rather than doing it by
[official-gcc.git] / gcc / tree-flow-inline.h
blob70450537698cb921e225521a1288e4501891ab88
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>
5 This file is part of GCC.
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.
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; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef _TREE_FLOW_INLINE_H
23 #define _TREE_FLOW_INLINE_H 1
25 /* Inline functions for manipulating various data structures defined in
26 tree-flow.h. See tree-flow.h for documentation. */
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)
33 gcc_assert (t);
34 gcc_assert (DECL_P (t));
35 gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
37 return (var_ann_t) t->common.ann;
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)
45 var_ann_t ann = var_ann (var);
46 return (ann) ? ann : create_var_ann (var);
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)
54 #ifdef ENABLE_CHECKING
55 gcc_assert (is_gimple_stmt (t));
56 #endif
57 return (stmt_ann_t) t->common.ann;
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)
65 stmt_ann_t ann = stmt_ann (stmt);
66 return (ann) ? ann : create_stmt_ann (stmt);
70 /* Return the annotation type for annotation ANN. */
71 static inline enum tree_ann_type
72 ann_type (tree_ann_t ann)
74 return ann->common.type;
77 /* Return the basic block for statement T. */
78 static inline basic_block
79 bb_for_stmt (tree t)
81 stmt_ann_t ann;
83 if (TREE_CODE (t) == PHI_NODE)
84 return PHI_BB (t);
86 ann = stmt_ann (t);
87 return ann ? ann->bb : NULL;
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)
95 var_ann_t ann = var_ann (var);
96 return ann ? ann->may_aliases : NULL;
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)
104 if (expr == NULL_TREE)
105 return -1;
107 if (TREE_CODE (expr) == COMPOUND_EXPR)
108 expr = TREE_OPERAND (expr, 0);
110 if (! EXPR_HAS_LOCATION (expr))
111 return -1;
113 return EXPR_LINENO (expr);
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)
121 const char *filename;
122 if (expr == NULL_TREE)
123 return "???";
125 if (TREE_CODE (expr) == COMPOUND_EXPR)
126 expr = TREE_OPERAND (expr, 0);
128 if (EXPR_HAS_LOCATION (expr) && (filename = EXPR_FILENAME (expr)))
129 return filename;
130 else
131 return "???";
134 /* Return true if T is a noreturn call. */
135 static inline bool
136 noreturn_call_p (tree t)
138 tree call = get_call_expr_in (t);
139 return call != 0 && (call_expr_flags (call) & ECF_NORETURN) != 0;
142 /* Mark statement T as modified. */
143 static inline void
144 modify_stmt (tree t)
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;
154 /* Mark statement T as unmodified. */
155 static inline void
156 unmodify_stmt (tree t)
158 stmt_ann_t ann = stmt_ann (t);
159 if (ann == NULL)
160 ann = create_stmt_ann (t);
161 ann->modified = 0;
164 /* Return true if T is marked as modified, false otherwise. */
165 static inline bool
166 stmt_modified_p (tree t)
168 stmt_ann_t ann = stmt_ann (t);
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;
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)
181 return ann ? ann->operands.def_ops : NULL;
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)
189 return ann ? ann->operands.use_ops : NULL;
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)
198 return ann ? ann->operands.v_may_def_ops : NULL;
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)
206 return ann ? ann->operands.vuse_ops : NULL;
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)
214 return ann ? ann->operands.v_must_def_ops : NULL;
217 /* Return the tree pointer to by USE. */
218 static inline tree
219 get_use_from_ptr (use_operand_p use)
221 return *(use.use);
224 /* Return the tree pointer to by DEF. */
225 static inline tree
226 get_def_from_ptr (def_operand_p def)
228 return *(def.def);
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)
235 gcc_assert (index < uses->num_uses);
236 return uses->uses[index];
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)
243 gcc_assert (index < defs->num_defs);
244 return defs->defs[index];
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)
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;
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)
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;
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)
274 use_operand_p op;
275 gcc_assert (index < vuses->num_vuses);
276 op.use = &(vuses->vuses[index]);
277 return op;
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)
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;
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)
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;
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)
306 def_operand_p op;
307 op.def = &(PHI_RESULT_TREE (phi));
308 return op;
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)
315 use_operand_p op;
316 op.use = &(PHI_ARG_DEF_TREE (phi, i));
317 return op;
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)
325 stmt_ann_t ann = stmt_ann (stmt);
326 return ann ? ann->addresses_taken : NULL;
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)
334 stmt_ann_t ann;
336 if (TREE_CODE (stmt) == PHI_NODE)
337 return PHI_DF (stmt);
339 ann = stmt_ann (stmt);
340 return ann ? ann->df : NULL;
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)
348 varray_type imm;
350 if (!df)
351 return 0;
353 imm = df->immediate_uses;
354 if (!imm)
355 return df->uses[1] ? 2 : 1;
357 return VARRAY_ACTIVE_SIZE (imm) + 2;
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)
364 if (!df)
365 return NULL_TREE;
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);
375 /* Return the basic_block annotation for BB. */
376 static inline bb_ann_t
377 bb_ann (basic_block bb)
379 return (bb_ann_t)bb->tree_annotations;
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)
387 return bb_ann (bb)->phi_nodes;
390 /* Set list of phi nodes of a basic block BB to L. */
392 static inline void
393 set_phi_nodes (basic_block bb, tree l)
395 tree phi;
397 bb_ann (bb)->phi_nodes = l;
398 for (phi = l; phi; phi = PHI_CHAIN (phi))
399 set_bb_for_stmt (phi, bb);
402 /* Mark VAR as used, so that it'll be preserved during rtl expansion. */
404 static inline void
405 set_is_used (tree var)
407 var_ann_t ann = get_var_ann (var);
408 ann->used = 1;
412 /* ----------------------------------------------------------------------- */
414 /* Return true if T is an executable statement. */
415 static inline bool
416 is_exec_stmt (tree t)
418 return (t && !IS_EMPTY_STMT (t) && t != error_mark_node);
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)
427 if (t)
428 switch (TREE_CODE (t))
430 case LABEL_DECL:
431 case LABEL_EXPR:
432 case CASE_LABEL_EXPR:
433 return true;
434 default:
435 return false;
437 return false;
440 /* Set the default definition for VAR to DEF. */
441 static inline void
442 set_default_def (tree var, tree def)
444 var_ann_t ann = get_var_ann (var);
445 ann->default_def = def;
448 /* Return the default definition for variable VAR, or NULL if none
449 exists. */
450 static inline tree
451 default_def (tree var)
453 var_ann_t ann = var_ann (var);
454 return ann ? ann->default_def : NULL_TREE;
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. */
461 static inline bool
462 phi_ssa_name_p (tree t)
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;
472 /* ----------------------------------------------------------------------- */
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)
479 block_stmt_iterator bsi;
480 if (bb->stmt_list)
481 bsi.tsi = tsi_start (bb->stmt_list);
482 else
484 gcc_assert (bb->index < 0);
485 bsi.tsi.ptr = NULL;
486 bsi.tsi.container = NULL;
488 bsi.bb = bb;
489 return bsi;
492 /* Return a block statement iterator that points to the last label in
493 block BB. */
495 static inline block_stmt_iterator
496 bsi_after_labels (basic_block bb)
498 block_stmt_iterator bsi;
499 tree_stmt_iterator next;
501 bsi.bb = bb;
503 if (!bb->stmt_list)
505 gcc_assert (bb->index < 0);
506 bsi.tsi.ptr = NULL;
507 bsi.tsi.container = NULL;
508 return bsi;
511 bsi.tsi = tsi_start (bb->stmt_list);
512 if (tsi_end_p (bsi.tsi))
513 return bsi;
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);
522 next = bsi.tsi;
523 tsi_next (&next);
525 while (!tsi_end_p (next)
526 && TREE_CODE (tsi_stmt (next)) == LABEL_EXPR)
528 bsi.tsi = next;
529 tsi_next (&next);
532 return bsi;
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)
540 block_stmt_iterator bsi;
541 if (bb->stmt_list)
542 bsi.tsi = tsi_last (bb->stmt_list);
543 else
545 gcc_assert (bb->index < 0);
546 bsi.tsi.ptr = NULL;
547 bsi.tsi.container = NULL;
549 bsi.bb = bb;
550 return bsi;
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)
558 return tsi_end_p (i.tsi);
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)
566 tsi_next (&i->tsi);
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)
574 tsi_prev (&i->tsi);
577 /* Return the statement that block statement iterator I is currently
578 at. */
579 static inline tree
580 bsi_stmt (block_stmt_iterator i)
582 return tsi_stmt (i.tsi);
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)
590 return tsi_stmt_ptr (i.tsi);
593 /* Returns the loop of the statement STMT. */
595 static inline struct loop *
596 loop_containing_stmt (tree stmt)
598 basic_block bb = bb_for_stmt (stmt);
599 if (!bb)
600 return NULL;
602 return bb->loop_father;
605 /* Return true if VAR is a clobbered by function calls. */
606 static inline bool
607 is_call_clobbered (tree var)
609 return is_global_var (var)
610 || bitmap_bit_p (call_clobbered_vars, var_ann (var)->uid);
613 /* Mark variable VAR as being clobbered by function calls. */
614 static inline void
615 mark_call_clobbered (tree var)
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;
629 /* Clear the call-clobbered attribute from variable VAR. */
630 static inline void
631 clear_call_clobbered (tree var)
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;
641 /* Mark variable VAR as being non-addressable. */
642 static inline void
643 mark_non_addressable (tree var)
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;
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)
656 return t->common.ann;
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)
664 tree_ann_t ann = tree_ann (t);
665 return (ann) ? ann : create_tree_ann (t);
668 /* ----------------------------------------------------------------------- */
670 /* The following set of routines are used to iterator over various type of
671 SSA operands. */
673 /* Return true if PTR is finished iterating. */
674 static inline bool
675 op_iter_done (ssa_op_iter *ptr)
677 return ptr->done;
680 /* Get the next iterator use value for PTR. */
681 static inline use_operand_p
682 op_iter_next_use (ssa_op_iter *ptr)
684 if (ptr->use_i < ptr->num_use)
686 return USE_OP_PTR (ptr->ops->use_ops, (ptr->use_i)++);
688 if (ptr->vuse_i < ptr->num_vuse)
690 return VUSE_OP_PTR (ptr->ops->vuse_ops, (ptr->vuse_i)++);
692 if (ptr->v_mayu_i < ptr->num_v_mayu)
694 return V_MAY_DEF_OP_PTR (ptr->ops->v_may_def_ops,
695 (ptr->v_mayu_i)++);
697 if (ptr->v_mustu_i < ptr->num_v_mustu)
699 return V_MUST_DEF_KILL_PTR (ptr->ops->v_must_def_ops,
700 (ptr->v_mustu_i)++);
702 ptr->done = true;
703 return NULL_USE_OPERAND_P;
706 /* Get the next iterator def value for PTR. */
707 static inline def_operand_p
708 op_iter_next_def (ssa_op_iter *ptr)
710 if (ptr->def_i < ptr->num_def)
712 return DEF_OP_PTR (ptr->ops->def_ops, (ptr->def_i)++);
714 if (ptr->v_mustd_i < ptr->num_v_mustd)
716 return V_MUST_DEF_RESULT_PTR (ptr->ops->v_must_def_ops,
717 (ptr->v_mustd_i)++);
719 if (ptr->v_mayd_i < ptr->num_v_mayd)
721 return V_MAY_DEF_RESULT_PTR (ptr->ops->v_may_def_ops,
722 (ptr->v_mayd_i)++);
724 ptr->done = true;
725 return NULL_DEF_OPERAND_P;
728 /* Get the next iterator tree value for PTR. */
729 static inline tree
730 op_iter_next_tree (ssa_op_iter *ptr)
732 if (ptr->use_i < ptr->num_use)
734 return USE_OP (ptr->ops->use_ops, (ptr->use_i)++);
736 if (ptr->vuse_i < ptr->num_vuse)
738 return VUSE_OP (ptr->ops->vuse_ops, (ptr->vuse_i)++);
740 if (ptr->v_mayu_i < ptr->num_v_mayu)
742 return V_MAY_DEF_OP (ptr->ops->v_may_def_ops, (ptr->v_mayu_i)++);
744 if (ptr->v_mustu_i < ptr->num_v_mustu)
746 return V_MUST_DEF_KILL (ptr->ops->v_must_def_ops, (ptr->v_mustu_i)++);
748 if (ptr->def_i < ptr->num_def)
750 return DEF_OP (ptr->ops->def_ops, (ptr->def_i)++);
752 if (ptr->v_mustd_i < ptr->num_v_mustd)
754 return V_MUST_DEF_RESULT (ptr->ops->v_must_def_ops,
755 (ptr->v_mustd_i)++);
757 if (ptr->v_mayd_i < ptr->num_v_mayd)
759 return V_MAY_DEF_RESULT (ptr->ops->v_may_def_ops,
760 (ptr->v_mayd_i)++);
762 ptr->done = true;
763 return NULL;
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)
770 stmt_operands_p ops;
771 stmt_ann_t ann = get_stmt_ann (stmt);
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;
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)
801 op_iter_init (ptr, stmt, flags);
802 return op_iter_next_use (ptr);
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)
810 op_iter_init (ptr, stmt, flags);
811 return op_iter_next_def (ptr);
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)
819 op_iter_init (ptr, stmt, flags);
820 return op_iter_next_tree (ptr);
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)
828 if (ptr->v_mustu_i < ptr->num_v_mustu)
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;
834 else
836 *def = NULL_DEF_OPERAND_P;
837 *kill = NULL_USE_OPERAND_P;
839 ptr->done = true;
840 return;
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)
847 if (ptr->v_mayu_i < ptr->num_v_mayu)
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;
853 else
855 *def = NULL_DEF_OPERAND_P;
856 *use = NULL_USE_OPERAND_P;
858 ptr->done = true;
859 return;
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)
868 op_iter_init (ptr, stmt, SSA_OP_VMAYUSE);
869 op_iter_next_maydef (use, def, ptr);
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)
878 op_iter_init (ptr, stmt, SSA_OP_VMUSTDEFKILL);
879 op_iter_next_mustdef (kill, def, ptr);
881 #endif /* _TREE_FLOW_INLINE_H */