annotate gcc/internal-fn.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Internal functions.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2011-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #ifndef GCC_INTERNAL_FN_H
kono
parents:
diff changeset
21 #define GCC_INTERNAL_FN_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 /* INTEGER_CST values for IFN_UNIQUE function arg-0.
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 UNSPEC: Undifferentiated UNIQUE.
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 FORK and JOIN mark the points at which OpenACC partitioned
kono
parents:
diff changeset
28 execution is entered or exited.
kono
parents:
diff changeset
29 DEP_VAR = UNIQUE ({FORK,JOIN}, DEP_VAR, AXIS)
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 HEAD_MARK and TAIL_MARK are used to demark the sequence entering
kono
parents:
diff changeset
32 or leaving partitioned execution.
kono
parents:
diff changeset
33 DEP_VAR = UNIQUE ({HEAD,TAIL}_MARK, REMAINING_MARKS, ...PRIMARY_FLAGS)
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 The PRIMARY_FLAGS only occur on the first HEAD_MARK of a sequence. */
kono
parents:
diff changeset
36 #define IFN_UNIQUE_CODES \
kono
parents:
diff changeset
37 DEF(UNSPEC), \
kono
parents:
diff changeset
38 DEF(OACC_FORK), DEF(OACC_JOIN), \
kono
parents:
diff changeset
39 DEF(OACC_HEAD_MARK), DEF(OACC_TAIL_MARK)
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 enum ifn_unique_kind {
kono
parents:
diff changeset
42 #define DEF(X) IFN_UNIQUE_##X
kono
parents:
diff changeset
43 IFN_UNIQUE_CODES
kono
parents:
diff changeset
44 #undef DEF
kono
parents:
diff changeset
45 };
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 /* INTEGER_CST values for IFN_GOACC_LOOP arg-0. Allows the precise
kono
parents:
diff changeset
48 stepping of the compute geometry over the loop iterations to be
kono
parents:
diff changeset
49 deferred until it is known which compiler is generating the code.
kono
parents:
diff changeset
50 The action is encoded in a constant first argument.
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 CHUNK_MAX = LOOP (CODE_CHUNKS, DIR, RANGE, STEP, CHUNK_SIZE, MASK)
kono
parents:
diff changeset
53 STEP = LOOP (CODE_STEP, DIR, RANGE, STEP, CHUNK_SIZE, MASK)
kono
parents:
diff changeset
54 OFFSET = LOOP (CODE_OFFSET, DIR, RANGE, STEP, CHUNK_SIZE, MASK, CHUNK_NO)
kono
parents:
diff changeset
55 BOUND = LOOP (CODE_BOUND, DIR, RANGE, STEP, CHUNK_SIZE, MASK, OFFSET)
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 DIR - +1 for up loop, -1 for down loop
kono
parents:
diff changeset
58 RANGE - Range of loop (END - BASE)
kono
parents:
diff changeset
59 STEP - iteration step size
kono
parents:
diff changeset
60 CHUNKING - size of chunking, (constant zero for no chunking)
kono
parents:
diff changeset
61 CHUNK_NO - chunk number
kono
parents:
diff changeset
62 MASK - partitioning mask. */
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 #define IFN_GOACC_LOOP_CODES \
kono
parents:
diff changeset
65 DEF(CHUNKS), DEF(STEP), DEF(OFFSET), DEF(BOUND)
kono
parents:
diff changeset
66 enum ifn_goacc_loop_kind {
kono
parents:
diff changeset
67 #define DEF(X) IFN_GOACC_LOOP_##X
kono
parents:
diff changeset
68 IFN_GOACC_LOOP_CODES
kono
parents:
diff changeset
69 #undef DEF
kono
parents:
diff changeset
70 };
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 /* The GOACC_REDUCTION function defines a generic interface to support
kono
parents:
diff changeset
73 gang, worker and vector reductions. All calls are of the following
kono
parents:
diff changeset
74 form:
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 V = REDUCTION (CODE, REF_TO_RES, LOCAL_VAR, LEVEL, OP, OFFSET)
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 REF_TO_RES - is a reference to the original reduction varl, may be NULL
kono
parents:
diff changeset
79 LOCAL_VAR is the intermediate reduction variable
kono
parents:
diff changeset
80 LEVEL corresponds to the GOMP_DIM of the reduction
kono
parents:
diff changeset
81 OP is the tree code of the reduction operation
kono
parents:
diff changeset
82 OFFSET may be used as an offset into a reduction array for the
kono
parents:
diff changeset
83 reductions occuring at this level.
kono
parents:
diff changeset
84 In general the return value is LOCAL_VAR, which creates a data
kono
parents:
diff changeset
85 dependency between calls operating on the same reduction. */
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 #define IFN_GOACC_REDUCTION_CODES \
kono
parents:
diff changeset
88 DEF(SETUP), DEF(INIT), DEF(FINI), DEF(TEARDOWN)
kono
parents:
diff changeset
89 enum ifn_goacc_reduction_kind {
kono
parents:
diff changeset
90 #define DEF(X) IFN_GOACC_REDUCTION_##X
kono
parents:
diff changeset
91 IFN_GOACC_REDUCTION_CODES
kono
parents:
diff changeset
92 #undef DEF
kono
parents:
diff changeset
93 };
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 /* Initialize internal function tables. */
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 extern void init_internal_fns ();
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 /* Return the name of internal function FN. The name is only meaningful
kono
parents:
diff changeset
100 for dumps; it has no linkage. */
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 extern const char *const internal_fn_name_array[];
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 static inline const char *
kono
parents:
diff changeset
105 internal_fn_name (enum internal_fn fn)
kono
parents:
diff changeset
106 {
kono
parents:
diff changeset
107 return internal_fn_name_array[(int) fn];
kono
parents:
diff changeset
108 }
kono
parents:
diff changeset
109
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
110 extern internal_fn lookup_internal_fn (const char *);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
111
111
kono
parents:
diff changeset
112 /* Return the ECF_* flags for function FN. */
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 extern const int internal_fn_flags_array[];
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 static inline int
kono
parents:
diff changeset
117 internal_fn_flags (enum internal_fn fn)
kono
parents:
diff changeset
118 {
kono
parents:
diff changeset
119 return internal_fn_flags_array[(int) fn];
kono
parents:
diff changeset
120 }
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 /* Return fnspec for function FN. */
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 extern GTY(()) const_tree internal_fn_fnspec_array[IFN_LAST + 1];
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 static inline const_tree
kono
parents:
diff changeset
127 internal_fn_fnspec (enum internal_fn fn)
kono
parents:
diff changeset
128 {
kono
parents:
diff changeset
129 return internal_fn_fnspec_array[(int) fn];
kono
parents:
diff changeset
130 }
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 /* Describes an internal function that maps directly to an optab. */
kono
parents:
diff changeset
133 struct direct_internal_fn_info
kono
parents:
diff changeset
134 {
kono
parents:
diff changeset
135 /* optabs can be parameterized by one or two modes. These fields describe
kono
parents:
diff changeset
136 how to select those modes from the types of the return value and
kono
parents:
diff changeset
137 arguments. A value of -1 says that the mode is determined by the
kono
parents:
diff changeset
138 return type while a value N >= 0 says that the mode is determined by
kono
parents:
diff changeset
139 the type of argument N. A value of -2 says that this internal
kono
parents:
diff changeset
140 function isn't directly mapped to an optab. */
kono
parents:
diff changeset
141 signed int type0 : 8;
kono
parents:
diff changeset
142 signed int type1 : 8;
kono
parents:
diff changeset
143 /* True if the function is pointwise, so that it can be vectorized by
kono
parents:
diff changeset
144 converting the return type and all argument types to vectors of the
kono
parents:
diff changeset
145 same number of elements. E.g. we can vectorize an IFN_SQRT on
kono
parents:
diff changeset
146 floats as an IFN_SQRT on vectors of N floats.
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 This only needs 1 bit, but occupies the full 16 to ensure a nice
kono
parents:
diff changeset
149 layout. */
kono
parents:
diff changeset
150 unsigned int vectorizable : 16;
kono
parents:
diff changeset
151 };
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 extern const direct_internal_fn_info direct_internal_fn_array[IFN_LAST + 1];
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 /* Return true if FN is mapped directly to an optab. */
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 inline bool
kono
parents:
diff changeset
158 direct_internal_fn_p (internal_fn fn)
kono
parents:
diff changeset
159 {
kono
parents:
diff changeset
160 return direct_internal_fn_array[fn].type0 >= -1;
kono
parents:
diff changeset
161 }
kono
parents:
diff changeset
162
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
163 /* Return true if FN is a direct internal function that can be vectorized by
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
164 converting the return type and all argument types to vectors of the same
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
165 number of elements. E.g. we can vectorize an IFN_SQRT on floats as an
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
166 IFN_SQRT on vectors of N floats. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
167
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
168 inline bool
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
169 vectorizable_internal_fn_p (internal_fn fn)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
170 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
171 return direct_internal_fn_array[fn].vectorizable;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
172 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
173
111
kono
parents:
diff changeset
174 /* Return optab information about internal function FN. Only meaningful
kono
parents:
diff changeset
175 if direct_internal_fn_p (FN). */
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 inline const direct_internal_fn_info &
kono
parents:
diff changeset
178 direct_internal_fn (internal_fn fn)
kono
parents:
diff changeset
179 {
kono
parents:
diff changeset
180 gcc_checking_assert (direct_internal_fn_p (fn));
kono
parents:
diff changeset
181 return direct_internal_fn_array[fn];
kono
parents:
diff changeset
182 }
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 extern tree_pair direct_internal_fn_types (internal_fn, tree, tree *);
kono
parents:
diff changeset
185 extern tree_pair direct_internal_fn_types (internal_fn, gcall *);
kono
parents:
diff changeset
186 extern bool direct_internal_fn_supported_p (internal_fn, tree_pair,
kono
parents:
diff changeset
187 optimization_type);
kono
parents:
diff changeset
188 extern bool direct_internal_fn_supported_p (internal_fn, tree,
kono
parents:
diff changeset
189 optimization_type);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
190 extern bool direct_internal_fn_supported_p (gcall *, optimization_type);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
191
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
192 /* Return true if FN is supported for types TYPE0 and TYPE1 when the
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
193 optimization type is OPT_TYPE. The types are those associated with
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
194 the "type0" and "type1" fields of FN's direct_internal_fn_info
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
195 structure. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
196
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
197 inline bool
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
198 direct_internal_fn_supported_p (internal_fn fn, tree type0, tree type1,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
199 optimization_type opt_type)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
200 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
201 return direct_internal_fn_supported_p (fn, tree_pair (type0, type1),
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
202 opt_type);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
203 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
204
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
205 extern int first_commutative_argument (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
206
111
kono
parents:
diff changeset
207 extern bool set_edom_supported_p (void);
kono
parents:
diff changeset
208
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
209 extern internal_fn get_conditional_internal_fn (tree_code);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
210 extern internal_fn get_conditional_internal_fn (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
211 extern tree_code conditional_internal_fn_code (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
212 extern internal_fn get_unconditional_internal_fn (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
213 extern bool can_interpret_as_conditional_op_p (gimple *, tree *,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
214 tree_code *, tree (&)[3],
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
215 tree *);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
216
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
217 extern bool internal_load_fn_p (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
218 extern bool internal_store_fn_p (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
219 extern bool internal_gather_scatter_fn_p (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
220 extern int internal_fn_mask_index (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
221 extern int internal_fn_stored_value_index (internal_fn);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
222 extern bool internal_gather_scatter_fn_supported_p (internal_fn, tree,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
223 tree, tree, int);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
224 extern bool internal_check_ptrs_fn_supported_p (internal_fn, tree,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
225 poly_uint64, unsigned int);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
226
111
kono
parents:
diff changeset
227 extern void expand_internal_call (gcall *);
kono
parents:
diff changeset
228 extern void expand_internal_call (internal_fn, gcall *);
kono
parents:
diff changeset
229 extern void expand_PHI (internal_fn, gcall *);
kono
parents:
diff changeset
230
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
231 extern bool vectorized_internal_fn_supported_p (internal_fn, tree);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
232
111
kono
parents:
diff changeset
233 #endif