52 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
62 #if defined ENABLE_GIMPLE_CHECKING
63 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
68 #define GIMPLE_CHECK(GS, CODE) \
70 const_gimple __gs = (GS); \
71 if (gimple_code (__gs) != (CODE)) \
72 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
73 (CODE), ERROR_MARK); \
76 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
77 #define GIMPLE_CHECK(GS, CODE) (void)0
170 unsigned int no_warning : 1;
177 unsigned int nontemporal_move : 1;
184 unsigned int plf : 2;
188 unsigned modified : 1;
191 unsigned has_volatile_ops : 1;
197 unsigned int subcode : 16;
259 tree GTY((length (
"%h.opbase.gsbase.num_ops"))) op[1];
289 tree GTY((length (
"%h.membase.opbase.gsbase.num_ops"))) op[1];
305 tree GTY ((tag ("0
"))) fntype;
310 Operand vector. NOTE! This must always be the last field
311 of this structure. In particular, this means that this
312 structure cannot be embedded inside another one. */
313 tree GTY((length ("%h.membase.opbase.gsbase.num_ops
"))) op[1];
317 /* OpenMP statements (#pragma omp). */
319 struct GTY((user)) gimple_statement_omp : public gimple_statement_base {
320 /* [ WORD 1-6 ] : base class */
329 struct GTY((user)) gimple_statement_bind : public gimple_statement_base {
330 /* [ WORD 1-6 ] : base class */
333 Variables declared in this scope. */
337 This is different than the BLOCK field in gimple_statement_base,
338 which is analogous to TREE_BLOCK (i.e., the lexical block holding
339 this statement). This field is the equivalent of BIND_EXPR_BLOCK
340 in tree land (i.e., the lexical scope defined by this bind). See
351 struct GTY((user)) gimple_statement_catch : public gimple_statement_base {
352 /* [ WORD 1-6 ] : base class */
362 /* GIMPLE_EH_FILTER */
364 struct GTY((user)) gimple_statement_eh_filter : public gimple_statement_base {
365 /* [ WORD 1-6 ] : base class */
378 struct GTY((user)) gimple_statement_eh_else : public gimple_statement_base {
379 /* [ WORD 1-6 ] : base class */
382 gimple_seq n_body, e_body;
385 /* GIMPLE_EH_MUST_NOT_THROW */
387 struct GTY((user)) gimple_statement_eh_mnt : public gimple_statement_base {
388 /* [ WORD 1-6 ] : base class */
390 /* [ WORD 7 ] Abort function decl. */
396 struct GTY((user)) gimple_statement_phi : public gimple_statement_base {
397 /* [ WORD 1-6 ] : base class */
407 struct phi_arg_d GTY ((length ("%h.nargs
"))) args[1];
411 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
413 struct GTY((user)) gimple_statement_eh_ctrl : public gimple_statement_base
415 /* [ WORD 1-6 ] : base class */
418 Exception region number. */
425 struct GTY((user)) gimple_statement_try : public gimple_statement_base {
426 /* [ WORD 1-6 ] : base class */
429 Expression to evaluate. */
433 Cleanup expression. */
437 /* Kind of GIMPLE_TRY statements. */
438 enum gimple_try_flags
441 GIMPLE_TRY_CATCH = 1 << 0,
444 GIMPLE_TRY_FINALLY = 1 << 1,
445 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
447 /* Analogous to TRY_CATCH_IS_CLEANUP. */
448 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
451 /* GIMPLE_WITH_CLEANUP_EXPR */
453 struct GTY((user)) gimple_statement_wce : public gimple_statement_base {
454 /* [ WORD 1-6 ] : base class */
456 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
457 executed if an exception is thrown, not on normal exit of its
458 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
462 Cleanup expression. */
469 struct GTY((user)) gimple_statement_asm
470 : public gimple_statement_with_memory_ops_base
472 /* [ WORD 1-9 ] : base class */
475 __asm__ statement. */
479 Number of inputs, outputs, clobbers, labels. */
486 Operand vector. NOTE! This must always be the last field
487 of this structure. In particular, this means that this
488 structure cannot be embedded inside another one. */
489 tree GTY((length ("%h.membase.opbase.gsbase.num_ops
"))) op[1];
492 /* GIMPLE_OMP_CRITICAL */
494 struct GTY((user)) gimple_statement_omp_critical
495 : public gimple_statement_omp
497 /* [ WORD 1-7 ] : base class */
500 Critical section name. */
505 struct GTY(()) gimple_omp_for_iter {
506 /* Condition code. */
509 /* Index variable. */
524 struct GTY((user)) gimple_statement_omp_for : public gimple_statement_omp {
525 /* [ WORD 1-7 ] : base class */
531 Number of elements in iter array. */
535 struct gimple_omp_for_iter * GTY((length ("%h.collapse
"))) iter;
538 Pre-body evaluated before the loop body begins. */
543 /* GIMPLE_OMP_PARALLEL */
545 struct GTY((user)) gimple_statement_omp_parallel : public gimple_statement_omp {
546 /* [ WORD 1-7 ] : base class */
553 Child function holding the body of the parallel region. */
557 Shared data argument. */
562 /* GIMPLE_OMP_TASK */
564 struct GTY((user)) gimple_statement_omp_task : public gimple_statement_omp_parallel {
565 /* [ WORD 1-10 ] : base class */
568 Child function holding firstprivate initialization if needed. */
572 Size and alignment in bytes of the argument data block. */
578 /* GIMPLE_OMP_SECTION */
579 /* Uses struct gimple_statement_omp. */
582 /* GIMPLE_OMP_SECTIONS */
584 struct GTY((user)) gimple_statement_omp_sections
585 : public gimple_statement_omp
587 /* [ WORD 1-7 ] : base class */
593 The control variable used for deciding which of the sections to
598 /* GIMPLE_OMP_CONTINUE.
600 Note: This does not inherit from gimple_statement_omp, because we
601 do not need the body field. */
603 struct GTY((user)) gimple_statement_omp_continue
604 : public gimple_statement_base
606 /* [ WORD 1-6 ] : base class */
615 /* GIMPLE_OMP_SINGLE */
617 struct GTY((user)) gimple_statement_omp_single : public gimple_statement_omp {
618 /* [ WORD 1-7 ] : base class */
625 /* GIMPLE_OMP_ATOMIC_LOAD.
626 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
627 contains a sequence, which we don't need here. */
629 struct GTY((user)) gimple_statement_omp_atomic_load
630 : public gimple_statement_base
632 /* [ WORD 1-6 ] : base class */
638 /* GIMPLE_OMP_ATOMIC_STORE.
639 See note on GIMPLE_OMP_ATOMIC_LOAD. */
641 struct GTY((user)) gimple_statement_omp_atomic_store
642 : public gimple_statement_base
644 /* [ WORD 1-6 ] : base class */
650 /* GIMPLE_TRANSACTION. */
652 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
654 /* The __transaction_atomic was declared [[outer]] or it is
655 __transaction_relaxed. */
656 #define GTMA_IS_OUTER (1u << 0)
657 #define GTMA_IS_RELAXED (1u << 1)
658 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
660 /* The transaction is seen to not have an abort. */
661 #define GTMA_HAVE_ABORT (1u << 2)
662 /* The transaction is seen to have loads or stores. */
663 #define GTMA_HAVE_LOAD (1u << 3)
664 #define GTMA_HAVE_STORE (1u << 4)
665 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
666 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
667 /* The transaction WILL enter serial irrevocable mode.
668 An irrevocable block post-dominates the entire transaction, such
669 that all invocations of the transaction will go serial-irrevocable.
670 In such case, we don't bother instrumenting the transaction, and
671 tell the runtime that it should begin the transaction in
672 serial-irrevocable mode. */
673 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
674 /* The transaction contains no instrumentation code whatsover, most
675 likely because it is guaranteed to go irrevocable upon entry. */
676 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
678 struct GTY((user)) gimple_statement_transaction
679 : public gimple_statement_with_memory_ops_base
681 /* [ WORD 1-9 ] : base class */
690 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
691 enum gimple_statement_structure_enum {
692 #include "gsstruct.def
"
700 is_a_helper <gimple_statement_asm>::test (gimple gs)
702 return gs->code == GIMPLE_ASM;
708 is_a_helper <gimple_statement_bind>::test (gimple gs)
710 return gs->code == GIMPLE_BIND;
716 is_a_helper <gimple_statement_call>::test (gimple gs)
718 return gs->code == GIMPLE_CALL;
724 is_a_helper <gimple_statement_catch>::test (gimple gs)
726 return gs->code == GIMPLE_CATCH;
732 is_a_helper <gimple_statement_eh_ctrl>::test (gimple gs)
734 return gs->code == GIMPLE_RESX|| gs->code == GIMPLE_EH_DISPATCH;
740 is_a_helper <gimple_statement_eh_else>::test (gimple gs)
742 return gs->code == GIMPLE_EH_ELSE;
748 is_a_helper <gimple_statement_eh_filter>::test (gimple gs)
750 return gs->code == GIMPLE_EH_FILTER;
756 is_a_helper <gimple_statement_eh_mnt>::test (gimple gs)
758 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
764 is_a_helper <gimple_statement_omp_atomic_load>::test (gimple gs)
766 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
772 is_a_helper <gimple_statement_omp_atomic_store>::test (gimple gs)
774 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
780 is_a_helper <gimple_statement_omp_continue>::test (gimple gs)
782 return gs->code == GIMPLE_OMP_CONTINUE;
788 is_a_helper <gimple_statement_omp_critical>::test (gimple gs)
790 return gs->code == GIMPLE_OMP_CRITICAL;
796 is_a_helper <gimple_statement_omp_for>::test (gimple gs)
798 return gs->code == GIMPLE_OMP_FOR;
804 is_a_helper <gimple_statement_omp_parallel>::test (gimple gs)
806 return gs->code == GIMPLE_OMP_PARALLEL;
812 is_a_helper <gimple_statement_omp_sections>::test (gimple gs)
814 return gs->code == GIMPLE_OMP_SECTIONS;
820 is_a_helper <gimple_statement_omp_single>::test (gimple gs)
822 return gs->code == GIMPLE_OMP_SINGLE;
828 is_a_helper <gimple_statement_omp_task>::test (gimple gs)
830 return gs->code == GIMPLE_OMP_TASK;
836 is_a_helper <gimple_statement_phi>::test (gimple gs)
838 return gs->code == GIMPLE_PHI;
844 is_a_helper <gimple_statement_transaction>::test (gimple gs)
846 return gs->code == GIMPLE_TRANSACTION;
852 is_a_helper <gimple_statement_try>::test (gimple gs)
854 return gs->code == GIMPLE_TRY;
860 is_a_helper <gimple_statement_wce>::test (gimple gs)
862 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
868 is_a_helper <const gimple_statement_asm>::test (const_gimple gs)
870 return gs->code == GIMPLE_ASM;
876 is_a_helper <const gimple_statement_bind>::test (const_gimple gs)
878 return gs->code == GIMPLE_BIND;
884 is_a_helper <const gimple_statement_call>::test (const_gimple gs)
886 return gs->code == GIMPLE_CALL;
892 is_a_helper <const gimple_statement_catch>::test (const_gimple gs)
894 return gs->code == GIMPLE_CATCH;
900 is_a_helper <const gimple_statement_eh_ctrl>::test (const_gimple gs)
902 return gs->code == GIMPLE_RESX|| gs->code == GIMPLE_EH_DISPATCH;
908 is_a_helper <const gimple_statement_eh_filter>::test (const_gimple gs)
910 return gs->code == GIMPLE_EH_FILTER;
916 is_a_helper <const gimple_statement_omp_atomic_load>::test (const_gimple gs)
918 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
924 is_a_helper <const gimple_statement_omp_atomic_store>::test (const_gimple gs)
926 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
932 is_a_helper <const gimple_statement_omp_continue>::test (const_gimple gs)
934 return gs->code == GIMPLE_OMP_CONTINUE;
940 is_a_helper <const gimple_statement_omp_critical>::test (const_gimple gs)
942 return gs->code == GIMPLE_OMP_CRITICAL;
948 is_a_helper <const gimple_statement_omp_for>::test (const_gimple gs)
950 return gs->code == GIMPLE_OMP_FOR;
956 is_a_helper <const gimple_statement_omp_parallel>::test (const_gimple gs)
958 return gs->code == GIMPLE_OMP_PARALLEL;
964 is_a_helper <const gimple_statement_omp_sections>::test (const_gimple gs)
966 return gs->code == GIMPLE_OMP_SECTIONS;
972 is_a_helper <const gimple_statement_omp_single>::test (const_gimple gs)
974 return gs->code == GIMPLE_OMP_SINGLE;
980 is_a_helper <const gimple_statement_omp_task>::test (const_gimple gs)
982 return gs->code == GIMPLE_OMP_TASK;
988 is_a_helper <const gimple_statement_phi>::test (const_gimple gs)
990 return gs->code == GIMPLE_PHI;
996 is_a_helper <const gimple_statement_transaction>::test (const_gimple gs)
998 return gs->code == GIMPLE_TRANSACTION;
1004 /* Helper functions to build GIMPLE statements. */
1005 tree create_gimple_tmp (tree, enum ssa_mode = M_SSA);
1006 gimple build_assign (enum tree_code, tree, int, enum ssa_mode = M_SSA);
1007 gimple build_assign (enum tree_code, gimple, int, enum ssa_mode = M_SSA);
1008 gimple build_assign (enum tree_code, tree, tree, enum ssa_mode = M_SSA);
1009 gimple build_assign (enum tree_code, gimple, tree, enum ssa_mode = M_SSA);
1010 gimple build_assign (enum tree_code, tree, gimple, enum ssa_mode = M_SSA);
1011 gimple build_assign (enum tree_code, gimple, gimple, enum ssa_mode = M_SSA);
1012 gimple build_type_cast (tree, tree, enum ssa_mode = M_SSA);
1013 gimple build_type_cast (tree, gimple, enum ssa_mode = M_SSA);
1015 /* Offset in bytes to the location of the operand vector.
1016 Zero if there is no operand vector for this tuple structure. */
1017 extern size_t const gimple_ops_offset_[];
1019 /* Map GIMPLE codes to GSS codes. */
1020 extern enum gimple_statement_structure_enum const gss_for_code_[];
1022 /* This variable holds the currently expanded gimple statement for purposes
1023 of comminucating the profile info to the builtin expanders. */
1024 extern gimple currently_expanding_gimple_stmt;
1026 gimple gimple_build_return (tree);
1028 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1029 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1031 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
1034 gimple_build_assign_with_ops (enum tree_code, tree,
1035 tree, tree CXX_MEM_STAT_INFO);
1037 gimple_build_assign_with_ops (enum tree_code, tree,
1038 tree, tree, tree CXX_MEM_STAT_INFO);
1040 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1041 #define gimple_build_debug_bind(var,val,stmt) \
1042 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1043 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1044 #define gimple_build_debug_source_bind(var,val,stmt) \
1045 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1047 gimple gimple_build_call_vec (tree, vec<tree> );
1048 gimple gimple_build_call (tree, unsigned, ...);
1049 gimple gimple_build_call_valist (tree, unsigned, va_list);
1050 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1051 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1052 gimple gimple_build_call_from_tree (tree);
1053 gimple gimplify_assign (tree, tree, gimple_seq *);
1054 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1055 gimple gimple_build_label (tree label);
1056 gimple gimple_build_goto (tree dest);
1057 gimple gimple_build_nop (void);
1058 gimple gimple_build_bind (tree, gimple_seq, tree);
1059 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1060 vec<tree, va_gc> *, vec<tree, va_gc> *,
1061 vec<tree, va_gc> *);
1062 gimple gimple_build_catch (tree, gimple_seq);
1063 gimple gimple_build_eh_filter (tree, gimple_seq);
1064 gimple gimple_build_eh_must_not_throw (tree);
1065 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1066 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1067 enum gimple_try_flags);
1068 gimple gimple_build_wce (gimple_seq);
1069 gimple gimple_build_resx (int);
1070 gimple gimple_build_eh_dispatch (int);
1071 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1072 gimple gimple_build_switch (tree, tree, vec<tree> );
1073 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1074 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1075 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1076 gimple gimple_build_omp_critical (gimple_seq, tree);
1077 gimple gimple_build_omp_section (gimple_seq);
1078 gimple gimple_build_omp_continue (tree, tree);
1079 gimple gimple_build_omp_master (gimple_seq);
1080 gimple gimple_build_omp_return (bool);
1081 gimple gimple_build_omp_ordered (gimple_seq);
1082 gimple gimple_build_omp_sections (gimple_seq, tree);
1083 gimple gimple_build_omp_sections_switch (void);
1084 gimple gimple_build_omp_single (gimple_seq, tree);
1085 gimple gimple_build_cdt (tree, tree);
1086 gimple gimple_build_omp_atomic_load (tree, tree);
1087 gimple gimple_build_omp_atomic_store (tree);
1088 gimple gimple_build_transaction (gimple_seq, tree);
1089 gimple gimple_build_predict (enum br_predictor, enum prediction);
1090 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
1091 void sort_case_labels (vec<tree> );
1092 void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1093 void gimple_set_body (tree, gimple_seq);
1094 gimple_seq gimple_body (tree);
1095 bool gimple_has_body_p (tree);
1096 gimple_seq gimple_seq_alloc (void);
1097 void gimple_seq_free (gimple_seq);
1098 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1099 gimple_seq gimple_seq_copy (gimple_seq);
1100 bool gimple_call_same_target_p (const_gimple, const_gimple);
1101 int gimple_call_flags (const_gimple);
1102 int gimple_call_return_flags (const_gimple);
1103 int gimple_call_arg_flags (const_gimple, unsigned);
1104 void gimple_call_reset_alias_info (gimple);
1105 bool gimple_assign_copy_p (gimple);
1106 bool gimple_assign_ssa_name_copy_p (gimple);
1107 bool gimple_assign_unary_nop_p (gimple);
1108 void gimple_set_bb (gimple, basic_block);
1109 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1110 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1112 tree gimple_get_lhs (const_gimple);
1113 void gimple_set_lhs (gimple, tree);
1114 void gimple_replace_lhs (gimple, tree);
1115 gimple gimple_copy (gimple);
1116 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
1117 gimple gimple_build_cond_from_tree (tree, tree, tree);
1118 void gimple_cond_set_condition_from_tree (gimple, tree);
1119 bool gimple_has_side_effects (const_gimple);
1120 bool gimple_could_trap_p (gimple);
1121 bool gimple_could_trap_p_1 (gimple, bool, bool);
1122 bool gimple_assign_rhs_could_trap_p (gimple);
1123 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
1124 bool empty_body_p (gimple_seq);
1125 unsigned get_gimple_rhs_num_ops (enum tree_code);
1126 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1127 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1128 const char *gimple_decl_printable_name (tree, int);
1129 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
1130 tree gimple_extract_devirt_binfo_from_cst (tree, tree);
1132 /* Returns true iff T is a scalar register variable. */
1133 extern bool is_gimple_reg (tree);
1134 /* Returns true iff T is any sort of variable. */
1135 extern bool is_gimple_variable (tree);
1136 /* Returns true iff T is any sort of symbol. */
1137 extern bool is_gimple_id (tree);
1138 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
1139 extern bool is_gimple_min_lval (tree);
1140 /* Returns true iff T is something whose address can be taken. */
1141 extern bool is_gimple_addressable (tree);
1142 /* Returns true iff T is any valid GIMPLE lvalue. */
1143 extern bool is_gimple_lvalue (tree);
1145 /* Returns true iff T is a GIMPLE address. */
1146 bool is_gimple_address (const_tree);
1147 /* Returns true iff T is a GIMPLE invariant address. */
1148 bool is_gimple_invariant_address (const_tree);
1149 /* Returns true iff T is a GIMPLE invariant address at interprocedural
1151 bool is_gimple_ip_invariant_address (const_tree);
1152 /* Returns true iff T is a valid GIMPLE constant. */
1153 bool is_gimple_constant (const_tree);
1154 /* Returns true iff T is a GIMPLE restricted function invariant. */
1155 extern bool is_gimple_min_invariant (const_tree);
1156 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
1157 extern bool is_gimple_ip_invariant (const_tree);
1158 /* Returns true iff T is a GIMPLE rvalue. */
1159 extern bool is_gimple_val (tree);
1160 /* Returns true iff T is a GIMPLE asm statement input. */
1161 extern bool is_gimple_asm_val (tree);
1162 /* Returns true iff T is a valid address operand of a MEM_REF. */
1163 bool is_gimple_mem_ref_addr (tree);
1165 /* Returns true iff T is a valid if-statement condition. */
1166 extern bool is_gimple_condexpr (tree);
1168 /* Returns true iff T is a valid call address expression. */
1169 extern bool is_gimple_call_addr (tree);
1171 /* Return TRUE iff stmt is a call to a built-in function. */
1172 extern bool is_gimple_builtin_call (gimple stmt);
1174 extern void recalculate_side_effects (tree);
1175 extern bool gimple_compare_field_offset (tree, tree);
1176 extern tree gimple_register_canonical_type (tree);
1177 extern void print_gimple_types_stats (const char *);
1178 extern void free_gimple_type_tables (void);
1179 extern tree gimple_unsigned_type (tree);
1180 extern tree gimple_signed_type (tree);
1181 extern alias_set_type gimple_get_alias_set (tree);
1182 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1184 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1185 bool (*)(gimple, tree, void *),
1186 bool (*)(gimple, tree, void *),
1187 bool (*)(gimple, tree, void *));
1188 extern bool walk_stmt_load_store_ops (gimple, void *,
1189 bool (*)(gimple, tree, void *),
1190 bool (*)(gimple, tree, void *));
1191 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1192 extern bool gimple_call_builtin_p (gimple, enum built_in_class);
1193 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1194 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1197 extern tree create_tmp_var_raw (tree, const char *);
1198 extern tree create_tmp_var_name (const char *);
1199 extern tree create_tmp_var (tree, const char *);
1200 extern tree create_tmp_reg (tree, const char *);
1201 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1202 extern tree get_formal_tmp_var (tree, gimple_seq *);
1203 extern void declare_vars (tree, gimple, bool);
1204 extern void annotate_all_with_location (gimple_seq, location_t);
1206 /* Validation of GIMPLE expressions. Note that these predicates only check
1207 the basic form of the expression, they don't recurse to make sure that
1208 underlying nodes are also of the right form. */
1209 typedef bool (*gimple_predicate)(tree);
1212 /* FIXME we should deduce this from the predicate. */
1214 fb_none = 0, /* Do not generate a temporary. */
1216 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1217 gimplified expression. */
1219 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1220 gimplified expression. */
1222 fb_mayfail = 4, /* Gimplification may fail. Error issued
1224 fb_either= fb_rvalue | fb_lvalue
1227 typedef int fallback_t;
1229 enum gimplify_status {
1230 GS_ERROR = -2, /* Something Bad Seen. */
1231 GS_UNHANDLED = -1, /* A langhook result for "I dunno
". */
1232 GS_OK = 0, /* We did something, maybe more to do. */
1233 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1236 /* Formal (expression) temporary table handling: multiple occurrences of
1237 the same scalar expression are evaluated into the same temporary. */
1239 typedef struct gimple_temp_hash_elt
1242 tree temp; /* Value */
1245 /* Gimplify hashtable helper. */
1247 struct gimplify_hasher : typed_free_remove <elt_t>
1249 typedef elt_t value_type;
1250 typedef elt_t compare_type;
1251 static inline hashval_t hash (const value_type *);
1252 static inline bool equal (const value_type *, const compare_type *);
1256 gimplify_hasher::hash (const value_type *p)
1259 return iterative_hash_expr (t, 0);
1263 gimplify_hasher::equal (const value_type *p1, const compare_type *p2)
1267 enum tree_code code = TREE_CODE (t1);
1269 if (TREE_CODE (t2) != code
1270 || TREE_TYPE (t1) != TREE_TYPE (t2))
1273 if (!operand_equal_p (t1, t2, 0))
1276 #ifdef ENABLE_CHECKING
1277 /* Only allow them to compare equal if they also hash equal; otherwise
1278 results are nondeterminate, and we fail bootstrap comparison. */
1279 gcc_assert (hash (p1) == hash (p2));
1287 struct gimplify_ctx *prev_context;
1289 vec<gimple> bind_expr_stack;
1291 gimple_seq conditional_cleanups;
1295 vec<tree> case_labels;
1296 /* The formal temporary table. Should this be persistent? */
1297 hash_table <gimplify_hasher> temp_htab;
1302 bool allow_rhs_cond_expr;
1303 bool in_cleanup_point_expr;
1306 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1307 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1310 is_gimple_sizepos (tree expr)
1312 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1313 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1314 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1315 function, the gimplifier will want to replace it with a new variable,
1316 but that will cause problems if this type is from outside the function.
1317 It's OK to have that here. */
1318 return (expr == NULL_TREE
1319 || TREE_CONSTANT (expr)
1320 || TREE_CODE (expr) == VAR_DECL
1321 || CONTAINS_PLACEHOLDER_P (expr));
1324 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1325 bool (*) (tree), fallback_t);
1326 extern void gimplify_type_sizes (tree, gimple_seq *);
1327 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1328 enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *,
1330 extern bool gimplify_stmt (tree *, gimple_seq *);
1331 extern gimple gimplify_body (tree, bool);
1332 extern void push_gimplify_context (struct gimplify_ctx *);
1333 extern void pop_gimplify_context (gimple);
1334 extern void gimplify_and_add (tree, gimple_seq *);
1336 /* Miscellaneous helpers. */
1337 extern void gimple_add_tmp_var (tree);
1338 extern gimple gimple_current_bind_expr (void);
1339 extern vec<gimple> gimple_bind_expr_stack (void);
1340 extern tree voidify_wrapper_expr (tree, tree);
1341 extern tree build_and_jump (tree *);
1342 extern tree force_labels_r (tree *, int *, void *);
1343 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1345 struct gimplify_omp_ctx;
1346 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1347 extern tree gimple_boolify (tree);
1348 extern gimple_predicate rhs_predicate_for (tree);
1349 extern tree canonicalize_cond_expr_cond (tree);
1352 extern tree omp_reduction_init (tree, tree);
1354 /* In trans-mem.c. */
1355 extern void diagnose_tm_safe_errors (tree);
1356 extern void compute_transaction_bits (void);
1358 /* In tree-nested.c. */
1359 extern void lower_nested_functions (tree);
1360 extern void insert_field_into_struct (tree, tree);
1362 /* In gimplify.c. */
1363 extern void gimplify_function_tree (tree);
1365 /* In cfgexpand.c. */
1366 extern tree gimple_assign_rhs_to_tree (gimple);
1369 extern bool validate_gimple_arglist (const_gimple, ...);
1372 extern bool tree_ssa_useless_type_conversion (tree);
1373 extern tree tree_ssa_strip_useless_type_conversions (tree);
1374 extern bool useless_type_conversion_p (tree, tree);
1375 extern bool types_compatible_p (tree, tree);
1377 /* In tree-ssa-coalesce.c */
1378 extern bool gimple_can_coalesce_p (tree, tree);
1380 /* Return the first node in GIMPLE sequence S. */
1382 static inline gimple_seq_node
1383 gimple_seq_first (gimple_seq s)
1389 /* Return the first statement in GIMPLE sequence S. */
1391 static inline gimple
1392 gimple_seq_first_stmt (gimple_seq s)
1394 gimple_seq_node n = gimple_seq_first (s);
1399 /* Return the last node in GIMPLE sequence S. */
1401 static inline gimple_seq_node
1402 gimple_seq_last (gimple_seq s)
1404 return s ? s->prev : NULL;
1408 /* Return the last statement in GIMPLE sequence S. */
1410 static inline gimple
1411 gimple_seq_last_stmt (gimple_seq s)
1413 gimple_seq_node n = gimple_seq_last (s);
1418 /* Set the last node in GIMPLE sequence *PS to LAST. */
1421 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1427 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1430 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1436 /* Return true if GIMPLE sequence S is empty. */
1439 gimple_seq_empty_p (gimple_seq s)
1444 void gimple_seq_add_stmt (gimple_seq *, gimple);
1446 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1447 *SEQ_P is NULL, a new sequence is allocated. This function is
1448 similar to gimple_seq_add_stmt, but does not scan the operands.
1449 During gimplification, we need to manipulate statement sequences
1450 before the def/use vectors have been constructed. */
1451 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1453 /* Allocate a new sequence and initialize its first element with STMT. */
1455 static inline gimple_seq
1456 gimple_seq_alloc_with_stmt (gimple stmt)
1458 gimple_seq seq = NULL;
1459 gimple_seq_add_stmt (&seq, stmt);
1464 /* Returns the sequence of statements in BB. */
1466 static inline gimple_seq
1467 bb_seq (const_basic_block bb)
1469 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1472 static inline gimple_seq *
1473 bb_seq_addr (basic_block bb)
1475 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1478 /* Sets the sequence of statements in BB to SEQ. */
1481 set_bb_seq (basic_block bb, gimple_seq seq)
1483 gcc_checking_assert (!(bb->flags & BB_RTL));
1484 bb->il.gimple.seq = seq;
1488 /* Return the code for GIMPLE statement G. */
1490 static inline enum gimple_code
1491 gimple_code (const_gimple g)
1497 /* Return the GSS code used by a GIMPLE code. */
1499 static inline enum gimple_statement_structure_enum
1500 gss_for_code (enum gimple_code code)
1502 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1503 return gss_for_code_[code];
1507 /* Return which GSS code is used by GS. */
1509 static inline enum gimple_statement_structure_enum
1510 gimple_statement_structure (gimple gs)
1512 return gss_for_code (gimple_code (gs));
1516 /* Return true if statement G has sub-statements. This is only true for
1517 High GIMPLE statements. */
1520 gimple_has_substatements (gimple g)
1522 switch (gimple_code (g))
1526 case GIMPLE_EH_FILTER:
1527 case GIMPLE_EH_ELSE:
1529 case GIMPLE_OMP_FOR:
1530 case GIMPLE_OMP_MASTER:
1531 case GIMPLE_OMP_ORDERED:
1532 case GIMPLE_OMP_SECTION:
1533 case GIMPLE_OMP_PARALLEL:
1534 case GIMPLE_OMP_TASK:
1535 case GIMPLE_OMP_SECTIONS:
1536 case GIMPLE_OMP_SINGLE:
1537 case GIMPLE_OMP_CRITICAL:
1538 case GIMPLE_WITH_CLEANUP_EXPR:
1539 case GIMPLE_TRANSACTION:
1548 /* Return the basic block holding statement G. */
1550 static inline basic_block
1551 gimple_bb (const_gimple g)
1557 /* Return the lexical scope block holding statement G. */
1560 gimple_block (const_gimple g)
1562 return LOCATION_BLOCK (g->location);
1566 /* Set BLOCK to be the lexical scope block holding statement G. */
1569 gimple_set_block (gimple g, tree block)
1573 COMBINE_LOCATION_DATA (line_table, g->location, block);
1575 g->location = LOCATION_LOCUS (g->location);
1579 /* Return location information for statement G. */
1581 static inline location_t
1582 gimple_location (const_gimple g)
1587 /* Return pointer to location information for statement G. */
1589 static inline const location_t *
1590 gimple_location_ptr (const_gimple g)
1592 return &g->location;
1596 /* Set location information for statement G. */
1599 gimple_set_location (gimple g, location_t location)
1601 g->location = location;
1605 /* Return true if G contains location information. */
1608 gimple_has_location (const_gimple g)
1610 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1614 /* Return the file name of the location of STMT. */
1616 static inline const char *
1617 gimple_filename (const_gimple stmt)
1619 return LOCATION_FILE (gimple_location (stmt));
1623 /* Return the line number of the location of STMT. */
1626 gimple_lineno (const_gimple stmt)
1628 return LOCATION_LINE (gimple_location (stmt));
1632 /* Determine whether SEQ is a singleton. */
1635 gimple_seq_singleton_p (gimple_seq seq)
1637 return ((gimple_seq_first (seq) != NULL)
1638 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1641 /* Return true if no warnings should be emitted for statement STMT. */
1644 gimple_no_warning_p (const_gimple stmt)
1646 return stmt->no_warning;
1649 /* Set the no_warning flag of STMT to NO_WARNING. */
1652 gimple_set_no_warning (gimple stmt, bool no_warning)
1654 stmt->no_warning = (unsigned) no_warning;
1657 /* Set the visited status on statement STMT to VISITED_P. */
1660 gimple_set_visited (gimple stmt, bool visited_p)
1662 stmt->visited = (unsigned) visited_p;
1666 /* Return the visited status for statement STMT. */
1669 gimple_visited_p (gimple stmt)
1671 return stmt->visited;
1675 /* Set pass local flag PLF on statement STMT to VAL_P. */
1678 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1681 stmt->plf |= (unsigned int) plf;
1683 stmt->plf &= ~((unsigned int) plf);
1687 /* Return the value of pass local flag PLF on statement STMT. */
1689 static inline unsigned int
1690 gimple_plf (gimple stmt, enum plf_mask plf)
1692 return stmt->plf & ((unsigned int) plf);
1696 /* Set the UID of statement. */
1699 gimple_set_uid (gimple g, unsigned uid)
1705 /* Return the UID of statement. */
1707 static inline unsigned
1708 gimple_uid (const_gimple g)
1714 /* Make statement G a singleton sequence. */
1717 gimple_init_singleton (gimple g)
1724 /* Return true if GIMPLE statement G has register or memory operands. */
1727 gimple_has_ops (const_gimple g)
1729 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1735 is_a_helper <const gimple_statement_with_ops>::test (const_gimple gs)
1737 return gimple_has_ops (gs);
1743 is_a_helper <gimple_statement_with_ops>::test (gimple gs)
1745 return gimple_has_ops (gs);
1748 /* Return true if GIMPLE statement G has memory operands. */
1751 gimple_has_mem_ops (const_gimple g)
1753 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1759 is_a_helper <const gimple_statement_with_memory_ops>::test (const_gimple gs)
1761 return gimple_has_mem_ops (gs);
1767 is_a_helper <gimple_statement_with_memory_ops>::test (gimple gs)
1769 return gimple_has_mem_ops (gs);
1772 /* Return the set of USE operands for statement G. */
1774 static inline struct use_optype_d *
1775 gimple_use_ops (const_gimple g)
1777 const gimple_statement_with_ops *ops_stmt =
1778 dyn_cast <const gimple_statement_with_ops> (g);
1781 return ops_stmt->use_ops;
1785 /* Set USE to be the set of USE operands for statement G. */
1788 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1790 gimple_statement_with_ops *ops_stmt =
1791 as_a <gimple_statement_with_ops> (g);
1792 ops_stmt->use_ops = use;
1796 /* Return the set of VUSE operand for statement G. */
1798 static inline use_operand_p
1799 gimple_vuse_op (const_gimple g)
1801 struct use_optype_d *ops;
1802 const gimple_statement_with_memory_ops *mem_ops_stmt =
1803 dyn_cast <const gimple_statement_with_memory_ops> (g);
1805 return NULL_USE_OPERAND_P;
1806 ops = mem_ops_stmt->use_ops;
1808 && USE_OP_PTR (ops)->use == &mem_ops_stmt->vuse)
1809 return USE_OP_PTR (ops);
1810 return NULL_USE_OPERAND_P;
1813 /* Return the set of VDEF operand for statement G. */
1815 static inline def_operand_p
1816 gimple_vdef_op (gimple g)
1818 gimple_statement_with_memory_ops *mem_ops_stmt =
1819 dyn_cast <gimple_statement_with_memory_ops> (g);
1821 return NULL_DEF_OPERAND_P;
1822 if (mem_ops_stmt->vdef)
1823 return &mem_ops_stmt->vdef;
1824 return NULL_DEF_OPERAND_P;
1828 /* Return the single VUSE operand of the statement G. */
1831 gimple_vuse (const_gimple g)
1833 const gimple_statement_with_memory_ops *mem_ops_stmt =
1834 dyn_cast <const gimple_statement_with_memory_ops> (g);
1837 return mem_ops_stmt->vuse;
1840 /* Return the single VDEF operand of the statement G. */
1843 gimple_vdef (const_gimple g)
1845 const gimple_statement_with_memory_ops *mem_ops_stmt =
1846 dyn_cast <const gimple_statement_with_memory_ops> (g);
1849 return mem_ops_stmt->vdef;
1852 /* Return the single VUSE operand of the statement G. */
1854 static inline tree *
1855 gimple_vuse_ptr (gimple g)
1857 gimple_statement_with_memory_ops *mem_ops_stmt =
1858 dyn_cast <gimple_statement_with_memory_ops> (g);
1861 return &mem_ops_stmt->vuse;
1864 /* Return the single VDEF operand of the statement G. */
1866 static inline tree *
1867 gimple_vdef_ptr (gimple g)
1869 gimple_statement_with_memory_ops *mem_ops_stmt =
1870 dyn_cast <gimple_statement_with_memory_ops> (g);
1873 return &mem_ops_stmt->vdef;
1876 /* Set the single VUSE operand of the statement G. */
1879 gimple_set_vuse (gimple g, tree vuse)
1881 gimple_statement_with_memory_ops *mem_ops_stmt =
1882 as_a <gimple_statement_with_memory_ops> (g);
1883 mem_ops_stmt->vuse = vuse;
1886 /* Set the single VDEF operand of the statement G. */
1889 gimple_set_vdef (gimple g, tree vdef)
1891 gimple_statement_with_memory_ops *mem_ops_stmt =
1892 as_a <gimple_statement_with_memory_ops> (g);
1893 mem_ops_stmt->vdef = vdef;
1897 /* Return true if statement G has operands and the modified field has
1901 gimple_modified_p (const_gimple g)
1903 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1907 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1908 a MODIFIED field. */
1911 gimple_set_modified (gimple s, bool modifiedp)
1913 if (gimple_has_ops (s))
1914 s->modified = (unsigned) modifiedp;
1918 /* Return the tree code for the expression computed by STMT. This is
1919 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1920 GIMPLE_CALL, return CALL_EXPR as the expression code for
1921 consistency. This is useful when the caller needs to deal with the
1922 three kinds of computation that GIMPLE supports. */
1924 static inline enum tree_code
1925 gimple_expr_code (const_gimple stmt)
1927 enum gimple_code code = gimple_code (stmt);
1928 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1929 return (enum tree_code) stmt->subcode;
1932 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1938 /* Mark statement S as modified, and update it. */
1941 update_stmt (gimple s)
1943 if (gimple_has_ops (s))
1945 gimple_set_modified (s, true);
1946 update_stmt_operands (s);
1950 /* Update statement S if it has been optimized. */
1953 update_stmt_if_modified (gimple s)
1955 if (gimple_modified_p (s))
1956 update_stmt_operands (s);
1959 /* Return true if statement STMT contains volatile operands. */
1962 gimple_has_volatile_ops (const_gimple stmt)
1964 if (gimple_has_mem_ops (stmt))
1965 return stmt->has_volatile_ops;
1971 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1974 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1976 if (gimple_has_mem_ops (stmt))
1977 stmt->has_volatile_ops = (unsigned) volatilep;
1980 /* Return true if BB is in a transaction. */
1983 block_in_transaction (basic_block bb)
1985 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1988 /* Return true if STMT is in a transaction. */
1991 gimple_in_transaction (gimple stmt)
1993 return block_in_transaction (gimple_bb (stmt));
1996 /* Return true if statement STMT may access memory. */
1999 gimple_references_memory_p (gimple stmt)
2001 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2005 /* Return the subcode for OMP statement S. */
2007 static inline unsigned
2008 gimple_omp_subcode (const_gimple s)
2010 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2011 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
2015 /* Set the subcode for OMP statement S to SUBCODE. */
2018 gimple_omp_set_subcode (gimple s, unsigned int subcode)
2020 /* We only have 16 bits for the subcode. Assert that we are not
2022 gcc_gimple_checking_assert (subcode < (1 << 16));
2023 s->subcode = subcode;
2026 /* Set the nowait flag on OMP_RETURN statement S. */
2029 gimple_omp_return_set_nowait (gimple s)
2031 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2032 s->subcode |= GF_OMP_RETURN_NOWAIT;
2036 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2040 gimple_omp_return_nowait_p (const_gimple g)
2042 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2043 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2047 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2051 gimple_omp_section_last_p (const_gimple g)
2053 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2054 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2058 /* Set the GF_OMP_SECTION_LAST flag on G. */
2061 gimple_omp_section_set_last (gimple g)
2063 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2064 g->subcode |= GF_OMP_SECTION_LAST;
2068 /* Return true if OMP parallel statement G has the
2069 GF_OMP_PARALLEL_COMBINED flag set. */
2072 gimple_omp_parallel_combined_p (const_gimple g)
2074 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2075 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2079 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2080 value of COMBINED_P. */
2083 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2085 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2087 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2089 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2093 /* Return true if OMP atomic load/store statement G has the
2094 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2097 gimple_omp_atomic_need_value_p (const_gimple g)
2099 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2100 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2101 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2105 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2108 gimple_omp_atomic_set_need_value (gimple g)
2110 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2111 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2112 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2116 /* Return the number of operands for statement GS. */
2118 static inline unsigned
2119 gimple_num_ops (const_gimple gs)
2125 /* Set the number of operands for statement GS. */
2128 gimple_set_num_ops (gimple gs, unsigned num_ops)
2130 gs->num_ops = num_ops;
2134 /* Return the array of operands for statement GS. */
2136 static inline tree *
2137 gimple_ops (gimple gs)
2141 /* All the tuples have their operand vector at the very bottom
2142 of the structure. Note that those structures that do not
2143 have an operand vector have a zero offset. */
2144 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2145 gcc_gimple_checking_assert (off != 0);
2147 return (tree *) ((char *) gs + off);
2151 /* Return operand I for statement GS. */
2154 gimple_op (const_gimple gs, unsigned i)
2156 if (gimple_has_ops (gs))
2158 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2159 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2165 /* Return a pointer to operand I for statement GS. */
2167 static inline tree *
2168 gimple_op_ptr (const_gimple gs, unsigned i)
2170 if (gimple_has_ops (gs))
2172 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2173 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2179 /* Set operand I of statement GS to OP. */
2182 gimple_set_op (gimple gs, unsigned i, tree op)
2184 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2186 /* Note. It may be tempting to assert that OP matches
2187 is_gimple_operand, but that would be wrong. Different tuples
2188 accept slightly different sets of tree operands. Each caller
2189 should perform its own validation. */
2190 gimple_ops (gs)[i] = op;
2193 /* Return true if GS is a GIMPLE_ASSIGN. */
2196 is_gimple_assign (const_gimple gs)
2198 return gimple_code (gs) == GIMPLE_ASSIGN;
2201 /* Determine if expression CODE is one of the valid expressions that can
2202 be used on the RHS of GIMPLE assignments. */
2204 static inline enum gimple_rhs_class
2205 get_gimple_rhs_class (enum tree_code code)
2207 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2210 /* Return the LHS of assignment statement GS. */
2213 gimple_assign_lhs (const_gimple gs)
2215 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2216 return gimple_op (gs, 0);
2220 /* Return a pointer to the LHS of assignment statement GS. */
2222 static inline tree *
2223 gimple_assign_lhs_ptr (const_gimple gs)
2225 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2226 return gimple_op_ptr (gs, 0);
2230 /* Set LHS to be the LHS operand of assignment statement GS. */
2233 gimple_assign_set_lhs (gimple gs, tree lhs)
2235 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2236 gimple_set_op (gs, 0, lhs);
2238 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2239 SSA_NAME_DEF_STMT (lhs) = gs;
2243 /* Return the first operand on the RHS of assignment statement GS. */
2246 gimple_assign_rhs1 (const_gimple gs)
2248 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2249 return gimple_op (gs, 1);
2253 /* Return a pointer to the first operand on the RHS of assignment
2256 static inline tree *
2257 gimple_assign_rhs1_ptr (const_gimple gs)
2259 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2260 return gimple_op_ptr (gs, 1);
2263 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2266 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2268 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2270 gimple_set_op (gs, 1, rhs);
2274 /* Return the second operand on the RHS of assignment statement GS.
2275 If GS does not have two operands, NULL is returned instead. */
2278 gimple_assign_rhs2 (const_gimple gs)
2280 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2282 if (gimple_num_ops (gs) >= 3)
2283 return gimple_op (gs, 2);
2289 /* Return a pointer to the second operand on the RHS of assignment
2292 static inline tree *
2293 gimple_assign_rhs2_ptr (const_gimple gs)
2295 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2296 return gimple_op_ptr (gs, 2);
2300 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2303 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2305 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2307 gimple_set_op (gs, 2, rhs);
2310 /* Return the third operand on the RHS of assignment statement GS.
2311 If GS does not have two operands, NULL is returned instead. */
2314 gimple_assign_rhs3 (const_gimple gs)
2316 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2318 if (gimple_num_ops (gs) >= 4)
2319 return gimple_op (gs, 3);
2324 /* Return a pointer to the third operand on the RHS of assignment
2327 static inline tree *
2328 gimple_assign_rhs3_ptr (const_gimple gs)
2330 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2331 return gimple_op_ptr (gs, 3);
2335 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2338 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2340 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2342 gimple_set_op (gs, 3, rhs);
2345 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2346 to see only a maximum of two operands. */
2349 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2352 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2355 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2356 to see only a maximum of two operands. */
2359 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
2363 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
2364 gcc_assert (op2 == NULL_TREE);
2367 /* Returns true if GS is a nontemporal move. */
2370 gimple_assign_nontemporal_move_p (const_gimple gs)
2372 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2373 return gs->nontemporal_move;
2376 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2379 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2381 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2382 gs->nontemporal_move = nontemporal;
2386 /* Return the code of the expression computed on the rhs of assignment
2387 statement GS. In case that the RHS is a single object, returns the
2388 tree code of the object. */
2390 static inline enum tree_code
2391 gimple_assign_rhs_code (const_gimple gs)
2393 enum tree_code code;
2394 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2396 code = (enum tree_code) gs->subcode;
2397 /* While we initially set subcode to the TREE_CODE of the rhs for
2398 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2399 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2400 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2401 code = TREE_CODE (gimple_assign_rhs1 (gs));
2407 /* Set CODE to be the code for the expression computed on the RHS of
2411 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2413 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2418 /* Return the gimple rhs class of the code of the expression computed on
2419 the rhs of assignment statement GS.
2420 This will never return GIMPLE_INVALID_RHS. */
2422 static inline enum gimple_rhs_class
2423 gimple_assign_rhs_class (const_gimple gs)
2425 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2428 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2429 there is no operator associated with the assignment itself.
2430 Unlike gimple_assign_copy_p, this predicate returns true for
2431 any RHS operand, including those that perform an operation
2432 and do not have the semantics of a copy, such as COND_EXPR. */
2435 gimple_assign_single_p (gimple gs)
2437 return (is_gimple_assign (gs)
2438 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2441 /* Return true if GS performs a store to its lhs. */
2444 gimple_store_p (gimple gs)
2446 tree lhs = gimple_get_lhs (gs);
2447 return lhs && !is_gimple_reg (lhs);
2450 /* Return true if GS is an assignment that loads from its rhs1. */
2453 gimple_assign_load_p (gimple gs)
2456 if (!gimple_assign_single_p (gs))
2458 rhs = gimple_assign_rhs1 (gs);
2459 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2461 rhs = get_base_address (rhs);
2462 return (DECL_P (rhs)
2463 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2467 /* Return true if S is a type-cast assignment. */
2470 gimple_assign_cast_p (gimple s)
2472 if (is_gimple_assign (s))
2474 enum tree_code sc = gimple_assign_rhs_code (s);
2475 return CONVERT_EXPR_CODE_P (sc)
2476 || sc == VIEW_CONVERT_EXPR
2477 || sc == FIX_TRUNC_EXPR;
2483 /* Return true if S is a clobber statement. */
2486 gimple_clobber_p (gimple s)
2488 return gimple_assign_single_p (s)
2489 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2492 /* Return true if GS is a GIMPLE_CALL. */
2495 is_gimple_call (const_gimple gs)
2497 return gimple_code (gs) == GIMPLE_CALL;
2500 /* Return the LHS of call statement GS. */
2503 gimple_call_lhs (const_gimple gs)
2505 GIMPLE_CHECK (gs, GIMPLE_CALL);
2506 return gimple_op (gs, 0);
2510 /* Return a pointer to the LHS of call statement GS. */
2512 static inline tree *
2513 gimple_call_lhs_ptr (const_gimple gs)
2515 GIMPLE_CHECK (gs, GIMPLE_CALL);
2516 return gimple_op_ptr (gs, 0);
2520 /* Set LHS to be the LHS operand of call statement GS. */
2523 gimple_call_set_lhs (gimple gs, tree lhs)
2525 GIMPLE_CHECK (gs, GIMPLE_CALL);
2526 gimple_set_op (gs, 0, lhs);
2527 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2528 SSA_NAME_DEF_STMT (lhs) = gs;
2532 /* Return true if call GS calls an internal-only function, as enumerated
2536 gimple_call_internal_p (const_gimple gs)
2538 GIMPLE_CHECK (gs, GIMPLE_CALL);
2539 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2543 /* Return the target of internal call GS. */
2545 static inline enum internal_fn
2546 gimple_call_internal_fn (const_gimple gs)
2548 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2549 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2553 /* Return the function type of the function called by GS. */
2556 gimple_call_fntype (const_gimple gs)
2558 const gimple_statement_call *call_stmt =
2559 as_a <const gimple_statement_call> (gs);
2560 if (gimple_call_internal_p (gs))
2562 return call_stmt->u.fntype;
2565 /* Set the type of the function called by GS to FNTYPE. */
2568 gimple_call_set_fntype (gimple gs, tree fntype)
2570 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2571 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2572 call_stmt->u.fntype = fntype;
2576 /* Return the tree node representing the function called by call
2580 gimple_call_fn (const_gimple gs)
2582 GIMPLE_CHECK (gs, GIMPLE_CALL);
2583 return gimple_op (gs, 1);
2586 /* Return a pointer to the tree node representing the function called by call
2589 static inline tree *
2590 gimple_call_fn_ptr (const_gimple gs)
2592 GIMPLE_CHECK (gs, GIMPLE_CALL);
2593 return gimple_op_ptr (gs, 1);
2597 /* Set FN to be the function called by call statement GS. */
2600 gimple_call_set_fn (gimple gs, tree fn)
2602 GIMPLE_CHECK (gs, GIMPLE_CALL);
2603 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2604 gimple_set_op (gs, 1, fn);
2608 /* Set FNDECL to be the function called by call statement GS. */
2611 gimple_call_set_fndecl (gimple gs, tree decl)
2613 GIMPLE_CHECK (gs, GIMPLE_CALL);
2614 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2615 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2619 /* Set internal function FN to be the function called by call statement GS. */
2622 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2624 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
2625 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2626 call_stmt->u.internal_fn = fn;
2630 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2631 associated with the callee if known. Otherwise return NULL_TREE. */
2634 gimple_call_addr_fndecl (const_tree fn)
2636 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2638 tree fndecl = TREE_OPERAND (fn, 0);
2639 if (TREE_CODE (fndecl) == MEM_REF
2640 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2641 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2642 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2643 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2649 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2650 Otherwise return NULL. This function is analogous to
2651 get_callee_fndecl in tree land. */
2654 gimple_call_fndecl (const_gimple gs)
2656 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2660 /* Return the type returned by call statement GS. */
2663 gimple_call_return_type (const_gimple gs)
2665 tree type = gimple_call_fntype (gs);
2667 if (type == NULL_TREE)
2668 return TREE_TYPE (gimple_call_lhs (gs));
2670 /* The type returned by a function is the type of its
2672 return TREE_TYPE (type);
2676 /* Return the static chain for call statement GS. */
2679 gimple_call_chain (const_gimple gs)
2681 GIMPLE_CHECK (gs, GIMPLE_CALL);
2682 return gimple_op (gs, 2);
2686 /* Return a pointer to the static chain for call statement GS. */
2688 static inline tree *
2689 gimple_call_chain_ptr (const_gimple gs)
2691 GIMPLE_CHECK (gs, GIMPLE_CALL);
2692 return gimple_op_ptr (gs, 2);
2695 /* Set CHAIN to be the static chain for call statement GS. */
2698 gimple_call_set_chain (gimple gs, tree chain)
2700 GIMPLE_CHECK (gs, GIMPLE_CALL);
2702 gimple_set_op (gs, 2, chain);
2706 /* Return the number of arguments used by call statement GS. */
2708 static inline unsigned
2709 gimple_call_num_args (const_gimple gs)
2712 GIMPLE_CHECK (gs, GIMPLE_CALL);
2713 num_ops = gimple_num_ops (gs);
2718 /* Return the argument at position INDEX for call statement GS. */
2721 gimple_call_arg (const_gimple gs, unsigned index)
2723 GIMPLE_CHECK (gs, GIMPLE_CALL);
2724 return gimple_op (gs, index + 3);
2728 /* Return a pointer to the argument at position INDEX for call
2731 static inline tree *
2732 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2734 GIMPLE_CHECK (gs, GIMPLE_CALL);
2735 return gimple_op_ptr (gs, index + 3);
2739 /* Set ARG to be the argument at position INDEX for call statement GS. */
2742 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2744 GIMPLE_CHECK (gs, GIMPLE_CALL);
2745 gimple_set_op (gs, index + 3, arg);
2749 /* If TAIL_P is true, mark call statement S as being a tail call
2750 (i.e., a call just before the exit of a function). These calls are
2751 candidate for tail call optimization. */
2754 gimple_call_set_tail (gimple s, bool tail_p)
2756 GIMPLE_CHECK (s, GIMPLE_CALL);
2758 s->subcode |= GF_CALL_TAILCALL;
2760 s->subcode &= ~GF_CALL_TAILCALL;
2764 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2767 gimple_call_tail_p (gimple s)
2769 GIMPLE_CHECK (s, GIMPLE_CALL);
2770 return (s->subcode & GF_CALL_TAILCALL) != 0;
2774 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2775 slot optimization. This transformation uses the target of the call
2776 expansion as the return slot for calls that return in memory. */
2779 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2781 GIMPLE_CHECK (s, GIMPLE_CALL);
2782 if (return_slot_opt_p)
2783 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2785 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2789 /* Return true if S is marked for return slot optimization. */
2792 gimple_call_return_slot_opt_p (gimple s)
2794 GIMPLE_CHECK (s, GIMPLE_CALL);
2795 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2799 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2800 thunk to the thunked-to function. */
2803 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2805 GIMPLE_CHECK (s, GIMPLE_CALL);
2807 s->subcode |= GF_CALL_FROM_THUNK;
2809 s->subcode &= ~GF_CALL_FROM_THUNK;
2813 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2816 gimple_call_from_thunk_p (gimple s)
2818 GIMPLE_CHECK (s, GIMPLE_CALL);
2819 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2823 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2824 argument pack in its argument list. */
2827 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2829 GIMPLE_CHECK (s, GIMPLE_CALL);
2830 if (pass_arg_pack_p)
2831 s->subcode |= GF_CALL_VA_ARG_PACK;
2833 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2837 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2838 argument pack in its argument list. */
2841 gimple_call_va_arg_pack_p (gimple s)
2843 GIMPLE_CHECK (s, GIMPLE_CALL);
2844 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2848 /* Return true if S is a noreturn call. */
2851 gimple_call_noreturn_p (gimple s)
2853 GIMPLE_CHECK (s, GIMPLE_CALL);
2854 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2858 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2859 even if the called function can throw in other cases. */
2862 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2864 GIMPLE_CHECK (s, GIMPLE_CALL);
2866 s->subcode |= GF_CALL_NOTHROW;
2868 s->subcode &= ~GF_CALL_NOTHROW;
2871 /* Return true if S is a nothrow call. */
2874 gimple_call_nothrow_p (gimple s)
2876 GIMPLE_CHECK (s, GIMPLE_CALL);
2877 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2880 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2881 is known to be emitted for VLA objects. Those are wrapped by
2882 stack_save/stack_restore calls and hence can't lead to unbounded
2883 stack growth even when they occur in loops. */
2886 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2888 GIMPLE_CHECK (s, GIMPLE_CALL);
2890 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2892 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2895 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2898 gimple_call_alloca_for_var_p (gimple s)
2900 GIMPLE_CHECK (s, GIMPLE_CALL);
2901 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2904 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2907 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2909 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2910 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2911 dest_call->subcode = orig_call->subcode;
2915 /* Return a pointer to the points-to solution for the set of call-used
2916 variables of the call CALL. */
2918 static inline struct pt_solution *
2919 gimple_call_use_set (gimple call)
2921 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2922 return &call_stmt->call_used;
2926 /* Return a pointer to the points-to solution for the set of call-used
2927 variables of the call CALL. */
2929 static inline struct pt_solution *
2930 gimple_call_clobber_set (gimple call)
2932 gimple_statement_call *call_stmt = as_a <gimple_statement_call> (call);
2933 return &call_stmt->call_clobbered;
2937 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2941 gimple_has_lhs (gimple stmt)
2943 return (is_gimple_assign (stmt)
2944 || (is_gimple_call (stmt)
2945 && gimple_call_lhs (stmt) != NULL_TREE));
2949 /* Return the code of the predicate computed by conditional statement GS. */
2951 static inline enum tree_code
2952 gimple_cond_code (const_gimple gs)
2954 GIMPLE_CHECK (gs, GIMPLE_COND);
2955 return (enum tree_code) gs->subcode;
2959 /* Set CODE to be the predicate code for the conditional statement GS. */
2962 gimple_cond_set_code (gimple gs, enum tree_code code)
2964 GIMPLE_CHECK (gs, GIMPLE_COND);
2969 /* Return the LHS of the predicate computed by conditional statement GS. */
2972 gimple_cond_lhs (const_gimple gs)
2974 GIMPLE_CHECK (gs, GIMPLE_COND);
2975 return gimple_op (gs, 0);
2978 /* Return the pointer to the LHS of the predicate computed by conditional
2981 static inline tree *
2982 gimple_cond_lhs_ptr (const_gimple gs)
2984 GIMPLE_CHECK (gs, GIMPLE_COND);
2985 return gimple_op_ptr (gs, 0);
2988 /* Set LHS to be the LHS operand of the predicate computed by
2989 conditional statement GS. */
2992 gimple_cond_set_lhs (gimple gs, tree lhs)
2994 GIMPLE_CHECK (gs, GIMPLE_COND);
2995 gimple_set_op (gs, 0, lhs);
2999 /* Return the RHS operand of the predicate computed by conditional GS. */
3002 gimple_cond_rhs (const_gimple gs)
3004 GIMPLE_CHECK (gs, GIMPLE_COND);
3005 return gimple_op (gs, 1);
3008 /* Return the pointer to the RHS operand of the predicate computed by
3011 static inline tree *
3012 gimple_cond_rhs_ptr (const_gimple gs)
3014 GIMPLE_CHECK (gs, GIMPLE_COND);
3015 return gimple_op_ptr (gs, 1);
3019 /* Set RHS to be the RHS operand of the predicate computed by
3020 conditional statement GS. */
3023 gimple_cond_set_rhs (gimple gs, tree rhs)
3025 GIMPLE_CHECK (gs, GIMPLE_COND);
3026 gimple_set_op (gs, 1, rhs);
3030 /* Return the label used by conditional statement GS when its
3031 predicate evaluates to true. */
3034 gimple_cond_true_label (const_gimple gs)
3036 GIMPLE_CHECK (gs, GIMPLE_COND);
3037 return gimple_op (gs, 2);
3041 /* Set LABEL to be the label used by conditional statement GS when its
3042 predicate evaluates to true. */
3045 gimple_cond_set_true_label (gimple gs, tree label)
3047 GIMPLE_CHECK (gs, GIMPLE_COND);
3048 gimple_set_op (gs, 2, label);
3052 /* Set LABEL to be the label used by conditional statement GS when its
3053 predicate evaluates to false. */
3056 gimple_cond_set_false_label (gimple gs, tree label)
3058 GIMPLE_CHECK (gs, GIMPLE_COND);
3059 gimple_set_op (gs, 3, label);
3063 /* Return the label used by conditional statement GS when its
3064 predicate evaluates to false. */
3067 gimple_cond_false_label (const_gimple gs)
3069 GIMPLE_CHECK (gs, GIMPLE_COND);
3070 return gimple_op (gs, 3);
3074 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3077 gimple_cond_make_false (gimple gs)
3079 gimple_cond_set_lhs (gs, boolean_true_node);
3080 gimple_cond_set_rhs (gs, boolean_false_node);
3081 gs->subcode = EQ_EXPR;
3085 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3088 gimple_cond_make_true (gimple gs)
3090 gimple_cond_set_lhs (gs, boolean_true_node);
3091 gimple_cond_set_rhs (gs, boolean_true_node);
3092 gs->subcode = EQ_EXPR;
3095 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3096 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3099 gimple_cond_true_p (const_gimple gs)
3101 tree lhs = gimple_cond_lhs (gs);
3102 tree rhs = gimple_cond_rhs (gs);
3103 enum tree_code code = gimple_cond_code (gs);
3105 if (lhs != boolean_true_node && lhs != boolean_false_node)
3108 if (rhs != boolean_true_node && rhs != boolean_false_node)
3111 if (code == NE_EXPR && lhs != rhs)
3114 if (code == EQ_EXPR && lhs == rhs)
3120 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3121 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3124 gimple_cond_false_p (const_gimple gs)
3126 tree lhs = gimple_cond_lhs (gs);
3127 tree rhs = gimple_cond_rhs (gs);
3128 enum tree_code code = gimple_cond_code (gs);
3130 if (lhs != boolean_true_node && lhs != boolean_false_node)
3133 if (rhs != boolean_true_node && rhs != boolean_false_node)
3136 if (code == NE_EXPR && lhs == rhs)
3139 if (code == EQ_EXPR && lhs != rhs)
3145 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3148 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3150 gimple_cond_set_code (stmt, code);
3151 gimple_cond_set_lhs (stmt, lhs);
3152 gimple_cond_set_rhs (stmt, rhs);
3155 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3158 gimple_label_label (const_gimple gs)
3160 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3161 return gimple_op (gs, 0);
3165 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3169 gimple_label_set_label (gimple gs, tree label)
3171 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3172 gimple_set_op (gs, 0, label);
3176 /* Return the destination of the unconditional jump GS. */
3179 gimple_goto_dest (const_gimple gs)
3181 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3182 return gimple_op (gs, 0);
3186 /* Set DEST to be the destination of the unconditonal jump GS. */
3189 gimple_goto_set_dest (gimple gs, tree dest)
3191 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3192 gimple_set_op (gs, 0, dest);
3196 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3199 gimple_bind_vars (const_gimple gs)
3201 const gimple_statement_bind *bind_stmt =
3202 as_a <const gimple_statement_bind> (gs);
3203 return bind_stmt->vars;
3207 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3211 gimple_bind_set_vars (gimple gs, tree vars)
3213 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3214 bind_stmt->vars = vars;
3218 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3222 gimple_bind_append_vars (gimple gs, tree vars)
3224 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3225 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3229 static inline gimple_seq *
3230 gimple_bind_body_ptr (gimple gs)
3232 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3233 return &bind_stmt->body;
3236 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3238 static inline gimple_seq
3239 gimple_bind_body (gimple gs)
3241 return *gimple_bind_body_ptr (gs);
3245 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3249 gimple_bind_set_body (gimple gs, gimple_seq seq)
3251 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3252 bind_stmt->body = seq;
3256 /* Append a statement to the end of a GIMPLE_BIND's body. */
3259 gimple_bind_add_stmt (gimple gs, gimple stmt)
3261 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3262 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3266 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3269 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3271 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3272 gimple_seq_add_seq (&bind_stmt->body, seq);
3276 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3277 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3280 gimple_bind_block (const_gimple gs)
3282 const gimple_statement_bind *bind_stmt =
3283 as_a <const gimple_statement_bind> (gs);
3284 return bind_stmt->block;
3288 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3292 gimple_bind_set_block (gimple gs, tree block)
3294 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind> (gs);
3295 gcc_gimple_checking_assert (block == NULL_TREE
3296 || TREE_CODE (block) == BLOCK);
3297 bind_stmt->block = block;
3301 /* Return the number of input operands for GIMPLE_ASM GS. */
3303 static inline unsigned
3304 gimple_asm_ninputs (const_gimple gs)
3306 const gimple_statement_asm *asm_stmt =
3307 as_a <const gimple_statement_asm> (gs);
3308 return asm_stmt->ni;
3312 /* Return the number of output operands for GIMPLE_ASM GS. */
3314 static inline unsigned
3315 gimple_asm_noutputs (const_gimple gs)
3317 const gimple_statement_asm *asm_stmt =
3318 as_a <const gimple_statement_asm> (gs);
3319 return asm_stmt->no;
3323 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3325 static inline unsigned
3326 gimple_asm_nclobbers (const_gimple gs)
3328 const gimple_statement_asm *asm_stmt =
3329 as_a <const gimple_statement_asm> (gs);
3330 return asm_stmt->nc;
3333 /* Return the number of label operands for GIMPLE_ASM GS. */
3335 static inline unsigned
3336 gimple_asm_nlabels (const_gimple gs)
3338 const gimple_statement_asm *asm_stmt =
3339 as_a <const gimple_statement_asm> (gs);
3340 return asm_stmt->nl;
3343 /* Return input operand INDEX of GIMPLE_ASM GS. */
3346 gimple_asm_input_op (const_gimple gs, unsigned index)
3348 const gimple_statement_asm *asm_stmt =
3349 as_a <const gimple_statement_asm> (gs);
3350 gcc_gimple_checking_assert (index < asm_stmt->ni);
3351 return gimple_op (gs, index + asm_stmt->no);
3354 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3356 static inline tree *
3357 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3359 const gimple_statement_asm *asm_stmt =
3360 as_a <const gimple_statement_asm> (gs);
3361 gcc_gimple_checking_assert (index < asm_stmt->ni);
3362 return gimple_op_ptr (gs, index + asm_stmt->no);
3366 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3369 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3371 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3372 gcc_gimple_checking_assert (index < asm_stmt->ni
3373 && TREE_CODE (in_op) == TREE_LIST);
3374 gimple_set_op (gs, index + asm_stmt->no, in_op);
3378 /* Return output operand INDEX of GIMPLE_ASM GS. */
3381 gimple_asm_output_op (const_gimple gs, unsigned index)
3383 const gimple_statement_asm *asm_stmt =
3384 as_a <const gimple_statement_asm> (gs);
3385 gcc_gimple_checking_assert (index < asm_stmt->no);
3386 return gimple_op (gs, index);
3389 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3391 static inline tree *
3392 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3394 const gimple_statement_asm *asm_stmt =
3395 as_a <const gimple_statement_asm> (gs);
3396 gcc_gimple_checking_assert (index < asm_stmt->no);
3397 return gimple_op_ptr (gs, index);
3401 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3404 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3406 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3407 gcc_gimple_checking_assert (index < asm_stmt->no
3408 && TREE_CODE (out_op) == TREE_LIST);
3409 gimple_set_op (gs, index, out_op);
3413 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3416 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3418 const gimple_statement_asm *asm_stmt =
3419 as_a <const gimple_statement_asm> (gs);
3420 gcc_gimple_checking_assert (index < asm_stmt->nc);
3421 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3425 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3428 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3430 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3431 gcc_gimple_checking_assert (index < asm_stmt->nc
3432 && TREE_CODE (clobber_op) == TREE_LIST);
3433 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3436 /* Return label operand INDEX of GIMPLE_ASM GS. */
3439 gimple_asm_label_op (const_gimple gs, unsigned index)
3441 const gimple_statement_asm *asm_stmt =
3442 as_a <const gimple_statement_asm> (gs);
3443 gcc_gimple_checking_assert (index < asm_stmt->nl);
3444 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3447 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3450 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3452 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm> (gs);
3453 gcc_gimple_checking_assert (index < asm_stmt->nl
3454 && TREE_CODE (label_op) == TREE_LIST);
3455 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3458 /* Return the string representing the assembly instruction in
3461 static inline const char *
3462 gimple_asm_string (const_gimple gs)
3464 const gimple_statement_asm *asm_stmt =
3465 as_a <const gimple_statement_asm> (gs);
3466 return asm_stmt->string;
3470 /* Return true if GS is an asm statement marked volatile. */
3473 gimple_asm_volatile_p (const_gimple gs)
3475 GIMPLE_CHECK (gs, GIMPLE_ASM);
3476 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3480 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3483 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3485 GIMPLE_CHECK (gs, GIMPLE_ASM);
3487 gs->subcode |= GF_ASM_VOLATILE;
3489 gs->subcode &= ~GF_ASM_VOLATILE;
3493 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3496 gimple_asm_set_input (gimple gs, bool input_p)
3498 GIMPLE_CHECK (gs, GIMPLE_ASM);
3500 gs->subcode |= GF_ASM_INPUT;
3502 gs->subcode &= ~GF_ASM_INPUT;
3506 /* Return true if asm GS is an ASM_INPUT. */
3509 gimple_asm_input_p (const_gimple gs)
3511 GIMPLE_CHECK (gs, GIMPLE_ASM);
3512 return (gs->subcode & GF_ASM_INPUT) != 0;
3516 /* Return the types handled by GIMPLE_CATCH statement GS. */
3519 gimple_catch_types (const_gimple gs)
3521 const gimple_statement_catch *catch_stmt =
3522 as_a <const gimple_statement_catch> (gs);
3523 return catch_stmt->types;
3527 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3529 static inline tree *
3530 gimple_catch_types_ptr (gimple gs)
3532 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3533 return &catch_stmt->types;
3537 /* Return a pointer to the GIMPLE sequence representing the body of
3538 the handler of GIMPLE_CATCH statement GS. */
3540 static inline gimple_seq *
3541 gimple_catch_handler_ptr (gimple gs)
3543 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3544 return &catch_stmt->handler;
3548 /* Return the GIMPLE sequence representing the body of the handler of
3549 GIMPLE_CATCH statement GS. */
3551 static inline gimple_seq
3552 gimple_catch_handler (gimple gs)
3554 return *gimple_catch_handler_ptr (gs);
3558 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3561 gimple_catch_set_types (gimple gs, tree t)
3563 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3564 catch_stmt->types = t;
3568 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3571 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3573 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch> (gs);
3574 catch_stmt->handler = handler;
3578 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3581 gimple_eh_filter_types (const_gimple gs)
3583 const gimple_statement_eh_filter *eh_filter_stmt =
3584 as_a <const gimple_statement_eh_filter> (gs);
3585 return eh_filter_stmt->types;
3589 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3592 static inline tree *
3593 gimple_eh_filter_types_ptr (gimple gs)
3595 gimple_statement_eh_filter *eh_filter_stmt =
3596 as_a <gimple_statement_eh_filter> (gs);
3597 return &eh_filter_stmt->types;
3601 /* Return a pointer to the sequence of statement to execute when
3602 GIMPLE_EH_FILTER statement fails. */
3604 static inline gimple_seq *
3605 gimple_eh_filter_failure_ptr (gimple gs)
3607 gimple_statement_eh_filter *eh_filter_stmt =
3608 as_a <gimple_statement_eh_filter> (gs);
3609 return &eh_filter_stmt->failure;
3613 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3616 static inline gimple_seq
3617 gimple_eh_filter_failure (gimple gs)
3619 return *gimple_eh_filter_failure_ptr (gs);
3623 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3626 gimple_eh_filter_set_types (gimple gs, tree types)
3628 gimple_statement_eh_filter *eh_filter_stmt =
3629 as_a <gimple_statement_eh_filter> (gs);
3630 eh_filter_stmt->types = types;
3634 /* Set FAILURE to be the sequence of statements to execute on failure
3635 for GIMPLE_EH_FILTER GS. */
3638 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3640 gimple_statement_eh_filter *eh_filter_stmt =
3641 as_a <gimple_statement_eh_filter> (gs);
3642 eh_filter_stmt->failure = failure;
3645 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3648 gimple_eh_must_not_throw_fndecl (gimple gs)
3650 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3651 return eh_mnt_stmt->fndecl;
3654 /* Set the function decl to be called by GS to DECL. */
3657 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3659 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt> (gs);
3660 eh_mnt_stmt->fndecl = decl;
3663 /* GIMPLE_EH_ELSE accessors. */
3665 static inline gimple_seq *
3666 gimple_eh_else_n_body_ptr (gimple gs)
3668 gimple_statement_eh_else *eh_else_stmt =
3669 as_a <gimple_statement_eh_else> (gs);
3670 return &eh_else_stmt->n_body;
3673 static inline gimple_seq
3674 gimple_eh_else_n_body (gimple gs)
3676 return *gimple_eh_else_n_body_ptr (gs);
3679 static inline gimple_seq *
3680 gimple_eh_else_e_body_ptr (gimple gs)
3682 gimple_statement_eh_else *eh_else_stmt =
3683 as_a <gimple_statement_eh_else> (gs);
3684 return &eh_else_stmt->e_body;
3687 static inline gimple_seq
3688 gimple_eh_else_e_body (gimple gs)
3690 return *gimple_eh_else_e_body_ptr (gs);
3694 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3696 gimple_statement_eh_else *eh_else_stmt =
3697 as_a <gimple_statement_eh_else> (gs);
3698 eh_else_stmt->n_body = seq;
3702 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3704 gimple_statement_eh_else *eh_else_stmt =
3705 as_a <gimple_statement_eh_else> (gs);
3706 eh_else_stmt->e_body = seq;
3709 /* GIMPLE_TRY accessors. */
3711 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3712 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3714 static inline enum gimple_try_flags
3715 gimple_try_kind (const_gimple gs)
3717 GIMPLE_CHECK (gs, GIMPLE_TRY);
3718 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3722 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3725 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3727 GIMPLE_CHECK (gs, GIMPLE_TRY);
3728 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3729 || kind == GIMPLE_TRY_FINALLY);
3730 if (gimple_try_kind (gs) != kind)
3731 gs->subcode = (unsigned int) kind;
3735 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3738 gimple_try_catch_is_cleanup (const_gimple gs)
3740 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3741 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3745 /* Return a pointer to the sequence of statements used as the
3746 body for GIMPLE_TRY GS. */
3748 static inline gimple_seq *
3749 gimple_try_eval_ptr (gimple gs)
3751 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3752 return &try_stmt->eval;
3756 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3758 static inline gimple_seq
3759 gimple_try_eval (gimple gs)
3761 return *gimple_try_eval_ptr (gs);
3765 /* Return a pointer to the sequence of statements used as the cleanup body for
3768 static inline gimple_seq *
3769 gimple_try_cleanup_ptr (gimple gs)
3771 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3772 return &try_stmt->cleanup;
3776 /* Return the sequence of statements used as the cleanup body for
3779 static inline gimple_seq
3780 gimple_try_cleanup (gimple gs)
3782 return *gimple_try_cleanup_ptr (gs);
3786 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3789 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3791 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3792 if (catch_is_cleanup)
3793 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3795 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3799 /* Set EVAL to be the sequence of statements to use as the body for
3803 gimple_try_set_eval (gimple gs, gimple_seq eval)
3805 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3806 try_stmt->eval = eval;
3810 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3811 body for GIMPLE_TRY GS. */
3814 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3816 gimple_statement_try *try_stmt = as_a <gimple_statement_try> (gs);
3817 try_stmt->cleanup = cleanup;
3821 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3823 static inline gimple_seq *
3824 gimple_wce_cleanup_ptr (gimple gs)
3826 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3827 return &wce_stmt->cleanup;
3831 /* Return the cleanup sequence for cleanup statement GS. */
3833 static inline gimple_seq
3834 gimple_wce_cleanup (gimple gs)
3836 return *gimple_wce_cleanup_ptr (gs);
3840 /* Set CLEANUP to be the cleanup sequence for GS. */
3843 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3845 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce> (gs);
3846 wce_stmt->cleanup = cleanup;
3850 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3853 gimple_wce_cleanup_eh_only (const_gimple gs)
3855 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3856 return gs->subcode != 0;
3860 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3863 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3865 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3866 gs->subcode = (unsigned int) eh_only_p;
3870 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3872 static inline unsigned
3873 gimple_phi_capacity (const_gimple gs)
3875 const gimple_statement_phi *phi_stmt =
3876 as_a <const gimple_statement_phi> (gs);
3877 return phi_stmt->capacity;
3881 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3882 be exactly the number of incoming edges for the basic block holding
3885 static inline unsigned
3886 gimple_phi_num_args (const_gimple gs)
3888 const gimple_statement_phi *phi_stmt =
3889 as_a <const gimple_statement_phi> (gs);
3890 return phi_stmt->nargs;
3894 /* Return the SSA name created by GIMPLE_PHI GS. */
3897 gimple_phi_result (const_gimple gs)
3899 const gimple_statement_phi *phi_stmt =
3900 as_a <const gimple_statement_phi> (gs);
3901 return phi_stmt->result;
3904 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3906 static inline tree *
3907 gimple_phi_result_ptr (gimple gs)
3909 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3910 return &phi_stmt->result;
3913 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3916 gimple_phi_set_result (gimple gs, tree result)
3918 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3919 phi_stmt->result = result;
3920 if (result && TREE_CODE (result) == SSA_NAME)
3921 SSA_NAME_DEF_STMT (result) = gs;
3925 /* Return the PHI argument corresponding to incoming edge INDEX for
3928 static inline struct phi_arg_d *
3929 gimple_phi_arg (gimple gs, unsigned index)
3931 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3932 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3933 return &(phi_stmt->args[index]);
3936 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3937 for GIMPLE_PHI GS. */
3940 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3942 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi> (gs);
3943 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3944 phi_stmt->args[index] = *phiarg;
3947 /* Return the region number for GIMPLE_RESX GS. */
3950 gimple_resx_region (const_gimple gs)
3952 const gimple_statement_eh_ctrl *eh_ctrl_stmt =
3953 as_a <const gimple_statement_eh_ctrl> (gs);
3954 return eh_ctrl_stmt->region;
3957 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3960 gimple_resx_set_region (gimple gs, int region)
3962 gimple_statement_eh_ctrl *eh_ctrl_stmt =
3963 as_a <gimple_statement_eh_ctrl> (gs);
3964 eh_ctrl_stmt->region = region;
3967 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3970 gimple_eh_dispatch_region (const_gimple gs)
3972 const gimple_statement_eh_ctrl *eh_ctrl_stmt =
3973 as_a <const gimple_statement_eh_ctrl> (gs);
3974 return eh_ctrl_stmt->region;
3977 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3980 gimple_eh_dispatch_set_region (gimple gs, int region)
3982 gimple_statement_eh_ctrl *eh_ctrl_stmt =
3983 as_a <gimple_statement_eh_ctrl> (gs);
3984 eh_ctrl_stmt->region = region;
3987 /* Return the number of labels associated with the switch statement GS. */
3989 static inline unsigned
3990 gimple_switch_num_labels (const_gimple gs)
3993 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3994 num_ops = gimple_num_ops (gs);
3995 gcc_gimple_checking_assert (num_ops > 1);
4000 /* Set NLABELS to be the number of labels for the switch statement GS. */
4003 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
4005 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4006 gimple_set_num_ops (g, nlabels + 1);
4010 /* Return the index variable used by the switch statement GS. */
4013 gimple_switch_index (const_gimple gs)
4015 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4016 return gimple_op (gs, 0);
4020 /* Return a pointer to the index variable for the switch statement GS. */
4022 static inline tree *
4023 gimple_switch_index_ptr (const_gimple gs)
4025 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4026 return gimple_op_ptr (gs, 0);
4030 /* Set INDEX to be the index variable for switch statement GS. */
4033 gimple_switch_set_index (gimple gs, tree index)
4035 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4036 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4037 gimple_set_op (gs, 0, index);
4041 /* Return the label numbered INDEX. The default label is 0, followed by any
4042 labels in a switch statement. */
4045 gimple_switch_label (const_gimple gs, unsigned index)
4047 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4048 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4049 return gimple_op (gs, index + 1);
4052 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4055 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4057 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4058 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4059 && (label == NULL_TREE
4060 || TREE_CODE (label) == CASE_LABEL_EXPR));
4061 gimple_set_op (gs, index + 1, label);
4064 /* Return the default label for a switch statement. */
4067 gimple_switch_default_label (const_gimple gs)
4069 tree label = gimple_switch_label (gs, 0);
4070 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4074 /* Set the default label for a switch statement. */
4077 gimple_switch_set_default_label (gimple gs, tree label)
4079 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4080 gimple_switch_set_label (gs, 0, label);
4083 /* Return true if GS is a GIMPLE_DEBUG statement. */
4086 is_gimple_debug (const_gimple gs)
4088 return gimple_code (gs) == GIMPLE_DEBUG;
4091 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4094 gimple_debug_bind_p (const_gimple s)
4096 if (is_gimple_debug (s))
4097 return s->subcode == GIMPLE_DEBUG_BIND;
4102 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4105 gimple_debug_bind_get_var (gimple dbg)
4107 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4108 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4109 return gimple_op (dbg, 0);
4112 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4116 gimple_debug_bind_get_value (gimple dbg)
4118 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4119 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4120 return gimple_op (dbg, 1);
4123 /* Return a pointer to the value bound to the variable in a
4124 GIMPLE_DEBUG bind statement. */
4126 static inline tree *
4127 gimple_debug_bind_get_value_ptr (gimple dbg)
4129 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4130 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4131 return gimple_op_ptr (dbg, 1);
4134 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4137 gimple_debug_bind_set_var (gimple dbg, tree var)
4139 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4140 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4141 gimple_set_op (dbg, 0, var);
4144 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4148 gimple_debug_bind_set_value (gimple dbg, tree value)
4150 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4151 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4152 gimple_set_op (dbg, 1, value);
4155 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4157 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4159 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4163 gimple_debug_bind_reset_value (gimple dbg)
4165 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4166 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4167 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4170 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4174 gimple_debug_bind_has_value_p (gimple dbg)
4176 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4177 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4178 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4181 #undef GIMPLE_DEBUG_BIND_NOVALUE
4183 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4186 gimple_debug_source_bind_p (const_gimple s)
4188 if (is_gimple_debug (s))
4189 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4194 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4197 gimple_debug_source_bind_get_var (gimple dbg)
4199 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4200 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4201 return gimple_op (dbg, 0);
4204 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4208 gimple_debug_source_bind_get_value (gimple dbg)
4210 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4211 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4212 return gimple_op (dbg, 1);
4215 /* Return a pointer to the value bound to the variable in a
4216 GIMPLE_DEBUG source bind statement. */
4218 static inline tree *
4219 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4221 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4222 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4223 return gimple_op_ptr (dbg, 1);
4226 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4229 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4231 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4232 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4233 gimple_set_op (dbg, 0, var);
4236 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4240 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4242 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4243 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4244 gimple_set_op (dbg, 1, value);
4247 /* Return a pointer to the body for the OMP statement GS. */
4249 static inline gimple_seq *
4250 gimple_omp_body_ptr (gimple gs)
4252 return &static_cast <gimple_statement_omp *> (gs)->body;
4255 /* Return the body for the OMP statement GS. */
4257 static inline gimple_seq
4258 gimple_omp_body (gimple gs)
4260 return *gimple_omp_body_ptr (gs);
4263 /* Set BODY to be the body for the OMP statement GS. */
4266 gimple_omp_set_body (gimple gs, gimple_seq body)
4268 static_cast <gimple_statement_omp *> (gs)->body = body;
4272 /* Return the name associated with OMP_CRITICAL statement GS. */
4275 gimple_omp_critical_name (const_gimple gs)
4277 const gimple_statement_omp_critical *omp_critical_stmt =
4278 as_a <const gimple_statement_omp_critical> (gs);
4279 return omp_critical_stmt->name;
4283 /* Return a pointer to the name associated with OMP critical statement GS. */
4285 static inline tree *
4286 gimple_omp_critical_name_ptr (gimple gs)
4288 gimple_statement_omp_critical *omp_critical_stmt =
4289 as_a <gimple_statement_omp_critical> (gs);
4290 return &omp_critical_stmt->name;
4294 /* Set NAME to be the name associated with OMP critical statement GS. */
4297 gimple_omp_critical_set_name (gimple gs, tree name)
4299 gimple_statement_omp_critical *omp_critical_stmt =
4300 as_a <gimple_statement_omp_critical> (gs);
4301 omp_critical_stmt->name = name;
4305 /* Return the kind of OMP for statemement. */
4308 gimple_omp_for_kind (const_gimple g)
4310 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4311 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4315 /* Set the OMP for kind. */
4318 gimple_omp_for_set_kind (gimple g, int kind)
4320 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4321 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4322 | (kind & GF_OMP_FOR_KIND_MASK);
4326 /* Return the clauses associated with OMP_FOR GS. */
4329 gimple_omp_for_clauses (const_gimple gs)
4331 const gimple_statement_omp_for *omp_for_stmt =
4332 as_a <const gimple_statement_omp_for> (gs);
4333 return omp_for_stmt->clauses;
4337 /* Return a pointer to the OMP_FOR GS. */
4339 static inline tree *
4340 gimple_omp_for_clauses_ptr (gimple gs)
4342 gimple_statement_omp_for *omp_for_stmt =
4343 as_a <gimple_statement_omp_for> (gs);
4344 return &omp_for_stmt->clauses;
4348 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4351 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4353 gimple_statement_omp_for *omp_for_stmt =
4354 as_a <gimple_statement_omp_for> (gs);
4355 omp_for_stmt->clauses = clauses;
4359 /* Get the collapse count of OMP_FOR GS. */
4361 static inline size_t
4362 gimple_omp_for_collapse (gimple gs)
4364 gimple_statement_omp_for *omp_for_stmt =
4365 as_a <gimple_statement_omp_for> (gs);
4366 return omp_for_stmt->collapse;
4370 /* Return the index variable for OMP_FOR GS. */
4373 gimple_omp_for_index (const_gimple gs, size_t i)
4375 const gimple_statement_omp_for *omp_for_stmt =
4376 as_a <const gimple_statement_omp_for> (gs);
4377 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4378 return omp_for_stmt->iter[i].index;
4382 /* Return a pointer to the index variable for OMP_FOR GS. */
4384 static inline tree *
4385 gimple_omp_for_index_ptr (gimple gs, size_t i)
4387 gimple_statement_omp_for *omp_for_stmt =
4388 as_a <gimple_statement_omp_for> (gs);
4389 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4390 return &omp_for_stmt->iter[i].index;
4394 /* Set INDEX to be the index variable for OMP_FOR GS. */
4397 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4399 gimple_statement_omp_for *omp_for_stmt =
4400 as_a <gimple_statement_omp_for> (gs);
4401 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4402 omp_for_stmt->iter[i].index = index;
4406 /* Return the initial value for OMP_FOR GS. */
4409 gimple_omp_for_initial (const_gimple gs, size_t i)
4411 const gimple_statement_omp_for *omp_for_stmt =
4412 as_a <const gimple_statement_omp_for> (gs);
4413 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4414 return omp_for_stmt->iter[i].initial;
4418 /* Return a pointer to the initial value for OMP_FOR GS. */
4420 static inline tree *
4421 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4423 gimple_statement_omp_for *omp_for_stmt =
4424 as_a <gimple_statement_omp_for> (gs);
4425 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4426 return &omp_for_stmt->iter[i].initial;
4430 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4433 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4435 gimple_statement_omp_for *omp_for_stmt =
4436 as_a <gimple_statement_omp_for> (gs);
4437 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4438 omp_for_stmt->iter[i].initial = initial;
4442 /* Return the final value for OMP_FOR GS. */
4445 gimple_omp_for_final (const_gimple gs, size_t i)
4447 const gimple_statement_omp_for *omp_for_stmt =
4448 as_a <const gimple_statement_omp_for> (gs);
4449 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4450 return omp_for_stmt->iter[i].final;
4454 /* Return a pointer to the final value for OMP_FOR GS. */
4456 static inline tree *
4457 gimple_omp_for_final_ptr (gimple gs, size_t i)
4459 gimple_statement_omp_for *omp_for_stmt =
4460 as_a <gimple_statement_omp_for> (gs);
4461 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4462 return &omp_for_stmt->iter[i].final;
4466 /* Set FINAL to be the final value for OMP_FOR GS. */
4469 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4471 gimple_statement_omp_for *omp_for_stmt =
4472 as_a <gimple_statement_omp_for> (gs);
4473 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4474 omp_for_stmt->iter[i].final = final;
4478 /* Return the increment value for OMP_FOR GS. */
4481 gimple_omp_for_incr (const_gimple gs, size_t i)
4483 const gimple_statement_omp_for *omp_for_stmt =
4484 as_a <const gimple_statement_omp_for> (gs);
4485 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4486 return omp_for_stmt->iter[i].incr;
4490 /* Return a pointer to the increment value for OMP_FOR GS. */
4492 static inline tree *
4493 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4495 gimple_statement_omp_for *omp_for_stmt =
4496 as_a <gimple_statement_omp_for> (gs);
4497 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4498 return &omp_for_stmt->iter[i].incr;
4502 /* Set INCR to be the increment value for OMP_FOR GS. */
4505 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4507 gimple_statement_omp_for *omp_for_stmt =
4508 as_a <gimple_statement_omp_for> (gs);
4509 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4510 omp_for_stmt->iter[i].incr = incr;
4514 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4515 statement GS starts. */
4517 static inline gimple_seq *
4518 gimple_omp_for_pre_body_ptr (gimple gs)
4520 gimple_statement_omp_for *omp_for_stmt =
4521 as_a <gimple_statement_omp_for> (gs);
4522 return &omp_for_stmt->pre_body;
4526 /* Return the sequence of statements to execute before the OMP_FOR
4527 statement GS starts. */
4529 static inline gimple_seq
4530 gimple_omp_for_pre_body (gimple gs)
4532 return *gimple_omp_for_pre_body_ptr (gs);
4536 /* Set PRE_BODY to be the sequence of statements to execute before the
4537 OMP_FOR statement GS starts. */
4540 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4542 gimple_statement_omp_for *omp_for_stmt =
4543 as_a <gimple_statement_omp_for> (gs);
4544 omp_for_stmt->pre_body = pre_body;
4548 /* Return the clauses associated with OMP_PARALLEL GS. */
4551 gimple_omp_parallel_clauses (const_gimple gs)
4553 const gimple_statement_omp_parallel *omp_parallel_stmt =
4554 as_a <const gimple_statement_omp_parallel> (gs);
4555 return omp_parallel_stmt->clauses;
4559 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4561 static inline tree *
4562 gimple_omp_parallel_clauses_ptr (gimple gs)
4564 gimple_statement_omp_parallel *omp_parallel_stmt =
4565 as_a <gimple_statement_omp_parallel> (gs);
4566 return &omp_parallel_stmt->clauses;
4570 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4574 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4576 gimple_statement_omp_parallel *omp_parallel_stmt =
4577 as_a <gimple_statement_omp_parallel> (gs);
4578 omp_parallel_stmt->clauses = clauses;
4582 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4585 gimple_omp_parallel_child_fn (const_gimple gs)
4587 const gimple_statement_omp_parallel *omp_parallel_stmt =
4588 as_a <const gimple_statement_omp_parallel> (gs);
4589 return omp_parallel_stmt->child_fn;
4592 /* Return a pointer to the child function used to hold the body of
4595 static inline tree *
4596 gimple_omp_parallel_child_fn_ptr (gimple gs)
4598 gimple_statement_omp_parallel *omp_parallel_stmt =
4599 as_a <gimple_statement_omp_parallel> (gs);
4600 return &omp_parallel_stmt->child_fn;
4604 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4607 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4609 gimple_statement_omp_parallel *omp_parallel_stmt =
4610 as_a <gimple_statement_omp_parallel> (gs);
4611 omp_parallel_stmt->child_fn = child_fn;
4615 /* Return the artificial argument used to send variables and values
4616 from the parent to the children threads in OMP_PARALLEL GS. */
4619 gimple_omp_parallel_data_arg (const_gimple gs)
4621 const gimple_statement_omp_parallel *omp_parallel_stmt =
4622 as_a <const gimple_statement_omp_parallel> (gs);
4623 return omp_parallel_stmt->data_arg;
4627 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4629 static inline tree *
4630 gimple_omp_parallel_data_arg_ptr (gimple gs)
4632 gimple_statement_omp_parallel *omp_parallel_stmt =
4633 as_a <gimple_statement_omp_parallel> (gs);
4634 return &omp_parallel_stmt->data_arg;
4638 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4641 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4643 gimple_statement_omp_parallel *omp_parallel_stmt =
4644 as_a <gimple_statement_omp_parallel> (gs);
4645 omp_parallel_stmt->data_arg = data_arg;
4649 /* Return the clauses associated with OMP_TASK GS. */
4652 gimple_omp_task_clauses (const_gimple gs)
4654 const gimple_statement_omp_task *omp_task_stmt =
4655 as_a <const gimple_statement_omp_task> (gs);
4656 return omp_task_stmt->clauses;
4660 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4662 static inline tree *
4663 gimple_omp_task_clauses_ptr (gimple gs)
4665 gimple_statement_omp_task *omp_task_stmt =
4666 as_a <gimple_statement_omp_task> (gs);
4667 return &omp_task_stmt->clauses;
4671 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4675 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4677 gimple_statement_omp_task *omp_task_stmt =
4678 as_a <gimple_statement_omp_task> (gs);
4679 omp_task_stmt->clauses = clauses;
4683 /* Return the child function used to hold the body of OMP_TASK GS. */
4686 gimple_omp_task_child_fn (const_gimple gs)
4688 const gimple_statement_omp_task *omp_task_stmt =
4689 as_a <const gimple_statement_omp_task> (gs);
4690 return omp_task_stmt->child_fn;
4693 /* Return a pointer to the child function used to hold the body of
4696 static inline tree *
4697 gimple_omp_task_child_fn_ptr (gimple gs)
4699 gimple_statement_omp_task *omp_task_stmt =
4700 as_a <gimple_statement_omp_task> (gs);
4701 return &omp_task_stmt->child_fn;
4705 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4708 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4710 gimple_statement_omp_task *omp_task_stmt =
4711 as_a <gimple_statement_omp_task> (gs);
4712 omp_task_stmt->child_fn = child_fn;
4716 /* Return the artificial argument used to send variables and values
4717 from the parent to the children threads in OMP_TASK GS. */
4720 gimple_omp_task_data_arg (const_gimple gs)
4722 const gimple_statement_omp_task *omp_task_stmt =
4723 as_a <const gimple_statement_omp_task> (gs);
4724 return omp_task_stmt->data_arg;
4728 /* Return a pointer to the data argument for OMP_TASK GS. */
4730 static inline tree *
4731 gimple_omp_task_data_arg_ptr (gimple gs)
4733 gimple_statement_omp_task *omp_task_stmt =
4734 as_a <gimple_statement_omp_task> (gs);
4735 return &omp_task_stmt->data_arg;
4739 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4742 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4744 gimple_statement_omp_task *omp_task_stmt =
4745 as_a <gimple_statement_omp_task> (gs);
4746 omp_task_stmt->data_arg = data_arg;
4750 /* Return the clauses associated with OMP_TASK GS. */
4753 gimple_omp_taskreg_clauses (const_gimple gs)
4755 const gimple_statement_omp_parallel *omp_parallel_stmt =
4756 as_a <const gimple_statement_omp_parallel> (gs);
4757 return omp_parallel_stmt->clauses;
4761 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4763 static inline tree *
4764 gimple_omp_taskreg_clauses_ptr (gimple gs)
4766 gimple_statement_omp_parallel *omp_parallel_stmt =
4767 as_a <gimple_statement_omp_parallel> (gs);
4768 return &omp_parallel_stmt->clauses;
4772 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4776 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4778 gimple_statement_omp_parallel *omp_parallel_stmt =
4779 as_a <gimple_statement_omp_parallel> (gs);
4780 omp_parallel_stmt->clauses = clauses;
4784 /* Return the child function used to hold the body of OMP_TASK GS. */
4787 gimple_omp_taskreg_child_fn (const_gimple gs)
4789 const gimple_statement_omp_parallel *omp_parallel_stmt =
4790 as_a <const gimple_statement_omp_parallel> (gs);
4791 return omp_parallel_stmt->child_fn;
4794 /* Return a pointer to the child function used to hold the body of
4797 static inline tree *
4798 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4800 gimple_statement_omp_parallel *omp_parallel_stmt =
4801 as_a <gimple_statement_omp_parallel> (gs);
4802 return &omp_parallel_stmt->child_fn;
4806 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4809 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4811 gimple_statement_omp_parallel *omp_parallel_stmt =
4812 as_a <gimple_statement_omp_parallel> (gs);
4813 omp_parallel_stmt->child_fn = child_fn;
4817 /* Return the artificial argument used to send variables and values
4818 from the parent to the children threads in OMP_TASK GS. */
4821 gimple_omp_taskreg_data_arg (const_gimple gs)
4823 const gimple_statement_omp_parallel *omp_parallel_stmt =
4824 as_a <const gimple_statement_omp_parallel> (gs);
4825 return omp_parallel_stmt->data_arg;
4829 /* Return a pointer to the data argument for OMP_TASK GS. */
4831 static inline tree *
4832 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4834 gimple_statement_omp_parallel *omp_parallel_stmt =
4835 as_a <gimple_statement_omp_parallel> (gs);
4836 return &omp_parallel_stmt->data_arg;
4840 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4843 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4845 gimple_statement_omp_parallel *omp_parallel_stmt =
4846 as_a <gimple_statement_omp_parallel> (gs);
4847 omp_parallel_stmt->data_arg = data_arg;
4851 /* Return the copy function used to hold the body of OMP_TASK GS. */
4854 gimple_omp_task_copy_fn (const_gimple gs)
4856 const gimple_statement_omp_task *omp_task_stmt =
4857 as_a <const gimple_statement_omp_task> (gs);
4858 return omp_task_stmt->copy_fn;
4861 /* Return a pointer to the copy function used to hold the body of
4864 static inline tree *
4865 gimple_omp_task_copy_fn_ptr (gimple gs)
4867 gimple_statement_omp_task *omp_task_stmt =
4868 as_a <gimple_statement_omp_task> (gs);
4869 return &omp_task_stmt->copy_fn;
4873 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4876 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4878 gimple_statement_omp_task *omp_task_stmt =
4879 as_a <gimple_statement_omp_task> (gs);
4880 omp_task_stmt->copy_fn = copy_fn;
4884 /* Return size of the data block in bytes in OMP_TASK GS. */
4887 gimple_omp_task_arg_size (const_gimple gs)
4889 const gimple_statement_omp_task *omp_task_stmt =
4890 as_a <const gimple_statement_omp_task> (gs);
4891 return omp_task_stmt->arg_size;
4895 /* Return a pointer to the data block size for OMP_TASK GS. */
4897 static inline tree *
4898 gimple_omp_task_arg_size_ptr (gimple gs)
4900 gimple_statement_omp_task *omp_task_stmt =
4901 as_a <gimple_statement_omp_task> (gs);
4902 return &omp_task_stmt->arg_size;
4906 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4909 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4911 gimple_statement_omp_task *omp_task_stmt =
4912 as_a <gimple_statement_omp_task> (gs);
4913 omp_task_stmt->arg_size = arg_size;
4917 /* Return align of the data block in bytes in OMP_TASK GS. */
4920 gimple_omp_task_arg_align (const_gimple gs)
4922 const gimple_statement_omp_task *omp_task_stmt =
4923 as_a <const gimple_statement_omp_task> (gs);
4924 return omp_task_stmt->arg_align;
4928 /* Return a pointer to the data block align for OMP_TASK GS. */
4930 static inline tree *
4931 gimple_omp_task_arg_align_ptr (gimple gs)
4933 gimple_statement_omp_task *omp_task_stmt =
4934 as_a <gimple_statement_omp_task> (gs);
4935 return &omp_task_stmt->arg_align;
4939 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4942 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4944 gimple_statement_omp_task *omp_task_stmt =
4945 as_a <gimple_statement_omp_task> (gs);
4946 omp_task_stmt->arg_align = arg_align;
4950 /* Return the clauses associated with OMP_SINGLE GS. */
4953 gimple_omp_single_clauses (const_gimple gs)
4955 const gimple_statement_omp_single *omp_single_stmt =
4956 as_a <const gimple_statement_omp_single> (gs);
4957 return omp_single_stmt->clauses;
4961 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4963 static inline tree *
4964 gimple_omp_single_clauses_ptr (gimple gs)
4966 gimple_statement_omp_single *omp_single_stmt =
4967 as_a <gimple_statement_omp_single> (gs);
4968 return &omp_single_stmt->clauses;
4972 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4975 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4977 gimple_statement_omp_single *omp_single_stmt =
4978 as_a <gimple_statement_omp_single> (gs);
4979 omp_single_stmt->clauses = clauses;
4983 /* Return the clauses associated with OMP_SECTIONS GS. */
4986 gimple_omp_sections_clauses (const_gimple gs)
4988 const gimple_statement_omp_sections *omp_sections_stmt =
4989 as_a <const gimple_statement_omp_sections> (gs);
4990 return omp_sections_stmt->clauses;
4994 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4996 static inline tree *
4997 gimple_omp_sections_clauses_ptr (gimple gs)
4999 gimple_statement_omp_sections *omp_sections_stmt =
5000 as_a <gimple_statement_omp_sections> (gs);
5001 return &omp_sections_stmt->clauses;
5005 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5009 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5011 gimple_statement_omp_sections *omp_sections_stmt =
5012 as_a <gimple_statement_omp_sections> (gs);
5013 omp_sections_stmt->clauses = clauses;
5017 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5021 gimple_omp_sections_control (const_gimple gs)
5023 const gimple_statement_omp_sections *omp_sections_stmt =
5024 as_a <const gimple_statement_omp_sections> (gs);
5025 return omp_sections_stmt->control;
5029 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5032 static inline tree *
5033 gimple_omp_sections_control_ptr (gimple gs)
5035 gimple_statement_omp_sections *omp_sections_stmt =
5036 as_a <gimple_statement_omp_sections> (gs);
5037 return &omp_sections_stmt->control;
5041 /* Set CONTROL to be the set of clauses associated with the
5042 GIMPLE_OMP_SECTIONS in GS. */
5045 gimple_omp_sections_set_control (gimple gs, tree control)
5047 gimple_statement_omp_sections *omp_sections_stmt =
5048 as_a <gimple_statement_omp_sections> (gs);
5049 omp_sections_stmt->control = control;
5053 /* Set COND to be the condition code for OMP_FOR GS. */
5056 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5058 gimple_statement_omp_for *omp_for_stmt =
5059 as_a <gimple_statement_omp_for> (gs);
5060 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5061 && i < omp_for_stmt->collapse);
5062 omp_for_stmt->iter[i].cond = cond;
5066 /* Return the condition code associated with OMP_FOR GS. */
5068 static inline enum tree_code
5069 gimple_omp_for_cond (const_gimple gs, size_t i)
5071 const gimple_statement_omp_for *omp_for_stmt =
5072 as_a <const gimple_statement_omp_for> (gs);
5073 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5074 return omp_for_stmt->iter[i].cond;
5078 /* Set the value being stored in an atomic store. */
5081 gimple_omp_atomic_store_set_val (gimple g, tree val)
5083 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5084 as_a <gimple_statement_omp_atomic_store> (g);
5085 omp_atomic_store_stmt->val = val;
5089 /* Return the value being stored in an atomic store. */
5092 gimple_omp_atomic_store_val (const_gimple g)
5094 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5095 as_a <const gimple_statement_omp_atomic_store> (g);
5096 return omp_atomic_store_stmt->val;
5100 /* Return a pointer to the value being stored in an atomic store. */
5102 static inline tree *
5103 gimple_omp_atomic_store_val_ptr (gimple g)
5105 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5106 as_a <gimple_statement_omp_atomic_store> (g);
5107 return &omp_atomic_store_stmt->val;
5111 /* Set the LHS of an atomic load. */
5114 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5116 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5117 as_a <gimple_statement_omp_atomic_load> (g);
5118 omp_atomic_load_stmt->lhs = lhs;
5122 /* Get the LHS of an atomic load. */
5125 gimple_omp_atomic_load_lhs (const_gimple g)
5127 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5128 as_a <const gimple_statement_omp_atomic_load> (g);
5129 return omp_atomic_load_stmt->lhs;
5133 /* Return a pointer to the LHS of an atomic load. */
5135 static inline tree *
5136 gimple_omp_atomic_load_lhs_ptr (gimple g)
5138 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5139 as_a <gimple_statement_omp_atomic_load> (g);
5140 return &omp_atomic_load_stmt->lhs;
5144 /* Set the RHS of an atomic load. */
5147 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5149 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5150 as_a <gimple_statement_omp_atomic_load> (g);
5151 omp_atomic_load_stmt->rhs = rhs;
5155 /* Get the RHS of an atomic load. */
5158 gimple_omp_atomic_load_rhs (const_gimple g)
5160 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5161 as_a <const gimple_statement_omp_atomic_load> (g);
5162 return omp_atomic_load_stmt->rhs;
5166 /* Return a pointer to the RHS of an atomic load. */
5168 static inline tree *
5169 gimple_omp_atomic_load_rhs_ptr (gimple g)
5171 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5172 as_a <gimple_statement_omp_atomic_load> (g);
5173 return &omp_atomic_load_stmt->rhs;
5177 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5180 gimple_omp_continue_control_def (const_gimple g)
5182 const gimple_statement_omp_continue *omp_continue_stmt =
5183 as_a <const gimple_statement_omp_continue> (g);
5184 return omp_continue_stmt->control_def;
5187 /* The same as above, but return the address. */
5189 static inline tree *
5190 gimple_omp_continue_control_def_ptr (gimple g)
5192 gimple_statement_omp_continue *omp_continue_stmt =
5193 as_a <gimple_statement_omp_continue> (g);
5194 return &omp_continue_stmt->control_def;
5197 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5200 gimple_omp_continue_set_control_def (gimple g, tree def)
5202 gimple_statement_omp_continue *omp_continue_stmt =
5203 as_a <gimple_statement_omp_continue> (g);
5204 omp_continue_stmt->control_def = def;
5208 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5211 gimple_omp_continue_control_use (const_gimple g)
5213 const gimple_statement_omp_continue *omp_continue_stmt =
5214 as_a <const gimple_statement_omp_continue> (g);
5215 return omp_continue_stmt->control_use;
5219 /* The same as above, but return the address. */
5221 static inline tree *
5222 gimple_omp_continue_control_use_ptr (gimple g)
5224 gimple_statement_omp_continue *omp_continue_stmt =
5225 as_a <gimple_statement_omp_continue> (g);
5226 return &omp_continue_stmt->control_use;
5230 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5233 gimple_omp_continue_set_control_use (gimple g, tree use)
5235 gimple_statement_omp_continue *omp_continue_stmt =
5236 as_a <gimple_statement_omp_continue> (g);
5237 omp_continue_stmt->control_use = use;
5240 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5242 static inline gimple_seq *
5243 gimple_transaction_body_ptr (gimple gs)
5245 gimple_statement_transaction *transaction_stmt =
5246 as_a <gimple_statement_transaction> (gs);
5247 return &transaction_stmt->body;
5250 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5252 static inline gimple_seq
5253 gimple_transaction_body (gimple gs)
5255 return *gimple_transaction_body_ptr (gs);
5258 /* Return the label associated with a GIMPLE_TRANSACTION. */
5261 gimple_transaction_label (const_gimple gs)
5263 const gimple_statement_transaction *transaction_stmt =
5264 as_a <const gimple_statement_transaction> (gs);
5265 return transaction_stmt->label;
5268 static inline tree *
5269 gimple_transaction_label_ptr (gimple gs)
5271 gimple_statement_transaction *transaction_stmt =
5272 as_a <gimple_statement_transaction> (gs);
5273 return &transaction_stmt->label;
5276 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5278 static inline unsigned int
5279 gimple_transaction_subcode (const_gimple gs)
5281 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5285 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5288 gimple_transaction_set_body (gimple gs, gimple_seq body)
5290 gimple_statement_transaction *transaction_stmt =
5291 as_a <gimple_statement_transaction> (gs);
5292 transaction_stmt->body = body;
5295 /* Set the label associated with a GIMPLE_TRANSACTION. */
5298 gimple_transaction_set_label (gimple gs, tree label)
5300 gimple_statement_transaction *transaction_stmt =
5301 as_a <gimple_statement_transaction> (gs);
5302 transaction_stmt->label = label;
5305 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5308 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5310 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5311 gs->subcode = subcode;
5315 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5317 static inline tree *
5318 gimple_return_retval_ptr (const_gimple gs)
5320 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5321 return gimple_op_ptr (gs, 0);
5324 /* Return the return value for GIMPLE_RETURN GS. */
5327 gimple_return_retval (const_gimple gs)
5329 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5330 return gimple_op (gs, 0);
5334 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5337 gimple_return_set_retval (gimple gs, tree retval)
5339 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5340 gimple_set_op (gs, 0, retval);
5344 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5346 #define CASE_GIMPLE_OMP \
5347 case GIMPLE_OMP_PARALLEL: \
5348 case GIMPLE_OMP_TASK: \
5349 case GIMPLE_OMP_FOR: \
5350 case GIMPLE_OMP_SECTIONS: \
5351 case GIMPLE_OMP_SECTIONS_SWITCH: \
5352 case GIMPLE_OMP_SINGLE: \
5353 case GIMPLE_OMP_SECTION: \
5354 case GIMPLE_OMP_MASTER: \
5355 case GIMPLE_OMP_ORDERED: \
5356 case GIMPLE_OMP_CRITICAL: \
5357 case GIMPLE_OMP_RETURN: \
5358 case GIMPLE_OMP_ATOMIC_LOAD: \
5359 case GIMPLE_OMP_ATOMIC_STORE: \
5360 case GIMPLE_OMP_CONTINUE
5363 is_gimple_omp (const_gimple stmt)
5365 switch (gimple_code (stmt))
5375 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5378 gimple_nop_p (const_gimple g)
5380 return gimple_code (g) == GIMPLE_NOP;
5384 /* Return true if GS is a GIMPLE_RESX. */
5387 is_gimple_resx (const_gimple gs)
5389 return gimple_code (gs) == GIMPLE_RESX;
5392 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5394 static inline enum br_predictor
5395 gimple_predict_predictor (gimple gs)
5397 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5398 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5402 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5405 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5407 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5408 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5409 | (unsigned) predictor;
5413 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5415 static inline enum prediction
5416 gimple_predict_outcome (gimple gs)
5418 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5419 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5423 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5426 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5428 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5429 if (outcome == TAKEN)
5430 gs->subcode |= GF_PREDICT_TAKEN;
5432 gs->subcode &= ~GF_PREDICT_TAKEN;
5436 /* Return the type of the main expression computed by STMT. Return
5437 void_type_node if the statement computes nothing. */
5440 gimple_expr_type (const_gimple stmt)
5442 enum gimple_code code = gimple_code (stmt);
5444 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5447 /* In general we want to pass out a type that can be substituted
5448 for both the RHS and the LHS types if there is a possibly
5449 useless conversion involved. That means returning the
5450 original RHS type as far as we can reconstruct it. */
5451 if (code == GIMPLE_CALL)
5452 type = gimple_call_return_type (stmt);
5454 switch (gimple_assign_rhs_code (stmt))
5456 case POINTER_PLUS_EXPR:
5457 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5461 /* As fallback use the type of the LHS. */
5462 type = TREE_TYPE (gimple_get_lhs (stmt));
5467 else if (code == GIMPLE_COND)
5468 return boolean_type_node;
5470 return void_type_node;
5473 /* Return true if TYPE is a suitable type for a scalar register variable. */
5476 is_gimple_reg_type (tree type)
5478 return !AGGREGATE_TYPE_P (type);
5481 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5483 static inline gimple_stmt_iterator
5484 gsi_start_1 (gimple_seq *seq)
5486 gimple_stmt_iterator i;
5488 i.ptr = gimple_seq_first (*seq);
5490 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5495 #define gsi_start(x) gsi_start_1(&(x))
5497 static inline gimple_stmt_iterator
5500 gimple_stmt_iterator i;
5507 /* Return a new iterator pointing to the first statement in basic block BB. */
5509 static inline gimple_stmt_iterator
5510 gsi_start_bb (basic_block bb)
5512 gimple_stmt_iterator i;
5515 seq = bb_seq_addr (bb);
5516 i.ptr = gimple_seq_first (*seq);
5524 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5526 static inline gimple_stmt_iterator
5527 gsi_last_1 (gimple_seq *seq)
5529 gimple_stmt_iterator i;
5531 i.ptr = gimple_seq_last (*seq);
5533 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
5538 #define gsi_last(x) gsi_last_1(&(x))
5540 /* Return a new iterator pointing to the last statement in basic block BB. */
5542 static inline gimple_stmt_iterator
5543 gsi_last_bb (basic_block bb)
5545 gimple_stmt_iterator i;
5548 seq = bb_seq_addr (bb);
5549 i.ptr = gimple_seq_last (*seq);
5557 /* Return true if I is at the end of its sequence. */
5560 gsi_end_p (gimple_stmt_iterator i)
5562 return i.ptr == NULL;
5566 /* Return true if I is one statement before the end of its sequence. */
5569 gsi_one_before_end_p (gimple_stmt_iterator i)
5571 return i.ptr != NULL && i.ptr->next == NULL;
5575 /* Advance the iterator to the next gimple statement. */
5578 gsi_next (gimple_stmt_iterator *i)
5580 i->ptr = i->ptr->next;
5583 /* Advance the iterator to the previous gimple statement. */
5586 gsi_prev (gimple_stmt_iterator *i)
5588 gimple prev = i->ptr->prev;
5595 /* Return the current stmt. */
5597 static inline gimple
5598 gsi_stmt (gimple_stmt_iterator i)
5603 /* Return a block statement iterator that points to the first non-label
5604 statement in block BB. */
5606 static inline gimple_stmt_iterator
5607 gsi_after_labels (basic_block bb)
5609 gimple_stmt_iterator gsi = gsi_start_bb (bb);
5611 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
5617 /* Advance the iterator to the next non-debug gimple statement. */
5620 gsi_next_nondebug (gimple_stmt_iterator *i)
5626 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5629 /* Advance the iterator to the next non-debug gimple statement. */
5632 gsi_prev_nondebug (gimple_stmt_iterator *i)
5638 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5641 /* Return a new iterator pointing to the first non-debug statement in
5644 static inline gimple_stmt_iterator
5645 gsi_start_nondebug_bb (basic_block bb)
5647 gimple_stmt_iterator i = gsi_start_bb (bb);
5649 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5650 gsi_next_nondebug (&i);
5655 /* Return a new iterator pointing to the last non-debug statement in
5658 static inline gimple_stmt_iterator
5659 gsi_last_nondebug_bb (basic_block bb)
5661 gimple_stmt_iterator i = gsi_last_bb (bb);
5663 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5664 gsi_prev_nondebug (&i);
5670 /* Return the basic block associated with this iterator. */
5672 static inline basic_block
5673 gsi_bb (gimple_stmt_iterator i)
5679 /* Return the sequence associated with this iterator. */
5681 static inline gimple_seq
5682 gsi_seq (gimple_stmt_iterator i)
5688 enum gsi_iterator_update
5690 GSI_NEW_STMT, /* Only valid when single statement is added, move
5692 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5693 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5694 for linking other statements in the same
5698 /* In gimple-iterator.c */
5699 gimple_stmt_iterator gsi_start_phis (basic_block);
5700 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5701 void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
5702 void gsi_set_stmt (gimple_stmt_iterator *, gimple);
5703 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5704 void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
5705 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5706 enum gsi_iterator_update);
5707 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5708 enum gsi_iterator_update);
5709 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5710 enum gsi_iterator_update);
5711 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5712 enum gsi_iterator_update);
5713 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5714 enum gsi_iterator_update);
5715 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5716 enum gsi_iterator_update);
5717 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5718 enum gsi_iterator_update);
5719 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5720 enum gsi_iterator_update);
5721 bool gsi_remove (gimple_stmt_iterator *, bool);
5722 gimple_stmt_iterator gsi_for_stmt (gimple);
5723 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5724 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5725 void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
5726 void gsi_insert_on_edge (edge, gimple);
5727 void gsi_insert_seq_on_edge (edge, gimple_seq);
5728 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5729 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5730 void gsi_commit_one_edge_insert (edge, basic_block *);
5731 void gsi_commit_edge_inserts (void);
5732 gimple gimple_call_copy_skip_args (gimple, bitmap);
5735 /* Convenience routines to walk all statements of a gimple function.
5736 Note that this is useful exclusively before the code is converted
5737 into SSA form. Once the program is in SSA form, the standard
5738 operand interface should be used to analyze/modify statements. */
5739 struct walk_stmt_info
5741 /* Points to the current statement being walked. */
5742 gimple_stmt_iterator gsi;
5744 /* Additional data that the callback functions may want to carry
5745 through the recursion. */
5748 /* Pointer map used to mark visited tree nodes when calling
5749 walk_tree on each operand. If set to NULL, duplicate tree nodes
5750 will be visited more than once. */
5751 struct pointer_set_t *pset;
5753 /* Operand returned by the callbacks. This is set when calling
5754 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5755 returns non-NULL, this field will contain the tree returned by
5756 the last callback. */
5757 tree callback_result;
5759 /* Indicates whether the operand being examined may be replaced
5760 with something that matches is_gimple_val (if true) or something
5761 slightly more complicated (if false). "Something
" technically
5762 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5763 but we never try to form anything more complicated than that, so
5764 we don't bother checking.
5766 Also note that CALLBACK should update this flag while walking the
5767 sub-expressions of a statement. For instance, when walking the
5768 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5769 to true, however, when walking &var, the operand of that
5770 ADDR_EXPR does not need to be a GIMPLE value. */
5771 BOOL_BITFIELD val_only : 1;
5773 /* True if we are currently walking the LHS of an assignment. */
5774 BOOL_BITFIELD is_lhs : 1;
5776 /* Optional. Set to true by the callback functions if they made any
5778 BOOL_BITFIELD changed : 1;
5780 /* True if we're interested in location information. */
5781 BOOL_BITFIELD want_locations : 1;
5783 /* True if we've removed the statement that was processed. */
5784 BOOL_BITFIELD removed_stmt : 1;
5787 /* Callback for walk_gimple_stmt. Called for every statement found
5788 during traversal. The first argument points to the statement to
5789 walk. The second argument is a flag that the callback sets to
5790 'true' if it the callback handled all the operands and
5791 sub-statements of the statement (the default value of this flag is
5792 'false'). The third argument is an anonymous pointer to data
5793 to be used by the callback. */
5794 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5795 struct walk_stmt_info *);
5797 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5798 struct walk_stmt_info *);
5799 gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
5800 struct walk_stmt_info *);
5801 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5802 struct walk_stmt_info *);
5803 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5805 /* Enum and arrays used for allocation stats. Keep in sync with
5806 gimple.c:gimple_alloc_kind_names. */
5807 enum gimple_alloc_kind
5809 gimple_alloc_kind_assign, /* Assignments. */
5810 gimple_alloc_kind_phi, /* PHI nodes. */
5811 gimple_alloc_kind_cond, /* Conditionals. */
5812 gimple_alloc_kind_rest, /* Everything else. */
5813 gimple_alloc_kind_all
5816 extern int gimple_alloc_counts[];
5817 extern int gimple_alloc_sizes[];
5819 /* Return the allocation kind for a given stmt CODE. */
5820 static inline enum gimple_alloc_kind
5821 gimple_alloc_kind (enum gimple_code code)
5826 return gimple_alloc_kind_assign;
5828 return gimple_alloc_kind_phi;
5830 return gimple_alloc_kind_cond;
5832 return gimple_alloc_kind_rest;
5836 extern void dump_gimple_statistics (void);
5838 /* In gimple-fold.c. */
5839 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5840 tree gimple_fold_builtin (gimple);
5841 bool fold_stmt (gimple_stmt_iterator *);
5842 bool fold_stmt_inplace (gimple_stmt_iterator *);
5843 tree get_symbol_constant_value (tree);
5844 tree canonicalize_constructor_val (tree, tree);
5845 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5846 enum tree_code, tree, tree);
5847 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5848 enum tree_code, tree, tree);
5850 bool gimple_val_nonnegative_real_p (tree);
5853 /* Set the location of all statements in SEQ to LOC. */
5856 gimple_seq_set_location (gimple_seq seq, location_t loc)
5858 for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
5859 gimple_set_location (gsi_stmt (i), loc);
5862 #endif /* GCC_GIMPLE_H */