Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

172 lines
8.2KB

  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>Elimination (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Elimination (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Elimination (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="Stack-and-Calling.html#Stack-and-Calling" rel="up" title="Stack and Calling">
  30. <link href="Stack-Arguments.html#Stack-Arguments" rel="next" title="Stack Arguments">
  31. <link href="Frame-Registers.html#Frame-Registers" rel="prev" title="Frame Registers">
  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="Elimination"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Stack-Arguments.html#Stack-Arguments" accesskey="n" rel="next">Stack Arguments</a>, Previous: <a href="Frame-Registers.html#Frame-Registers" accesskey="p" rel="prev">Frame Registers</a>, Up: <a href="Stack-and-Calling.html#Stack-and-Calling" accesskey="u" rel="up">Stack and Calling</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="Eliminating-Frame-Pointer-and-Arg-Pointer"></a>
  68. <h4 class="subsection">18.9.5 Eliminating Frame Pointer and Arg Pointer</h4>
  69. <p>This is about eliminating the frame pointer and arg pointer.
  70. </p>
  71. <dl>
  72. <dt><a name="index-TARGET_005fFRAME_005fPOINTER_005fREQUIRED"></a>Target Hook: <em>bool</em> <strong>TARGET_FRAME_POINTER_REQUIRED</strong> <em>(void)</em></dt>
  73. <dd><p>This target hook should return <code>true</code> if a function must have and use
  74. a frame pointer. This target hook is called in the reload pass. If its return
  75. value is <code>true</code> the function will have a frame pointer.
  76. </p>
  77. <p>This target hook can in principle examine the current function and decide
  78. according to the facts, but on most machines the constant <code>false</code> or the
  79. constant <code>true</code> suffices. Use <code>false</code> when the machine allows code
  80. to be generated with no frame pointer, and doing so saves some time or space.
  81. Use <code>true</code> when there is no possible advantage to avoiding a frame
  82. pointer.
  83. </p>
  84. <p>In certain cases, the compiler does not know how to produce valid code
  85. without a frame pointer. The compiler recognizes those cases and
  86. automatically gives the function a frame pointer regardless of what
  87. <code>targetm.frame_pointer_required</code> returns. You don&rsquo;t need to worry about
  88. them.
  89. </p>
  90. <p>In a function that does not require a frame pointer, the frame pointer
  91. register can be allocated for ordinary usage, unless you mark it as a
  92. fixed register. See <code>FIXED_REGISTERS</code> for more information.
  93. </p>
  94. <p>Default return value is <code>false</code>.
  95. </p></dd></dl>
  96. <dl>
  97. <dt><a name="index-ELIMINABLE_005fREGS"></a>Macro: <strong>ELIMINABLE_REGS</strong></dt>
  98. <dd><p>This macro specifies a table of register pairs used to eliminate
  99. unneeded registers that point into the stack frame.
  100. </p>
  101. <p>The definition of this macro is a list of structure initializations, each
  102. of which specifies an original and replacement register.
  103. </p>
  104. <p>On some machines, the position of the argument pointer is not known until
  105. the compilation is completed. In such a case, a separate hard register
  106. must be used for the argument pointer. This register can be eliminated by
  107. replacing it with either the frame pointer or the argument pointer,
  108. depending on whether or not the frame pointer has been eliminated.
  109. </p>
  110. <p>In this case, you might specify:
  111. </p><div class="smallexample">
  112. <pre class="smallexample">#define ELIMINABLE_REGS \
  113. {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  114. {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  115. {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
  116. </pre></div>
  117. <p>Note that the elimination of the argument pointer with the stack pointer is
  118. specified first since that is the preferred elimination.
  119. </p></dd></dl>
  120. <dl>
  121. <dt><a name="index-TARGET_005fCAN_005fELIMINATE"></a>Target Hook: <em>bool</em> <strong>TARGET_CAN_ELIMINATE</strong> <em>(const int <var>from_reg</var>, const int <var>to_reg</var>)</em></dt>
  122. <dd><p>This target hook should return <code>true</code> if the compiler is allowed to
  123. try to replace register number <var>from_reg</var> with register number
  124. <var>to_reg</var>. This target hook will usually be <code>true</code>, since most of the
  125. cases preventing register elimination are things that the compiler already
  126. knows about.
  127. </p>
  128. <p>Default return value is <code>true</code>.
  129. </p></dd></dl>
  130. <dl>
  131. <dt><a name="index-INITIAL_005fELIMINATION_005fOFFSET"></a>Macro: <strong>INITIAL_ELIMINATION_OFFSET</strong> <em>(<var>from-reg</var>, <var>to-reg</var>, <var>offset-var</var>)</em></dt>
  132. <dd><p>This macro returns the initial difference between the specified pair
  133. of registers. The value would be computed from information
  134. such as the result of <code>get_frame_size ()</code> and the tables of
  135. registers <code>df_regs_ever_live_p</code> and <code>call_used_regs</code>.
  136. </p></dd></dl>
  137. <dl>
  138. <dt><a name="index-TARGET_005fCOMPUTE_005fFRAME_005fLAYOUT"></a>Target Hook: <em>void</em> <strong>TARGET_COMPUTE_FRAME_LAYOUT</strong> <em>(void)</em></dt>
  139. <dd><p>This target hook is called once each time the frame layout needs to be
  140. recalculated. The calculations can be cached by the target and can then
  141. be used by <code>INITIAL_ELIMINATION_OFFSET</code> instead of re-computing the
  142. layout on every invocation of that hook. This is particularly useful
  143. for targets that have an expensive frame layout function. Implementing
  144. this callback is optional.
  145. </p></dd></dl>
  146. <hr>
  147. <div class="header">
  148. <p>
  149. Next: <a href="Stack-Arguments.html#Stack-Arguments" accesskey="n" rel="next">Stack Arguments</a>, Previous: <a href="Frame-Registers.html#Frame-Registers" accesskey="p" rel="prev">Frame Registers</a>, Up: <a href="Stack-and-Calling.html#Stack-and-Calling" accesskey="u" rel="up">Stack and Calling</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>
  150. </div>
  151. </body>
  152. </html>