1 /* Gimple walk support.
3 Copyright (C) 2007-2014 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
28 #include "basic-block.h"
29 #include "tree-ssa-alias.h"
30 #include "internal-fn.h"
31 #include "gimple-expr.h"
34 #include "gimple-iterator.h"
35 #include "gimple-walk.h"
36 #include "gimple-walk.h"
39 /* Walk all the statements in the sequence *PSEQ calling walk_gimple_stmt
40 on each one. WI is as in walk_gimple_stmt.
42 If walk_gimple_stmt returns non-NULL, the walk is stopped, and the
43 value is stored in WI->CALLBACK_RESULT. Also, the statement that
44 produced the value is returned if this statement has not been
45 removed by a callback (wi->removed_stmt). If the statement has
46 been removed, NULL is returned.
48 Otherwise, all the statements are walked and NULL returned. */
51 walk_gimple_seq_mod (gimple_seq
*pseq
, walk_stmt_fn callback_stmt
,
52 walk_tree_fn callback_op
, struct walk_stmt_info
*wi
)
54 gimple_stmt_iterator gsi
;
56 for (gsi
= gsi_start (*pseq
); !gsi_end_p (gsi
); )
58 tree ret
= walk_gimple_stmt (&gsi
, callback_stmt
, callback_op
, wi
);
61 /* If CALLBACK_STMT or CALLBACK_OP return a value, WI must exist
64 wi
->callback_result
= ret
;
66 return wi
->removed_stmt
? NULL
: gsi_stmt (gsi
);
69 if (!wi
->removed_stmt
)
74 wi
->callback_result
= NULL_TREE
;
80 /* Like walk_gimple_seq_mod, but ensure that the head of SEQ isn't
81 changed by the callbacks. */
84 walk_gimple_seq (gimple_seq seq
, walk_stmt_fn callback_stmt
,
85 walk_tree_fn callback_op
, struct walk_stmt_info
*wi
)
87 gimple_seq seq2
= seq
;
88 gimple ret
= walk_gimple_seq_mod (&seq2
, callback_stmt
, callback_op
, wi
);
89 gcc_assert (seq2
== seq
);
94 /* Helper function for walk_gimple_stmt. Walk operands of a GIMPLE_ASM. */
97 walk_gimple_asm (gimple stmt
, walk_tree_fn callback_op
,
98 struct walk_stmt_info
*wi
)
102 const char **oconstraints
;
104 const char *constraint
;
105 bool allows_mem
, allows_reg
, is_inout
;
107 noutputs
= gimple_asm_noutputs (stmt
);
108 oconstraints
= (const char **) alloca ((noutputs
) * sizeof (const char *));
113 for (i
= 0; i
< noutputs
; i
++)
115 op
= gimple_asm_output_op (stmt
, i
);
116 constraint
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op
)));
117 oconstraints
[i
] = constraint
;
118 parse_output_constraint (&constraint
, i
, 0, 0, &allows_mem
, &allows_reg
,
121 wi
->val_only
= (allows_reg
|| !allows_mem
);
122 ret
= walk_tree (&TREE_VALUE (op
), callback_op
, wi
, NULL
);
127 n
= gimple_asm_ninputs (stmt
);
128 for (i
= 0; i
< n
; i
++)
130 op
= gimple_asm_input_op (stmt
, i
);
131 constraint
= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op
)));
132 parse_input_constraint (&constraint
, 0, 0, noutputs
, 0,
133 oconstraints
, &allows_mem
, &allows_reg
);
136 wi
->val_only
= (allows_reg
|| !allows_mem
);
137 /* Although input "m" is not really a LHS, we need a lvalue. */
138 wi
->is_lhs
= !wi
->val_only
;
140 ret
= walk_tree (&TREE_VALUE (op
), callback_op
, wi
, NULL
);
151 n
= gimple_asm_nlabels (stmt
);
152 for (i
= 0; i
< n
; i
++)
154 op
= gimple_asm_label_op (stmt
, i
);
155 ret
= walk_tree (&TREE_VALUE (op
), callback_op
, wi
, NULL
);
164 /* Helper function of WALK_GIMPLE_STMT. Walk every tree operand in
165 STMT. CALLBACK_OP and WI are as in WALK_GIMPLE_STMT.
167 CALLBACK_OP is called on each operand of STMT via walk_tree.
168 Additional parameters to walk_tree must be stored in WI. For each operand
169 OP, walk_tree is called as:
171 walk_tree (&OP, CALLBACK_OP, WI, WI->PSET)
173 If CALLBACK_OP returns non-NULL for an operand, the remaining
174 operands are not scanned.
176 The return value is that returned by the last call to walk_tree, or
177 NULL_TREE if no CALLBACK_OP is specified. */
180 walk_gimple_op (gimple stmt
, walk_tree_fn callback_op
,
181 struct walk_stmt_info
*wi
)
183 hash_set
<tree
> *pset
= (wi
) ? wi
->pset
: NULL
;
185 tree ret
= NULL_TREE
;
187 switch (gimple_code (stmt
))
190 /* Walk the RHS operands. If the LHS is of a non-renamable type or
191 is a register variable, we may use a COMPONENT_REF on the RHS. */
194 tree lhs
= gimple_assign_lhs (stmt
);
196 = (is_gimple_reg_type (TREE_TYPE (lhs
)) && !is_gimple_reg (lhs
))
197 || gimple_assign_rhs_class (stmt
) != GIMPLE_SINGLE_RHS
;
200 for (i
= 1; i
< gimple_num_ops (stmt
); i
++)
202 ret
= walk_tree (gimple_op_ptr (stmt
, i
), callback_op
, wi
,
208 /* Walk the LHS. If the RHS is appropriate for a memory, we
209 may use a COMPONENT_REF on the LHS. */
212 /* If the RHS is of a non-renamable type or is a register variable,
213 we may use a COMPONENT_REF on the LHS. */
214 tree rhs1
= gimple_assign_rhs1 (stmt
);
216 = (is_gimple_reg_type (TREE_TYPE (rhs1
)) && !is_gimple_reg (rhs1
))
217 || gimple_assign_rhs_class (stmt
) != GIMPLE_SINGLE_RHS
;
221 ret
= walk_tree (gimple_op_ptr (stmt
, 0), callback_op
, wi
, pset
);
239 ret
= walk_tree (gimple_call_chain_ptr (as_a
<gimple_call
> (stmt
)),
240 callback_op
, wi
, pset
);
244 ret
= walk_tree (gimple_call_fn_ptr (stmt
), callback_op
, wi
, pset
);
248 for (i
= 0; i
< gimple_call_num_args (stmt
); i
++)
252 = is_gimple_reg_type (TREE_TYPE (gimple_call_arg (stmt
, i
)));
253 ret
= walk_tree (gimple_call_arg_ptr (stmt
, i
), callback_op
, wi
,
259 if (gimple_call_lhs (stmt
))
265 = is_gimple_reg_type (TREE_TYPE (gimple_call_lhs (stmt
)));
268 ret
= walk_tree (gimple_call_lhs_ptr (stmt
), callback_op
, wi
, pset
);
281 ret
= walk_tree (gimple_catch_types_ptr (stmt
), callback_op
, wi
,
287 case GIMPLE_EH_FILTER
:
288 ret
= walk_tree (gimple_eh_filter_types_ptr (stmt
), callback_op
, wi
,
295 ret
= walk_gimple_asm (stmt
, callback_op
, wi
);
300 case GIMPLE_OMP_CONTINUE
:
301 ret
= walk_tree (gimple_omp_continue_control_def_ptr (stmt
),
302 callback_op
, wi
, pset
);
306 ret
= walk_tree (gimple_omp_continue_control_use_ptr (stmt
),
307 callback_op
, wi
, pset
);
312 case GIMPLE_OMP_CRITICAL
:
313 ret
= walk_tree (gimple_omp_critical_name_ptr (stmt
), callback_op
, wi
,
320 ret
= walk_tree (gimple_omp_for_clauses_ptr (stmt
), callback_op
, wi
,
324 for (i
= 0; i
< gimple_omp_for_collapse (stmt
); i
++)
326 ret
= walk_tree (gimple_omp_for_index_ptr (stmt
, i
), callback_op
,
330 ret
= walk_tree (gimple_omp_for_initial_ptr (stmt
, i
), callback_op
,
334 ret
= walk_tree (gimple_omp_for_final_ptr (stmt
, i
), callback_op
,
338 ret
= walk_tree (gimple_omp_for_incr_ptr (stmt
, i
), callback_op
,
345 case GIMPLE_OMP_PARALLEL
:
346 ret
= walk_tree (gimple_omp_parallel_clauses_ptr (stmt
), callback_op
,
350 ret
= walk_tree (gimple_omp_parallel_child_fn_ptr (stmt
), callback_op
,
354 ret
= walk_tree (gimple_omp_parallel_data_arg_ptr (stmt
), callback_op
,
360 case GIMPLE_OMP_TASK
:
361 ret
= walk_tree (gimple_omp_task_clauses_ptr (stmt
), callback_op
,
365 ret
= walk_tree (gimple_omp_task_child_fn_ptr (stmt
), callback_op
,
369 ret
= walk_tree (gimple_omp_task_data_arg_ptr (stmt
), callback_op
,
373 ret
= walk_tree (gimple_omp_task_copy_fn_ptr (stmt
), callback_op
,
377 ret
= walk_tree (gimple_omp_task_arg_size_ptr (stmt
), callback_op
,
381 ret
= walk_tree (gimple_omp_task_arg_align_ptr (stmt
), callback_op
,
387 case GIMPLE_OMP_SECTIONS
:
388 ret
= walk_tree (gimple_omp_sections_clauses_ptr (stmt
), callback_op
,
393 ret
= walk_tree (gimple_omp_sections_control_ptr (stmt
), callback_op
,
400 case GIMPLE_OMP_SINGLE
:
401 ret
= walk_tree (gimple_omp_single_clauses_ptr (stmt
), callback_op
, wi
,
407 case GIMPLE_OMP_TARGET
:
408 ret
= walk_tree (gimple_omp_target_clauses_ptr (stmt
), callback_op
, wi
,
414 case GIMPLE_OMP_TEAMS
:
415 ret
= walk_tree (gimple_omp_teams_clauses_ptr (stmt
), callback_op
, wi
,
421 case GIMPLE_OMP_ATOMIC_LOAD
:
422 ret
= walk_tree (gimple_omp_atomic_load_lhs_ptr (stmt
), callback_op
, wi
,
427 ret
= walk_tree (gimple_omp_atomic_load_rhs_ptr (stmt
), callback_op
, wi
,
433 case GIMPLE_OMP_ATOMIC_STORE
:
434 ret
= walk_tree (gimple_omp_atomic_store_val_ptr (stmt
), callback_op
,
440 case GIMPLE_TRANSACTION
:
441 ret
= walk_tree (gimple_transaction_label_ptr (stmt
), callback_op
,
447 case GIMPLE_OMP_RETURN
:
448 ret
= walk_tree (gimple_omp_return_lhs_ptr (stmt
), callback_op
, wi
,
454 /* Tuples that do not have operands. */
462 enum gimple_statement_structure_enum gss
;
463 gss
= gimple_statement_structure (stmt
);
464 if (gss
== GSS_WITH_OPS
|| gss
== GSS_WITH_MEM_OPS
)
465 for (i
= 0; i
< gimple_num_ops (stmt
); i
++)
467 ret
= walk_tree (gimple_op_ptr (stmt
, i
), callback_op
, wi
, pset
);
479 /* Walk the current statement in GSI (optionally using traversal state
480 stored in WI). If WI is NULL, no state is kept during traversal.
481 The callback CALLBACK_STMT is called. If CALLBACK_STMT indicates
482 that it has handled all the operands of the statement, its return
483 value is returned. Otherwise, the return value from CALLBACK_STMT
484 is discarded and its operands are scanned.
486 If CALLBACK_STMT is NULL or it didn't handle the operands,
487 CALLBACK_OP is called on each operand of the statement via
488 walk_gimple_op. If walk_gimple_op returns non-NULL for any
489 operand, the remaining operands are not scanned. In this case, the
490 return value from CALLBACK_OP is returned.
492 In any other case, NULL_TREE is returned. */
495 walk_gimple_stmt (gimple_stmt_iterator
*gsi
, walk_stmt_fn callback_stmt
,
496 walk_tree_fn callback_op
, struct walk_stmt_info
*wi
)
500 gimple stmt
= gsi_stmt (*gsi
);
505 wi
->removed_stmt
= false;
507 if (wi
->want_locations
&& gimple_has_location (stmt
))
508 input_location
= gimple_location (stmt
);
513 /* Invoke the statement callback. Return if the callback handled
514 all of STMT operands by itself. */
517 bool handled_ops
= false;
518 tree_ret
= callback_stmt (gsi
, &handled_ops
, wi
);
522 /* If CALLBACK_STMT did not handle operands, it should not have
523 a value to return. */
524 gcc_assert (tree_ret
== NULL
);
526 if (wi
&& wi
->removed_stmt
)
529 /* Re-read stmt in case the callback changed it. */
530 stmt
= gsi_stmt (*gsi
);
533 /* If CALLBACK_OP is defined, invoke it on every operand of STMT. */
536 tree_ret
= walk_gimple_op (stmt
, callback_op
, wi
);
541 /* If STMT can have statements inside (e.g. GIMPLE_BIND), walk them. */
542 switch (gimple_code (stmt
))
546 walk_gimple_seq_mod (gimple_bind_body_ptr (as_a
<gimple_bind
> (stmt
)),
547 callback_stmt
, callback_op
, wi
);
549 return wi
->callback_result
;
553 ret
= walk_gimple_seq_mod (gimple_catch_handler_ptr (stmt
), callback_stmt
,
556 return wi
->callback_result
;
559 case GIMPLE_EH_FILTER
:
560 ret
= walk_gimple_seq_mod (gimple_eh_filter_failure_ptr (stmt
), callback_stmt
,
563 return wi
->callback_result
;
567 ret
= walk_gimple_seq_mod (gimple_eh_else_n_body_ptr (stmt
),
568 callback_stmt
, callback_op
, wi
);
570 return wi
->callback_result
;
571 ret
= walk_gimple_seq_mod (gimple_eh_else_e_body_ptr (stmt
),
572 callback_stmt
, callback_op
, wi
);
574 return wi
->callback_result
;
578 ret
= walk_gimple_seq_mod (gimple_try_eval_ptr (stmt
), callback_stmt
, callback_op
,
581 return wi
->callback_result
;
583 ret
= walk_gimple_seq_mod (gimple_try_cleanup_ptr (stmt
), callback_stmt
,
586 return wi
->callback_result
;
590 ret
= walk_gimple_seq_mod (gimple_omp_for_pre_body_ptr (stmt
), callback_stmt
,
593 return wi
->callback_result
;
596 case GIMPLE_OMP_CRITICAL
:
597 case GIMPLE_OMP_MASTER
:
598 case GIMPLE_OMP_TASKGROUP
:
599 case GIMPLE_OMP_ORDERED
:
600 case GIMPLE_OMP_SECTION
:
601 case GIMPLE_OMP_PARALLEL
:
602 case GIMPLE_OMP_TASK
:
603 case GIMPLE_OMP_SECTIONS
:
604 case GIMPLE_OMP_SINGLE
:
605 case GIMPLE_OMP_TARGET
:
606 case GIMPLE_OMP_TEAMS
:
607 ret
= walk_gimple_seq_mod (gimple_omp_body_ptr (stmt
), callback_stmt
,
610 return wi
->callback_result
;
613 case GIMPLE_WITH_CLEANUP_EXPR
:
614 ret
= walk_gimple_seq_mod (gimple_wce_cleanup_ptr (stmt
), callback_stmt
,
617 return wi
->callback_result
;
620 case GIMPLE_TRANSACTION
:
621 ret
= walk_gimple_seq_mod (gimple_transaction_body_ptr (stmt
),
622 callback_stmt
, callback_op
, wi
);
624 return wi
->callback_result
;
628 gcc_assert (!gimple_has_substatements (stmt
));
635 /* From a tree operand OP return the base of a load or store operation
636 or NULL_TREE if OP is not a load or a store. */
639 get_base_loadstore (tree op
)
641 while (handled_component_p (op
))
642 op
= TREE_OPERAND (op
, 0);
644 || INDIRECT_REF_P (op
)
645 || TREE_CODE (op
) == MEM_REF
646 || TREE_CODE (op
) == TARGET_MEM_REF
)
652 /* For the statement STMT call the callbacks VISIT_LOAD, VISIT_STORE and
653 VISIT_ADDR if non-NULL on loads, store and address-taken operands
654 passing the STMT, the base of the operand, the operand itself containing
655 the base and DATA to it. The base will be either a decl, an indirect
656 reference (including TARGET_MEM_REF) or the argument of an address
658 Returns the results of these callbacks or'ed. */
661 walk_stmt_load_store_addr_ops (gimple stmt
, void *data
,
662 walk_stmt_load_store_addr_fn visit_load
,
663 walk_stmt_load_store_addr_fn visit_store
,
664 walk_stmt_load_store_addr_fn visit_addr
)
668 if (gimple_assign_single_p (stmt
))
673 arg
= gimple_assign_lhs (stmt
);
674 lhs
= get_base_loadstore (arg
);
676 ret
|= visit_store (stmt
, lhs
, arg
, data
);
678 arg
= gimple_assign_rhs1 (stmt
);
680 while (handled_component_p (rhs
))
681 rhs
= TREE_OPERAND (rhs
, 0);
684 if (TREE_CODE (rhs
) == ADDR_EXPR
)
685 ret
|= visit_addr (stmt
, TREE_OPERAND (rhs
, 0), arg
, data
);
686 else if (TREE_CODE (rhs
) == TARGET_MEM_REF
687 && TREE_CODE (TMR_BASE (rhs
)) == ADDR_EXPR
)
688 ret
|= visit_addr (stmt
, TREE_OPERAND (TMR_BASE (rhs
), 0), arg
,
690 else if (TREE_CODE (rhs
) == OBJ_TYPE_REF
691 && TREE_CODE (OBJ_TYPE_REF_OBJECT (rhs
)) == ADDR_EXPR
)
692 ret
|= visit_addr (stmt
, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (rhs
),
694 else if (TREE_CODE (rhs
) == CONSTRUCTOR
)
699 FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs
), ix
, val
)
700 if (TREE_CODE (val
) == ADDR_EXPR
)
701 ret
|= visit_addr (stmt
, TREE_OPERAND (val
, 0), arg
, data
);
702 else if (TREE_CODE (val
) == OBJ_TYPE_REF
703 && TREE_CODE (OBJ_TYPE_REF_OBJECT (val
)) == ADDR_EXPR
)
704 ret
|= visit_addr (stmt
,
705 TREE_OPERAND (OBJ_TYPE_REF_OBJECT (val
),
708 lhs
= gimple_assign_lhs (stmt
);
709 if (TREE_CODE (lhs
) == TARGET_MEM_REF
710 && TREE_CODE (TMR_BASE (lhs
)) == ADDR_EXPR
)
711 ret
|= visit_addr (stmt
, TREE_OPERAND (TMR_BASE (lhs
), 0), lhs
, data
);
715 rhs
= get_base_loadstore (rhs
);
717 ret
|= visit_load (stmt
, rhs
, arg
, data
);
721 && (is_gimple_assign (stmt
)
722 || gimple_code (stmt
) == GIMPLE_COND
))
724 for (i
= 0; i
< gimple_num_ops (stmt
); ++i
)
726 tree op
= gimple_op (stmt
, i
);
729 else if (TREE_CODE (op
) == ADDR_EXPR
)
730 ret
|= visit_addr (stmt
, TREE_OPERAND (op
, 0), op
, data
);
731 /* COND_EXPR and VCOND_EXPR rhs1 argument is a comparison
732 tree with two operands. */
733 else if (i
== 1 && COMPARISON_CLASS_P (op
))
735 if (TREE_CODE (TREE_OPERAND (op
, 0)) == ADDR_EXPR
)
736 ret
|= visit_addr (stmt
, TREE_OPERAND (TREE_OPERAND (op
, 0),
738 if (TREE_CODE (TREE_OPERAND (op
, 1)) == ADDR_EXPR
)
739 ret
|= visit_addr (stmt
, TREE_OPERAND (TREE_OPERAND (op
, 1),
744 else if (is_gimple_call (stmt
))
748 tree arg
= gimple_call_lhs (stmt
);
751 tree lhs
= get_base_loadstore (arg
);
753 ret
|= visit_store (stmt
, lhs
, arg
, data
);
756 if (visit_load
|| visit_addr
)
757 for (i
= 0; i
< gimple_call_num_args (stmt
); ++i
)
759 tree arg
= gimple_call_arg (stmt
, i
);
761 && TREE_CODE (arg
) == ADDR_EXPR
)
762 ret
|= visit_addr (stmt
, TREE_OPERAND (arg
, 0), arg
, data
);
765 tree rhs
= get_base_loadstore (arg
);
767 ret
|= visit_load (stmt
, rhs
, arg
, data
);
771 && gimple_call_chain (stmt
)
772 && TREE_CODE (gimple_call_chain (stmt
)) == ADDR_EXPR
)
773 ret
|= visit_addr (stmt
, TREE_OPERAND (gimple_call_chain (stmt
), 0),
774 gimple_call_chain (stmt
), data
);
776 && gimple_call_return_slot_opt_p (stmt
)
777 && gimple_call_lhs (stmt
) != NULL_TREE
778 && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt
))))
779 ret
|= visit_addr (stmt
, gimple_call_lhs (stmt
),
780 gimple_call_lhs (stmt
), data
);
782 else if (gimple_code (stmt
) == GIMPLE_ASM
)
785 const char *constraint
;
786 const char **oconstraints
;
787 bool allows_mem
, allows_reg
, is_inout
;
788 noutputs
= gimple_asm_noutputs (stmt
);
789 oconstraints
= XALLOCAVEC (const char *, noutputs
);
790 if (visit_store
|| visit_addr
)
791 for (i
= 0; i
< gimple_asm_noutputs (stmt
); ++i
)
793 tree link
= gimple_asm_output_op (stmt
, i
);
794 tree op
= get_base_loadstore (TREE_VALUE (link
));
795 if (op
&& visit_store
)
796 ret
|= visit_store (stmt
, op
, TREE_VALUE (link
), data
);
799 constraint
= TREE_STRING_POINTER
800 (TREE_VALUE (TREE_PURPOSE (link
)));
801 oconstraints
[i
] = constraint
;
802 parse_output_constraint (&constraint
, i
, 0, 0, &allows_mem
,
803 &allows_reg
, &is_inout
);
804 if (op
&& !allows_reg
&& allows_mem
)
805 ret
|= visit_addr (stmt
, op
, TREE_VALUE (link
), data
);
808 if (visit_load
|| visit_addr
)
809 for (i
= 0; i
< gimple_asm_ninputs (stmt
); ++i
)
811 tree link
= gimple_asm_input_op (stmt
, i
);
812 tree op
= TREE_VALUE (link
);
814 && TREE_CODE (op
) == ADDR_EXPR
)
815 ret
|= visit_addr (stmt
, TREE_OPERAND (op
, 0), op
, data
);
816 else if (visit_load
|| visit_addr
)
818 op
= get_base_loadstore (op
);
822 ret
|= visit_load (stmt
, op
, TREE_VALUE (link
), data
);
825 constraint
= TREE_STRING_POINTER
826 (TREE_VALUE (TREE_PURPOSE (link
)));
827 parse_input_constraint (&constraint
, 0, 0, noutputs
,
829 &allows_mem
, &allows_reg
);
830 if (!allows_reg
&& allows_mem
)
831 ret
|= visit_addr (stmt
, op
, TREE_VALUE (link
),
838 else if (gimple_code (stmt
) == GIMPLE_RETURN
)
840 tree op
= gimple_return_retval (stmt
);
844 && TREE_CODE (op
) == ADDR_EXPR
)
845 ret
|= visit_addr (stmt
, TREE_OPERAND (op
, 0), op
, data
);
848 tree base
= get_base_loadstore (op
);
850 ret
|= visit_load (stmt
, base
, op
, data
);
855 && gimple_code (stmt
) == GIMPLE_PHI
)
857 for (i
= 0; i
< gimple_phi_num_args (stmt
); ++i
)
859 tree op
= gimple_phi_arg_def (stmt
, i
);
860 if (TREE_CODE (op
) == ADDR_EXPR
)
861 ret
|= visit_addr (stmt
, TREE_OPERAND (op
, 0), op
, data
);
865 && gimple_code (stmt
) == GIMPLE_GOTO
)
867 tree op
= gimple_goto_dest (stmt
);
868 if (TREE_CODE (op
) == ADDR_EXPR
)
869 ret
|= visit_addr (stmt
, TREE_OPERAND (op
, 0), op
, data
);
875 /* Like walk_stmt_load_store_addr_ops but with NULL visit_addr. IPA-CP
876 should make a faster clone for this case. */
879 walk_stmt_load_store_ops (gimple stmt
, void *data
,
880 walk_stmt_load_store_addr_fn visit_load
,
881 walk_stmt_load_store_addr_fn visit_store
)
883 return walk_stmt_load_store_addr_ops (stmt
, data
,
884 visit_load
, visit_store
, NULL
);