OSDN Git Service

2009-05-20 Sandra Loosemore <sandra@codesourcery.com>
[pf3gnuchains/gcc-fork.git] / gcc / gimple.def
1 /* This file contains the definitions of the GIMPLE IR tuples used in GCC.
2
3    Copyright (C) 2007, 2008 Free Software Foundation, Inc.
4    Contributed by Aldy Hernandez <aldyh@redhat.com>
5
6 This file is part of GCC.
7
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.
12
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.
17
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/>.  */
21
22 /* The format of this file is
23    DEFGSCODE(GIMPLE_symbol, printable name, structure).
24
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().
31
32    If a code does not use operand vectors, STRUCTURE should be NULL.  */
33
34 /* Error marker.  This is used in similar ways as ERROR_MARK in tree.def.  */
35 DEFGSCODE(GIMPLE_ERROR_MARK, "gimple_error_mark", NULL)
36
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.  */
40
41 /* GIMPLE_COND <COND_CODE, OP1, OP2, TRUE_LABEL, FALSE_LABEL>
42    represents the conditional jump:
43    
44    if (OP1 COND_CODE OP2) goto TRUE_LABEL else goto FALSE_LABEL
45
46    COND_CODE is the tree code used as the comparison predicate.  It
47    must be of class tcc_comparison.
48
49    OP1 and OP2 are the operands used in the comparison.  They must be
50    accepted by is_gimple_operand.
51
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)
55
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)
59
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)
63
64 /* GIMPLE_SWITCH <INDEX, DEFAULT_LAB, LAB1, ..., LABN> represents the
65    multiway branch:
66
67    switch (INDEX)
68    {
69      case LAB1: ...; break;
70      ...
71      case LABN: ...; break;
72      default: ...
73    }
74
75    INDEX is the variable evaluated to decide which label to jump to.
76
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)
80
81 /* GIMPLE_CHANGE_DYNAMIC_TYPE indicates a change in the dynamic type
82    of a memory location.  This has no value and generates no
83    executable code.  It is only used for type based alias analysis.
84    This is generated by C++ placement new and it's a direct
85    translation from CHANGE_DYNAMIC_TYPE_EXPR.  The first operand
86    (gimple_cdt_new_type) is the new type.  The second operand
87    (gimple_cdt_location) is the location (pointer) whose type is being
88    changed.  */
89 DEFGSCODE(GIMPLE_CHANGE_DYNAMIC_TYPE, "gimple_change_dynamic_type",
90           struct gimple_statement_with_ops)
91
92 /* IMPORTANT.
93    
94    Do not rearrange the codes between GIMPLE_ASSIGN and GIMPLE_RETURN.
95    It's exposed by GIMPLE_RANGE_CHECK calls. These are all the GIMPLE
96    statements with memory and register operands.  */
97
98 /* GIMPLE_ASSIGN <SUBCODE, LHS, RHS1[, RHS2]> represents the assignment
99    statement
100
101    LHS = RHS1 SUBCODE RHS2.
102
103    SUBCODE is the tree code for the expression computed by the RHS of the
104    assignment.  It must be one of the tree codes accepted by
105    get_gimple_rhs_class.  If LHS is not a gimple register according to
106    is_gimple_reg, SUBCODE must be of class GIMPLE_SINGLE_RHS.
107
108    LHS is the operand on the LHS of the assignment.  It must be a tree node
109    accepted by is_gimple_lvalue.
110
111    RHS1 is the first operand on the RHS of the assignment.  It must always be
112    present.  It must be a tree node accepted by is_gimple_val.
113
114    RHS2 is the second operand on the RHS of the assignment.  It must be a tree
115    node accepted by is_gimple_val.  This argument exists only if SUBCODE is
116    of class GIMPLE_BINARY_RHS.  */
117 DEFGSCODE(GIMPLE_ASSIGN, "gimple_assign",
118           struct gimple_statement_with_memory_ops)
119
120 /* GIMPLE_ASM <STRING, I1, ..., IN, O1, ... OM, C1, ..., CP>
121    represents inline assembly statements.
122
123    STRING is the string containing the assembly statements.
124    I1 ... IN are the N input operands.
125    O1 ... OM are the M output operands.
126    C1 ... CP are the P clobber operands.  */
127 DEFGSCODE(GIMPLE_ASM, "gimple_asm", struct gimple_statement_asm)
128
129 /* GIMPLE_CALL <FN, LHS, ARG1, ..., ARGN[, CHAIN]> represents function
130    calls.
131
132    FN is the callee.  It must be accepted by is_gimple_call_addr.
133
134    LHS is the operand where the return value from FN is stored.  It may
135    be NULL.
136
137    ARG1 ... ARGN are the arguments.  They must all be accepted by
138    is_gimple_operand.
139
140     CHAIN is the optional static chain link for nested functions.  */
141 DEFGSCODE(GIMPLE_CALL, "gimple_call",
142           struct gimple_statement_with_memory_ops)
143
144 /* GIMPLE_RETURN <RETVAL> represents return statements.
145
146    RETVAL is the value to return or NULL.  If a value is returned it
147    must be accepted by is_gimple_operand.  */
148 DEFGSCODE(GIMPLE_RETURN, "gimple_return",
149           struct gimple_statement_with_memory_ops)
150
151 /* GIMPLE_BIND <VARS, BLOCK, BODY> represents a lexical scope.
152    VARS is the set of variables declared in that scope.
153    BLOCK is the symbol binding block used for debug information.  
154    BODY is the sequence of statements in the scope.  */
155 DEFGSCODE(GIMPLE_BIND, "gimple_bind", NULL)
156
157 /* GIMPLE_CATCH <TYPES, HANDLER> represents a typed exception handler.
158    TYPES is the type (or list of types) handled.  HANDLER is the
159    sequence of statements that handle these types.  */
160 DEFGSCODE(GIMPLE_CATCH, "gimple_catch", NULL)
161
162 /* GIMPLE_EH_FILTER <TYPES, FAILURE> represents an exception
163    specification.  TYPES is a list of allowed types and FAILURE is the
164    sequence of statements to execute on failure.  */
165 DEFGSCODE(GIMPLE_EH_FILTER, "gimple_eh_filter", NULL)
166
167 /* GIMPLE_PHI <RESULT, ARG1, ..., ARGN> represents the PHI node
168
169    RESULT = PHI <ARG1, ..., ARGN>
170
171    RESULT is the SSA name created by this PHI node.
172
173    ARG1 ... ARGN are the arguments to the PHI node.  N must be
174    exactly the same as the number of incoming edges to the basic block
175    holding the PHI node.  Every argument is either an SSA name or a
176    tree node of class tcc_constant.  */
177 DEFGSCODE(GIMPLE_PHI, "gimple_phi", NULL)
178
179 /* GIMPLE_RESX <REGION> resumes execution after an exception.
180    REGION is the region number being left.  */
181 DEFGSCODE(GIMPLE_RESX, "gimple_resx", NULL)
182
183 /* GIMPLE_TRY <TRY_KIND, EVAL, CLEANUP>
184    represents a try/catch or a try/finally statement.
185
186    TRY_KIND is either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY.
187
188    EVAL is the sequence of statements to execute on entry to GIMPLE_TRY.
189
190    CLEANUP is the sequence of statements to execute according to
191    TRY_KIND.  If TRY_KIND is GIMPLE_TRY_CATCH, CLEANUP is only exected
192    if an exception is thrown during execution of EVAL.  If TRY_KIND is
193    GIMPLE_TRY_FINALLY, CLEANUP is always executed after executing EVAL
194    (regardless of whether EVAL finished normally, or jumped out or an
195    exception was thrown).  */
196 DEFGSCODE(GIMPLE_TRY, "gimple_try", NULL)
197
198 /* GIMPLE_NOP represents the "do nothing" statement.  */
199 DEFGSCODE(GIMPLE_NOP, "gimple_nop", NULL)
200
201
202 /* IMPORTANT.
203    
204    Do not rearrange any of the GIMPLE_OMP_* codes.  This ordering is
205    exposed by the range check in gimple_omp_subcode().  */
206
207
208 /* Tuples used for lowering of OMP_ATOMIC.  Although the form of the OMP_ATOMIC
209    expression is very simple (just in form mem op= expr), various implicit
210    conversions may cause the expression to become more complex, so that it does
211    not fit the gimple grammar very well.  To overcome this problem, OMP_ATOMIC
212    is rewritten as a sequence of two codes in gimplification:
213
214    GIMPLE_OMP_LOAD (tmp, mem)
215    val = some computations involving tmp;
216    GIMPLE_OMP_STORE (val).  */
217 DEFGSCODE(GIMPLE_OMP_ATOMIC_LOAD, "gimple_omp_atomic_load", NULL)
218 DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimple_omp_atomic_store", NULL)
219
220 /* GIMPLE_OMP_CONTINUE marks the location of the loop or sections
221    iteration in partially lowered OpenMP code.  */
222 DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", NULL)
223
224 /* GIMPLE_OMP_CRITICAL <NAME, BODY> represents
225
226    #pragma omp critical [name]
227
228    NAME is the name given to the critical section.
229    BODY is the sequence of statements that are inside the critical section.  */
230 DEFGSCODE(GIMPLE_OMP_CRITICAL, "gimple_omp_critical", NULL)
231
232 /* GIMPLE_OMP_FOR <BODY, CLAUSES, INDEX, INITIAL, FINAL, COND, INCR, PRE_BODY>
233    represents
234
235    PRE_BODY
236    #pragma omp for [clause1 ... clauseN]
237    for (INDEX = INITIAL; INDEX COND FINAL; INDEX {+=,-=} INCR)
238    BODY
239
240    BODY is the loop body.
241
242    CLAUSES is the list of clauses.
243
244    INDEX must be an integer or pointer variable, which is implicitly thread
245    private.  It must be accepted by is_gimple_operand.
246
247    INITIAL is the initial value given to INDEX. It must be
248    accepted by is_gimple_operand.
249
250    FINAL is the final value that INDEX should take. It must
251    be accepted by is_gimple_operand.
252
253    COND is the condition code for the controlling predicate.  It must
254    be one of { <, >, <=, >= }
255
256    INCR is the loop index increment.  It must be tree node of type
257    tcc_constant.
258
259    PRE_BODY is a landing pad filled by the gimplifier with things from
260    INIT, COND, and INCR that are technically part of the OMP_FOR
261    structured block, but are evaluated before the loop body begins.
262
263    INITIAL, FINAL and INCR are required to be loop invariant integer
264    expressions that are evaluated without any synchronization.
265    The evaluation order, frequency of evaluation and side-effects are
266    unspecified by the standard.  */
267 DEFGSCODE(GIMPLE_OMP_FOR, "gimple_omp_for", NULL)
268
269 /* GIMPLE_OMP_MASTER <BODY> represents #pragma omp master.
270    BODY is the sequence of statements to execute in the master section.  */
271 DEFGSCODE(GIMPLE_OMP_MASTER, "gimple_omp_master", NULL)
272
273 /* GIMPLE_OMP_ORDERED <BODY> represents #pragma omp ordered.
274    BODY is the sequence of statements to execute in the ordered section.  */
275 DEFGSCODE(GIMPLE_OMP_ORDERED, "gimple_omp_ordered", NULL)
276
277 /* GIMPLE_OMP_PARALLEL <BODY, CLAUSES, CHILD_FN, DATA_ARG> represents
278
279    #pragma omp parallel [CLAUSES]
280    BODY
281
282    BODY is a the sequence of statements to be executed by all threads.
283
284    CLAUSES is a TREE_LIST node with all the clauses.
285
286    CHILD_FN is set when outlining the body of the parallel region.
287    All the statements in BODY are moved into this newly created
288    function when converting OMP constructs into low-GIMPLE.
289
290    DATA_ARG is a local variable in the parent function containing data
291    to be shared with CHILD_FN.  This is used to implement all the data
292    sharing clauses.  */
293 DEFGSCODE(GIMPLE_OMP_PARALLEL, "gimple_omp_parallel", NULL)
294
295 /* GIMPLE_OMP_TASK <BODY, CLAUSES, CHILD_FN, DATA_ARG, COPY_FN,
296                     ARG_SIZE, ARG_ALIGN> represents
297
298    #pragma omp task [CLAUSES]
299    BODY
300
301    BODY is a the sequence of statements to be executed by all threads.
302
303    CLAUSES is a TREE_LIST node with all the clauses.
304
305    CHILD_FN is set when outlining the body of the explicit task region.
306    All the statements in BODY are moved into this newly created
307    function when converting OMP constructs into low-GIMPLE.
308
309    DATA_ARG is a local variable in the parent function containing data
310    to be shared with CHILD_FN.  This is used to implement all the data
311    sharing clauses.
312
313    COPY_FN is set when outlining the firstprivate var initialization.
314    All the needed statements are emitted into the newly created
315    function, or when only memcpy is needed, it is NULL.
316
317    ARG_SIZE and ARG_ALIGN are the size and alignment of the incoming
318    data area allocated by GOMP_task and passed to CHILD_FN.  */
319 DEFGSCODE(GIMPLE_OMP_TASK, "gimple_omp_task", NULL)
320
321 /* OMP_RETURN marks the end of an OpenMP directive.  */
322 DEFGSCODE(GIMPLE_OMP_RETURN, "gimple_omp_return", NULL)
323
324 /* OMP_SECTION <BODY> represents #pragma omp section.
325    BODY is the sequence of statements in the section body.  */
326 DEFGSCODE(GIMPLE_OMP_SECTION, "gimple_omp_section", NULL)
327
328 /* OMP_SECTIONS <BODY, CLAUSES, CONTROL> represents #pragma omp sections.
329
330    BODY is the sequence of statements in the sections body.
331    CLAUSES is a TREE_LIST node holding the list of associated clauses.
332    CONTROL is a VAR_DECL used for deciding which of the sections
333    to execute.  */
334 DEFGSCODE(GIMPLE_OMP_SECTIONS, "gimple_omp_sections", NULL)
335
336 /* GIMPLE_OMP_SECTIONS_SWITCH is a marker placed immediately after
337    OMP_SECTIONS.  It represents the GIMPLE_SWITCH used to decide which
338    branch is taken.  */
339 DEFGSCODE(GIMPLE_OMP_SECTIONS_SWITCH, "gimple_omp_sections_switch", NULL)
340
341 /* GIMPLE_OMP_SINGLE <BODY, CLAUSES> represents #pragma omp single
342    BODY is the sequence of statements inside the single section.
343    CLAUSES is a TREE_LIST node holding the associated clauses.  */
344 DEFGSCODE(GIMPLE_OMP_SINGLE, "gimple_omp_single", NULL)
345
346 /* GIMPLE_PREDICT <PREDICT, OUTCOME> specifies a hint for branch prediction.
347
348    PREDICT is one of the predictors from predict.def.
349
350    OUTCOME is NOT_TAKEN or TAKEN.  */
351 DEFGSCODE(GIMPLE_PREDICT, "gimple_predict", NULL)
352
353 /*  This node represents a cleanup expression.  It is ONLY USED INTERNALLY
354     by the gimplifier as a placeholder for cleanups, and its uses will be
355     cleaned up by the time gimplification is done.
356     
357     This tuple should not exist outside of the gimplifier proper.  */
358 DEFGSCODE(GIMPLE_WITH_CLEANUP_EXPR, "gimple_with_cleanup_expr", NULL)