Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

758 lines
38KB

  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 Layout (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Storage Layout (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Storage Layout (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="Target-Macros.html#Target-Macros" rel="up" title="Target Macros">
  30. <link href="Type-Layout.html#Type-Layout" rel="next" title="Type Layout">
  31. <link href="Per_002dFunction-Data.html#Per_002dFunction-Data" rel="prev" title="Per-Function Data">
  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-Layout"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Type-Layout.html#Type-Layout" accesskey="n" rel="next">Type Layout</a>, Previous: <a href="Per_002dFunction-Data.html#Per_002dFunction-Data" accesskey="p" rel="prev">Per-Function Data</a>, Up: <a href="Target-Macros.html#Target-Macros" accesskey="u" rel="up">Target Macros</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="Storage-Layout-1"></a>
  68. <h3 class="section">18.5 Storage Layout</h3>
  69. <a name="index-storage-layout"></a>
  70. <p>Note that the definitions of the macros in this table which are sizes or
  71. alignments measured in bits do not need to be constant. They can be C
  72. expressions that refer to static variables, such as the <code>target_flags</code>.
  73. See <a href="Run_002dtime-Target.html#Run_002dtime-Target">Run-time Target</a>.
  74. </p>
  75. <dl>
  76. <dt><a name="index-BITS_005fBIG_005fENDIAN"></a>Macro: <strong>BITS_BIG_ENDIAN</strong></dt>
  77. <dd><p>Define this macro to have the value 1 if the most significant bit in a
  78. byte has the lowest number; otherwise define it to have the value zero.
  79. This means that bit-field instructions count from the most significant
  80. bit. If the machine has no bit-field instructions, then this must still
  81. be defined, but it doesn&rsquo;t matter which value it is defined to. This
  82. macro need not be a constant.
  83. </p>
  84. <p>This macro does not affect the way structure fields are packed into
  85. bytes or words; that is controlled by <code>BYTES_BIG_ENDIAN</code>.
  86. </p></dd></dl>
  87. <dl>
  88. <dt><a name="index-BYTES_005fBIG_005fENDIAN"></a>Macro: <strong>BYTES_BIG_ENDIAN</strong></dt>
  89. <dd><p>Define this macro to have the value 1 if the most significant byte in a
  90. word has the lowest number. This macro need not be a constant.
  91. </p></dd></dl>
  92. <dl>
  93. <dt><a name="index-WORDS_005fBIG_005fENDIAN"></a>Macro: <strong>WORDS_BIG_ENDIAN</strong></dt>
  94. <dd><p>Define this macro to have the value 1 if, in a multiword object, the
  95. most significant word has the lowest number. This applies to both
  96. memory locations and registers; see <code>REG_WORDS_BIG_ENDIAN</code> if the
  97. order of words in memory is not the same as the order in registers. This
  98. macro need not be a constant.
  99. </p></dd></dl>
  100. <dl>
  101. <dt><a name="index-REG_005fWORDS_005fBIG_005fENDIAN"></a>Macro: <strong>REG_WORDS_BIG_ENDIAN</strong></dt>
  102. <dd><p>On some machines, the order of words in a multiword object differs between
  103. registers in memory. In such a situation, define this macro to describe
  104. the order of words in a register. The macro <code>WORDS_BIG_ENDIAN</code> controls
  105. the order of words in memory.
  106. </p></dd></dl>
  107. <dl>
  108. <dt><a name="index-FLOAT_005fWORDS_005fBIG_005fENDIAN"></a>Macro: <strong>FLOAT_WORDS_BIG_ENDIAN</strong></dt>
  109. <dd><p>Define this macro to have the value 1 if <code>DFmode</code>, <code>XFmode</code> or
  110. <code>TFmode</code> floating point numbers are stored in memory with the word
  111. containing the sign bit at the lowest address; otherwise define it to
  112. have the value 0. This macro need not be a constant.
  113. </p>
  114. <p>You need not define this macro if the ordering is the same as for
  115. multi-word integers.
  116. </p></dd></dl>
  117. <dl>
  118. <dt><a name="index-BITS_005fPER_005fWORD"></a>Macro: <strong>BITS_PER_WORD</strong></dt>
  119. <dd><p>Number of bits in a word. If you do not define this macro, the default
  120. is <code>BITS_PER_UNIT * UNITS_PER_WORD</code>.
  121. </p></dd></dl>
  122. <dl>
  123. <dt><a name="index-MAX_005fBITS_005fPER_005fWORD"></a>Macro: <strong>MAX_BITS_PER_WORD</strong></dt>
  124. <dd><p>Maximum number of bits in a word. If this is undefined, the default is
  125. <code>BITS_PER_WORD</code>. Otherwise, it is the constant value that is the
  126. largest value that <code>BITS_PER_WORD</code> can have at run-time.
  127. </p></dd></dl>
  128. <dl>
  129. <dt><a name="index-UNITS_005fPER_005fWORD"></a>Macro: <strong>UNITS_PER_WORD</strong></dt>
  130. <dd><p>Number of storage units in a word; normally the size of a general-purpose
  131. register, a power of two from 1 or 8.
  132. </p></dd></dl>
  133. <dl>
  134. <dt><a name="index-MIN_005fUNITS_005fPER_005fWORD"></a>Macro: <strong>MIN_UNITS_PER_WORD</strong></dt>
  135. <dd><p>Minimum number of units in a word. If this is undefined, the default is
  136. <code>UNITS_PER_WORD</code>. Otherwise, it is the constant value that is the
  137. smallest value that <code>UNITS_PER_WORD</code> can have at run-time.
  138. </p></dd></dl>
  139. <dl>
  140. <dt><a name="index-POINTER_005fSIZE"></a>Macro: <strong>POINTER_SIZE</strong></dt>
  141. <dd><p>Width of a pointer, in bits. You must specify a value no wider than the
  142. width of <code>Pmode</code>. If it is not equal to the width of <code>Pmode</code>,
  143. you must define <code>POINTERS_EXTEND_UNSIGNED</code>. If you do not specify
  144. a value the default is <code>BITS_PER_WORD</code>.
  145. </p></dd></dl>
  146. <dl>
  147. <dt><a name="index-POINTERS_005fEXTEND_005fUNSIGNED"></a>Macro: <strong>POINTERS_EXTEND_UNSIGNED</strong></dt>
  148. <dd><p>A C expression that determines how pointers should be extended from
  149. <code>ptr_mode</code> to either <code>Pmode</code> or <code>word_mode</code>. It is
  150. greater than zero if pointers should be zero-extended, zero if they
  151. should be sign-extended, and negative if some other sort of conversion
  152. is needed. In the last case, the extension is done by the target&rsquo;s
  153. <code>ptr_extend</code> instruction.
  154. </p>
  155. <p>You need not define this macro if the <code>ptr_mode</code>, <code>Pmode</code>
  156. and <code>word_mode</code> are all the same width.
  157. </p></dd></dl>
  158. <dl>
  159. <dt><a name="index-PROMOTE_005fMODE"></a>Macro: <strong>PROMOTE_MODE</strong> <em>(<var>m</var>, <var>unsignedp</var>, <var>type</var>)</em></dt>
  160. <dd><p>A macro to update <var>m</var> and <var>unsignedp</var> when an object whose type
  161. is <var>type</var> and which has the specified mode and signedness is to be
  162. stored in a register. This macro is only called when <var>type</var> is a
  163. scalar type.
  164. </p>
  165. <p>On most RISC machines, which only have operations that operate on a full
  166. register, define this macro to set <var>m</var> to <code>word_mode</code> if
  167. <var>m</var> is an integer mode narrower than <code>BITS_PER_WORD</code>. In most
  168. cases, only integer modes should be widened because wider-precision
  169. floating-point operations are usually more expensive than their narrower
  170. counterparts.
  171. </p>
  172. <p>For most machines, the macro definition does not change <var>unsignedp</var>.
  173. However, some machines, have instructions that preferentially handle
  174. either signed or unsigned quantities of certain modes. For example, on
  175. the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
  176. sign-extend the result to 64 bits. On such machines, set
  177. <var>unsignedp</var> according to which kind of extension is more efficient.
  178. </p>
  179. <p>Do not define this macro if it would never modify <var>m</var>.
  180. </p></dd></dl>
  181. <dl>
  182. <dt><a name="index-TARGET_005fC_005fEXCESS_005fPRECISION"></a>Target Hook: <em>enum flt_eval_method</em> <strong>TARGET_C_EXCESS_PRECISION</strong> <em>(enum excess_precision_type <var>type</var>)</em></dt>
  183. <dd><p>Return a value, with the same meaning as the C99 macro <code>FLT_EVAL_METHOD</code> that describes which excess precision should be applied. <var>type</var> is either <code>EXCESS_PRECISION_TYPE_IMPLICIT</code>, <code>EXCESS_PRECISION_TYPE_FAST</code>, or <code>EXCESS_PRECISION_TYPE_STANDARD</code>. For <code>EXCESS_PRECISION_TYPE_IMPLICIT</code>, the target should return which precision and range operations will be implictly evaluated in regardless of the excess precision explicitly added. For <code>EXCESS_PRECISION_TYPE_STANDARD</code> and <code>EXCESS_PRECISION_TYPE_FAST</code>, the target should return the explicit excess precision that should be added depending on the value set for <samp>-fexcess-precision=<span class="roman">[</span>standard<span class="roman">|</span>fast<span class="roman">]</span></samp>. Note that unpredictable explicit excess precision does not make sense, so a target should never return <code>FLT_EVAL_METHOD_UNPREDICTABLE</code> when <var>type</var> is <code>EXCESS_PRECISION_TYPE_STANDARD</code> or <code>EXCESS_PRECISION_TYPE_FAST</code>.
  184. </p></dd></dl>
  185. <dl>
  186. <dt><a name="index-TARGET_005fPROMOTE_005fFUNCTION_005fMODE"></a>Target Hook: <em>machine_mode</em> <strong>TARGET_PROMOTE_FUNCTION_MODE</strong> <em>(const_tree <var>type</var>, machine_mode <var>mode</var>, int *<var>punsignedp</var>, const_tree <var>funtype</var>, int <var>for_return</var>)</em></dt>
  187. <dd><p>Like <code>PROMOTE_MODE</code>, but it is applied to outgoing function arguments or
  188. function return values. The target hook should return the new mode
  189. and possibly change <code>*<var>punsignedp</var></code> if the promotion should
  190. change signedness. This function is called only for scalar <em>or
  191. pointer</em> types.
  192. </p>
  193. <p><var>for_return</var> allows to distinguish the promotion of arguments and
  194. return values. If it is <code>1</code>, a return value is being promoted and
  195. <code>TARGET_FUNCTION_VALUE</code> must perform the same promotions done here.
  196. If it is <code>2</code>, the returned mode should be that of the register in
  197. which an incoming parameter is copied, or the outgoing result is computed;
  198. then the hook should return the same mode as <code>promote_mode</code>, though
  199. the signedness may be different.
  200. </p>
  201. <p><var>type</var> can be NULL when promoting function arguments of libcalls.
  202. </p>
  203. <p>The default is to not promote arguments and return values. You can
  204. also define the hook to <code>default_promote_function_mode_always_promote</code>
  205. if you would like to apply the same rules given by <code>PROMOTE_MODE</code>.
  206. </p></dd></dl>
  207. <dl>
  208. <dt><a name="index-PARM_005fBOUNDARY"></a>Macro: <strong>PARM_BOUNDARY</strong></dt>
  209. <dd><p>Normal alignment required for function parameters on the stack, in
  210. bits. All stack parameters receive at least this much alignment
  211. regardless of data type. On most machines, this is the same as the
  212. size of an integer.
  213. </p></dd></dl>
  214. <dl>
  215. <dt><a name="index-STACK_005fBOUNDARY"></a>Macro: <strong>STACK_BOUNDARY</strong></dt>
  216. <dd><p>Define this macro to the minimum alignment enforced by hardware for the
  217. stack pointer on this machine. The definition is a C expression for the
  218. desired alignment (measured in bits). This value is used as a default
  219. if <code>PREFERRED_STACK_BOUNDARY</code> is not defined. On most machines,
  220. this should be the same as <code>PARM_BOUNDARY</code>.
  221. </p></dd></dl>
  222. <dl>
  223. <dt><a name="index-PREFERRED_005fSTACK_005fBOUNDARY"></a>Macro: <strong>PREFERRED_STACK_BOUNDARY</strong></dt>
  224. <dd><p>Define this macro if you wish to preserve a certain alignment for the
  225. stack pointer, greater than what the hardware enforces. The definition
  226. is a C expression for the desired alignment (measured in bits). This
  227. macro must evaluate to a value equal to or larger than
  228. <code>STACK_BOUNDARY</code>.
  229. </p></dd></dl>
  230. <dl>
  231. <dt><a name="index-INCOMING_005fSTACK_005fBOUNDARY"></a>Macro: <strong>INCOMING_STACK_BOUNDARY</strong></dt>
  232. <dd><p>Define this macro if the incoming stack boundary may be different
  233. from <code>PREFERRED_STACK_BOUNDARY</code>. This macro must evaluate
  234. to a value equal to or larger than <code>STACK_BOUNDARY</code>.
  235. </p></dd></dl>
  236. <dl>
  237. <dt><a name="index-FUNCTION_005fBOUNDARY"></a>Macro: <strong>FUNCTION_BOUNDARY</strong></dt>
  238. <dd><p>Alignment required for a function entry point, in bits.
  239. </p></dd></dl>
  240. <dl>
  241. <dt><a name="index-BIGGEST_005fALIGNMENT"></a>Macro: <strong>BIGGEST_ALIGNMENT</strong></dt>
  242. <dd><p>Biggest alignment that any data type can require on this machine, in
  243. bits. Note that this is not the biggest alignment that is supported,
  244. just the biggest alignment that, when violated, may cause a fault.
  245. </p></dd></dl>
  246. <dl>
  247. <dt><a name="index-TARGET_005fABSOLUTE_005fBIGGEST_005fALIGNMENT"></a>Target Hook: <em>HOST_WIDE_INT</em> <strong>TARGET_ABSOLUTE_BIGGEST_ALIGNMENT</strong></dt>
  248. <dd><p>If defined, this target hook specifies the absolute biggest alignment
  249. that a type or variable can have on this machine, otherwise,
  250. <code>BIGGEST_ALIGNMENT</code> is used.
  251. </p></dd></dl>
  252. <dl>
  253. <dt><a name="index-MALLOC_005fABI_005fALIGNMENT"></a>Macro: <strong>MALLOC_ABI_ALIGNMENT</strong></dt>
  254. <dd><p>Alignment, in bits, a C conformant malloc implementation has to
  255. provide. If not defined, the default value is <code>BITS_PER_WORD</code>.
  256. </p></dd></dl>
  257. <dl>
  258. <dt><a name="index-ATTRIBUTE_005fALIGNED_005fVALUE"></a>Macro: <strong>ATTRIBUTE_ALIGNED_VALUE</strong></dt>
  259. <dd><p>Alignment used by the <code>__attribute__ ((aligned))</code> construct. If
  260. not defined, the default value is <code>BIGGEST_ALIGNMENT</code>.
  261. </p></dd></dl>
  262. <dl>
  263. <dt><a name="index-MINIMUM_005fATOMIC_005fALIGNMENT"></a>Macro: <strong>MINIMUM_ATOMIC_ALIGNMENT</strong></dt>
  264. <dd><p>If defined, the smallest alignment, in bits, that can be given to an
  265. object that can be referenced in one operation, without disturbing any
  266. nearby object. Normally, this is <code>BITS_PER_UNIT</code>, but may be larger
  267. on machines that don&rsquo;t have byte or half-word store operations.
  268. </p></dd></dl>
  269. <dl>
  270. <dt><a name="index-BIGGEST_005fFIELD_005fALIGNMENT"></a>Macro: <strong>BIGGEST_FIELD_ALIGNMENT</strong></dt>
  271. <dd><p>Biggest alignment that any structure or union field can require on this
  272. machine, in bits. If defined, this overrides <code>BIGGEST_ALIGNMENT</code> for
  273. structure and union fields only, unless the field alignment has been set
  274. by the <code>__attribute__ ((aligned (<var>n</var>)))</code> construct.
  275. </p></dd></dl>
  276. <dl>
  277. <dt><a name="index-ADJUST_005fFIELD_005fALIGN"></a>Macro: <strong>ADJUST_FIELD_ALIGN</strong> <em>(<var>field</var>, <var>type</var>, <var>computed</var>)</em></dt>
  278. <dd><p>An expression for the alignment of a structure field <var>field</var> of
  279. type <var>type</var> if the alignment computed in the usual way (including
  280. applying of <code>BIGGEST_ALIGNMENT</code> and <code>BIGGEST_FIELD_ALIGNMENT</code> to the
  281. alignment) is <var>computed</var>. It overrides alignment only if the
  282. field alignment has not been set by the
  283. <code>__attribute__ ((aligned (<var>n</var>)))</code> construct. Note that <var>field</var>
  284. may be <code>NULL_TREE</code> in case we just query for the minimum alignment
  285. of a field of type <var>type</var> in structure context.
  286. </p></dd></dl>
  287. <dl>
  288. <dt><a name="index-MAX_005fSTACK_005fALIGNMENT"></a>Macro: <strong>MAX_STACK_ALIGNMENT</strong></dt>
  289. <dd><p>Biggest stack alignment guaranteed by the backend. Use this macro
  290. to specify the maximum alignment of a variable on stack.
  291. </p>
  292. <p>If not defined, the default value is <code>STACK_BOUNDARY</code>.
  293. </p>
  294. </dd></dl>
  295. <dl>
  296. <dt><a name="index-MAX_005fOFILE_005fALIGNMENT"></a>Macro: <strong>MAX_OFILE_ALIGNMENT</strong></dt>
  297. <dd><p>Biggest alignment supported by the object file format of this machine.
  298. Use this macro to limit the alignment which can be specified using the
  299. <code>__attribute__ ((aligned (<var>n</var>)))</code> construct for functions and
  300. objects with static storage duration. The alignment of automatic
  301. objects may exceed the object file format maximum up to the maximum
  302. supported by GCC. If not defined, the default value is
  303. <code>BIGGEST_ALIGNMENT</code>.
  304. </p>
  305. <p>On systems that use ELF, the default (in <samp>config/elfos.h</samp>) is
  306. the largest supported 32-bit ELF section alignment representable on
  307. a 32-bit host e.g. &lsquo;<samp>(((uint64_t) 1 &lt;&lt; 28) * 8)</samp>&rsquo;.
  308. On 32-bit ELF the largest supported section alignment in bits is
  309. &lsquo;<samp>(0x80000000 * 8)</samp>&rsquo;, but this is not representable on 32-bit hosts.
  310. </p></dd></dl>
  311. <dl>
  312. <dt><a name="index-TARGET_005fSTATIC_005fRTX_005fALIGNMENT"></a>Target Hook: <em>HOST_WIDE_INT</em> <strong>TARGET_STATIC_RTX_ALIGNMENT</strong> <em>(machine_mode <var>mode</var>)</em></dt>
  313. <dd><p>This hook returns the preferred alignment in bits for a
  314. statically-allocated rtx, such as a constant pool entry. <var>mode</var>
  315. is the mode of the rtx. The default implementation returns
  316. &lsquo;<samp>GET_MODE_ALIGNMENT (<var>mode</var>)</samp>&rsquo;.
  317. </p></dd></dl>
  318. <dl>
  319. <dt><a name="index-DATA_005fALIGNMENT"></a>Macro: <strong>DATA_ALIGNMENT</strong> <em>(<var>type</var>, <var>basic-align</var>)</em></dt>
  320. <dd><p>If defined, a C expression to compute the alignment for a variable in
  321. the static store. <var>type</var> is the data type, and <var>basic-align</var> is
  322. the alignment that the object would ordinarily have. The value of this
  323. macro is used instead of that alignment to align the object.
  324. </p>
  325. <p>If this macro is not defined, then <var>basic-align</var> is used.
  326. </p>
  327. <a name="index-strcpy"></a>
  328. <p>One use of this macro is to increase alignment of medium-size data to
  329. make it all fit in fewer cache lines. Another is to cause character
  330. arrays to be word-aligned so that <code>strcpy</code> calls that copy
  331. constants to character arrays can be done inline.
  332. </p></dd></dl>
  333. <dl>
  334. <dt><a name="index-DATA_005fABI_005fALIGNMENT"></a>Macro: <strong>DATA_ABI_ALIGNMENT</strong> <em>(<var>type</var>, <var>basic-align</var>)</em></dt>
  335. <dd><p>Similar to <code>DATA_ALIGNMENT</code>, but for the cases where the ABI mandates
  336. some alignment increase, instead of optimization only purposes. E.g.&nbsp;AMD x86-64 psABI says that variables with array type larger than 15 bytes
  337. must be aligned to 16 byte boundaries.
  338. </p>
  339. <p>If this macro is not defined, then <var>basic-align</var> is used.
  340. </p></dd></dl>
  341. <dl>
  342. <dt><a name="index-TARGET_005fCONSTANT_005fALIGNMENT"></a>Target Hook: <em>HOST_WIDE_INT</em> <strong>TARGET_CONSTANT_ALIGNMENT</strong> <em>(const_tree <var>constant</var>, HOST_WIDE_INT <var>basic_align</var>)</em></dt>
  343. <dd><p>This hook returns the alignment in bits of a constant that is being
  344. placed in memory. <var>constant</var> is the constant and <var>basic_align</var>
  345. is the alignment that the object would ordinarily have.
  346. </p>
  347. <p>The default definition just returns <var>basic_align</var>.
  348. </p>
  349. <p>The typical use of this hook is to increase alignment for string
  350. constants to be word aligned so that <code>strcpy</code> calls that copy
  351. constants can be done inline. The function
  352. <code>constant_alignment_word_strings</code> provides such a definition.
  353. </p></dd></dl>
  354. <dl>
  355. <dt><a name="index-LOCAL_005fALIGNMENT"></a>Macro: <strong>LOCAL_ALIGNMENT</strong> <em>(<var>type</var>, <var>basic-align</var>)</em></dt>
  356. <dd><p>If defined, a C expression to compute the alignment for a variable in
  357. the local store. <var>type</var> is the data type, and <var>basic-align</var> is
  358. the alignment that the object would ordinarily have. The value of this
  359. macro is used instead of that alignment to align the object.
  360. </p>
  361. <p>If this macro is not defined, then <var>basic-align</var> is used.
  362. </p>
  363. <p>One use of this macro is to increase alignment of medium-size data to
  364. make it all fit in fewer cache lines.
  365. </p>
  366. <p>If the value of this macro has a type, it should be an unsigned type.
  367. </p></dd></dl>
  368. <dl>
  369. <dt><a name="index-TARGET_005fVECTOR_005fALIGNMENT"></a>Target Hook: <em>HOST_WIDE_INT</em> <strong>TARGET_VECTOR_ALIGNMENT</strong> <em>(const_tree <var>type</var>)</em></dt>
  370. <dd><p>This hook can be used to define the alignment for a vector of type
  371. <var>type</var>, in order to comply with a platform ABI. The default is to
  372. require natural alignment for vector types. The alignment returned by
  373. this hook must be a power-of-two multiple of the default alignment of
  374. the vector element type.
  375. </p></dd></dl>
  376. <dl>
  377. <dt><a name="index-STACK_005fSLOT_005fALIGNMENT"></a>Macro: <strong>STACK_SLOT_ALIGNMENT</strong> <em>(<var>type</var>, <var>mode</var>, <var>basic-align</var>)</em></dt>
  378. <dd><p>If defined, a C expression to compute the alignment for stack slot.
  379. <var>type</var> is the data type, <var>mode</var> is the widest mode available,
  380. and <var>basic-align</var> is the alignment that the slot would ordinarily
  381. have. The value of this macro is used instead of that alignment to
  382. align the slot.
  383. </p>
  384. <p>If this macro is not defined, then <var>basic-align</var> is used when
  385. <var>type</var> is <code>NULL</code>. Otherwise, <code>LOCAL_ALIGNMENT</code> will
  386. be used.
  387. </p>
  388. <p>This macro is to set alignment of stack slot to the maximum alignment
  389. of all possible modes which the slot may have.
  390. </p>
  391. <p>If the value of this macro has a type, it should be an unsigned type.
  392. </p></dd></dl>
  393. <dl>
  394. <dt><a name="index-LOCAL_005fDECL_005fALIGNMENT"></a>Macro: <strong>LOCAL_DECL_ALIGNMENT</strong> <em>(<var>decl</var>)</em></dt>
  395. <dd><p>If defined, a C expression to compute the alignment for a local
  396. variable <var>decl</var>.
  397. </p>
  398. <p>If this macro is not defined, then
  399. <code>LOCAL_ALIGNMENT (TREE_TYPE (<var>decl</var>), DECL_ALIGN (<var>decl</var>))</code>
  400. is used.
  401. </p>
  402. <p>One use of this macro is to increase alignment of medium-size data to
  403. make it all fit in fewer cache lines.
  404. </p>
  405. <p>If the value of this macro has a type, it should be an unsigned type.
  406. </p></dd></dl>
  407. <dl>
  408. <dt><a name="index-MINIMUM_005fALIGNMENT"></a>Macro: <strong>MINIMUM_ALIGNMENT</strong> <em>(<var>exp</var>, <var>mode</var>, <var>align</var>)</em></dt>
  409. <dd><p>If defined, a C expression to compute the minimum required alignment
  410. for dynamic stack realignment purposes for <var>exp</var> (a type or decl),
  411. <var>mode</var>, assuming normal alignment <var>align</var>.
  412. </p>
  413. <p>If this macro is not defined, then <var>align</var> will be used.
  414. </p></dd></dl>
  415. <dl>
  416. <dt><a name="index-EMPTY_005fFIELD_005fBOUNDARY"></a>Macro: <strong>EMPTY_FIELD_BOUNDARY</strong></dt>
  417. <dd><p>Alignment in bits to be given to a structure bit-field that follows an
  418. empty field such as <code>int : 0;</code>.
  419. </p>
  420. <p>If <code>PCC_BITFIELD_TYPE_MATTERS</code> is true, it overrides this macro.
  421. </p></dd></dl>
  422. <dl>
  423. <dt><a name="index-STRUCTURE_005fSIZE_005fBOUNDARY"></a>Macro: <strong>STRUCTURE_SIZE_BOUNDARY</strong></dt>
  424. <dd><p>Number of bits which any structure or union&rsquo;s size must be a multiple of.
  425. Each structure or union&rsquo;s size is rounded up to a multiple of this.
  426. </p>
  427. <p>If you do not define this macro, the default is the same as
  428. <code>BITS_PER_UNIT</code>.
  429. </p></dd></dl>
  430. <dl>
  431. <dt><a name="index-STRICT_005fALIGNMENT"></a>Macro: <strong>STRICT_ALIGNMENT</strong></dt>
  432. <dd><p>Define this macro to be the value 1 if instructions will fail to work
  433. if given data not on the nominal alignment. If instructions will merely
  434. go slower in that case, define this macro as 0.
  435. </p></dd></dl>
  436. <dl>
  437. <dt><a name="index-PCC_005fBITFIELD_005fTYPE_005fMATTERS"></a>Macro: <strong>PCC_BITFIELD_TYPE_MATTERS</strong></dt>
  438. <dd><p>Define this if you wish to imitate the way many other C compilers handle
  439. alignment of bit-fields and the structures that contain them.
  440. </p>
  441. <p>The behavior is that the type written for a named bit-field (<code>int</code>,
  442. <code>short</code>, or other integer type) imposes an alignment for the entire
  443. structure, as if the structure really did contain an ordinary field of
  444. that type. In addition, the bit-field is placed within the structure so
  445. that it would fit within such a field, not crossing a boundary for it.
  446. </p>
  447. <p>Thus, on most machines, a named bit-field whose type is written as
  448. <code>int</code> would not cross a four-byte boundary, and would force
  449. four-byte alignment for the whole structure. (The alignment used may
  450. not be four bytes; it is controlled by the other alignment parameters.)
  451. </p>
  452. <p>An unnamed bit-field will not affect the alignment of the containing
  453. structure.
  454. </p>
  455. <p>If the macro is defined, its definition should be a C expression;
  456. a nonzero value for the expression enables this behavior.
  457. </p>
  458. <p>Note that if this macro is not defined, or its value is zero, some
  459. bit-fields may cross more than one alignment boundary. The compiler can
  460. support such references if there are &lsquo;<samp>insv</samp>&rsquo;, &lsquo;<samp>extv</samp>&rsquo;, and
  461. &lsquo;<samp>extzv</samp>&rsquo; insns that can directly reference memory.
  462. </p>
  463. <p>The other known way of making bit-fields work is to define
  464. <code>STRUCTURE_SIZE_BOUNDARY</code> as large as <code>BIGGEST_ALIGNMENT</code>.
  465. Then every structure can be accessed with fullwords.
  466. </p>
  467. <p>Unless the machine has bit-field instructions or you define
  468. <code>STRUCTURE_SIZE_BOUNDARY</code> that way, you must define
  469. <code>PCC_BITFIELD_TYPE_MATTERS</code> to have a nonzero value.
  470. </p>
  471. <p>If your aim is to make GCC use the same conventions for laying out
  472. bit-fields as are used by another compiler, here is how to investigate
  473. what the other compiler does. Compile and run this program:
  474. </p>
  475. <div class="smallexample">
  476. <pre class="smallexample">struct foo1
  477. {
  478. char x;
  479. char :0;
  480. char y;
  481. };
  482. struct foo2
  483. {
  484. char x;
  485. int :0;
  486. char y;
  487. };
  488. main ()
  489. {
  490. printf (&quot;Size of foo1 is %d\n&quot;,
  491. sizeof (struct foo1));
  492. printf (&quot;Size of foo2 is %d\n&quot;,
  493. sizeof (struct foo2));
  494. exit (0);
  495. }
  496. </pre></div>
  497. <p>If this prints 2 and 5, then the compiler&rsquo;s behavior is what you would
  498. get from <code>PCC_BITFIELD_TYPE_MATTERS</code>.
  499. </p></dd></dl>
  500. <dl>
  501. <dt><a name="index-BITFIELD_005fNBYTES_005fLIMITED"></a>Macro: <strong>BITFIELD_NBYTES_LIMITED</strong></dt>
  502. <dd><p>Like <code>PCC_BITFIELD_TYPE_MATTERS</code> except that its effect is limited
  503. to aligning a bit-field within the structure.
  504. </p></dd></dl>
  505. <dl>
  506. <dt><a name="index-TARGET_005fALIGN_005fANON_005fBITFIELD"></a>Target Hook: <em>bool</em> <strong>TARGET_ALIGN_ANON_BITFIELD</strong> <em>(void)</em></dt>
  507. <dd><p>When <code>PCC_BITFIELD_TYPE_MATTERS</code> is true this hook will determine
  508. whether unnamed bitfields affect the alignment of the containing
  509. structure. The hook should return true if the structure should inherit
  510. the alignment requirements of an unnamed bitfield&rsquo;s type.
  511. </p></dd></dl>
  512. <dl>
  513. <dt><a name="index-TARGET_005fNARROW_005fVOLATILE_005fBITFIELD"></a>Target Hook: <em>bool</em> <strong>TARGET_NARROW_VOLATILE_BITFIELD</strong> <em>(void)</em></dt>
  514. <dd><p>This target hook should return <code>true</code> if accesses to volatile bitfields
  515. should use the narrowest mode possible. It should return <code>false</code> if
  516. these accesses should use the bitfield container type.
  517. </p>
  518. <p>The default is <code>false</code>.
  519. </p></dd></dl>
  520. <dl>
  521. <dt><a name="index-TARGET_005fMEMBER_005fTYPE_005fFORCES_005fBLK"></a>Target Hook: <em>bool</em> <strong>TARGET_MEMBER_TYPE_FORCES_BLK</strong> <em>(const_tree <var>field</var>, machine_mode <var>mode</var>)</em></dt>
  522. <dd><p>Return true if a structure, union or array containing <var>field</var> should
  523. be accessed using <code>BLKMODE</code>.
  524. </p>
  525. <p>If <var>field</var> is the only field in the structure, <var>mode</var> is its
  526. mode, otherwise <var>mode</var> is VOIDmode. <var>mode</var> is provided in the
  527. case where structures of one field would require the structure&rsquo;s mode to
  528. retain the field&rsquo;s mode.
  529. </p>
  530. <p>Normally, this is not needed.
  531. </p></dd></dl>
  532. <dl>
  533. <dt><a name="index-ROUND_005fTYPE_005fALIGN"></a>Macro: <strong>ROUND_TYPE_ALIGN</strong> <em>(<var>type</var>, <var>computed</var>, <var>specified</var>)</em></dt>
  534. <dd><p>Define this macro as an expression for the alignment of a type (given
  535. by <var>type</var> as a tree node) if the alignment computed in the usual
  536. way is <var>computed</var> and the alignment explicitly specified was
  537. <var>specified</var>.
  538. </p>
  539. <p>The default is to use <var>specified</var> if it is larger; otherwise, use
  540. the smaller of <var>computed</var> and <code>BIGGEST_ALIGNMENT</code>
  541. </p></dd></dl>
  542. <dl>
  543. <dt><a name="index-MAX_005fFIXED_005fMODE_005fSIZE"></a>Macro: <strong>MAX_FIXED_MODE_SIZE</strong></dt>
  544. <dd><p>An integer expression for the size in bits of the largest integer
  545. machine mode that should actually be used. All integer machine modes of
  546. this size or smaller can be used for structures and unions with the
  547. appropriate sizes. If this macro is undefined, <code>GET_MODE_BITSIZE
  548. (DImode)</code> is assumed.
  549. </p></dd></dl>
  550. <dl>
  551. <dt><a name="index-STACK_005fSAVEAREA_005fMODE"></a>Macro: <strong>STACK_SAVEAREA_MODE</strong> <em>(<var>save_level</var>)</em></dt>
  552. <dd><p>If defined, an expression of type <code>machine_mode</code> that
  553. specifies the mode of the save area operand of a
  554. <code>save_stack_<var>level</var></code> named pattern (see <a href="Standard-Names.html#Standard-Names">Standard Names</a>).
  555. <var>save_level</var> is one of <code>SAVE_BLOCK</code>, <code>SAVE_FUNCTION</code>, or
  556. <code>SAVE_NONLOCAL</code> and selects which of the three named patterns is
  557. having its mode specified.
  558. </p>
  559. <p>You need not define this macro if it always returns <code>Pmode</code>. You
  560. would most commonly define this macro if the
  561. <code>save_stack_<var>level</var></code> patterns need to support both a 32- and a
  562. 64-bit mode.
  563. </p></dd></dl>
  564. <dl>
  565. <dt><a name="index-STACK_005fSIZE_005fMODE"></a>Macro: <strong>STACK_SIZE_MODE</strong></dt>
  566. <dd><p>If defined, an expression of type <code>machine_mode</code> that
  567. specifies the mode of the size increment operand of an
  568. <code>allocate_stack</code> named pattern (see <a href="Standard-Names.html#Standard-Names">Standard Names</a>).
  569. </p>
  570. <p>You need not define this macro if it always returns <code>word_mode</code>.
  571. You would most commonly define this macro if the <code>allocate_stack</code>
  572. pattern needs to support both a 32- and a 64-bit mode.
  573. </p></dd></dl>
  574. <dl>
  575. <dt><a name="index-TARGET_005fLIBGCC_005fCMP_005fRETURN_005fMODE"></a>Target Hook: <em>scalar_int_mode</em> <strong>TARGET_LIBGCC_CMP_RETURN_MODE</strong> <em>(void)</em></dt>
  576. <dd><p>This target hook should return the mode to be used for the return value
  577. of compare instructions expanded to libgcc calls. If not defined
  578. <code>word_mode</code> is returned which is the right choice for a majority of
  579. targets.
  580. </p></dd></dl>
  581. <dl>
  582. <dt><a name="index-TARGET_005fLIBGCC_005fSHIFT_005fCOUNT_005fMODE"></a>Target Hook: <em>scalar_int_mode</em> <strong>TARGET_LIBGCC_SHIFT_COUNT_MODE</strong> <em>(void)</em></dt>
  583. <dd><p>This target hook should return the mode to be used for the shift count operand
  584. of shift instructions expanded to libgcc calls. If not defined
  585. <code>word_mode</code> is returned which is the right choice for a majority of
  586. targets.
  587. </p></dd></dl>
  588. <dl>
  589. <dt><a name="index-TARGET_005fUNWIND_005fWORD_005fMODE"></a>Target Hook: <em>scalar_int_mode</em> <strong>TARGET_UNWIND_WORD_MODE</strong> <em>(void)</em></dt>
  590. <dd><p>Return machine mode to be used for <code>_Unwind_Word</code> type.
  591. The default is to use <code>word_mode</code>.
  592. </p></dd></dl>
  593. <dl>
  594. <dt><a name="index-TARGET_005fMS_005fBITFIELD_005fLAYOUT_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_MS_BITFIELD_LAYOUT_P</strong> <em>(const_tree <var>record_type</var>)</em></dt>
  595. <dd><p>This target hook returns <code>true</code> if bit-fields in the given
  596. <var>record_type</var> are to be laid out following the rules of Microsoft
  597. Visual C/C++, namely: (i) a bit-field won&rsquo;t share the same storage
  598. unit with the previous bit-field if their underlying types have
  599. different sizes, and the bit-field will be aligned to the highest
  600. alignment of the underlying types of itself and of the previous
  601. bit-field; (ii) a zero-sized bit-field will affect the alignment of
  602. the whole enclosing structure, even if it is unnamed; except that
  603. (iii) a zero-sized bit-field will be disregarded unless it follows
  604. another bit-field of nonzero size. If this hook returns <code>true</code>,
  605. other macros that control bit-field layout are ignored.
  606. </p>
  607. <p>When a bit-field is inserted into a packed record, the whole size
  608. of the underlying type is used by one or more same-size adjacent
  609. bit-fields (that is, if its long:3, 32 bits is used in the record,
  610. and any additional adjacent long bit-fields are packed into the same
  611. chunk of 32 bits. However, if the size changes, a new field of that
  612. size is allocated). In an unpacked record, this is the same as using
  613. alignment, but not equivalent when packing.
  614. </p>
  615. <p>If both MS bit-fields and &lsquo;<samp>__attribute__((packed))</samp>&rsquo; are used,
  616. the latter will take precedence. If &lsquo;<samp>__attribute__((packed))</samp>&rsquo; is
  617. used on a single field when MS bit-fields are in use, it will take
  618. precedence for that field, but the alignment of the rest of the structure
  619. may affect its placement.
  620. </p></dd></dl>
  621. <dl>
  622. <dt><a name="index-TARGET_005fDECIMAL_005fFLOAT_005fSUPPORTED_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_DECIMAL_FLOAT_SUPPORTED_P</strong> <em>(void)</em></dt>
  623. <dd><p>Returns true if the target supports decimal floating point.
  624. </p></dd></dl>
  625. <dl>
  626. <dt><a name="index-TARGET_005fFIXED_005fPOINT_005fSUPPORTED_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_FIXED_POINT_SUPPORTED_P</strong> <em>(void)</em></dt>
  627. <dd><p>Returns true if the target supports fixed-point arithmetic.
  628. </p></dd></dl>
  629. <dl>
  630. <dt><a name="index-TARGET_005fEXPAND_005fTO_005fRTL_005fHOOK"></a>Target Hook: <em>void</em> <strong>TARGET_EXPAND_TO_RTL_HOOK</strong> <em>(void)</em></dt>
  631. <dd><p>This hook is called just before expansion into rtl, allowing the target
  632. to perform additional initializations or analysis before the expansion.
  633. For example, the rs6000 port uses it to allocate a scratch stack slot
  634. for use in copying SDmode values between memory and floating point
  635. registers whenever the function being expanded has any SDmode
  636. usage.
  637. </p></dd></dl>
  638. <dl>
  639. <dt><a name="index-TARGET_005fINSTANTIATE_005fDECLS"></a>Target Hook: <em>void</em> <strong>TARGET_INSTANTIATE_DECLS</strong> <em>(void)</em></dt>
  640. <dd><p>This hook allows the backend to perform additional instantiations on rtl
  641. that are not actually in any insns yet, but will be later.
  642. </p></dd></dl>
  643. <dl>
  644. <dt><a name="index-TARGET_005fMANGLE_005fTYPE"></a>Target Hook: <em>const char *</em> <strong>TARGET_MANGLE_TYPE</strong> <em>(const_tree <var>type</var>)</em></dt>
  645. <dd><p>If your target defines any fundamental types, or any types your target
  646. uses should be mangled differently from the default, define this hook
  647. to return the appropriate encoding for these types as part of a C++
  648. mangled name. The <var>type</var> argument is the tree structure representing
  649. the type to be mangled. The hook may be applied to trees which are
  650. not target-specific fundamental types; it should return <code>NULL</code>
  651. for all such types, as well as arguments it does not recognize. If the
  652. return value is not <code>NULL</code>, it must point to a statically-allocated
  653. string constant.
  654. </p>
  655. <p>Target-specific fundamental types might be new fundamental types or
  656. qualified versions of ordinary fundamental types. Encode new
  657. fundamental types as &lsquo;<samp>u&nbsp;<var>n</var>&nbsp;<var>name</var><!-- /@w --></samp>&rsquo;, where <var>name</var>
  658. is the name used for the type in source code, and <var>n</var> is the
  659. length of <var>name</var> in decimal. Encode qualified versions of
  660. ordinary types as &lsquo;<samp>U&nbsp;<var>n</var>&nbsp;<var>name</var>&nbsp;<var>code</var><!-- /@w --></samp>&rsquo;, where
  661. <var>name</var> is the name used for the type qualifier in source code,
  662. <var>n</var> is the length of <var>name</var> as above, and <var>code</var> is the
  663. code used to represent the unqualified version of this type. (See
  664. <code>write_builtin_type</code> in <samp>cp/mangle.c</samp> for the list of
  665. codes.) In both cases the spaces are for clarity; do not include any
  666. spaces in your string.
  667. </p>
  668. <p>This hook is applied to types prior to typedef resolution. If the mangled
  669. name for a particular type depends only on that type&rsquo;s main variant, you
  670. can perform typedef resolution yourself using <code>TYPE_MAIN_VARIANT</code>
  671. before mangling.
  672. </p>
  673. <p>The default version of this hook always returns <code>NULL</code>, which is
  674. appropriate for a target that does not define any new fundamental
  675. types.
  676. </p></dd></dl>
  677. <hr>
  678. <div class="header">
  679. <p>
  680. Next: <a href="Type-Layout.html#Type-Layout" accesskey="n" rel="next">Type Layout</a>, Previous: <a href="Per_002dFunction-Data.html#Per_002dFunction-Data" accesskey="p" rel="prev">Per-Function Data</a>, Up: <a href="Target-Macros.html#Target-Macros" accesskey="u" rel="up">Target Macros</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>
  681. </div>
  682. </body>
  683. </html>