Data-Output.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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: Data Output</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Data Output">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Data Output">
  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="Assembler-Format.html#Assembler-Format" rel="up" title="Assembler Format">
  30. <link href="Uninitialized-Data.html#Uninitialized-Data" rel="next" title="Uninitialized Data">
  31. <link href="File-Framework.html#File-Framework" rel="prev" title="File Framework">
  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="Data-Output"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Uninitialized-Data.html#Uninitialized-Data" accesskey="n" rel="next">Uninitialized Data</a>, Previous: <a href="File-Framework.html#File-Framework" accesskey="p" rel="prev">File Framework</a>, Up: <a href="Assembler-Format.html#Assembler-Format" accesskey="u" rel="up">Assembler Format</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="Output-of-Data"></a>
  69. <h4 class="subsection">17.20.2 Output of Data</h4>
  70. <dl>
  71. <dt><a name="index-TARGET_005fASM_005fBYTE_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_BYTE_OP</strong></dt>
  72. <dt><a name="index-TARGET_005fASM_005fALIGNED_005fHI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_ALIGNED_HI_OP</strong></dt>
  73. <dt><a name="index-TARGET_005fASM_005fALIGNED_005fSI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_ALIGNED_SI_OP</strong></dt>
  74. <dt><a name="index-TARGET_005fASM_005fALIGNED_005fDI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_ALIGNED_DI_OP</strong></dt>
  75. <dt><a name="index-TARGET_005fASM_005fALIGNED_005fTI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_ALIGNED_TI_OP</strong></dt>
  76. <dt><a name="index-TARGET_005fASM_005fUNALIGNED_005fHI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_UNALIGNED_HI_OP</strong></dt>
  77. <dt><a name="index-TARGET_005fASM_005fUNALIGNED_005fSI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_UNALIGNED_SI_OP</strong></dt>
  78. <dt><a name="index-TARGET_005fASM_005fUNALIGNED_005fDI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_UNALIGNED_DI_OP</strong></dt>
  79. <dt><a name="index-TARGET_005fASM_005fUNALIGNED_005fTI_005fOP"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_UNALIGNED_TI_OP</strong></dt>
  80. <dd><p>These hooks specify assembly directives for creating certain kinds
  81. of integer object. The <code>TARGET_ASM_BYTE_OP</code> directive creates a
  82. byte-sized object, the <code>TARGET_ASM_ALIGNED_HI_OP</code> one creates an
  83. aligned two-byte object, and so on. Any of the hooks may be
  84. <code>NULL</code>, indicating that no suitable directive is available.
  85. </p>
  86. <p>The compiler will print these strings at the start of a new line,
  87. followed immediately by the object&rsquo;s initial value. In most cases,
  88. the string should contain a tab, a pseudo-op, and then another tab.
  89. </p></dd></dl>
  90. <dl>
  91. <dt><a name="index-TARGET_005fASM_005fINTEGER"></a>Target Hook: <em>bool</em> <strong>TARGET_ASM_INTEGER</strong> <em>(rtx <var>x</var>, unsigned int <var>size</var>, int <var>aligned_p</var>)</em></dt>
  92. <dd><p>The <code>assemble_integer</code> function uses this hook to output an
  93. integer object. <var>x</var> is the object&rsquo;s value, <var>size</var> is its size
  94. in bytes and <var>aligned_p</var> indicates whether it is aligned. The
  95. function should return <code>true</code> if it was able to output the
  96. object. If it returns false, <code>assemble_integer</code> will try to
  97. split the object into smaller parts.
  98. </p>
  99. <p>The default implementation of this hook will use the
  100. <code>TARGET_ASM_BYTE_OP</code> family of strings, returning <code>false</code>
  101. when the relevant string is <code>NULL</code>.
  102. </p></dd></dl>
  103. <dl>
  104. <dt><a name="index-TARGET_005fASM_005fDECL_005fEND"></a>Target Hook: <em>void</em> <strong>TARGET_ASM_DECL_END</strong> <em>(void)</em></dt>
  105. <dd><p>Define this hook if the target assembler requires a special marker to
  106. terminate an initialized variable declaration.
  107. </p></dd></dl>
  108. <dl>
  109. <dt><a name="index-TARGET_005fASM_005fOUTPUT_005fADDR_005fCONST_005fEXTRA"></a>Target Hook: <em>bool</em> <strong>TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA</strong> <em>(FILE *<var>file</var>, rtx <var>x</var>)</em></dt>
  110. <dd><p>A target hook to recognize <var>rtx</var> patterns that <code>output_addr_const</code>
  111. can&rsquo;t deal with, and output assembly code to <var>file</var> corresponding to
  112. the pattern <var>x</var>. This may be used to allow machine-dependent
  113. <code>UNSPEC</code>s to appear within constants.
  114. </p>
  115. <p>If target hook fails to recognize a pattern, it must return <code>false</code>,
  116. so that a standard error message is printed. If it prints an error message
  117. itself, by calling, for example, <code>output_operand_lossage</code>, it may just
  118. return <code>true</code>.
  119. </p></dd></dl>
  120. <dl>
  121. <dt><a name="index-ASM_005fOUTPUT_005fASCII"></a>Macro: <strong>ASM_OUTPUT_ASCII</strong> <em>(<var>stream</var>, <var>ptr</var>, <var>len</var>)</em></dt>
  122. <dd><p>A C statement to output to the stdio stream <var>stream</var> an assembler
  123. instruction to assemble a string constant containing the <var>len</var>
  124. bytes at <var>ptr</var>. <var>ptr</var> will be a C expression of type
  125. <code>char *</code> and <var>len</var> a C expression of type <code>int</code>.
  126. </p>
  127. <p>If the assembler has a <code>.ascii</code> pseudo-op as found in the
  128. Berkeley Unix assembler, do not define the macro
  129. <code>ASM_OUTPUT_ASCII</code>.
  130. </p></dd></dl>
  131. <dl>
  132. <dt><a name="index-ASM_005fOUTPUT_005fFDESC"></a>Macro: <strong>ASM_OUTPUT_FDESC</strong> <em>(<var>stream</var>, <var>decl</var>, <var>n</var>)</em></dt>
  133. <dd><p>A C statement to output word <var>n</var> of a function descriptor for
  134. <var>decl</var>. This must be defined if <code>TARGET_VTABLE_USES_DESCRIPTORS</code>
  135. is defined, and is otherwise unused.
  136. </p></dd></dl>
  137. <dl>
  138. <dt><a name="index-CONSTANT_005fPOOL_005fBEFORE_005fFUNCTION"></a>Macro: <strong>CONSTANT_POOL_BEFORE_FUNCTION</strong></dt>
  139. <dd><p>You may define this macro as a C expression. You should define the
  140. expression to have a nonzero value if GCC should output the constant
  141. pool for a function before the code for the function, or a zero value if
  142. GCC should output the constant pool after the function. If you do
  143. not define this macro, the usual case, GCC will output the constant
  144. pool before the function.
  145. </p></dd></dl>
  146. <dl>
  147. <dt><a name="index-ASM_005fOUTPUT_005fPOOL_005fPROLOGUE"></a>Macro: <strong>ASM_OUTPUT_POOL_PROLOGUE</strong> <em>(<var>file</var>, <var>funname</var>, <var>fundecl</var>, <var>size</var>)</em></dt>
  148. <dd><p>A C statement to output assembler commands to define the start of the
  149. constant pool for a function. <var>funname</var> is a string giving
  150. the name of the function. Should the return type of the function
  151. be required, it can be obtained via <var>fundecl</var>. <var>size</var>
  152. is the size, in bytes, of the constant pool that will be written
  153. immediately after this call.
  154. </p>
  155. <p>If no constant-pool prefix is required, the usual case, this macro need
  156. not be defined.
  157. </p></dd></dl>
  158. <dl>
  159. <dt><a name="index-ASM_005fOUTPUT_005fSPECIAL_005fPOOL_005fENTRY"></a>Macro: <strong>ASM_OUTPUT_SPECIAL_POOL_ENTRY</strong> <em>(<var>file</var>, <var>x</var>, <var>mode</var>, <var>align</var>, <var>labelno</var>, <var>jumpto</var>)</em></dt>
  160. <dd><p>A C statement (with or without semicolon) to output a constant in the
  161. constant pool, if it needs special treatment. (This macro need not do
  162. anything for RTL expressions that can be output normally.)
  163. </p>
  164. <p>The argument <var>file</var> is the standard I/O stream to output the
  165. assembler code on. <var>x</var> is the RTL expression for the constant to
  166. output, and <var>mode</var> is the machine mode (in case <var>x</var> is a
  167. &lsquo;<samp>const_int</samp>&rsquo;). <var>align</var> is the required alignment for the value
  168. <var>x</var>; you should output an assembler directive to force this much
  169. alignment.
  170. </p>
  171. <p>The argument <var>labelno</var> is a number to use in an internal label for
  172. the address of this pool entry. The definition of this macro is
  173. responsible for outputting the label definition at the proper place.
  174. Here is how to do this:
  175. </p>
  176. <div class="smallexample">
  177. <pre class="smallexample"><code>(*targetm.asm_out.internal_label)</code> (<var>file</var>, &quot;LC&quot;, <var>labelno</var>);
  178. </pre></div>
  179. <p>When you output a pool entry specially, you should end with a
  180. <code>goto</code> to the label <var>jumpto</var>. This will prevent the same pool
  181. entry from being output a second time in the usual manner.
  182. </p>
  183. <p>You need not define this macro if it would do nothing.
  184. </p></dd></dl>
  185. <dl>
  186. <dt><a name="index-ASM_005fOUTPUT_005fPOOL_005fEPILOGUE"></a>Macro: <strong>ASM_OUTPUT_POOL_EPILOGUE</strong> <em>(<var>file</var> <var>funname</var> <var>fundecl</var> <var>size</var>)</em></dt>
  187. <dd><p>A C statement to output assembler commands to at the end of the constant
  188. pool for a function. <var>funname</var> is a string giving the name of the
  189. function. Should the return type of the function be required, you can
  190. obtain it via <var>fundecl</var>. <var>size</var> is the size, in bytes, of the
  191. constant pool that GCC wrote immediately before this call.
  192. </p>
  193. <p>If no constant-pool epilogue is required, the usual case, you need not
  194. define this macro.
  195. </p></dd></dl>
  196. <dl>
  197. <dt><a name="index-IS_005fASM_005fLOGICAL_005fLINE_005fSEPARATOR"></a>Macro: <strong>IS_ASM_LOGICAL_LINE_SEPARATOR</strong> <em>(<var>C</var>, <var>STR</var>)</em></dt>
  198. <dd><p>Define this macro as a C expression which is nonzero if <var>C</var> is
  199. used as a logical line separator by the assembler. <var>STR</var> points
  200. to the position in the string where <var>C</var> was found; this can be used if
  201. a line separator uses multiple characters.
  202. </p>
  203. <p>If you do not define this macro, the default is that only
  204. the character &lsquo;<samp>;</samp>&rsquo; is treated as a logical line separator.
  205. </p></dd></dl>
  206. <dl>
  207. <dt><a name="index-TARGET_005fASM_005fOPEN_005fPAREN"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_OPEN_PAREN</strong></dt>
  208. <dt><a name="index-TARGET_005fASM_005fCLOSE_005fPAREN"></a>Target Hook: <em>const char *</em> <strong>TARGET_ASM_CLOSE_PAREN</strong></dt>
  209. <dd><p>These target hooks are C string constants, describing the syntax in the
  210. assembler for grouping arithmetic expressions. If not overridden, they
  211. default to normal parentheses, which is correct for most assemblers.
  212. </p></dd></dl>
  213. <p>These macros are provided by <samp>real.h</samp> for writing the definitions
  214. of <code>ASM_OUTPUT_DOUBLE</code> and the like:
  215. </p>
  216. <dl>
  217. <dt><a name="index-REAL_005fVALUE_005fTO_005fTARGET_005fSINGLE"></a>Macro: <strong>REAL_VALUE_TO_TARGET_SINGLE</strong> <em>(<var>x</var>, <var>l</var>)</em></dt>
  218. <dt><a name="index-REAL_005fVALUE_005fTO_005fTARGET_005fDOUBLE"></a>Macro: <strong>REAL_VALUE_TO_TARGET_DOUBLE</strong> <em>(<var>x</var>, <var>l</var>)</em></dt>
  219. <dt><a name="index-REAL_005fVALUE_005fTO_005fTARGET_005fLONG_005fDOUBLE"></a>Macro: <strong>REAL_VALUE_TO_TARGET_LONG_DOUBLE</strong> <em>(<var>x</var>, <var>l</var>)</em></dt>
  220. <dt><a name="index-REAL_005fVALUE_005fTO_005fTARGET_005fDECIMAL32"></a>Macro: <strong>REAL_VALUE_TO_TARGET_DECIMAL32</strong> <em>(<var>x</var>, <var>l</var>)</em></dt>
  221. <dt><a name="index-REAL_005fVALUE_005fTO_005fTARGET_005fDECIMAL64"></a>Macro: <strong>REAL_VALUE_TO_TARGET_DECIMAL64</strong> <em>(<var>x</var>, <var>l</var>)</em></dt>
  222. <dt><a name="index-REAL_005fVALUE_005fTO_005fTARGET_005fDECIMAL128"></a>Macro: <strong>REAL_VALUE_TO_TARGET_DECIMAL128</strong> <em>(<var>x</var>, <var>l</var>)</em></dt>
  223. <dd><p>These translate <var>x</var>, of type <code>REAL_VALUE_TYPE</code>, to the
  224. target&rsquo;s floating point representation, and store its bit pattern in
  225. the variable <var>l</var>. For <code>REAL_VALUE_TO_TARGET_SINGLE</code> and
  226. <code>REAL_VALUE_TO_TARGET_DECIMAL32</code>, this variable should be a
  227. simple <code>long int</code>. For the others, it should be an array of
  228. <code>long int</code>. The number of elements in this array is determined
  229. by the size of the desired target floating point data type: 32 bits of
  230. it go in each <code>long int</code> array element. Each array element holds
  231. 32 bits of the result, even if <code>long int</code> is wider than 32 bits
  232. on the host machine.
  233. </p>
  234. <p>The array element values are designed so that you can print them out
  235. using <code>fprintf</code> in the order they should appear in the target
  236. machine&rsquo;s memory.
  237. </p></dd></dl>
  238. <hr>
  239. <div class="header">
  240. <p>
  241. Next: <a href="Uninitialized-Data.html#Uninitialized-Data" accesskey="n" rel="next">Uninitialized Data</a>, Previous: <a href="File-Framework.html#File-Framework" accesskey="p" rel="prev">File Framework</a>, Up: <a href="Assembler-Format.html#Assembler-Format" accesskey="u" rel="up">Assembler Format</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>
  242. </div>
  243. </body>
  244. </html>