Basic-Statements.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: Basic Statements</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Basic Statements">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Basic Statements">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Basic-Statements"></a>
  63. <div class="header">
  64. <p>
  65. 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>
  66. </div>
  67. <hr>
  68. <a name="Basic-Statements-1"></a>
  69. <h4 class="subsection">10.7.1 Basic Statements</h4>
  70. <a name="index-Basic-Statements"></a>
  71. <dl compact="compact">
  72. <dt><code>ASM_EXPR</code></dt>
  73. <dd>
  74. <p>Used to represent an inline assembly statement. For an inline assembly
  75. statement like:
  76. </p><div class="smallexample">
  77. <pre class="smallexample">asm (&quot;mov x, y&quot;);
  78. </pre></div>
  79. <p>The <code>ASM_STRING</code> macro will return a <code>STRING_CST</code> node for
  80. <code>&quot;mov x, y&quot;</code>. If the original statement made use of the
  81. extended-assembly syntax, then <code>ASM_OUTPUTS</code>,
  82. <code>ASM_INPUTS</code>, and <code>ASM_CLOBBERS</code> will be the outputs, inputs,
  83. and clobbers for the statement, represented as <code>STRING_CST</code> nodes.
  84. The extended-assembly syntax looks like:
  85. </p><div class="smallexample">
  86. <pre class="smallexample">asm (&quot;fsinx %1,%0&quot; : &quot;=f&quot; (result) : &quot;f&quot; (angle));
  87. </pre></div>
  88. <p>The first string is the <code>ASM_STRING</code>, containing the instruction
  89. template. The next two strings are the output and inputs, respectively;
  90. this statement has no clobbers. As this example indicates, &ldquo;plain&rdquo;
  91. assembly statements are merely a special case of extended assembly
  92. statements; they have no cv-qualifiers, outputs, inputs, or clobbers.
  93. All of the strings will be <code>NUL</code>-terminated, and will contain no
  94. embedded <code>NUL</code>-characters.
  95. </p>
  96. <p>If the assembly statement is declared <code>volatile</code>, or if the
  97. statement was not an extended assembly statement, and is therefore
  98. implicitly volatile, then the predicate <code>ASM_VOLATILE_P</code> will hold
  99. of the <code>ASM_EXPR</code>.
  100. </p>
  101. </dd>
  102. <dt><code>DECL_EXPR</code></dt>
  103. <dd>
  104. <p>Used to represent a local declaration. The <code>DECL_EXPR_DECL</code> macro
  105. can be used to obtain the entity declared. This declaration may be a
  106. <code>LABEL_DECL</code>, indicating that the label declared is a local label.
  107. (As an extension, GCC allows the declaration of labels with scope.) In
  108. C, this declaration may be a <code>FUNCTION_DECL</code>, indicating the
  109. use of the GCC nested function extension. For more information,
  110. see <a href="Functions.html#Functions">Functions</a>.
  111. </p>
  112. </dd>
  113. <dt><code>LABEL_EXPR</code></dt>
  114. <dd>
  115. <p>Used to represent a label. The <code>LABEL_DECL</code> declared by this
  116. statement can be obtained with the <code>LABEL_EXPR_LABEL</code> macro. The
  117. <code>IDENTIFIER_NODE</code> giving the name of the label can be obtained from
  118. the <code>LABEL_DECL</code> with <code>DECL_NAME</code>.
  119. </p>
  120. </dd>
  121. <dt><code>GOTO_EXPR</code></dt>
  122. <dd>
  123. <p>Used to represent a <code>goto</code> statement. The <code>GOTO_DESTINATION</code> will
  124. usually be a <code>LABEL_DECL</code>. However, if the &ldquo;computed goto&rdquo; extension
  125. has been used, the <code>GOTO_DESTINATION</code> will be an arbitrary expression
  126. indicating the destination. This expression will always have pointer type.
  127. </p>
  128. </dd>
  129. <dt><code>RETURN_EXPR</code></dt>
  130. <dd>
  131. <p>Used to represent a <code>return</code> statement. Operand 0 represents the
  132. value to return. It should either be the <code>RESULT_DECL</code> for the
  133. containing function, or a <code>MODIFY_EXPR</code> or <code>INIT_EXPR</code>
  134. setting the function&rsquo;s <code>RESULT_DECL</code>. It will be
  135. <code>NULL_TREE</code> if the statement was just
  136. </p><div class="smallexample">
  137. <pre class="smallexample">return;
  138. </pre></div>
  139. </dd>
  140. <dt><code>LOOP_EXPR</code></dt>
  141. <dd><p>These nodes represent &ldquo;infinite&rdquo; loops. The <code>LOOP_EXPR_BODY</code>
  142. represents the body of the loop. It should be executed forever, unless
  143. an <code>EXIT_EXPR</code> is encountered.
  144. </p>
  145. </dd>
  146. <dt><code>EXIT_EXPR</code></dt>
  147. <dd><p>These nodes represent conditional exits from the nearest enclosing
  148. <code>LOOP_EXPR</code>. The single operand is the condition; if it is
  149. nonzero, then the loop should be exited. An <code>EXIT_EXPR</code> will only
  150. appear within a <code>LOOP_EXPR</code>.
  151. </p>
  152. </dd>
  153. <dt><code>SWITCH_STMT</code></dt>
  154. <dd>
  155. <p>Used to represent a <code>switch</code> statement. The <code>SWITCH_STMT_COND</code>
  156. is the expression on which the switch is occurring. See the documentation
  157. for an <code>IF_STMT</code> for more information on the representation used
  158. for the condition. The <code>SWITCH_STMT_BODY</code> is the body of the switch
  159. statement. The <code>SWITCH_STMT_TYPE</code> is the original type of switch
  160. expression as given in the source, before any compiler conversions.
  161. </p>
  162. </dd>
  163. <dt><code>CASE_LABEL_EXPR</code></dt>
  164. <dd>
  165. <p>Use to represent a <code>case</code> label, range of <code>case</code> labels, or a
  166. <code>default</code> label. If <code>CASE_LOW</code> is <code>NULL_TREE</code>, then this is a
  167. <code>default</code> label. Otherwise, if <code>CASE_HIGH</code> is <code>NULL_TREE</code>, then
  168. this is an ordinary <code>case</code> label. In this case, <code>CASE_LOW</code> is
  169. an expression giving the value of the label. Both <code>CASE_LOW</code> and
  170. <code>CASE_HIGH</code> are <code>INTEGER_CST</code> nodes. These values will have
  171. the same type as the condition expression in the switch statement.
  172. </p>
  173. <p>Otherwise, if both <code>CASE_LOW</code> and <code>CASE_HIGH</code> are defined, the
  174. statement is a range of case labels. Such statements originate with the
  175. extension that allows users to write things of the form:
  176. </p><div class="smallexample">
  177. <pre class="smallexample">case 2 ... 5:
  178. </pre></div>
  179. <p>The first value will be <code>CASE_LOW</code>, while the second will be
  180. <code>CASE_HIGH</code>.
  181. </p>
  182. </dd>
  183. </dl>
  184. <hr>
  185. <div class="header">
  186. <p>
  187. 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>
  188. </div>
  189. </body>
  190. </html>