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.

Storage-References.html 8.0KB

3 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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>Storage References (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Storage References (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Storage References (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="Unary-and-Binary-Expressions.html#Unary-and-Binary-Expressions" rel="next" title="Unary and Binary Expressions">
  31. <link href="Constant-expressions.html#Constant-expressions" rel="prev" title="Constant expressions">
  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="Storage-References"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Unary-and-Binary-Expressions.html#Unary-and-Binary-Expressions" accesskey="n" rel="next">Unary and Binary Expressions</a>, Previous: <a href="Constant-expressions.html#Constant-expressions" accesskey="p" rel="prev">Constant expressions</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="References-to-storage"></a>
  68. <h4 class="subsection">11.6.2 References to storage</h4>
  69. <a name="index-ADDR_005fEXPR"></a>
  70. <a name="index-INDIRECT_005fREF"></a>
  71. <a name="index-MEM_005fREF"></a>
  72. <a name="index-ARRAY_005fREF"></a>
  73. <a name="index-ARRAY_005fRANGE_005fREF"></a>
  74. <a name="index-TARGET_005fMEM_005fREF"></a>
  75. <a name="index-COMPONENT_005fREF"></a>
  76. <dl compact="compact">
  77. <dt><code>ARRAY_REF</code></dt>
  78. <dd><p>These nodes represent array accesses. The first operand is the array;
  79. the second is the index. To calculate the address of the memory
  80. accessed, you must scale the index by the size of the type of the array
  81. elements. The type of these expressions must be the type of a component of
  82. the array. The third and fourth operands are used after gimplification
  83. to represent the lower bound and component size but should not be used
  84. directly; call <code>array_ref_low_bound</code> and <code>array_ref_element_size</code>
  85. instead.
  86. </p>
  87. </dd>
  88. <dt><code>ARRAY_RANGE_REF</code></dt>
  89. <dd><p>These nodes represent access to a range (or &ldquo;slice&rdquo;) of an array. The
  90. operands are the same as that for <code>ARRAY_REF</code> and have the same
  91. meanings. The type of these expressions must be an array whose component
  92. type is the same as that of the first operand. The range of that array
  93. type determines the amount of data these expressions access.
  94. </p>
  95. </dd>
  96. <dt><code>TARGET_MEM_REF</code></dt>
  97. <dd><p>These nodes represent memory accesses whose address directly map to
  98. an addressing mode of the target architecture. The first argument
  99. is <code>TMR_SYMBOL</code> and must be a <code>VAR_DECL</code> of an object with
  100. a fixed address. The second argument is <code>TMR_BASE</code> and the
  101. third one is <code>TMR_INDEX</code>. The fourth argument is
  102. <code>TMR_STEP</code> and must be an <code>INTEGER_CST</code>. The fifth
  103. argument is <code>TMR_OFFSET</code> and must be an <code>INTEGER_CST</code>.
  104. Any of the arguments may be NULL if the appropriate component
  105. does not appear in the address. Address of the <code>TARGET_MEM_REF</code>
  106. is determined in the following way.
  107. </p>
  108. <div class="smallexample">
  109. <pre class="smallexample">&amp;TMR_SYMBOL + TMR_BASE + TMR_INDEX * TMR_STEP + TMR_OFFSET
  110. </pre></div>
  111. <p>The sixth argument is the reference to the original memory access, which
  112. is preserved for the purposes of the RTL alias analysis. The seventh
  113. argument is a tag representing the results of tree level alias analysis.
  114. </p>
  115. </dd>
  116. <dt><code>ADDR_EXPR</code></dt>
  117. <dd><p>These nodes are used to represent the address of an object. (These
  118. expressions will always have pointer or reference type.) The operand may
  119. be another expression, or it may be a declaration.
  120. </p>
  121. <p>As an extension, GCC allows users to take the address of a label. In
  122. this case, the operand of the <code>ADDR_EXPR</code> will be a
  123. <code>LABEL_DECL</code>. The type of such an expression is <code>void*</code>.
  124. </p>
  125. <p>If the object addressed is not an lvalue, a temporary is created, and
  126. the address of the temporary is used.
  127. </p>
  128. </dd>
  129. <dt><code>INDIRECT_REF</code></dt>
  130. <dd><p>These nodes are used to represent the object pointed to by a pointer.
  131. The operand is the pointer being dereferenced; it will always have
  132. pointer or reference type.
  133. </p>
  134. </dd>
  135. <dt><code>MEM_REF</code></dt>
  136. <dd><p>These nodes are used to represent the object pointed to by a pointer
  137. offset by a constant.
  138. The first operand is the pointer being dereferenced; it will always have
  139. pointer or reference type. The second operand is a pointer constant.
  140. Its type is specifying the type to be used for type-based alias analysis.
  141. </p>
  142. </dd>
  143. <dt><code>COMPONENT_REF</code></dt>
  144. <dd><p>These nodes represent non-static data member accesses. The first
  145. operand is the object (rather than a pointer to it); the second operand
  146. is the <code>FIELD_DECL</code> for the data member. The third operand represents
  147. the byte offset of the field, but should not be used directly; call
  148. <code>component_ref_field_offset</code> instead.
  149. </p>
  150. </dd>
  151. </dl>
  152. <hr>
  153. <div class="header">
  154. <p>
  155. Next: <a href="Unary-and-Binary-Expressions.html#Unary-and-Binary-Expressions" accesskey="n" rel="next">Unary and Binary Expressions</a>, Previous: <a href="Constant-expressions.html#Constant-expressions" accesskey="p" rel="prev">Constant expressions</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>
  156. </div>
  157. </body>
  158. </html>