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