annotate gcc/internal-fn.h @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Internal functions.
kono
parents:
diff changeset
2 Copyright (C) 2011-2017 Free Software Foundation, Inc.
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
kono
parents:
diff changeset
110 /* Return the ECF_* flags for function FN. */
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 extern const int internal_fn_flags_array[];
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 static inline int
kono
parents:
diff changeset
115 internal_fn_flags (enum internal_fn fn)
kono
parents:
diff changeset
116 {
kono
parents:
diff changeset
117 return internal_fn_flags_array[(int) fn];
kono
parents:
diff changeset
118 }
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 /* Return fnspec for function FN. */
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 extern GTY(()) const_tree internal_fn_fnspec_array[IFN_LAST + 1];
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 static inline const_tree
kono
parents:
diff changeset
125 internal_fn_fnspec (enum internal_fn fn)
kono
parents:
diff changeset
126 {
kono
parents:
diff changeset
127 return internal_fn_fnspec_array[(int) fn];
kono
parents:
diff changeset
128 }
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 /* Describes an internal function that maps directly to an optab. */
kono
parents:
diff changeset
131 struct direct_internal_fn_info
kono
parents:
diff changeset
132 {
kono
parents:
diff changeset
133 /* optabs can be parameterized by one or two modes. These fields describe
kono
parents:
diff changeset
134 how to select those modes from the types of the return value and
kono
parents:
diff changeset
135 arguments. A value of -1 says that the mode is determined by the
kono
parents:
diff changeset
136 return type while a value N >= 0 says that the mode is determined by
kono
parents:
diff changeset
137 the type of argument N. A value of -2 says that this internal
kono
parents:
diff changeset
138 function isn't directly mapped to an optab. */
kono
parents:
diff changeset
139 signed int type0 : 8;
kono
parents:
diff changeset
140 signed int type1 : 8;
kono
parents:
diff changeset
141 /* True if the function is pointwise, so that it can be vectorized by
kono
parents:
diff changeset
142 converting the return type and all argument types to vectors of the
kono
parents:
diff changeset
143 same number of elements. E.g. we can vectorize an IFN_SQRT on
kono
parents:
diff changeset
144 floats as an IFN_SQRT on vectors of N floats.
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 This only needs 1 bit, but occupies the full 16 to ensure a nice
kono
parents:
diff changeset
147 layout. */
kono
parents:
diff changeset
148 unsigned int vectorizable : 16;
kono
parents:
diff changeset
149 };
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 extern const direct_internal_fn_info direct_internal_fn_array[IFN_LAST + 1];
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 /* Return true if FN is mapped directly to an optab. */
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 inline bool
kono
parents:
diff changeset
156 direct_internal_fn_p (internal_fn fn)
kono
parents:
diff changeset
157 {
kono
parents:
diff changeset
158 return direct_internal_fn_array[fn].type0 >= -1;
kono
parents:
diff changeset
159 }
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 /* Return optab information about internal function FN. Only meaningful
kono
parents:
diff changeset
162 if direct_internal_fn_p (FN). */
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 inline const direct_internal_fn_info &
kono
parents:
diff changeset
165 direct_internal_fn (internal_fn fn)
kono
parents:
diff changeset
166 {
kono
parents:
diff changeset
167 gcc_checking_assert (direct_internal_fn_p (fn));
kono
parents:
diff changeset
168 return direct_internal_fn_array[fn];
kono
parents:
diff changeset
169 }
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 extern tree_pair direct_internal_fn_types (internal_fn, tree, tree *);
kono
parents:
diff changeset
172 extern tree_pair direct_internal_fn_types (internal_fn, gcall *);
kono
parents:
diff changeset
173 extern bool direct_internal_fn_supported_p (internal_fn, tree_pair,
kono
parents:
diff changeset
174 optimization_type);
kono
parents:
diff changeset
175 extern bool direct_internal_fn_supported_p (internal_fn, tree,
kono
parents:
diff changeset
176 optimization_type);
kono
parents:
diff changeset
177 extern bool set_edom_supported_p (void);
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 extern void expand_internal_call (gcall *);
kono
parents:
diff changeset
180 extern void expand_internal_call (internal_fn, gcall *);
kono
parents:
diff changeset
181 extern void expand_PHI (internal_fn, gcall *);
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 #endif