選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

158 行
9.4KB

  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>Mode Switching (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Mode Switching (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Mode Switching (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="Target-Attributes.html#Target-Attributes" rel="next" title="Target Attributes">
  31. <link href="Floating-Point.html#Floating-Point" rel="prev" title="Floating Point">
  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="Mode-Switching"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Target-Attributes.html#Target-Attributes" accesskey="n" rel="next">Target Attributes</a>, Previous: <a href="Floating-Point.html#Floating-Point" accesskey="p" rel="prev">Floating Point</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="Mode-Switching-Instructions"></a>
  68. <h3 class="section">18.23 Mode Switching Instructions</h3>
  69. <a name="index-mode-switching"></a>
  70. <p>The following macros control mode switching optimizations:
  71. </p>
  72. <dl>
  73. <dt><a name="index-OPTIMIZE_005fMODE_005fSWITCHING"></a>Macro: <strong>OPTIMIZE_MODE_SWITCHING</strong> <em>(<var>entity</var>)</em></dt>
  74. <dd><p>Define this macro if the port needs extra instructions inserted for mode
  75. switching in an optimizing compilation.
  76. </p>
  77. <p>For an example, the SH4 can perform both single and double precision
  78. floating point operations, but to perform a single precision operation,
  79. the FPSCR PR bit has to be cleared, while for a double precision
  80. operation, this bit has to be set. Changing the PR bit requires a general
  81. purpose register as a scratch register, hence these FPSCR sets have to
  82. be inserted before reload, i.e. you cannot put this into instruction emitting
  83. or <code>TARGET_MACHINE_DEPENDENT_REORG</code>.
  84. </p>
  85. <p>You can have multiple entities that are mode-switched, and select at run time
  86. which entities actually need it. <code>OPTIMIZE_MODE_SWITCHING</code> should
  87. return nonzero for any <var>entity</var> that needs mode-switching.
  88. If you define this macro, you also have to define
  89. <code>NUM_MODES_FOR_MODE_SWITCHING</code>, <code>TARGET_MODE_NEEDED</code>,
  90. <code>TARGET_MODE_PRIORITY</code> and <code>TARGET_MODE_EMIT</code>.
  91. <code>TARGET_MODE_AFTER</code>, <code>TARGET_MODE_ENTRY</code>, and <code>TARGET_MODE_EXIT</code>
  92. are optional.
  93. </p></dd></dl>
  94. <dl>
  95. <dt><a name="index-NUM_005fMODES_005fFOR_005fMODE_005fSWITCHING"></a>Macro: <strong>NUM_MODES_FOR_MODE_SWITCHING</strong></dt>
  96. <dd><p>If you define <code>OPTIMIZE_MODE_SWITCHING</code>, you have to define this as
  97. initializer for an array of integers. Each initializer element
  98. N refers to an entity that needs mode switching, and specifies the number
  99. of different modes that might need to be set for this entity.
  100. The position of the initializer in the initializer&mdash;starting counting at
  101. zero&mdash;determines the integer that is used to refer to the mode-switched
  102. entity in question.
  103. In macros that take mode arguments / yield a mode result, modes are
  104. represented as numbers 0 &hellip; N - 1. N is used to specify that no mode
  105. switch is needed / supplied.
  106. </p></dd></dl>
  107. <dl>
  108. <dt><a name="index-TARGET_005fMODE_005fEMIT"></a>Target Hook: <em>void</em> <strong>TARGET_MODE_EMIT</strong> <em>(int <var>entity</var>, int <var>mode</var>, int <var>prev_mode</var>, HARD_REG_SET <var>regs_live</var>)</em></dt>
  109. <dd><p>Generate one or more insns to set <var>entity</var> to <var>mode</var>. <var>hard_reg_live</var> is the set of hard registers live at the point where the insn(s) are to be inserted. <var>prev_moxde</var> indicates the mode to switch from. Sets of a lower numbered entity will be emitted before sets of a higher numbered entity to a mode of the same or lower priority.
  110. </p></dd></dl>
  111. <dl>
  112. <dt><a name="index-TARGET_005fMODE_005fNEEDED"></a>Target Hook: <em>int</em> <strong>TARGET_MODE_NEEDED</strong> <em>(int <var>entity</var>, rtx_insn *<var>insn</var>)</em></dt>
  113. <dd><p><var>entity</var> is an integer specifying a mode-switched entity. If <code>OPTIMIZE_MODE_SWITCHING</code> is defined, you must define this macro to return an integer value not larger than the corresponding element in <code>NUM_MODES_FOR_MODE_SWITCHING</code>, to denote the mode that <var>entity</var> must be switched into prior to the execution of <var>insn</var>.
  114. </p></dd></dl>
  115. <dl>
  116. <dt><a name="index-TARGET_005fMODE_005fAFTER"></a>Target Hook: <em>int</em> <strong>TARGET_MODE_AFTER</strong> <em>(int <var>entity</var>, int <var>mode</var>, rtx_insn *<var>insn</var>)</em></dt>
  117. <dd><p><var>entity</var> is an integer specifying a mode-switched entity. If this macro is defined, it is evaluated for every <var>insn</var> during mode switching. It determines the mode that an insn results in (if different from the incoming mode).
  118. </p></dd></dl>
  119. <dl>
  120. <dt><a name="index-TARGET_005fMODE_005fENTRY"></a>Target Hook: <em>int</em> <strong>TARGET_MODE_ENTRY</strong> <em>(int <var>entity</var>)</em></dt>
  121. <dd><p>If this macro is defined, it is evaluated for every <var>entity</var> that needs mode switching. It should evaluate to an integer, which is a mode that <var>entity</var> is assumed to be switched to at function entry. If <code>TARGET_MODE_ENTRY</code> is defined then <code>TARGET_MODE_EXIT</code> must be defined.
  122. </p></dd></dl>
  123. <dl>
  124. <dt><a name="index-TARGET_005fMODE_005fEXIT"></a>Target Hook: <em>int</em> <strong>TARGET_MODE_EXIT</strong> <em>(int <var>entity</var>)</em></dt>
  125. <dd><p>If this macro is defined, it is evaluated for every <var>entity</var> that needs mode switching. It should evaluate to an integer, which is a mode that <var>entity</var> is assumed to be switched to at function exit. If <code>TARGET_MODE_EXIT</code> is defined then <code>TARGET_MODE_ENTRY</code> must be defined.
  126. </p></dd></dl>
  127. <dl>
  128. <dt><a name="index-TARGET_005fMODE_005fPRIORITY"></a>Target Hook: <em>int</em> <strong>TARGET_MODE_PRIORITY</strong> <em>(int <var>entity</var>, int <var>n</var>)</em></dt>
  129. <dd><p>This macro specifies the order in which modes for <var>entity</var> are processed. 0 is the highest priority, <code>NUM_MODES_FOR_MODE_SWITCHING[<var>entity</var>] - 1</code> the lowest. The value of the macro should be an integer designating a mode for <var>entity</var>. For any fixed <var>entity</var>, <code>mode_priority</code> (<var>entity</var>, <var>n</var>) shall be a bijection in 0 &hellip; <code>num_modes_for_mode_switching[<var>entity</var>] - 1</code>.
  130. </p></dd></dl>
  131. <hr>
  132. <div class="header">
  133. <p>
  134. Next: <a href="Target-Attributes.html#Target-Attributes" accesskey="n" rel="next">Target Attributes</a>, Previous: <a href="Floating-Point.html#Floating-Point" accesskey="p" rel="prev">Floating Point</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>
  135. </div>
  136. </body>
  137. </html>