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.

Basic-Statements.html 9.1KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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>Basic Statements (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Basic Statements (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Basic 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="Statements.html#Statements" rel="up" title="Statements">
  30. <link href="Blocks.html#Blocks" rel="next" title="Blocks">
  31. <link href="Statements.html#Statements" rel="prev" title="Statements">
  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="Basic-Statements"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Blocks.html#Blocks" accesskey="n" rel="next">Blocks</a>, Up: <a href="Statements.html#Statements" accesskey="u" rel="up">Statements</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="Basic-Statements-1"></a>
  68. <h4 class="subsection">11.7.1 Basic Statements</h4>
  69. <a name="index-Basic-Statements"></a>
  70. <dl compact="compact">
  71. <dt><code>ASM_EXPR</code></dt>
  72. <dd>
  73. <p>Used to represent an inline assembly statement. For an inline assembly
  74. statement like:
  75. </p><div class="smallexample">
  76. <pre class="smallexample">asm (&quot;mov x, y&quot;);
  77. </pre></div>
  78. <p>The <code>ASM_STRING</code> macro will return a <code>STRING_CST</code> node for
  79. <code>&quot;mov x, y&quot;</code>. If the original statement made use of the
  80. extended-assembly syntax, then <code>ASM_OUTPUTS</code>,
  81. <code>ASM_INPUTS</code>, and <code>ASM_CLOBBERS</code> will be the outputs, inputs,
  82. and clobbers for the statement, represented as <code>STRING_CST</code> nodes.
  83. The extended-assembly syntax looks like:
  84. </p><div class="smallexample">
  85. <pre class="smallexample">asm (&quot;fsinx %1,%0&quot; : &quot;=f&quot; (result) : &quot;f&quot; (angle));
  86. </pre></div>
  87. <p>The first string is the <code>ASM_STRING</code>, containing the instruction
  88. template. The next two strings are the output and inputs, respectively;
  89. this statement has no clobbers. As this example indicates, &ldquo;plain&rdquo;
  90. assembly statements are merely a special case of extended assembly
  91. statements; they have no cv-qualifiers, outputs, inputs, or clobbers.
  92. All of the strings will be <code>NUL</code>-terminated, and will contain no
  93. embedded <code>NUL</code>-characters.
  94. </p>
  95. <p>If the assembly statement is declared <code>volatile</code>, or if the
  96. statement was not an extended assembly statement, and is therefore
  97. implicitly volatile, then the predicate <code>ASM_VOLATILE_P</code> will hold
  98. of the <code>ASM_EXPR</code>.
  99. </p>
  100. </dd>
  101. <dt><code>DECL_EXPR</code></dt>
  102. <dd>
  103. <p>Used to represent a local declaration. The <code>DECL_EXPR_DECL</code> macro
  104. can be used to obtain the entity declared. This declaration may be a
  105. <code>LABEL_DECL</code>, indicating that the label declared is a local label.
  106. (As an extension, GCC allows the declaration of labels with scope.) In
  107. C, this declaration may be a <code>FUNCTION_DECL</code>, indicating the
  108. use of the GCC nested function extension. For more information,
  109. see <a href="Functions.html#Functions">Functions</a>.
  110. </p>
  111. </dd>
  112. <dt><code>LABEL_EXPR</code></dt>
  113. <dd>
  114. <p>Used to represent a label. The <code>LABEL_DECL</code> declared by this
  115. statement can be obtained with the <code>LABEL_EXPR_LABEL</code> macro. The
  116. <code>IDENTIFIER_NODE</code> giving the name of the label can be obtained from
  117. the <code>LABEL_DECL</code> with <code>DECL_NAME</code>.
  118. </p>
  119. </dd>
  120. <dt><code>GOTO_EXPR</code></dt>
  121. <dd>
  122. <p>Used to represent a <code>goto</code> statement. The <code>GOTO_DESTINATION</code> will
  123. usually be a <code>LABEL_DECL</code>. However, if the &ldquo;computed goto&rdquo; extension
  124. has been used, the <code>GOTO_DESTINATION</code> will be an arbitrary expression
  125. indicating the destination. This expression will always have pointer type.
  126. </p>
  127. </dd>
  128. <dt><code>RETURN_EXPR</code></dt>
  129. <dd>
  130. <p>Used to represent a <code>return</code> statement. Operand 0 represents the
  131. value to return. It should either be the <code>RESULT_DECL</code> for the
  132. containing function, or a <code>MODIFY_EXPR</code> or <code>INIT_EXPR</code>
  133. setting the function&rsquo;s <code>RESULT_DECL</code>. It will be
  134. <code>NULL_TREE</code> if the statement was just
  135. </p><div class="smallexample">
  136. <pre class="smallexample">return;
  137. </pre></div>
  138. </dd>
  139. <dt><code>LOOP_EXPR</code></dt>
  140. <dd><p>These nodes represent &ldquo;infinite&rdquo; loops. The <code>LOOP_EXPR_BODY</code>
  141. represents the body of the loop. It should be executed forever, unless
  142. an <code>EXIT_EXPR</code> is encountered.
  143. </p>
  144. </dd>
  145. <dt><code>EXIT_EXPR</code></dt>
  146. <dd><p>These nodes represent conditional exits from the nearest enclosing
  147. <code>LOOP_EXPR</code>. The single operand is the condition; if it is
  148. nonzero, then the loop should be exited. An <code>EXIT_EXPR</code> will only
  149. appear within a <code>LOOP_EXPR</code>.
  150. </p>
  151. </dd>
  152. <dt><code>SWITCH_STMT</code></dt>
  153. <dd>
  154. <p>Used to represent a <code>switch</code> statement. The <code>SWITCH_STMT_COND</code>
  155. is the expression on which the switch is occurring. See the documentation
  156. for an <code>IF_STMT</code> for more information on the representation used
  157. for the condition. The <code>SWITCH_STMT_BODY</code> is the body of the switch
  158. statement. The <code>SWITCH_STMT_TYPE</code> is the original type of switch
  159. expression as given in the source, before any compiler conversions.
  160. </p>
  161. </dd>
  162. <dt><code>CASE_LABEL_EXPR</code></dt>
  163. <dd>
  164. <p>Use to represent a <code>case</code> label, range of <code>case</code> labels, or a
  165. <code>default</code> label. If <code>CASE_LOW</code> is <code>NULL_TREE</code>, then this is a
  166. <code>default</code> label. Otherwise, if <code>CASE_HIGH</code> is <code>NULL_TREE</code>, then
  167. this is an ordinary <code>case</code> label. In this case, <code>CASE_LOW</code> is
  168. an expression giving the value of the label. Both <code>CASE_LOW</code> and
  169. <code>CASE_HIGH</code> are <code>INTEGER_CST</code> nodes. These values will have
  170. the same type as the condition expression in the switch statement.
  171. </p>
  172. <p>Otherwise, if both <code>CASE_LOW</code> and <code>CASE_HIGH</code> are defined, the
  173. statement is a range of case labels. Such statements originate with the
  174. extension that allows users to write things of the form:
  175. </p><div class="smallexample">
  176. <pre class="smallexample">case 2 ... 5:
  177. </pre></div>
  178. <p>The first value will be <code>CASE_LOW</code>, while the second will be
  179. <code>CASE_HIGH</code>.
  180. </p>
  181. </dd>
  182. <dt><code>DEBUG_BEGIN_STMT</code></dt>
  183. <dd>
  184. <p>Marks the beginning of a source statement, for purposes of debug
  185. information generation.
  186. </p>
  187. </dd>
  188. </dl>
  189. <hr>
  190. <div class="header">
  191. <p>
  192. Next: <a href="Blocks.html#Blocks" accesskey="n" rel="next">Blocks</a>, Up: <a href="Statements.html#Statements" accesskey="u" rel="up">Statements</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>
  193. </div>
  194. </body>
  195. </html>