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.

Unary-and-Binary-Expressions.html 30KB

3 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  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>Unary and Binary Expressions (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Unary and Binary Expressions (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Unary and Binary Expressions (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="Expression-trees.html#Expression-trees" rel="up" title="Expression trees">
  30. <link href="Vectors.html#Vectors" rel="next" title="Vectors">
  31. <link href="Storage-References.html#Storage-References" rel="prev" title="Storage References">
  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="Unary-and-Binary-Expressions"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Vectors.html#Vectors" accesskey="n" rel="next">Vectors</a>, Previous: <a href="Storage-References.html#Storage-References" accesskey="p" rel="prev">Storage References</a>, Up: <a href="Expression-trees.html#Expression-trees" accesskey="u" rel="up">Expression trees</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="Unary-and-Binary-Expressions-1"></a>
  68. <h4 class="subsection">11.6.3 Unary and Binary Expressions</h4>
  69. <a name="index-NEGATE_005fEXPR"></a>
  70. <a name="index-ABS_005fEXPR"></a>
  71. <a name="index-ABSU_005fEXPR"></a>
  72. <a name="index-BIT_005fNOT_005fEXPR"></a>
  73. <a name="index-TRUTH_005fNOT_005fEXPR"></a>
  74. <a name="index-PREDECREMENT_005fEXPR"></a>
  75. <a name="index-PREINCREMENT_005fEXPR"></a>
  76. <a name="index-POSTDECREMENT_005fEXPR"></a>
  77. <a name="index-POSTINCREMENT_005fEXPR"></a>
  78. <a name="index-FIX_005fTRUNC_005fEXPR"></a>
  79. <a name="index-FLOAT_005fEXPR"></a>
  80. <a name="index-COMPLEX_005fEXPR"></a>
  81. <a name="index-CONJ_005fEXPR"></a>
  82. <a name="index-REALPART_005fEXPR"></a>
  83. <a name="index-IMAGPART_005fEXPR"></a>
  84. <a name="index-NON_005fLVALUE_005fEXPR"></a>
  85. <a name="index-NOP_005fEXPR"></a>
  86. <a name="index-CONVERT_005fEXPR"></a>
  87. <a name="index-FIXED_005fCONVERT_005fEXPR"></a>
  88. <a name="index-THROW_005fEXPR"></a>
  89. <a name="index-LSHIFT_005fEXPR"></a>
  90. <a name="index-RSHIFT_005fEXPR"></a>
  91. <a name="index-BIT_005fIOR_005fEXPR"></a>
  92. <a name="index-BIT_005fXOR_005fEXPR"></a>
  93. <a name="index-BIT_005fAND_005fEXPR"></a>
  94. <a name="index-TRUTH_005fANDIF_005fEXPR"></a>
  95. <a name="index-TRUTH_005fORIF_005fEXPR"></a>
  96. <a name="index-TRUTH_005fAND_005fEXPR"></a>
  97. <a name="index-TRUTH_005fOR_005fEXPR"></a>
  98. <a name="index-TRUTH_005fXOR_005fEXPR"></a>
  99. <a name="index-POINTER_005fPLUS_005fEXPR"></a>
  100. <a name="index-POINTER_005fDIFF_005fEXPR"></a>
  101. <a name="index-PLUS_005fEXPR"></a>
  102. <a name="index-MINUS_005fEXPR"></a>
  103. <a name="index-MULT_005fEXPR"></a>
  104. <a name="index-MULT_005fHIGHPART_005fEXPR"></a>
  105. <a name="index-RDIV_005fEXPR"></a>
  106. <a name="index-TRUNC_005fDIV_005fEXPR"></a>
  107. <a name="index-FLOOR_005fDIV_005fEXPR"></a>
  108. <a name="index-CEIL_005fDIV_005fEXPR"></a>
  109. <a name="index-ROUND_005fDIV_005fEXPR"></a>
  110. <a name="index-TRUNC_005fMOD_005fEXPR"></a>
  111. <a name="index-FLOOR_005fMOD_005fEXPR"></a>
  112. <a name="index-CEIL_005fMOD_005fEXPR"></a>
  113. <a name="index-ROUND_005fMOD_005fEXPR"></a>
  114. <a name="index-EXACT_005fDIV_005fEXPR"></a>
  115. <a name="index-LT_005fEXPR"></a>
  116. <a name="index-LE_005fEXPR"></a>
  117. <a name="index-GT_005fEXPR"></a>
  118. <a name="index-GE_005fEXPR"></a>
  119. <a name="index-EQ_005fEXPR"></a>
  120. <a name="index-NE_005fEXPR"></a>
  121. <a name="index-ORDERED_005fEXPR"></a>
  122. <a name="index-UNORDERED_005fEXPR"></a>
  123. <a name="index-UNLT_005fEXPR"></a>
  124. <a name="index-UNLE_005fEXPR"></a>
  125. <a name="index-UNGT_005fEXPR"></a>
  126. <a name="index-UNGE_005fEXPR"></a>
  127. <a name="index-UNEQ_005fEXPR"></a>
  128. <a name="index-LTGT_005fEXPR"></a>
  129. <a name="index-MODIFY_005fEXPR"></a>
  130. <a name="index-INIT_005fEXPR"></a>
  131. <a name="index-COMPOUND_005fEXPR"></a>
  132. <a name="index-COND_005fEXPR"></a>
  133. <a name="index-CALL_005fEXPR"></a>
  134. <a name="index-STMT_005fEXPR"></a>
  135. <a name="index-BIND_005fEXPR"></a>
  136. <a name="index-LOOP_005fEXPR"></a>
  137. <a name="index-EXIT_005fEXPR"></a>
  138. <a name="index-CLEANUP_005fPOINT_005fEXPR"></a>
  139. <a name="index-CONSTRUCTOR"></a>
  140. <a name="index-COMPOUND_005fLITERAL_005fEXPR"></a>
  141. <a name="index-SAVE_005fEXPR"></a>
  142. <a name="index-TARGET_005fEXPR"></a>
  143. <a name="index-VA_005fARG_005fEXPR"></a>
  144. <a name="index-ANNOTATE_005fEXPR"></a>
  145. <dl compact="compact">
  146. <dt><code>NEGATE_EXPR</code></dt>
  147. <dd><p>These nodes represent unary negation of the single operand, for both
  148. integer and floating-point types. The type of negation can be
  149. determined by looking at the type of the expression.
  150. </p>
  151. <p>The behavior of this operation on signed arithmetic overflow is
  152. controlled by the <code>flag_wrapv</code> and <code>flag_trapv</code> variables.
  153. </p>
  154. </dd>
  155. <dt><code>ABS_EXPR</code></dt>
  156. <dd><p>These nodes represent the absolute value of the single operand, for
  157. both integer and floating-point types. This is typically used to
  158. implement the <code>abs</code>, <code>labs</code> and <code>llabs</code> builtins for
  159. integer types, and the <code>fabs</code>, <code>fabsf</code> and <code>fabsl</code>
  160. builtins for floating point types. The type of abs operation can
  161. be determined by looking at the type of the expression.
  162. </p>
  163. <p>This node is not used for complex types. To represent the modulus
  164. or complex abs of a complex value, use the <code>BUILT_IN_CABS</code>,
  165. <code>BUILT_IN_CABSF</code> or <code>BUILT_IN_CABSL</code> builtins, as used
  166. to implement the C99 <code>cabs</code>, <code>cabsf</code> and <code>cabsl</code>
  167. built-in functions.
  168. </p>
  169. </dd>
  170. <dt><code>ABSU_EXPR</code></dt>
  171. <dd><p>These nodes represent the absolute value of the single operand in
  172. equivalent unsigned type such that <code>ABSU_EXPR</code> of <code>TYPE_MIN</code>
  173. is well defined.
  174. </p>
  175. </dd>
  176. <dt><code>BIT_NOT_EXPR</code></dt>
  177. <dd><p>These nodes represent bitwise complement, and will always have integral
  178. type. The only operand is the value to be complemented.
  179. </p>
  180. </dd>
  181. <dt><code>TRUTH_NOT_EXPR</code></dt>
  182. <dd><p>These nodes represent logical negation, and will always have integral
  183. (or boolean) type. The operand is the value being negated. The type
  184. of the operand and that of the result are always of <code>BOOLEAN_TYPE</code>
  185. or <code>INTEGER_TYPE</code>.
  186. </p>
  187. </dd>
  188. <dt><code>PREDECREMENT_EXPR</code></dt>
  189. <dt><code>PREINCREMENT_EXPR</code></dt>
  190. <dt><code>POSTDECREMENT_EXPR</code></dt>
  191. <dt><code>POSTINCREMENT_EXPR</code></dt>
  192. <dd><p>These nodes represent increment and decrement expressions. The value of
  193. the single operand is computed, and the operand incremented or
  194. decremented. In the case of <code>PREDECREMENT_EXPR</code> and
  195. <code>PREINCREMENT_EXPR</code>, the value of the expression is the value
  196. resulting after the increment or decrement; in the case of
  197. <code>POSTDECREMENT_EXPR</code> and <code>POSTINCREMENT_EXPR</code> is the value
  198. before the increment or decrement occurs. The type of the operand, like
  199. that of the result, will be either integral, boolean, or floating-point.
  200. </p>
  201. </dd>
  202. <dt><code>FIX_TRUNC_EXPR</code></dt>
  203. <dd><p>These nodes represent conversion of a floating-point value to an
  204. integer. The single operand will have a floating-point type, while
  205. the complete expression will have an integral (or boolean) type. The
  206. operand is rounded towards zero.
  207. </p>
  208. </dd>
  209. <dt><code>FLOAT_EXPR</code></dt>
  210. <dd><p>These nodes represent conversion of an integral (or boolean) value to a
  211. floating-point value. The single operand will have integral type, while
  212. the complete expression will have a floating-point type.
  213. </p>
  214. <p>FIXME: How is the operand supposed to be rounded? Is this dependent on
  215. <samp>-mieee</samp>?
  216. </p>
  217. </dd>
  218. <dt><code>COMPLEX_EXPR</code></dt>
  219. <dd><p>These nodes are used to represent complex numbers constructed from two
  220. expressions of the same (integer or real) type. The first operand is the
  221. real part and the second operand is the imaginary part.
  222. </p>
  223. </dd>
  224. <dt><code>CONJ_EXPR</code></dt>
  225. <dd><p>These nodes represent the conjugate of their operand.
  226. </p>
  227. </dd>
  228. <dt><code>REALPART_EXPR</code></dt>
  229. <dt><code>IMAGPART_EXPR</code></dt>
  230. <dd><p>These nodes represent respectively the real and the imaginary parts
  231. of complex numbers (their sole argument).
  232. </p>
  233. </dd>
  234. <dt><code>NON_LVALUE_EXPR</code></dt>
  235. <dd><p>These nodes indicate that their one and only operand is not an lvalue.
  236. A back end can treat these identically to the single operand.
  237. </p>
  238. </dd>
  239. <dt><code>NOP_EXPR</code></dt>
  240. <dd><p>These nodes are used to represent conversions that do not require any
  241. code-generation. For example, conversion of a <code>char*</code> to an
  242. <code>int*</code> does not require any code be generated; such a conversion is
  243. represented by a <code>NOP_EXPR</code>. The single operand is the expression
  244. to be converted. The conversion from a pointer to a reference is also
  245. represented with a <code>NOP_EXPR</code>.
  246. </p>
  247. </dd>
  248. <dt><code>CONVERT_EXPR</code></dt>
  249. <dd><p>These nodes are similar to <code>NOP_EXPR</code>s, but are used in those
  250. situations where code may need to be generated. For example, if an
  251. <code>int*</code> is converted to an <code>int</code> code may need to be generated
  252. on some platforms. These nodes are never used for C++-specific
  253. conversions, like conversions between pointers to different classes in
  254. an inheritance hierarchy. Any adjustments that need to be made in such
  255. cases are always indicated explicitly. Similarly, a user-defined
  256. conversion is never represented by a <code>CONVERT_EXPR</code>; instead, the
  257. function calls are made explicit.
  258. </p>
  259. </dd>
  260. <dt><code>FIXED_CONVERT_EXPR</code></dt>
  261. <dd><p>These nodes are used to represent conversions that involve fixed-point
  262. values. For example, from a fixed-point value to another fixed-point value,
  263. from an integer to a fixed-point value, from a fixed-point value to an
  264. integer, from a floating-point value to a fixed-point value, or from
  265. a fixed-point value to a floating-point value.
  266. </p>
  267. </dd>
  268. <dt><code>LSHIFT_EXPR</code></dt>
  269. <dt><code>RSHIFT_EXPR</code></dt>
  270. <dd><p>These nodes represent left and right shifts, respectively. The first
  271. operand is the value to shift; it will always be of integral type. The
  272. second operand is an expression for the number of bits by which to
  273. shift. Right shift should be treated as arithmetic, i.e., the
  274. high-order bits should be zero-filled when the expression has unsigned
  275. type and filled with the sign bit when the expression has signed type.
  276. Note that the result is undefined if the second operand is larger
  277. than or equal to the first operand&rsquo;s type size. Unlike most nodes, these
  278. can have a vector as first operand and a scalar as second operand.
  279. </p>
  280. </dd>
  281. <dt><code>BIT_IOR_EXPR</code></dt>
  282. <dt><code>BIT_XOR_EXPR</code></dt>
  283. <dt><code>BIT_AND_EXPR</code></dt>
  284. <dd><p>These nodes represent bitwise inclusive or, bitwise exclusive or, and
  285. bitwise and, respectively. Both operands will always have integral
  286. type.
  287. </p>
  288. </dd>
  289. <dt><code>TRUTH_ANDIF_EXPR</code></dt>
  290. <dt><code>TRUTH_ORIF_EXPR</code></dt>
  291. <dd><p>These nodes represent logical &ldquo;and&rdquo; and logical &ldquo;or&rdquo;, respectively.
  292. These operators are not strict; i.e., the second operand is evaluated
  293. only if the value of the expression is not determined by evaluation of
  294. the first operand. The type of the operands and that of the result are
  295. always of <code>BOOLEAN_TYPE</code> or <code>INTEGER_TYPE</code>.
  296. </p>
  297. </dd>
  298. <dt><code>TRUTH_AND_EXPR</code></dt>
  299. <dt><code>TRUTH_OR_EXPR</code></dt>
  300. <dt><code>TRUTH_XOR_EXPR</code></dt>
  301. <dd><p>These nodes represent logical and, logical or, and logical exclusive or.
  302. They are strict; both arguments are always evaluated. There are no
  303. corresponding operators in C or C++, but the front end will sometimes
  304. generate these expressions anyhow, if it can tell that strictness does
  305. not matter. The type of the operands and that of the result are
  306. always of <code>BOOLEAN_TYPE</code> or <code>INTEGER_TYPE</code>.
  307. </p>
  308. </dd>
  309. <dt><code>POINTER_PLUS_EXPR</code></dt>
  310. <dd><p>This node represents pointer arithmetic. The first operand is always
  311. a pointer/reference type. The second operand is always an unsigned
  312. integer type compatible with sizetype. This and POINTER_DIFF_EXPR are
  313. the only binary arithmetic operators that can operate on pointer types.
  314. </p>
  315. </dd>
  316. <dt><code>POINTER_DIFF_EXPR</code></dt>
  317. <dd><p>This node represents pointer subtraction. The two operands always
  318. have pointer/reference type. It returns a signed integer of the same
  319. precision as the pointers. The behavior is undefined if the difference
  320. of the two pointers, seen as infinite precision non-negative integers,
  321. does not fit in the result type. The result does not depend on the
  322. pointer type, it is not divided by the size of the pointed-to type.
  323. </p>
  324. </dd>
  325. <dt><code>PLUS_EXPR</code></dt>
  326. <dt><code>MINUS_EXPR</code></dt>
  327. <dt><code>MULT_EXPR</code></dt>
  328. <dd><p>These nodes represent various binary arithmetic operations.
  329. Respectively, these operations are addition, subtraction (of the second
  330. operand from the first) and multiplication. Their operands may have
  331. either integral or floating type, but there will never be case in which
  332. one operand is of floating type and the other is of integral type.
  333. </p>
  334. <p>The behavior of these operations on signed arithmetic overflow is
  335. controlled by the <code>flag_wrapv</code> and <code>flag_trapv</code> variables.
  336. </p>
  337. </dd>
  338. <dt><code>MULT_HIGHPART_EXPR</code></dt>
  339. <dd><p>This node represents the &ldquo;high-part&rdquo; of a widening multiplication.
  340. For an integral type with <var>b</var> bits of precision, the result is
  341. the most significant <var>b</var> bits of the full <em>2<var>b</var></em> product.
  342. </p>
  343. </dd>
  344. <dt><code>RDIV_EXPR</code></dt>
  345. <dd><p>This node represents a floating point division operation.
  346. </p>
  347. </dd>
  348. <dt><code>TRUNC_DIV_EXPR</code></dt>
  349. <dt><code>FLOOR_DIV_EXPR</code></dt>
  350. <dt><code>CEIL_DIV_EXPR</code></dt>
  351. <dt><code>ROUND_DIV_EXPR</code></dt>
  352. <dd><p>These nodes represent integer division operations that return an integer
  353. result. <code>TRUNC_DIV_EXPR</code> rounds towards zero, <code>FLOOR_DIV_EXPR</code>
  354. rounds towards negative infinity, <code>CEIL_DIV_EXPR</code> rounds towards
  355. positive infinity and <code>ROUND_DIV_EXPR</code> rounds to the closest integer.
  356. Integer division in C and C++ is truncating, i.e. <code>TRUNC_DIV_EXPR</code>.
  357. </p>
  358. <p>The behavior of these operations on signed arithmetic overflow, when
  359. dividing the minimum signed integer by minus one, is controlled by the
  360. <code>flag_wrapv</code> and <code>flag_trapv</code> variables.
  361. </p>
  362. </dd>
  363. <dt><code>TRUNC_MOD_EXPR</code></dt>
  364. <dt><code>FLOOR_MOD_EXPR</code></dt>
  365. <dt><code>CEIL_MOD_EXPR</code></dt>
  366. <dt><code>ROUND_MOD_EXPR</code></dt>
  367. <dd><p>These nodes represent the integer remainder or modulus operation.
  368. The integer modulus of two operands <code>a</code> and <code>b</code> is
  369. defined as <code>a - (a/b)*b</code> where the division calculated using
  370. the corresponding division operator. Hence for <code>TRUNC_MOD_EXPR</code>
  371. this definition assumes division using truncation towards zero, i.e.
  372. <code>TRUNC_DIV_EXPR</code>. Integer remainder in C and C++ uses truncating
  373. division, i.e. <code>TRUNC_MOD_EXPR</code>.
  374. </p>
  375. </dd>
  376. <dt><code>EXACT_DIV_EXPR</code></dt>
  377. <dd><p>The <code>EXACT_DIV_EXPR</code> code is used to represent integer divisions where
  378. the numerator is known to be an exact multiple of the denominator. This
  379. allows the backend to choose between the faster of <code>TRUNC_DIV_EXPR</code>,
  380. <code>CEIL_DIV_EXPR</code> and <code>FLOOR_DIV_EXPR</code> for the current target.
  381. </p>
  382. </dd>
  383. <dt><code>LT_EXPR</code></dt>
  384. <dt><code>LE_EXPR</code></dt>
  385. <dt><code>GT_EXPR</code></dt>
  386. <dt><code>GE_EXPR</code></dt>
  387. <dt><code>LTGT_EXPR</code></dt>
  388. <dt><code>EQ_EXPR</code></dt>
  389. <dt><code>NE_EXPR</code></dt>
  390. <dd><p>These nodes represent the less than, less than or equal to, greater than,
  391. greater than or equal to, less or greater than, equal, and not equal
  392. comparison operators. The first and second operands will either be both
  393. of integral type, both of floating type or both of vector type, except for
  394. LTGT_EXPR where they will only be both of floating type. The result type
  395. of these expressions will always be of integral, boolean or signed integral
  396. vector type. These operations return the result type&rsquo;s zero value for false,
  397. the result type&rsquo;s one value for true, and a vector whose elements are zero
  398. (false) or minus one (true) for vectors.
  399. </p>
  400. <p>For floating point comparisons, if we honor IEEE NaNs and either operand
  401. is NaN, then <code>NE_EXPR</code> always returns true and the remaining operators
  402. always return false. On some targets, comparisons against an IEEE NaN,
  403. other than equality and inequality, may generate a floating-point exception.
  404. </p>
  405. </dd>
  406. <dt><code>ORDERED_EXPR</code></dt>
  407. <dt><code>UNORDERED_EXPR</code></dt>
  408. <dd><p>These nodes represent non-trapping ordered and unordered comparison
  409. operators. These operations take two floating point operands and
  410. determine whether they are ordered or unordered relative to each other.
  411. If either operand is an IEEE NaN, their comparison is defined to be
  412. unordered, otherwise the comparison is defined to be ordered. The
  413. result type of these expressions will always be of integral or boolean
  414. type. These operations return the result type&rsquo;s zero value for false,
  415. and the result type&rsquo;s one value for true.
  416. </p>
  417. </dd>
  418. <dt><code>UNLT_EXPR</code></dt>
  419. <dt><code>UNLE_EXPR</code></dt>
  420. <dt><code>UNGT_EXPR</code></dt>
  421. <dt><code>UNGE_EXPR</code></dt>
  422. <dt><code>UNEQ_EXPR</code></dt>
  423. <dd><p>These nodes represent the unordered comparison operators.
  424. These operations take two floating point operands and determine whether
  425. the operands are unordered or are less than, less than or equal to,
  426. greater than, greater than or equal to, or equal respectively. For
  427. example, <code>UNLT_EXPR</code> returns true if either operand is an IEEE
  428. NaN or the first operand is less than the second. All these operations
  429. are guaranteed not to generate a floating point exception. The result
  430. type of these expressions will always be of integral or boolean type.
  431. These operations return the result type&rsquo;s zero value for false,
  432. and the result type&rsquo;s one value for true.
  433. </p>
  434. </dd>
  435. <dt><code>MODIFY_EXPR</code></dt>
  436. <dd><p>These nodes represent assignment. The left-hand side is the first
  437. operand; the right-hand side is the second operand. The left-hand side
  438. will be a <code>VAR_DECL</code>, <code>INDIRECT_REF</code>, <code>COMPONENT_REF</code>, or
  439. other lvalue.
  440. </p>
  441. <p>These nodes are used to represent not only assignment with &lsquo;<samp>=</samp>&rsquo; but
  442. also compound assignments (like &lsquo;<samp>+=</samp>&rsquo;), by reduction to &lsquo;<samp>=</samp>&rsquo;
  443. assignment. In other words, the representation for &lsquo;<samp>i += 3</samp>&rsquo; looks
  444. just like that for &lsquo;<samp>i = i + 3</samp>&rsquo;.
  445. </p>
  446. </dd>
  447. <dt><code>INIT_EXPR</code></dt>
  448. <dd><p>These nodes are just like <code>MODIFY_EXPR</code>, but are used only when a
  449. variable is initialized, rather than assigned to subsequently. This
  450. means that we can assume that the target of the initialization is not
  451. used in computing its own value; any reference to the lhs in computing
  452. the rhs is undefined.
  453. </p>
  454. </dd>
  455. <dt><code>COMPOUND_EXPR</code></dt>
  456. <dd><p>These nodes represent comma-expressions. The first operand is an
  457. expression whose value is computed and thrown away prior to the
  458. evaluation of the second operand. The value of the entire expression is
  459. the value of the second operand.
  460. </p>
  461. </dd>
  462. <dt><code>COND_EXPR</code></dt>
  463. <dd><p>These nodes represent <code>?:</code> expressions. The first operand
  464. is of boolean or integral type. If it evaluates to a nonzero value,
  465. the second operand should be evaluated, and returned as the value of the
  466. expression. Otherwise, the third operand is evaluated, and returned as
  467. the value of the expression.
  468. </p>
  469. <p>The second operand must have the same type as the entire expression,
  470. unless it unconditionally throws an exception or calls a noreturn
  471. function, in which case it should have void type. The same constraints
  472. apply to the third operand. This allows array bounds checks to be
  473. represented conveniently as <code>(i &gt;= 0 &amp;&amp; i &lt; 10) ? i : abort()</code>.
  474. </p>
  475. <p>As a GNU extension, the C language front-ends allow the second
  476. operand of the <code>?:</code> operator may be omitted in the source.
  477. For example, <code>x ? : 3</code> is equivalent to <code>x ? x : 3</code>,
  478. assuming that <code>x</code> is an expression without side effects.
  479. In the tree representation, however, the second operand is always
  480. present, possibly protected by <code>SAVE_EXPR</code> if the first
  481. argument does cause side effects.
  482. </p>
  483. </dd>
  484. <dt><code>CALL_EXPR</code></dt>
  485. <dd><p>These nodes are used to represent calls to functions, including
  486. non-static member functions. <code>CALL_EXPR</code>s are implemented as
  487. expression nodes with a variable number of operands. Rather than using
  488. <code>TREE_OPERAND</code> to extract them, it is preferable to use the
  489. specialized accessor macros and functions that operate specifically on
  490. <code>CALL_EXPR</code> nodes.
  491. </p>
  492. <p><code>CALL_EXPR_FN</code> returns a pointer to the
  493. function to call; it is always an expression whose type is a
  494. <code>POINTER_TYPE</code>.
  495. </p>
  496. <p>The number of arguments to the call is returned by <code>call_expr_nargs</code>,
  497. while the arguments themselves can be accessed with the <code>CALL_EXPR_ARG</code>
  498. macro. The arguments are zero-indexed and numbered left-to-right.
  499. You can iterate over the arguments using <code>FOR_EACH_CALL_EXPR_ARG</code>, as in:
  500. </p>
  501. <div class="smallexample">
  502. <pre class="smallexample">tree call, arg;
  503. call_expr_arg_iterator iter;
  504. FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
  505. /* arg is bound to successive arguments of call. */
  506. &hellip;;
  507. </pre></div>
  508. <p>For non-static
  509. member functions, there will be an operand corresponding to the
  510. <code>this</code> pointer. There will always be expressions corresponding to
  511. all of the arguments, even if the function is declared with default
  512. arguments and some arguments are not explicitly provided at the call
  513. sites.
  514. </p>
  515. <p><code>CALL_EXPR</code>s also have a <code>CALL_EXPR_STATIC_CHAIN</code> operand that
  516. is used to implement nested functions. This operand is otherwise null.
  517. </p>
  518. </dd>
  519. <dt><code>CLEANUP_POINT_EXPR</code></dt>
  520. <dd><p>These nodes represent full-expressions. The single operand is an
  521. expression to evaluate. Any destructor calls engendered by the creation
  522. of temporaries during the evaluation of that expression should be
  523. performed immediately after the expression is evaluated.
  524. </p>
  525. </dd>
  526. <dt><code>CONSTRUCTOR</code></dt>
  527. <dd><p>These nodes represent the brace-enclosed initializers for a structure or an
  528. array. They contain a sequence of component values made out of a vector of
  529. constructor_elt, which is a (<code>INDEX</code>, <code>VALUE</code>) pair.
  530. </p>
  531. <p>If the <code>TREE_TYPE</code> of the <code>CONSTRUCTOR</code> is a <code>RECORD_TYPE</code>,
  532. <code>UNION_TYPE</code> or <code>QUAL_UNION_TYPE</code> then the <code>INDEX</code> of each
  533. node in the sequence will be a <code>FIELD_DECL</code> and the <code>VALUE</code> will
  534. be the expression used to initialize that field.
  535. </p>
  536. <p>If the <code>TREE_TYPE</code> of the <code>CONSTRUCTOR</code> is an <code>ARRAY_TYPE</code>,
  537. then the <code>INDEX</code> of each node in the sequence will be an
  538. <code>INTEGER_CST</code> or a <code>RANGE_EXPR</code> of two <code>INTEGER_CST</code>s.
  539. A single <code>INTEGER_CST</code> indicates which element of the array is being
  540. assigned to. A <code>RANGE_EXPR</code> indicates an inclusive range of elements
  541. to initialize. In both cases the <code>VALUE</code> is the corresponding
  542. initializer. It is re-evaluated for each element of a
  543. <code>RANGE_EXPR</code>. If the <code>INDEX</code> is <code>NULL_TREE</code>, then
  544. the initializer is for the next available array element.
  545. </p>
  546. <p>In the front end, you should not depend on the fields appearing in any
  547. particular order. However, in the middle end, fields must appear in
  548. declaration order. You should not assume that all fields will be
  549. represented. Unrepresented fields will be cleared (zeroed), unless the
  550. CONSTRUCTOR_NO_CLEARING flag is set, in which case their value becomes
  551. undefined.
  552. </p>
  553. </dd>
  554. <dt><code>COMPOUND_LITERAL_EXPR</code></dt>
  555. <dd><a name="index-COMPOUND_005fLITERAL_005fEXPR_005fDECL_005fEXPR"></a>
  556. <a name="index-COMPOUND_005fLITERAL_005fEXPR_005fDECL"></a>
  557. <p>These nodes represent ISO C99 compound literals. The
  558. <code>COMPOUND_LITERAL_EXPR_DECL_EXPR</code> is a <code>DECL_EXPR</code>
  559. containing an anonymous <code>VAR_DECL</code> for
  560. the unnamed object represented by the compound literal; the
  561. <code>DECL_INITIAL</code> of that <code>VAR_DECL</code> is a <code>CONSTRUCTOR</code>
  562. representing the brace-enclosed list of initializers in the compound
  563. literal. That anonymous <code>VAR_DECL</code> can also be accessed directly
  564. by the <code>COMPOUND_LITERAL_EXPR_DECL</code> macro.
  565. </p>
  566. </dd>
  567. <dt><code>SAVE_EXPR</code></dt>
  568. <dd>
  569. <p>A <code>SAVE_EXPR</code> represents an expression (possibly involving
  570. side effects) that is used more than once. The side effects should
  571. occur only the first time the expression is evaluated. Subsequent uses
  572. should just reuse the computed value. The first operand to the
  573. <code>SAVE_EXPR</code> is the expression to evaluate. The side effects should
  574. be executed where the <code>SAVE_EXPR</code> is first encountered in a
  575. depth-first preorder traversal of the expression tree.
  576. </p>
  577. </dd>
  578. <dt><code>TARGET_EXPR</code></dt>
  579. <dd><p>A <code>TARGET_EXPR</code> represents a temporary object. The first operand
  580. is a <code>VAR_DECL</code> for the temporary variable. The second operand is
  581. the initializer for the temporary. The initializer is evaluated and,
  582. if non-void, copied (bitwise) into the temporary. If the initializer
  583. is void, that means that it will perform the initialization itself.
  584. </p>
  585. <p>Often, a <code>TARGET_EXPR</code> occurs on the right-hand side of an
  586. assignment, or as the second operand to a comma-expression which is
  587. itself the right-hand side of an assignment, etc. In this case, we say
  588. that the <code>TARGET_EXPR</code> is &ldquo;normal&rdquo;; otherwise, we say it is
  589. &ldquo;orphaned&rdquo;. For a normal <code>TARGET_EXPR</code> the temporary variable
  590. should be treated as an alias for the left-hand side of the assignment,
  591. rather than as a new temporary variable.
  592. </p>
  593. <p>The third operand to the <code>TARGET_EXPR</code>, if present, is a
  594. cleanup-expression (i.e., destructor call) for the temporary. If this
  595. expression is orphaned, then this expression must be executed when the
  596. statement containing this expression is complete. These cleanups must
  597. always be executed in the order opposite to that in which they were
  598. encountered. Note that if a temporary is created on one branch of a
  599. conditional operator (i.e., in the second or third operand to a
  600. <code>COND_EXPR</code>), the cleanup must be run only if that branch is
  601. actually executed.
  602. </p>
  603. </dd>
  604. <dt><code>VA_ARG_EXPR</code></dt>
  605. <dd><p>This node is used to implement support for the C/C++ variable argument-list
  606. mechanism. It represents expressions like <code>va_arg (ap, type)</code>.
  607. Its <code>TREE_TYPE</code> yields the tree representation for <code>type</code> and
  608. its sole argument yields the representation for <code>ap</code>.
  609. </p>
  610. </dd>
  611. <dt><code>ANNOTATE_EXPR</code></dt>
  612. <dd><p>This node is used to attach markers to an expression. The first operand
  613. is the annotated expression, the second is an <code>INTEGER_CST</code> with
  614. a value from <code>enum annot_expr_kind</code>, the third is an <code>INTEGER_CST</code>.
  615. </p></dd>
  616. </dl>
  617. <hr>
  618. <div class="header">
  619. <p>
  620. Next: <a href="Vectors.html#Vectors" accesskey="n" rel="next">Vectors</a>, Previous: <a href="Storage-References.html#Storage-References" accesskey="p" rel="prev">Storage References</a>, Up: <a href="Expression-trees.html#Expression-trees" accesskey="u" rel="up">Expression trees</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>
  621. </div>
  622. </body>
  623. </html>