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)
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
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
54 #ifdef ENABLE_CHECKING
55 gcc_assert (is_gimple_stmt (t
));
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
83 if (TREE_CODE (t
) == PHI_NODE
)
87 return ann
? ann
->bb
: NULL
;
90 /* Return the may_aliases varray for variable VAR, or NULL if it has
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. */
102 get_lineno (tree expr
)
104 if (expr
== NULL_TREE
)
107 if (TREE_CODE (expr
) == COMPOUND_EXPR
)
108 expr
= TREE_OPERAND (expr
, 0);
110 if (! EXPR_HAS_LOCATION (expr
))
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
)
125 if (TREE_CODE (expr
) == COMPOUND_EXPR
)
126 expr
= TREE_OPERAND (expr
, 0);
128 if (EXPR_HAS_LOCATION (expr
) && (filename
= EXPR_FILENAME (expr
)))
134 /* Return true if T is a noreturn call. */
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. */
146 stmt_ann_t ann
= stmt_ann (t
);
148 ann
= create_stmt_ann (t
);
149 else if (noreturn_call_p (t
))
150 VEC_safe_push (tree
, modified_noreturn_calls
, t
);
154 /* Mark statement T as unmodified. */
156 unmodify_stmt (tree t
)
158 stmt_ann_t ann
= stmt_ann (t
);
160 ann
= create_stmt_ann (t
);
164 /* Return true if T is marked as modified, false otherwise. */
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
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
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. */
219 get_use_from_ptr (use_operand_p use
)
224 /* Return the tree pointer to by DEF. */
226 get_def_from_ptr (def_operand_p 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
)
254 gcc_assert (index
< v_may_defs
->num_v_may_defs
);
255 op
.def
= &(v_may_defs
->v_may_defs
[index
].def
);
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
)
265 gcc_assert (index
< v_may_defs
->num_v_may_defs
);
266 op
.use
= &(v_may_defs
->v_may_defs
[index
].use
);
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
)
275 gcc_assert (index
< vuses
->num_vuses
);
276 op
.use
= &(vuses
->vuses
[index
]);
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
)
286 gcc_assert (index
< v_must_defs
->num_v_must_defs
);
287 op
.def
= &(v_must_defs
->v_must_defs
[index
].def
);
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
)
297 gcc_assert (index
< v_must_defs
->num_v_must_defs
);
298 op
.use
= &(v_must_defs
->v_must_defs
[index
].use
);
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
)
307 op
.def
= &(PHI_RESULT_TREE (phi
));
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
)
316 op
.use
= &(PHI_ARG_DEF_TREE (phi
, i
));
320 /* Return the bitmap of addresses taken by STMT, or NULL if it takes
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
332 get_immediate_uses (tree stmt
)
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. */
346 num_immediate_uses (dataflow_t df
)
353 imm
= df
->immediate_uses
;
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. */
362 immediate_use (dataflow_t df
, int num
)
367 #ifdef ENABLE_CHECKING
368 gcc_assert (num
< num_immediate_uses (df
));
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
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. */
393 set_phi_nodes (basic_block bb
, tree l
)
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. */
405 set_is_used (tree var
)
407 var_ann_t ann
= get_var_ann (var
);
412 /* ----------------------------------------------------------------------- */
414 /* Return true if T is an executable statement. */
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
425 is_label_stmt (tree t
)
428 switch (TREE_CODE (t
))
432 case CASE_LABEL_EXPR
:
440 /* Set the default definition for VAR to DEF. */
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
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. */
462 phi_ssa_name_p (tree t
)
464 if (TREE_CODE (t
) == SSA_NAME
)
466 #ifdef ENABLE_CHECKING
467 gcc_assert (is_gimple_min_invariant (t
));
472 /* ----------------------------------------------------------------------- */
474 /* Return a block_stmt_iterator that points to beginning of basic
476 static inline block_stmt_iterator
477 bsi_start (basic_block bb
)
479 block_stmt_iterator bsi
;
481 bsi
.tsi
= tsi_start (bb
->stmt_list
);
484 gcc_assert (bb
->index
< 0);
486 bsi
.tsi
.container
= NULL
;
492 /* Return a block statement iterator that points to the last label in
495 static inline block_stmt_iterator
496 bsi_after_labels (basic_block bb
)
498 block_stmt_iterator bsi
;
499 tree_stmt_iterator next
;
505 gcc_assert (bb
->index
< 0);
507 bsi
.tsi
.container
= NULL
;
511 bsi
.tsi
= tsi_start (bb
->stmt_list
);
512 if (tsi_end_p (bsi
.tsi
))
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
);
525 while (!tsi_end_p (next
)
526 && TREE_CODE (tsi_stmt (next
)) == LABEL_EXPR
)
535 /* Return a block statement iterator that points to the end of basic
537 static inline block_stmt_iterator
538 bsi_last (basic_block bb
)
540 block_stmt_iterator bsi
;
542 bsi
.tsi
= tsi_last (bb
->stmt_list
);
545 gcc_assert (bb
->index
< 0);
547 bsi
.tsi
.container
= NULL
;
553 /* Return true if block statement iterator I has reached the end of
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. */
564 bsi_next (block_stmt_iterator
*i
)
569 /* Modify block statement iterator I so that it is at the previous
570 statement in the basic block. */
572 bsi_prev (block_stmt_iterator
*i
)
577 /* Return the statement that block statement iterator I is currently
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
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
);
602 return bb
->loop_father
;
605 /* Return true if VAR is a clobbered by function calls. */
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. */
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
&& ann
->mem_tag_kind
!= STRUCT_FIELD
)
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. */
631 clear_call_clobbered (tree var
)
633 var_ann_t ann
= var_ann (var
);
634 if (ann
->mem_tag_kind
!= NOT_A_TAG
&& ann
->mem_tag_kind
!= STRUCT_FIELD
)
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. */
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
656 return t
->common
.ann
;
659 /* Return a common annotation for T. Create the constant annotation if it
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
673 /* Return true if PTR is finished iterating. */
675 op_iter_done (ssa_op_iter
*ptr
)
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
,
697 if (ptr
->v_mustu_i
< ptr
->num_v_mustu
)
699 return V_MUST_DEF_KILL_PTR (ptr
->ops
->v_must_def_ops
,
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
,
719 if (ptr
->v_mayd_i
< ptr
->num_v_mayd
)
721 return V_MAY_DEF_RESULT_PTR (ptr
->ops
->v_may_def_ops
,
725 return NULL_DEF_OPERAND_P
;
728 /* Get the next iterator tree value for PTR. */
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
,
757 if (ptr
->v_mayd_i
< ptr
->num_v_mayd
)
759 return V_MAY_DEF_RESULT (ptr
->ops
->v_may_def_ops
,
766 /* Initialize the iterator PTR to the virtual defs in STMT. */
768 op_iter_init (ssa_op_iter
*ptr
, tree stmt
, int flags
)
771 stmt_ann_t ann
= get_stmt_ann (stmt
);
773 ops
= &(ann
->operands
);
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;
796 /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
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
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. */
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
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
)++);
836 *def
= NULL_DEF_OPERAND_P
;
837 *kill
= NULL_USE_OPERAND_P
;
842 /* Get the next iterator maydef value for PTR, returning the maydef values in
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
)++);
855 *def
= NULL_DEF_OPERAND_P
;
856 *use
= NULL_USE_OPERAND_P
;
862 /* Initialize iterator PTR to the operands in STMT. Return the first operands
865 op_iter_init_maydef (ssa_op_iter
*ptr
, tree stmt
, use_operand_p
*use
,
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
875 op_iter_init_mustdef (ssa_op_iter
*ptr
, tree stmt
, use_operand_p
*kill
,
878 op_iter_init (ptr
, stmt
, SSA_OP_VMUSTDEFKILL
);
879 op_iter_next_mustdef (kill
, def
, ptr
);
882 /* Return true if REF, a COMPONENT_REF, has an ARRAY_REF somewhere in it. */
885 ref_contains_array_ref (tree ref
)
887 while (handled_component_p (ref
))
889 if (TREE_CODE (ref
) == ARRAY_REF
)
891 ref
= TREE_OPERAND (ref
, 0);
896 /* Given a variable VAR, lookup and return a pointer to the list of
897 subvariables for it. */
899 static inline subvar_t
*
900 lookup_subvars_for_var (tree var
)
902 var_ann_t ann
= var_ann (var
);
904 return &ann
->subvars
;
907 /* Given a variable VAR, return a linked list of subvariables for VAR, or
908 NULL, if there are no subvariables. */
910 static inline subvar_t
911 get_subvars_for_var (tree var
)
915 gcc_assert (SSA_VAR_P (var
));
917 if (TREE_CODE (var
) == SSA_NAME
)
918 subvars
= *(lookup_subvars_for_var (SSA_NAME_VAR (var
)));
920 subvars
= *(lookup_subvars_for_var (var
));
924 /* Return true if V is a tree that we can have subvars for.
925 Normally, this is any aggregate type, however, due to implementation
926 limitations ATM, we exclude array types as well. */
929 var_can_have_subvars (tree v
)
931 return (AGGREGATE_TYPE_P (TREE_TYPE (v
)) &&
932 TREE_CODE (TREE_TYPE (v
)) != ARRAY_TYPE
);
936 /* Return true if OFFSET and SIZE define a range that overlaps with some
937 portion of the range of SV, a subvar. If there was an exact overlap,
938 *EXACT will be set to true upon return. */
941 overlap_subvar (HOST_WIDE_INT offset
, HOST_WIDE_INT size
,
942 subvar_t sv
, bool *exact
)
944 /* There are three possible cases of overlap.
945 1. We can have an exact overlap, like so:
946 |offset, offset + size |
947 |sv->offset, sv->offset + sv->size |
949 2. We can have offset starting after sv->offset, like so:
951 |offset, offset + size |
952 |sv->offset, sv->offset + sv->size |
954 3. We can have offset starting before sv->offset, like so:
956 |offset, offset + size |
957 |sv->offset, sv->offset + sv->size|
962 if (offset
== sv
->offset
&& size
== sv
->size
)
968 else if (offset
>= sv
->offset
&& offset
< (sv
->offset
+ sv
->size
))
972 else if (offset
< sv
->offset
&& (offset
+ size
> sv
->offset
))
980 #endif /* _TREE_FLOW_INLINE_H */