* toplev.h (floor_log2): If GCC_VERSION >= 3004, declare as static
[official-gcc.git] / gcc / gimple.def
blobcee6753d200cc533f30265e6965af87e7d475afc
1 /* This file contains the definitions of the GIMPLE IR tuples used in GCC.
3 Copyright (C) 2007, 2008 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 /* The format of this file is
23 DEFGSCODE(GIMPLE_symbol, printable name, structure).
25 Where symbol is the enumeration name without the ``GIMPLE_''.
26 The argument STRUCTURE is used to compute offsets into each of the
27 tuple structures that contain operands. Since vector operands
28 are at different offsets depending on the particular structure
29 used, these offsets are computed at compile time for efficient
30 lookup at runtime. See gimple_ops().
32 If a code does not use operand vectors, STRUCTURE should be NULL. */
34 /* Error marker. This is used in similar ways as ERROR_MARK in tree.def. */
35 DEFGSCODE(GIMPLE_ERROR_MARK, "gimple_error_mark", NULL)
37 /* IMPORTANT. Do not rearrange the codes between GIMPLE_COND and
38 GIMPLE_RETURN. The ordering is exposed by gimple_has_ops calls.
39 These are all the GIMPLE statements with register operands. */
41 /* GIMPLE_COND <COND_CODE, OP1, OP2, TRUE_LABEL, FALSE_LABEL>
42 represents the conditional jump:
44 if (OP1 COND_CODE OP2) goto TRUE_LABEL else goto FALSE_LABEL
46 COND_CODE is the tree code used as the comparison predicate. It
47 must be of class tcc_comparison.
49 OP1 and OP2 are the operands used in the comparison. They must be
50 accepted by is_gimple_operand.
52 TRUE_LABEL and FALSE_LABEL are the LABEL_DECL nodes used as the
53 jump target for the comparison. */
54 DEFGSCODE(GIMPLE_COND, "gimple_cond", struct gimple_statement_with_ops)
56 /* GIMPLE_GOTO <TARGET> represents unconditional jumps.
57 TARGET is a LABEL_DECL or an expression node for computed GOTOs. */
58 DEFGSCODE(GIMPLE_GOTO, "gimple_goto", struct gimple_statement_with_ops)
60 /* GIMPLE_LABEL <LABEL> represents label statements. LABEL is a
61 LABEL_DECL representing a jump target. */
62 DEFGSCODE(GIMPLE_LABEL, "gimple_label", struct gimple_statement_with_ops)
64 /* GIMPLE_SWITCH <INDEX, DEFAULT_LAB, LAB1, ..., LABN> represents the
65 multiway branch:
67 switch (INDEX)
69 case LAB1: ...; break;
70 ...
71 case LABN: ...; break;
72 default: ...
75 INDEX is the variable evaluated to decide which label to jump to.
77 DEFAULT_LAB, LAB1 ... LABN are the tree nodes representing case labels.
78 They must be CASE_LABEL_EXPR nodes. */
79 DEFGSCODE(GIMPLE_SWITCH, "gimple_switch", struct gimple_statement_with_ops)
81 /* IMPORTANT.
83 Do not rearrange the codes between GIMPLE_ASSIGN and GIMPLE_RETURN.
84 It's exposed by GIMPLE_RANGE_CHECK calls. These are all the GIMPLE
85 statements with memory and register operands. */
87 /* GIMPLE_ASSIGN <SUBCODE, LHS, RHS1[, RHS2]> represents the assignment
88 statement
90 LHS = RHS1 SUBCODE RHS2.
92 SUBCODE is the tree code for the expression computed by the RHS of the
93 assignment. It must be one of the tree codes accepted by
94 get_gimple_rhs_class. If LHS is not a gimple register according to
95 is_gimple_reg, SUBCODE must be of class GIMPLE_SINGLE_RHS.
97 LHS is the operand on the LHS of the assignment. It must be a tree node
98 accepted by is_gimple_lvalue.
100 RHS1 is the first operand on the RHS of the assignment. It must always be
101 present. It must be a tree node accepted by is_gimple_val.
103 RHS2 is the second operand on the RHS of the assignment. It must be a tree
104 node accepted by is_gimple_val. This argument exists only if SUBCODE is
105 of class GIMPLE_BINARY_RHS. */
106 DEFGSCODE(GIMPLE_ASSIGN, "gimple_assign",
107 struct gimple_statement_with_memory_ops)
109 /* GIMPLE_ASM <STRING, I1, ..., IN, O1, ... OM, C1, ..., CP>
110 represents inline assembly statements.
112 STRING is the string containing the assembly statements.
113 I1 ... IN are the N input operands.
114 O1 ... OM are the M output operands.
115 C1 ... CP are the P clobber operands. */
116 DEFGSCODE(GIMPLE_ASM, "gimple_asm", struct gimple_statement_asm)
118 /* GIMPLE_CALL <FN, LHS, ARG1, ..., ARGN[, CHAIN]> represents function
119 calls.
121 FN is the callee. It must be accepted by is_gimple_call_addr.
123 LHS is the operand where the return value from FN is stored. It may
124 be NULL.
126 ARG1 ... ARGN are the arguments. They must all be accepted by
127 is_gimple_operand.
129 CHAIN is the optional static chain link for nested functions. */
130 DEFGSCODE(GIMPLE_CALL, "gimple_call",
131 struct gimple_statement_with_memory_ops)
133 /* GIMPLE_RETURN <RETVAL> represents return statements.
135 RETVAL is the value to return or NULL. If a value is returned it
136 must be accepted by is_gimple_operand. */
137 DEFGSCODE(GIMPLE_RETURN, "gimple_return",
138 struct gimple_statement_with_memory_ops)
140 /* GIMPLE_BIND <VARS, BLOCK, BODY> represents a lexical scope.
141 VARS is the set of variables declared in that scope.
142 BLOCK is the symbol binding block used for debug information.
143 BODY is the sequence of statements in the scope. */
144 DEFGSCODE(GIMPLE_BIND, "gimple_bind", NULL)
146 /* GIMPLE_CATCH <TYPES, HANDLER> represents a typed exception handler.
147 TYPES is the type (or list of types) handled. HANDLER is the
148 sequence of statements that handle these types. */
149 DEFGSCODE(GIMPLE_CATCH, "gimple_catch", NULL)
151 /* GIMPLE_EH_FILTER <TYPES, FAILURE> represents an exception
152 specification. TYPES is a list of allowed types and FAILURE is the
153 sequence of statements to execute on failure. */
154 DEFGSCODE(GIMPLE_EH_FILTER, "gimple_eh_filter", NULL)
156 /* GIMPLE_PHI <RESULT, ARG1, ..., ARGN> represents the PHI node
158 RESULT = PHI <ARG1, ..., ARGN>
160 RESULT is the SSA name created by this PHI node.
162 ARG1 ... ARGN are the arguments to the PHI node. N must be
163 exactly the same as the number of incoming edges to the basic block
164 holding the PHI node. Every argument is either an SSA name or a
165 tree node of class tcc_constant. */
166 DEFGSCODE(GIMPLE_PHI, "gimple_phi", NULL)
168 /* GIMPLE_RESX <REGION> resumes execution after an exception.
169 REGION is the region number being left. */
170 DEFGSCODE(GIMPLE_RESX, "gimple_resx", NULL)
172 /* GIMPLE_TRY <TRY_KIND, EVAL, CLEANUP>
173 represents a try/catch or a try/finally statement.
175 TRY_KIND is either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY.
177 EVAL is the sequence of statements to execute on entry to GIMPLE_TRY.
179 CLEANUP is the sequence of statements to execute according to
180 TRY_KIND. If TRY_KIND is GIMPLE_TRY_CATCH, CLEANUP is only exected
181 if an exception is thrown during execution of EVAL. If TRY_KIND is
182 GIMPLE_TRY_FINALLY, CLEANUP is always executed after executing EVAL
183 (regardless of whether EVAL finished normally, or jumped out or an
184 exception was thrown). */
185 DEFGSCODE(GIMPLE_TRY, "gimple_try", NULL)
187 /* GIMPLE_NOP represents the "do nothing" statement. */
188 DEFGSCODE(GIMPLE_NOP, "gimple_nop", NULL)
191 /* IMPORTANT.
193 Do not rearrange any of the GIMPLE_OMP_* codes. This ordering is
194 exposed by the range check in gimple_omp_subcode(). */
197 /* Tuples used for lowering of OMP_ATOMIC. Although the form of the OMP_ATOMIC
198 expression is very simple (just in form mem op= expr), various implicit
199 conversions may cause the expression to become more complex, so that it does
200 not fit the gimple grammar very well. To overcome this problem, OMP_ATOMIC
201 is rewritten as a sequence of two codes in gimplification:
203 GIMPLE_OMP_LOAD (tmp, mem)
204 val = some computations involving tmp;
205 GIMPLE_OMP_STORE (val). */
206 DEFGSCODE(GIMPLE_OMP_ATOMIC_LOAD, "gimple_omp_atomic_load", NULL)
207 DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimple_omp_atomic_store", NULL)
209 /* GIMPLE_OMP_CONTINUE marks the location of the loop or sections
210 iteration in partially lowered OpenMP code. */
211 DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", NULL)
213 /* GIMPLE_OMP_CRITICAL <NAME, BODY> represents
215 #pragma omp critical [name]
217 NAME is the name given to the critical section.
218 BODY is the sequence of statements that are inside the critical section. */
219 DEFGSCODE(GIMPLE_OMP_CRITICAL, "gimple_omp_critical", NULL)
221 /* GIMPLE_OMP_FOR <BODY, CLAUSES, INDEX, INITIAL, FINAL, COND, INCR, PRE_BODY>
222 represents
224 PRE_BODY
225 #pragma omp for [clause1 ... clauseN]
226 for (INDEX = INITIAL; INDEX COND FINAL; INDEX {+=,-=} INCR)
227 BODY
229 BODY is the loop body.
231 CLAUSES is the list of clauses.
233 INDEX must be an integer or pointer variable, which is implicitly thread
234 private. It must be accepted by is_gimple_operand.
236 INITIAL is the initial value given to INDEX. It must be
237 accepted by is_gimple_operand.
239 FINAL is the final value that INDEX should take. It must
240 be accepted by is_gimple_operand.
242 COND is the condition code for the controlling predicate. It must
243 be one of { <, >, <=, >= }
245 INCR is the loop index increment. It must be tree node of type
246 tcc_constant.
248 PRE_BODY is a landing pad filled by the gimplifier with things from
249 INIT, COND, and INCR that are technically part of the OMP_FOR
250 structured block, but are evaluated before the loop body begins.
252 INITIAL, FINAL and INCR are required to be loop invariant integer
253 expressions that are evaluated without any synchronization.
254 The evaluation order, frequency of evaluation and side-effects are
255 unspecified by the standard. */
256 DEFGSCODE(GIMPLE_OMP_FOR, "gimple_omp_for", NULL)
258 /* GIMPLE_OMP_MASTER <BODY> represents #pragma omp master.
259 BODY is the sequence of statements to execute in the master section. */
260 DEFGSCODE(GIMPLE_OMP_MASTER, "gimple_omp_master", NULL)
262 /* GIMPLE_OMP_ORDERED <BODY> represents #pragma omp ordered.
263 BODY is the sequence of statements to execute in the ordered section. */
264 DEFGSCODE(GIMPLE_OMP_ORDERED, "gimple_omp_ordered", NULL)
266 /* GIMPLE_OMP_PARALLEL <BODY, CLAUSES, CHILD_FN, DATA_ARG> represents
268 #pragma omp parallel [CLAUSES]
269 BODY
271 BODY is a the sequence of statements to be executed by all threads.
273 CLAUSES is a TREE_LIST node with all the clauses.
275 CHILD_FN is set when outlining the body of the parallel region.
276 All the statements in BODY are moved into this newly created
277 function when converting OMP constructs into low-GIMPLE.
279 DATA_ARG is a local variable in the parent function containing data
280 to be shared with CHILD_FN. This is used to implement all the data
281 sharing clauses. */
282 DEFGSCODE(GIMPLE_OMP_PARALLEL, "gimple_omp_parallel", NULL)
284 /* GIMPLE_OMP_TASK <BODY, CLAUSES, CHILD_FN, DATA_ARG, COPY_FN,
285 ARG_SIZE, ARG_ALIGN> represents
287 #pragma omp task [CLAUSES]
288 BODY
290 BODY is a the sequence of statements to be executed by all threads.
292 CLAUSES is a TREE_LIST node with all the clauses.
294 CHILD_FN is set when outlining the body of the explicit task region.
295 All the statements in BODY are moved into this newly created
296 function when converting OMP constructs into low-GIMPLE.
298 DATA_ARG is a local variable in the parent function containing data
299 to be shared with CHILD_FN. This is used to implement all the data
300 sharing clauses.
302 COPY_FN is set when outlining the firstprivate var initialization.
303 All the needed statements are emitted into the newly created
304 function, or when only memcpy is needed, it is NULL.
306 ARG_SIZE and ARG_ALIGN are the size and alignment of the incoming
307 data area allocated by GOMP_task and passed to CHILD_FN. */
308 DEFGSCODE(GIMPLE_OMP_TASK, "gimple_omp_task", NULL)
310 /* OMP_RETURN marks the end of an OpenMP directive. */
311 DEFGSCODE(GIMPLE_OMP_RETURN, "gimple_omp_return", NULL)
313 /* OMP_SECTION <BODY> represents #pragma omp section.
314 BODY is the sequence of statements in the section body. */
315 DEFGSCODE(GIMPLE_OMP_SECTION, "gimple_omp_section", NULL)
317 /* OMP_SECTIONS <BODY, CLAUSES, CONTROL> represents #pragma omp sections.
319 BODY is the sequence of statements in the sections body.
320 CLAUSES is a TREE_LIST node holding the list of associated clauses.
321 CONTROL is a VAR_DECL used for deciding which of the sections
322 to execute. */
323 DEFGSCODE(GIMPLE_OMP_SECTIONS, "gimple_omp_sections", NULL)
325 /* GIMPLE_OMP_SECTIONS_SWITCH is a marker placed immediately after
326 OMP_SECTIONS. It represents the GIMPLE_SWITCH used to decide which
327 branch is taken. */
328 DEFGSCODE(GIMPLE_OMP_SECTIONS_SWITCH, "gimple_omp_sections_switch", NULL)
330 /* GIMPLE_OMP_SINGLE <BODY, CLAUSES> represents #pragma omp single
331 BODY is the sequence of statements inside the single section.
332 CLAUSES is a TREE_LIST node holding the associated clauses. */
333 DEFGSCODE(GIMPLE_OMP_SINGLE, "gimple_omp_single", NULL)
335 /* GIMPLE_PREDICT <PREDICT, OUTCOME> specifies a hint for branch prediction.
337 PREDICT is one of the predictors from predict.def.
339 OUTCOME is NOT_TAKEN or TAKEN. */
340 DEFGSCODE(GIMPLE_PREDICT, "gimple_predict", NULL)
342 /* This node represents a cleanup expression. It is ONLY USED INTERNALLY
343 by the gimplifier as a placeholder for cleanups, and its uses will be
344 cleaned up by the time gimplification is done.
346 This tuple should not exist outside of the gimplifier proper. */
347 DEFGSCODE(GIMPLE_WITH_CLEANUP_EXPR, "gimple_with_cleanup_expr", NULL)