Storage-Layout.html 37 KB

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