You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

300 line
14KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Manipulating GIMPLE statements (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Manipulating GIMPLE statements (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Manipulating GIMPLE statements (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="GIMPLE.html#GIMPLE" rel="up" title="GIMPLE">
  30. <link href="Tuple-specific-accessors.html#Tuple-specific-accessors" rel="next" title="Tuple specific accessors">
  31. <link href="Logical-Operators.html#Logical-Operators" rel="prev" title="Logical Operators">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Manipulating-GIMPLE-statements"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Tuple-specific-accessors.html#Tuple-specific-accessors" accesskey="n" rel="next">Tuple specific accessors</a>, Previous: <a href="Operands.html#Operands" accesskey="p" rel="prev">Operands</a>, Up: <a href="GIMPLE.html#GIMPLE" accesskey="u" rel="up">GIMPLE</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Manipulating-GIMPLE-statements-1"></a>
  68. <h3 class="section">12.7 Manipulating GIMPLE statements</h3>
  69. <a name="index-Manipulating-GIMPLE-statements"></a>
  70. <p>This section documents all the functions available to handle each
  71. of the GIMPLE instructions.
  72. </p>
  73. <a name="Common-accessors"></a>
  74. <h4 class="subsection">12.7.1 Common accessors</h4>
  75. <p>The following are common accessors for gimple statements.
  76. </p>
  77. <dl>
  78. <dt><a name="index-gimple_005fcode"></a>GIMPLE function: <em>enum gimple_code</em> <strong>gimple_code</strong> <em>(gimple g)</em></dt>
  79. <dd><p>Return the code for statement <code>G</code>.
  80. </p></dd></dl>
  81. <dl>
  82. <dt><a name="index-gimple_005fbb"></a>GIMPLE function: <em>basic_block</em> <strong>gimple_bb</strong> <em>(gimple g)</em></dt>
  83. <dd><p>Return the basic block to which statement <code>G</code> belongs to.
  84. </p></dd></dl>
  85. <dl>
  86. <dt><a name="index-gimple_005fblock"></a>GIMPLE function: <em>tree</em> <strong>gimple_block</strong> <em>(gimple g)</em></dt>
  87. <dd><p>Return the lexical scope block holding statement <code>G</code>.
  88. </p></dd></dl>
  89. <dl>
  90. <dt><a name="index-gimple_005fexpr_005ftype"></a>GIMPLE function: <em>tree</em> <strong>gimple_expr_type</strong> <em>(gimple stmt)</em></dt>
  91. <dd><p>Return the type of the main expression computed by <code>STMT</code>. Return
  92. <code>void_type_node</code> if <code>STMT</code> computes nothing. This will only return
  93. something meaningful for <code>GIMPLE_ASSIGN</code>, <code>GIMPLE_COND</code> and
  94. <code>GIMPLE_CALL</code>. For all other tuple codes, it will return
  95. <code>void_type_node</code>.
  96. </p></dd></dl>
  97. <dl>
  98. <dt><a name="index-gimple_005fexpr_005fcode"></a>GIMPLE function: <em>enum tree_code</em> <strong>gimple_expr_code</strong> <em>(gimple stmt)</em></dt>
  99. <dd><p>Return the tree code for the expression computed by <code>STMT</code>. This
  100. is only meaningful for <code>GIMPLE_CALL</code>, <code>GIMPLE_ASSIGN</code> and
  101. <code>GIMPLE_COND</code>. If <code>STMT</code> is <code>GIMPLE_CALL</code>, it will return <code>CALL_EXPR</code>.
  102. For <code>GIMPLE_COND</code>, it returns the code of the comparison predicate.
  103. For <code>GIMPLE_ASSIGN</code> it returns the code of the operation performed
  104. by the <code>RHS</code> of the assignment.
  105. </p></dd></dl>
  106. <dl>
  107. <dt><a name="index-gimple_005fset_005fblock"></a>GIMPLE function: <em>void</em> <strong>gimple_set_block</strong> <em>(gimple g, tree block)</em></dt>
  108. <dd><p>Set the lexical scope block of <code>G</code> to <code>BLOCK</code>.
  109. </p></dd></dl>
  110. <dl>
  111. <dt><a name="index-gimple_005flocus"></a>GIMPLE function: <em>location_t</em> <strong>gimple_locus</strong> <em>(gimple g)</em></dt>
  112. <dd><p>Return locus information for statement <code>G</code>.
  113. </p></dd></dl>
  114. <dl>
  115. <dt><a name="index-gimple_005fset_005flocus"></a>GIMPLE function: <em>void</em> <strong>gimple_set_locus</strong> <em>(gimple g, location_t locus)</em></dt>
  116. <dd><p>Set locus information for statement <code>G</code>.
  117. </p></dd></dl>
  118. <dl>
  119. <dt><a name="index-gimple_005flocus_005fempty_005fp"></a>GIMPLE function: <em>bool</em> <strong>gimple_locus_empty_p</strong> <em>(gimple g)</em></dt>
  120. <dd><p>Return true if <code>G</code> does not have locus information.
  121. </p></dd></dl>
  122. <dl>
  123. <dt><a name="index-gimple_005fno_005fwarning_005fp"></a>GIMPLE function: <em>bool</em> <strong>gimple_no_warning_p</strong> <em>(gimple stmt)</em></dt>
  124. <dd><p>Return true if no warnings should be emitted for statement <code>STMT</code>.
  125. </p></dd></dl>
  126. <dl>
  127. <dt><a name="index-gimple_005fset_005fvisited"></a>GIMPLE function: <em>void</em> <strong>gimple_set_visited</strong> <em>(gimple stmt, bool visited_p)</em></dt>
  128. <dd><p>Set the visited status on statement <code>STMT</code> to <code>VISITED_P</code>.
  129. </p></dd></dl>
  130. <dl>
  131. <dt><a name="index-gimple_005fvisited_005fp"></a>GIMPLE function: <em>bool</em> <strong>gimple_visited_p</strong> <em>(gimple stmt)</em></dt>
  132. <dd><p>Return the visited status on statement <code>STMT</code>.
  133. </p></dd></dl>
  134. <dl>
  135. <dt><a name="index-gimple_005fset_005fplf"></a>GIMPLE function: <em>void</em> <strong>gimple_set_plf</strong> <em>(gimple stmt, enum plf_mask plf, bool val_p)</em></dt>
  136. <dd><p>Set pass local flag <code>PLF</code> on statement <code>STMT</code> to <code>VAL_P</code>.
  137. </p></dd></dl>
  138. <dl>
  139. <dt><a name="index-gimple_005fplf"></a>GIMPLE function: <em>unsigned int</em> <strong>gimple_plf</strong> <em>(gimple stmt, enum plf_mask plf)</em></dt>
  140. <dd><p>Return the value of pass local flag <code>PLF</code> on statement <code>STMT</code>.
  141. </p></dd></dl>
  142. <dl>
  143. <dt><a name="index-gimple_005fhas_005fops"></a>GIMPLE function: <em>bool</em> <strong>gimple_has_ops</strong> <em>(gimple g)</em></dt>
  144. <dd><p>Return true if statement <code>G</code> has register or memory operands.
  145. </p></dd></dl>
  146. <dl>
  147. <dt><a name="index-gimple_005fhas_005fmem_005fops"></a>GIMPLE function: <em>bool</em> <strong>gimple_has_mem_ops</strong> <em>(gimple g)</em></dt>
  148. <dd><p>Return true if statement <code>G</code> has memory operands.
  149. </p></dd></dl>
  150. <dl>
  151. <dt><a name="index-gimple_005fnum_005fops-1"></a>GIMPLE function: <em>unsigned</em> <strong>gimple_num_ops</strong> <em>(gimple g)</em></dt>
  152. <dd><p>Return the number of operands for statement <code>G</code>.
  153. </p></dd></dl>
  154. <dl>
  155. <dt><a name="index-gimple_005fops-1"></a>GIMPLE function: <em>tree *</em> <strong>gimple_ops</strong> <em>(gimple g)</em></dt>
  156. <dd><p>Return the array of operands for statement <code>G</code>.
  157. </p></dd></dl>
  158. <dl>
  159. <dt><a name="index-gimple_005fop-1"></a>GIMPLE function: <em>tree</em> <strong>gimple_op</strong> <em>(gimple g, unsigned i)</em></dt>
  160. <dd><p>Return operand <code>I</code> for statement <code>G</code>.
  161. </p></dd></dl>
  162. <dl>
  163. <dt><a name="index-gimple_005fop_005fptr"></a>GIMPLE function: <em>tree *</em> <strong>gimple_op_ptr</strong> <em>(gimple g, unsigned i)</em></dt>
  164. <dd><p>Return a pointer to operand <code>I</code> for statement <code>G</code>.
  165. </p></dd></dl>
  166. <dl>
  167. <dt><a name="index-gimple_005fset_005fop"></a>GIMPLE function: <em>void</em> <strong>gimple_set_op</strong> <em>(gimple g, unsigned i, tree op)</em></dt>
  168. <dd><p>Set operand <code>I</code> of statement <code>G</code> to <code>OP</code>.
  169. </p></dd></dl>
  170. <dl>
  171. <dt><a name="index-gimple_005faddresses_005ftaken"></a>GIMPLE function: <em>bitmap</em> <strong>gimple_addresses_taken</strong> <em>(gimple stmt)</em></dt>
  172. <dd><p>Return the set of symbols that have had their address taken by
  173. <code>STMT</code>.
  174. </p></dd></dl>
  175. <dl>
  176. <dt><a name="index-gimple_005fdef_005fops"></a>GIMPLE function: <em>struct def_optype_d *</em> <strong>gimple_def_ops</strong> <em>(gimple g)</em></dt>
  177. <dd><p>Return the set of <code>DEF</code> operands for statement <code>G</code>.
  178. </p></dd></dl>
  179. <dl>
  180. <dt><a name="index-gimple_005fset_005fdef_005fops"></a>GIMPLE function: <em>void</em> <strong>gimple_set_def_ops</strong> <em>(gimple g, struct def_optype_d *def)</em></dt>
  181. <dd><p>Set <code>DEF</code> to be the set of <code>DEF</code> operands for statement <code>G</code>.
  182. </p></dd></dl>
  183. <dl>
  184. <dt><a name="index-gimple_005fuse_005fops"></a>GIMPLE function: <em>struct use_optype_d *</em> <strong>gimple_use_ops</strong> <em>(gimple g)</em></dt>
  185. <dd><p>Return the set of <code>USE</code> operands for statement <code>G</code>.
  186. </p></dd></dl>
  187. <dl>
  188. <dt><a name="index-gimple_005fset_005fuse_005fops"></a>GIMPLE function: <em>void</em> <strong>gimple_set_use_ops</strong> <em>(gimple g, struct use_optype_d *use)</em></dt>
  189. <dd><p>Set <code>USE</code> to be the set of <code>USE</code> operands for statement <code>G</code>.
  190. </p></dd></dl>
  191. <dl>
  192. <dt><a name="index-gimple_005fvuse_005fops"></a>GIMPLE function: <em>struct voptype_d *</em> <strong>gimple_vuse_ops</strong> <em>(gimple g)</em></dt>
  193. <dd><p>Return the set of <code>VUSE</code> operands for statement <code>G</code>.
  194. </p></dd></dl>
  195. <dl>
  196. <dt><a name="index-gimple_005fset_005fvuse_005fops"></a>GIMPLE function: <em>void</em> <strong>gimple_set_vuse_ops</strong> <em>(gimple g, struct voptype_d *ops)</em></dt>
  197. <dd><p>Set <code>OPS</code> to be the set of <code>VUSE</code> operands for statement <code>G</code>.
  198. </p></dd></dl>
  199. <dl>
  200. <dt><a name="index-gimple_005fvdef_005fops"></a>GIMPLE function: <em>struct voptype_d *</em> <strong>gimple_vdef_ops</strong> <em>(gimple g)</em></dt>
  201. <dd><p>Return the set of <code>VDEF</code> operands for statement <code>G</code>.
  202. </p></dd></dl>
  203. <dl>
  204. <dt><a name="index-gimple_005fset_005fvdef_005fops"></a>GIMPLE function: <em>void</em> <strong>gimple_set_vdef_ops</strong> <em>(gimple g, struct voptype_d *ops)</em></dt>
  205. <dd><p>Set <code>OPS</code> to be the set of <code>VDEF</code> operands for statement <code>G</code>.
  206. </p></dd></dl>
  207. <dl>
  208. <dt><a name="index-gimple_005floaded_005fsyms"></a>GIMPLE function: <em>bitmap</em> <strong>gimple_loaded_syms</strong> <em>(gimple g)</em></dt>
  209. <dd><p>Return the set of symbols loaded by statement <code>G</code>. Each element of
  210. the set is the <code>DECL_UID</code> of the corresponding symbol.
  211. </p></dd></dl>
  212. <dl>
  213. <dt><a name="index-gimple_005fstored_005fsyms"></a>GIMPLE function: <em>bitmap</em> <strong>gimple_stored_syms</strong> <em>(gimple g)</em></dt>
  214. <dd><p>Return the set of symbols stored by statement <code>G</code>. Each element of
  215. the set is the <code>DECL_UID</code> of the corresponding symbol.
  216. </p></dd></dl>
  217. <dl>
  218. <dt><a name="index-gimple_005fmodified_005fp"></a>GIMPLE function: <em>bool</em> <strong>gimple_modified_p</strong> <em>(gimple g)</em></dt>
  219. <dd><p>Return true if statement <code>G</code> has operands and the modified field
  220. has been set.
  221. </p></dd></dl>
  222. <dl>
  223. <dt><a name="index-gimple_005fhas_005fvolatile_005fops"></a>GIMPLE function: <em>bool</em> <strong>gimple_has_volatile_ops</strong> <em>(gimple stmt)</em></dt>
  224. <dd><p>Return true if statement <code>STMT</code> contains volatile operands.
  225. </p></dd></dl>
  226. <dl>
  227. <dt><a name="index-gimple_005fset_005fhas_005fvolatile_005fops"></a>GIMPLE function: <em>void</em> <strong>gimple_set_has_volatile_ops</strong> <em>(gimple stmt, bool volatilep)</em></dt>
  228. <dd><p>Return true if statement <code>STMT</code> contains volatile operands.
  229. </p></dd></dl>
  230. <dl>
  231. <dt><a name="index-update_005fstmt"></a>GIMPLE function: <em>void</em> <strong>update_stmt</strong> <em>(gimple s)</em></dt>
  232. <dd><p>Mark statement <code>S</code> as modified, and update it.
  233. </p></dd></dl>
  234. <dl>
  235. <dt><a name="index-update_005fstmt_005fif_005fmodified"></a>GIMPLE function: <em>void</em> <strong>update_stmt_if_modified</strong> <em>(gimple s)</em></dt>
  236. <dd><p>Update statement <code>S</code> if it has been marked modified.
  237. </p></dd></dl>
  238. <dl>
  239. <dt><a name="index-gimple_005fcopy"></a>GIMPLE function: <em>gimple</em> <strong>gimple_copy</strong> <em>(gimple stmt)</em></dt>
  240. <dd><p>Return a deep copy of statement <code>STMT</code>.
  241. </p></dd></dl>
  242. <hr>
  243. <div class="header">
  244. <p>
  245. Next: <a href="Tuple-specific-accessors.html#Tuple-specific-accessors" accesskey="n" rel="next">Tuple specific accessors</a>, Previous: <a href="Operands.html#Operands" accesskey="p" rel="prev">Operands</a>, Up: <a href="GIMPLE.html#GIMPLE" accesskey="u" rel="up">GIMPLE</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  246. </div>
  247. </body>
  248. </html>