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.

151 lines
6.9KB

  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>Calls (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Calls (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Calls (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="RTL.html#RTL" rel="up" title="RTL">
  30. <link href="Sharing.html#Sharing" rel="next" title="Sharing">
  31. <link href="Insns.html#Insns" rel="prev" title="Insns">
  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="Calls"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Sharing.html#Sharing" accesskey="n" rel="next">Sharing</a>, Previous: <a href="Insns.html#Insns" accesskey="p" rel="prev">Insns</a>, Up: <a href="RTL.html#RTL" accesskey="u" rel="up">RTL</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="RTL-Representation-of-Function_002dCall-Insns"></a>
  68. <h3 class="section">14.20 RTL Representation of Function-Call Insns</h3>
  69. <a name="index-calling-functions-in-RTL"></a>
  70. <a name="index-RTL-function_002dcall-insns"></a>
  71. <a name="index-function_002dcall-insns"></a>
  72. <p>Insns that call subroutines have the RTL expression code <code>call_insn</code>.
  73. These insns must satisfy special rules, and their bodies must use a special
  74. RTL expression code, <code>call</code>.
  75. </p>
  76. <a name="index-call-usage"></a>
  77. <p>A <code>call</code> expression has two operands, as follows:
  78. </p>
  79. <div class="smallexample">
  80. <pre class="smallexample">(call (mem:<var>fm</var> <var>addr</var>) <var>nbytes</var>)
  81. </pre></div>
  82. <p>Here <var>nbytes</var> is an operand that represents the number of bytes of
  83. argument data being passed to the subroutine, <var>fm</var> is a machine mode
  84. (which must equal as the definition of the <code>FUNCTION_MODE</code> macro in
  85. the machine description) and <var>addr</var> represents the address of the
  86. subroutine.
  87. </p>
  88. <p>For a subroutine that returns no value, the <code>call</code> expression as
  89. shown above is the entire body of the insn, except that the insn might
  90. also contain <code>use</code> or <code>clobber</code> expressions.
  91. </p>
  92. <a name="index-BLKmode_002c-and-function-return-values"></a>
  93. <p>For a subroutine that returns a value whose mode is not <code>BLKmode</code>,
  94. the value is returned in a hard register. If this register&rsquo;s number is
  95. <var>r</var>, then the body of the call insn looks like this:
  96. </p>
  97. <div class="smallexample">
  98. <pre class="smallexample">(set (reg:<var>m</var> <var>r</var>)
  99. (call (mem:<var>fm</var> <var>addr</var>) <var>nbytes</var>))
  100. </pre></div>
  101. <p>This RTL expression makes it clear (to the optimizer passes) that the
  102. appropriate register receives a useful value in this insn.
  103. </p>
  104. <p>When a subroutine returns a <code>BLKmode</code> value, it is handled by
  105. passing to the subroutine the address of a place to store the value.
  106. So the call insn itself does not &ldquo;return&rdquo; any value, and it has the
  107. same RTL form as a call that returns nothing.
  108. </p>
  109. <p>On some machines, the call instruction itself clobbers some register,
  110. for example to contain the return address. <code>call_insn</code> insns
  111. on these machines should have a body which is a <code>parallel</code>
  112. that contains both the <code>call</code> expression and <code>clobber</code>
  113. expressions that indicate which registers are destroyed. Similarly,
  114. if the call instruction requires some register other than the stack
  115. pointer that is not explicitly mentioned in its RTL, a <code>use</code>
  116. subexpression should mention that register.
  117. </p>
  118. <p>Functions that are called are assumed to modify all registers listed in
  119. the configuration macro <code>CALL_USED_REGISTERS</code> (see <a href="Register-Basics.html#Register-Basics">Register Basics</a>) and, with the exception of <code>const</code> functions and library
  120. calls, to modify all of memory.
  121. </p>
  122. <p>Insns containing just <code>use</code> expressions directly precede the
  123. <code>call_insn</code> insn to indicate which registers contain inputs to the
  124. function. Similarly, if registers other than those in
  125. <code>CALL_USED_REGISTERS</code> are clobbered by the called function, insns
  126. containing a single <code>clobber</code> follow immediately after the call to
  127. indicate which registers.
  128. </p>
  129. <hr>
  130. <div class="header">
  131. <p>
  132. Next: <a href="Sharing.html#Sharing" accesskey="n" rel="next">Sharing</a>, Previous: <a href="Insns.html#Insns" accesskey="p" rel="prev">Insns</a>, Up: <a href="RTL.html#RTL" accesskey="u" rel="up">RTL</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>
  133. </div>
  134. </body>
  135. </html>