comparison gcc/gimple.h @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 367f9f4f266e 84e7813d76e9
children 351920fa3827
comparison
equal deleted inserted replaced
130:e108057fa461 132:d34655255c78
1 /* Gimple IR definitions. 1 /* Gimple IR definitions.
2 2
3 Copyright (C) 2007-2017 Free Software Foundation, Inc. 3 Copyright (C) 2007-2018 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com> 4 Contributed by Aldy Hernandez <aldyh@redhat.com>
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
143 GF_CALL_VA_ARG_PACK = 1 << 3, 143 GF_CALL_VA_ARG_PACK = 1 << 3,
144 GF_CALL_NOTHROW = 1 << 4, 144 GF_CALL_NOTHROW = 1 << 4,
145 GF_CALL_ALLOCA_FOR_VAR = 1 << 5, 145 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
146 GF_CALL_INTERNAL = 1 << 6, 146 GF_CALL_INTERNAL = 1 << 6,
147 GF_CALL_CTRL_ALTERING = 1 << 7, 147 GF_CALL_CTRL_ALTERING = 1 << 7,
148 GF_CALL_WITH_BOUNDS = 1 << 8,
149 GF_CALL_MUST_TAIL_CALL = 1 << 9, 148 GF_CALL_MUST_TAIL_CALL = 1 << 9,
150 GF_CALL_BY_DESCRIPTOR = 1 << 10, 149 GF_CALL_BY_DESCRIPTOR = 1 << 10,
151 GF_CALL_NOCF_CHECK = 1 << 11, 150 GF_CALL_NOCF_CHECK = 1 << 11,
152 #ifndef noCbC 151 #ifndef noCbC
153 GF_CALL_CBC_GOTO = 1 << 5, 152 GF_CALL_CBC_GOTO = 1 << 5,
157 GF_OMP_TASK_TASKLOOP = 1 << 0, 156 GF_OMP_TASK_TASKLOOP = 1 << 0,
158 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1, 157 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
159 GF_OMP_FOR_KIND_FOR = 0, 158 GF_OMP_FOR_KIND_FOR = 0,
160 GF_OMP_FOR_KIND_DISTRIBUTE = 1, 159 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
161 GF_OMP_FOR_KIND_TASKLOOP = 2, 160 GF_OMP_FOR_KIND_TASKLOOP = 2,
162 GF_OMP_FOR_KIND_CILKFOR = 3,
163 GF_OMP_FOR_KIND_OACC_LOOP = 4, 161 GF_OMP_FOR_KIND_OACC_LOOP = 4,
164 GF_OMP_FOR_KIND_GRID_LOOP = 5, 162 GF_OMP_FOR_KIND_GRID_LOOP = 5,
165 /* Flag for SIMD variants of OMP_FOR kinds. */ 163 /* Flag for SIMD variants of OMP_FOR kinds. */
166 GF_OMP_FOR_SIMD = 1 << 3, 164 GF_OMP_FOR_SIMD = 1 << 3,
167 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0, 165 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
168 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
169 GF_OMP_FOR_COMBINED = 1 << 4, 166 GF_OMP_FOR_COMBINED = 1 << 4,
170 GF_OMP_FOR_COMBINED_INTO = 1 << 5, 167 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
171 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop 168 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
172 statements. */ 169 statements. */
173 GF_OMP_FOR_GRID_PHONY = 1 << 6, 170 GF_OMP_FOR_GRID_PHONY = 1 << 6,
200 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0, 197 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
201 GF_OMP_ATOMIC_SEQ_CST = 1 << 1, 198 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
202 GF_PREDICT_TAKEN = 1 << 15 199 GF_PREDICT_TAKEN = 1 << 15
203 }; 200 };
204 201
205 /* Currently, there are only two types of gimple debug stmt. Others are 202 /* This subcode tells apart different kinds of stmts that are not used
206 envisioned, for example, to enable the generation of is_stmt notes 203 for codegen, but rather to retain debug information. */
207 in line number information, to mark sequence points, etc. This
208 subcode is to be used to tell them apart. */
209 enum gimple_debug_subcode { 204 enum gimple_debug_subcode {
210 GIMPLE_DEBUG_BIND = 0, 205 GIMPLE_DEBUG_BIND = 0,
211 GIMPLE_DEBUG_SOURCE_BIND = 1 206 GIMPLE_DEBUG_SOURCE_BIND = 1,
207 GIMPLE_DEBUG_BEGIN_STMT = 2,
208 GIMPLE_DEBUG_INLINE_ENTRY = 3
212 }; 209 };
213 210
214 /* Masks for selecting a pass local flag (PLF) to work on. These 211 /* Masks for selecting a pass local flag (PLF) to work on. These
215 masks are used by gimple_set_plf and gimple_plf. */ 212 masks are used by gimple_set_plf and gimple_plf. */
216 enum plf_mask { 213 enum plf_mask {
1457 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree); 1454 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1458 gswitch *gimple_build_switch (tree, tree, vec<tree> ); 1455 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1459 geh_dispatch *gimple_build_eh_dispatch (int); 1456 geh_dispatch *gimple_build_eh_dispatch (int);
1460 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO); 1457 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1461 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO); 1458 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1459 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1460 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1462 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree); 1461 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1463 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq); 1462 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1464 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree); 1463 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1465 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, 1464 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1466 tree, tree); 1465 tree, tree);
1490 gimple_seq gimple_seq_copy (gimple_seq); 1489 gimple_seq gimple_seq_copy (gimple_seq);
1491 bool gimple_call_same_target_p (const gimple *, const gimple *); 1490 bool gimple_call_same_target_p (const gimple *, const gimple *);
1492 int gimple_call_flags (const gimple *); 1491 int gimple_call_flags (const gimple *);
1493 int gimple_call_arg_flags (const gcall *, unsigned); 1492 int gimple_call_arg_flags (const gcall *, unsigned);
1494 int gimple_call_return_flags (const gcall *); 1493 int gimple_call_return_flags (const gcall *);
1494 bool gimple_call_nonnull_result_p (gcall *);
1495 tree gimple_call_nonnull_arg (gcall *);
1495 bool gimple_assign_copy_p (gimple *); 1496 bool gimple_assign_copy_p (gimple *);
1496 bool gimple_assign_ssa_name_copy_p (gimple *); 1497 bool gimple_assign_ssa_name_copy_p (gimple *);
1497 bool gimple_assign_unary_nop_p (gimple *); 1498 bool gimple_assign_unary_nop_p (gimple *);
1498 void gimple_set_bb (gimple *, basic_block); 1499 void gimple_set_bb (gimple *, basic_block);
1499 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree); 1500 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1798 { 1799 {
1799 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION; 1800 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1800 } 1801 }
1801 1802
1802 1803
1804 /* Return non-artificial location information for statement G. */
1805
1806 static inline location_t
1807 gimple_nonartificial_location (const gimple *g)
1808 {
1809 location_t *ploc = NULL;
1810
1811 if (tree block = gimple_block (g))
1812 ploc = block_nonartificial_location (block);
1813
1814 return ploc ? *ploc : gimple_location (g);
1815 }
1816
1817
1803 /* Return the file name of the location of STMT. */ 1818 /* Return the file name of the location of STMT. */
1804 1819
1805 static inline const char * 1820 static inline const char *
1806 gimple_filename (const gimple *stmt) 1821 gimple_filename (const gimple *stmt)
1807 { 1822 {
2857 { 2872 {
2858 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs); 2873 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2859 return gimple_call_internal_p (gc); 2874 return gimple_call_internal_p (gc);
2860 } 2875 }
2861 2876
2862
2863 /* Return true if call GS is marked as instrumented by
2864 Pointer Bounds Checker. */
2865
2866 static inline bool
2867 gimple_call_with_bounds_p (const gcall *gs)
2868 {
2869 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2870 }
2871
2872 static inline bool
2873 gimple_call_with_bounds_p (const gimple *gs)
2874 {
2875 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2876 return gimple_call_with_bounds_p (gc);
2877 }
2878
2879
2880 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2881 Pointer Bounds Checker. */
2882
2883 static inline void
2884 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2885 {
2886 if (with_bounds)
2887 gs->subcode |= GF_CALL_WITH_BOUNDS;
2888 else
2889 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2890 }
2891
2892 static inline void
2893 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2894 {
2895 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2896 gimple_call_set_with_bounds (gc, with_bounds);
2897 }
2898
2899
2900 /* Return true if call GS is marked as nocf_check. */ 2877 /* Return true if call GS is marked as nocf_check. */
2901 2878
2902 static inline bool 2879 static inline bool
2903 gimple_call_nocf_check_p (const gcall *gs) 2880 gimple_call_nocf_check_p (const gcall *gs)
2904 { 2881 {
4630 is_gimple_debug (const gimple *gs) 4607 is_gimple_debug (const gimple *gs)
4631 { 4608 {
4632 return gimple_code (gs) == GIMPLE_DEBUG; 4609 return gimple_code (gs) == GIMPLE_DEBUG;
4633 } 4610 }
4634 4611
4612
4613 /* Return the last nondebug statement in GIMPLE sequence S. */
4614
4615 static inline gimple *
4616 gimple_seq_last_nondebug_stmt (gimple_seq s)
4617 {
4618 gimple_seq_node n;
4619 for (n = gimple_seq_last (s);
4620 n && is_gimple_debug (n);
4621 n = n->prev)
4622 if (n->prev == s)
4623 return NULL;
4624 return n;
4625 }
4626
4627
4635 /* Return true if S is a GIMPLE_DEBUG BIND statement. */ 4628 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4636 4629
4637 static inline bool 4630 static inline bool
4638 gimple_debug_bind_p (const gimple *s) 4631 gimple_debug_bind_p (const gimple *s)
4639 { 4632 {
4784 gimple_debug_source_bind_set_value (gimple *dbg, tree value) 4777 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4785 { 4778 {
4786 GIMPLE_CHECK (dbg, GIMPLE_DEBUG); 4779 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4787 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); 4780 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4788 gimple_set_op (dbg, 1, value); 4781 gimple_set_op (dbg, 1, value);
4782 }
4783
4784 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4785
4786 static inline bool
4787 gimple_debug_begin_stmt_p (const gimple *s)
4788 {
4789 if (is_gimple_debug (s))
4790 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
4791
4792 return false;
4793 }
4794
4795 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4796
4797 static inline bool
4798 gimple_debug_inline_entry_p (const gimple *s)
4799 {
4800 if (is_gimple_debug (s))
4801 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4802
4803 return false;
4804 }
4805
4806 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4807
4808 static inline bool
4809 gimple_debug_nonbind_marker_p (const gimple *s)
4810 {
4811 if (is_gimple_debug (s))
4812 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
4813 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4814
4815 return false;
4789 } 4816 }
4790 4817
4791 /* Return the line number for EXPR, or return -1 if we have no line 4818 /* Return the line number for EXPR, or return -1 if we have no line
4792 number information for it. */ 4819 number information for it. */
4793 static inline int 4820 static inline int
6197 6224
6198 static inline void 6225 static inline void
6199 gimple_return_set_retval (greturn *gs, tree retval) 6226 gimple_return_set_retval (greturn *gs, tree retval)
6200 { 6227 {
6201 gs->op[0] = retval; 6228 gs->op[0] = retval;
6202 }
6203
6204
6205 /* Return the return bounds for GIMPLE_RETURN GS. */
6206
6207 static inline tree
6208 gimple_return_retbnd (const gimple *gs)
6209 {
6210 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6211 return gimple_op (gs, 1);
6212 }
6213
6214
6215 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6216
6217 static inline void
6218 gimple_return_set_retbnd (gimple *gs, tree retval)
6219 {
6220 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6221 gimple_set_op (gs, 1, retval);
6222 } 6229 }
6223 6230
6224 6231
6225 /* Returns true when the gimple statement STMT is any of the OMP types. */ 6232 /* Returns true when the gimple statement STMT is any of the OMP types. */
6226 6233
6346 useless conversion involved. That means returning the 6353 useless conversion involved. That means returning the
6347 original RHS type as far as we can reconstruct it. */ 6354 original RHS type as far as we can reconstruct it. */
6348 if (code == GIMPLE_CALL) 6355 if (code == GIMPLE_CALL)
6349 { 6356 {
6350 const gcall *call_stmt = as_a <const gcall *> (stmt); 6357 const gcall *call_stmt = as_a <const gcall *> (stmt);
6351 if (gimple_call_internal_p (call_stmt) 6358 if (gimple_call_internal_p (call_stmt))
6352 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE) 6359 switch (gimple_call_internal_fn (call_stmt))
6353 return TREE_TYPE (gimple_call_arg (call_stmt, 3)); 6360 {
6354 else 6361 case IFN_MASK_STORE:
6355 return gimple_call_return_type (call_stmt); 6362 case IFN_SCATTER_STORE:
6363 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6364 case IFN_MASK_SCATTER_STORE:
6365 return TREE_TYPE (gimple_call_arg (call_stmt, 4));
6366 default:
6367 break;
6368 }
6369 return gimple_call_return_type (call_stmt);
6356 } 6370 }
6357 else if (code == GIMPLE_ASSIGN) 6371 else if (code == GIMPLE_ASSIGN)
6358 { 6372 {
6359 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) 6373 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6360 return TREE_TYPE (gimple_assign_rhs1 (stmt)); 6374 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6377 gimple_alloc_kind_cond, /* Conditionals. */ 6391 gimple_alloc_kind_cond, /* Conditionals. */
6378 gimple_alloc_kind_rest, /* Everything else. */ 6392 gimple_alloc_kind_rest, /* Everything else. */
6379 gimple_alloc_kind_all 6393 gimple_alloc_kind_all
6380 }; 6394 };
6381 6395
6382 extern int gimple_alloc_counts[]; 6396 extern uint64_t gimple_alloc_counts[];
6383 extern int gimple_alloc_sizes[]; 6397 extern uint64_t gimple_alloc_sizes[];
6384 6398
6385 /* Return the allocation kind for a given stmt CODE. */ 6399 /* Return the allocation kind for a given stmt CODE. */
6386 static inline enum gimple_alloc_kind 6400 static inline enum gimple_alloc_kind
6387 gimple_alloc_kind (enum gimple_code code) 6401 gimple_alloc_kind (enum gimple_code code)
6388 { 6402 {