gimple.def 16 KB

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