Costs.html 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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: Costs</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Costs">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Costs">
  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="Scheduling.html#Scheduling" rel="next" title="Scheduling">
  31. <link href="MODE_005fCC-Condition-Codes.html#MODE_005fCC-Condition-Codes" rel="prev" title="MODE_CC Condition Codes">
  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="Costs"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Scheduling.html#Scheduling" accesskey="n" rel="next">Scheduling</a>, Previous: <a href="Condition-Code.html#Condition-Code" accesskey="p" rel="prev">Condition Code</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="Describing-Relative-Costs-of-Operations"></a>
  69. <h3 class="section">17.16 Describing Relative Costs of Operations</h3>
  70. <a name="index-costs-of-instructions"></a>
  71. <a name="index-relative-costs"></a>
  72. <a name="index-speed-of-instructions"></a>
  73. <p>These macros let you describe the relative speed of various operations
  74. on the target machine.
  75. </p>
  76. <dl>
  77. <dt><a name="index-REGISTER_005fMOVE_005fCOST"></a>Macro: <strong>REGISTER_MOVE_COST</strong> <em>(<var>mode</var>, <var>from</var>, <var>to</var>)</em></dt>
  78. <dd><p>A C expression for the cost of moving data of mode <var>mode</var> from a
  79. register in class <var>from</var> to one in class <var>to</var>. The classes are
  80. expressed using the enumeration values such as <code>GENERAL_REGS</code>. A
  81. value of 2 is the default; other values are interpreted relative to
  82. that.
  83. </p>
  84. <p>It is not required that the cost always equal 2 when <var>from</var> is the
  85. same as <var>to</var>; on some machines it is expensive to move between
  86. registers if they are not general registers.
  87. </p>
  88. <p>If reload sees an insn consisting of a single <code>set</code> between two
  89. hard registers, and if <code>REGISTER_MOVE_COST</code> applied to their
  90. classes returns a value of 2, reload does not check to ensure that the
  91. constraints of the insn are met. Setting a cost of other than 2 will
  92. allow reload to verify that the constraints are met. You should do this
  93. if the &lsquo;<samp>mov<var>m</var></samp>&rsquo; pattern&rsquo;s constraints do not allow such copying.
  94. </p>
  95. <p>These macros are obsolete, new ports should use the target hook
  96. <code>TARGET_REGISTER_MOVE_COST</code> instead.
  97. </p></dd></dl>
  98. <dl>
  99. <dt><a name="index-TARGET_005fREGISTER_005fMOVE_005fCOST"></a>Target Hook: <em>int</em> <strong>TARGET_REGISTER_MOVE_COST</strong> <em>(machine_mode <var>mode</var>, reg_class_t <var>from</var>, reg_class_t <var>to</var>)</em></dt>
  100. <dd><p>This target hook should return the cost of moving data of mode <var>mode</var>
  101. from a register in class <var>from</var> to one in class <var>to</var>. The classes
  102. are expressed using the enumeration values such as <code>GENERAL_REGS</code>.
  103. A value of 2 is the default; other values are interpreted relative to
  104. that.
  105. </p>
  106. <p>It is not required that the cost always equal 2 when <var>from</var> is the
  107. same as <var>to</var>; on some machines it is expensive to move between
  108. registers if they are not general registers.
  109. </p>
  110. <p>If reload sees an insn consisting of a single <code>set</code> between two
  111. hard registers, and if <code>TARGET_REGISTER_MOVE_COST</code> applied to their
  112. classes returns a value of 2, reload does not check to ensure that the
  113. constraints of the insn are met. Setting a cost of other than 2 will
  114. allow reload to verify that the constraints are met. You should do this
  115. if the &lsquo;<samp>mov<var>m</var></samp>&rsquo; pattern&rsquo;s constraints do not allow such copying.
  116. </p>
  117. <p>The default version of this function returns 2.
  118. </p></dd></dl>
  119. <dl>
  120. <dt><a name="index-MEMORY_005fMOVE_005fCOST"></a>Macro: <strong>MEMORY_MOVE_COST</strong> <em>(<var>mode</var>, <var>class</var>, <var>in</var>)</em></dt>
  121. <dd><p>A C expression for the cost of moving data of mode <var>mode</var> between a
  122. register of class <var>class</var> and memory; <var>in</var> is zero if the value
  123. is to be written to memory, nonzero if it is to be read in. This cost
  124. is relative to those in <code>REGISTER_MOVE_COST</code>. If moving between
  125. registers and memory is more expensive than between two registers, you
  126. should define this macro to express the relative cost.
  127. </p>
  128. <p>If you do not define this macro, GCC uses a default cost of 4 plus
  129. the cost of copying via a secondary reload register, if one is
  130. needed. If your machine requires a secondary reload register to copy
  131. between memory and a register of <var>class</var> but the reload mechanism is
  132. more complex than copying via an intermediate, define this macro to
  133. reflect the actual cost of the move.
  134. </p>
  135. <p>GCC defines the function <code>memory_move_secondary_cost</code> if
  136. secondary reloads are needed. It computes the costs due to copying via
  137. a secondary register. If your machine copies from memory using a
  138. secondary register in the conventional way but the default base value of
  139. 4 is not correct for your machine, define this macro to add some other
  140. value to the result of that function. The arguments to that function
  141. are the same as to this macro.
  142. </p>
  143. <p>These macros are obsolete, new ports should use the target hook
  144. <code>TARGET_MEMORY_MOVE_COST</code> instead.
  145. </p></dd></dl>
  146. <dl>
  147. <dt><a name="index-TARGET_005fMEMORY_005fMOVE_005fCOST"></a>Target Hook: <em>int</em> <strong>TARGET_MEMORY_MOVE_COST</strong> <em>(machine_mode <var>mode</var>, reg_class_t <var>rclass</var>, bool <var>in</var>)</em></dt>
  148. <dd><p>This target hook should return the cost of moving data of mode <var>mode</var>
  149. between a register of class <var>rclass</var> and memory; <var>in</var> is <code>false</code>
  150. if the value is to be written to memory, <code>true</code> if it is to be read in.
  151. This cost is relative to those in <code>TARGET_REGISTER_MOVE_COST</code>.
  152. If moving between registers and memory is more expensive than between two
  153. registers, you should add this target hook to express the relative cost.
  154. </p>
  155. <p>If you do not add this target hook, GCC uses a default cost of 4 plus
  156. the cost of copying via a secondary reload register, if one is
  157. needed. If your machine requires a secondary reload register to copy
  158. between memory and a register of <var>rclass</var> but the reload mechanism is
  159. more complex than copying via an intermediate, use this target hook to
  160. reflect the actual cost of the move.
  161. </p>
  162. <p>GCC defines the function <code>memory_move_secondary_cost</code> if
  163. secondary reloads are needed. It computes the costs due to copying via
  164. a secondary register. If your machine copies from memory using a
  165. secondary register in the conventional way but the default base value of
  166. 4 is not correct for your machine, use this target hook to add some other
  167. value to the result of that function. The arguments to that function
  168. are the same as to this target hook.
  169. </p></dd></dl>
  170. <dl>
  171. <dt><a name="index-BRANCH_005fCOST"></a>Macro: <strong>BRANCH_COST</strong> <em>(<var>speed_p</var>, <var>predictable_p</var>)</em></dt>
  172. <dd><p>A C expression for the cost of a branch instruction. A value of 1 is
  173. the default; other values are interpreted relative to that. Parameter
  174. <var>speed_p</var> is true when the branch in question should be optimized
  175. for speed. When it is false, <code>BRANCH_COST</code> should return a value
  176. optimal for code size rather than performance. <var>predictable_p</var> is
  177. true for well-predicted branches. On many architectures the
  178. <code>BRANCH_COST</code> can be reduced then.
  179. </p></dd></dl>
  180. <p>Here are additional macros which do not specify precise relative costs,
  181. but only that certain actions are more expensive than GCC would
  182. ordinarily expect.
  183. </p>
  184. <dl>
  185. <dt><a name="index-SLOW_005fBYTE_005fACCESS"></a>Macro: <strong>SLOW_BYTE_ACCESS</strong></dt>
  186. <dd><p>Define this macro as a C expression which is nonzero if accessing less
  187. than a word of memory (i.e. a <code>char</code> or a <code>short</code>) is no
  188. faster than accessing a word of memory, i.e., if such access
  189. require more than one instruction or if there is no difference in cost
  190. between byte and (aligned) word loads.
  191. </p>
  192. <p>When this macro is not defined, the compiler will access a field by
  193. finding the smallest containing object; when it is defined, a fullword
  194. load will be used if alignment permits. Unless bytes accesses are
  195. faster than word accesses, using word accesses is preferable since it
  196. may eliminate subsequent memory access if subsequent accesses occur to
  197. other fields in the same word of the structure, but to different bytes.
  198. </p></dd></dl>
  199. <dl>
  200. <dt><a name="index-SLOW_005fUNALIGNED_005fACCESS"></a>Macro: <strong>SLOW_UNALIGNED_ACCESS</strong> <em>(<var>mode</var>, <var>alignment</var>)</em></dt>
  201. <dd><p>Define this macro to be the value 1 if memory accesses described by the
  202. <var>mode</var> and <var>alignment</var> parameters have a cost many times greater
  203. than aligned accesses, for example if they are emulated in a trap
  204. handler. This macro is invoked only for unaligned accesses, i.e. when
  205. <code><var>alignment</var> &lt; GET_MODE_ALIGNMENT (<var>mode</var>)</code>.
  206. </p>
  207. <p>When this macro is nonzero, the compiler will act as if
  208. <code>STRICT_ALIGNMENT</code> were nonzero when generating code for block
  209. moves. This can cause significantly more instructions to be produced.
  210. Therefore, do not set this macro nonzero if unaligned accesses only add a
  211. cycle or two to the time for a memory access.
  212. </p>
  213. <p>If the value of this macro is always zero, it need not be defined. If
  214. this macro is defined, it should produce a nonzero value when
  215. <code>STRICT_ALIGNMENT</code> is nonzero.
  216. </p></dd></dl>
  217. <dl>
  218. <dt><a name="index-MOVE_005fRATIO"></a>Macro: <strong>MOVE_RATIO</strong> <em>(<var>speed</var>)</em></dt>
  219. <dd><p>The threshold of number of scalar memory-to-memory move insns, <em>below</em>
  220. which a sequence of insns should be generated instead of a
  221. string move insn or a library call. Increasing the value will always
  222. make code faster, but eventually incurs high cost in increased code size.
  223. </p>
  224. <p>Note that on machines where the corresponding move insn is a
  225. <code>define_expand</code> that emits a sequence of insns, this macro counts
  226. the number of such sequences.
  227. </p>
  228. <p>The parameter <var>speed</var> is true if the code is currently being
  229. optimized for speed rather than size.
  230. </p>
  231. <p>If you don&rsquo;t define this, a reasonable default is used.
  232. </p></dd></dl>
  233. <dl>
  234. <dt><a name="index-TARGET_005fUSE_005fBY_005fPIECES_005fINFRASTRUCTURE_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_USE_BY_PIECES_INFRASTRUCTURE_P</strong> <em>(unsigned HOST_WIDE_INT <var>size</var>, unsigned int <var>alignment</var>, enum by_pieces_operation <var>op</var>, bool <var>speed_p</var>)</em></dt>
  235. <dd><p>GCC will attempt several strategies when asked to copy between
  236. two areas of memory, or to set, clear or store to memory, for example
  237. when copying a <code>struct</code>. The <code>by_pieces</code> infrastructure
  238. implements such memory operations as a sequence of load, store or move
  239. insns. Alternate strategies are to expand the
  240. <code>movmem</code> or <code>setmem</code> optabs, to emit a library call, or to emit
  241. unit-by-unit, loop-based operations.
  242. </p>
  243. <p>This target hook should return true if, for a memory operation with a
  244. given <var>size</var> and <var>alignment</var>, using the <code>by_pieces</code>
  245. infrastructure is expected to result in better code generation.
  246. Both <var>size</var> and <var>alignment</var> are measured in terms of storage
  247. units.
  248. </p>
  249. <p>The parameter <var>op</var> is one of: <code>CLEAR_BY_PIECES</code>,
  250. <code>MOVE_BY_PIECES</code>, <code>SET_BY_PIECES</code>, <code>STORE_BY_PIECES</code> or
  251. <code>COMPARE_BY_PIECES</code>. These describe the type of memory operation
  252. under consideration.
  253. </p>
  254. <p>The parameter <var>speed_p</var> is true if the code is currently being
  255. optimized for speed rather than size.
  256. </p>
  257. <p>Returning true for higher values of <var>size</var> can improve code generation
  258. for speed if the target does not provide an implementation of the
  259. <code>movmem</code> or <code>setmem</code> standard names, if the <code>movmem</code> or
  260. <code>setmem</code> implementation would be more expensive than a sequence of
  261. insns, or if the overhead of a library call would dominate that of
  262. the body of the memory operation.
  263. </p>
  264. <p>Returning true for higher values of <code>size</code> may also cause an increase
  265. in code size, for example where the number of insns emitted to perform a
  266. move would be greater than that of a library call.
  267. </p></dd></dl>
  268. <dl>
  269. <dt><a name="index-TARGET_005fCOMPARE_005fBY_005fPIECES_005fBRANCH_005fRATIO"></a>Target Hook: <em>int</em> <strong>TARGET_COMPARE_BY_PIECES_BRANCH_RATIO</strong> <em>(machine_mode <var>mode</var>)</em></dt>
  270. <dd><p>When expanding a block comparison in MODE, gcc can try to reduce the
  271. number of branches at the expense of more memory operations. This hook
  272. allows the target to override the default choice. It should return the
  273. factor by which branches should be reduced over the plain expansion with
  274. one comparison per <var>mode</var>-sized piece. A port can also prevent a
  275. particular mode from being used for block comparisons by returning a
  276. negative number from this hook.
  277. </p></dd></dl>
  278. <dl>
  279. <dt><a name="index-MOVE_005fMAX_005fPIECES"></a>Macro: <strong>MOVE_MAX_PIECES</strong></dt>
  280. <dd><p>A C expression used by <code>move_by_pieces</code> to determine the largest unit
  281. a load or store used to copy memory is. Defaults to <code>MOVE_MAX</code>.
  282. </p></dd></dl>
  283. <dl>
  284. <dt><a name="index-STORE_005fMAX_005fPIECES"></a>Macro: <strong>STORE_MAX_PIECES</strong></dt>
  285. <dd><p>A C expression used by <code>store_by_pieces</code> to determine the largest unit
  286. a store used to memory is. Defaults to <code>MOVE_MAX_PIECES</code>, or two times
  287. the size of <code>HOST_WIDE_INT</code>, whichever is smaller.
  288. </p></dd></dl>
  289. <dl>
  290. <dt><a name="index-COMPARE_005fMAX_005fPIECES"></a>Macro: <strong>COMPARE_MAX_PIECES</strong></dt>
  291. <dd><p>A C expression used by <code>compare_by_pieces</code> to determine the largest unit
  292. a load or store used to compare memory is. Defaults to
  293. <code>MOVE_MAX_PIECES</code>.
  294. </p></dd></dl>
  295. <dl>
  296. <dt><a name="index-CLEAR_005fRATIO"></a>Macro: <strong>CLEAR_RATIO</strong> <em>(<var>speed</var>)</em></dt>
  297. <dd><p>The threshold of number of scalar move insns, <em>below</em> which a sequence
  298. of insns should be generated to clear memory instead of a string clear insn
  299. or a library call. Increasing the value will always make code faster, but
  300. eventually incurs high cost in increased code size.
  301. </p>
  302. <p>The parameter <var>speed</var> is true if the code is currently being
  303. optimized for speed rather than size.
  304. </p>
  305. <p>If you don&rsquo;t define this, a reasonable default is used.
  306. </p></dd></dl>
  307. <dl>
  308. <dt><a name="index-SET_005fRATIO"></a>Macro: <strong>SET_RATIO</strong> <em>(<var>speed</var>)</em></dt>
  309. <dd><p>The threshold of number of scalar move insns, <em>below</em> which a sequence
  310. of insns should be generated to set memory to a constant value, instead of
  311. a block set insn or a library call.
  312. Increasing the value will always make code faster, but
  313. eventually incurs high cost in increased code size.
  314. </p>
  315. <p>The parameter <var>speed</var> is true if the code is currently being
  316. optimized for speed rather than size.
  317. </p>
  318. <p>If you don&rsquo;t define this, it defaults to the value of <code>MOVE_RATIO</code>.
  319. </p></dd></dl>
  320. <dl>
  321. <dt><a name="index-USE_005fLOAD_005fPOST_005fINCREMENT"></a>Macro: <strong>USE_LOAD_POST_INCREMENT</strong> <em>(<var>mode</var>)</em></dt>
  322. <dd><p>A C expression used to determine whether a load postincrement is a good
  323. thing to use for a given mode. Defaults to the value of
  324. <code>HAVE_POST_INCREMENT</code>.
  325. </p></dd></dl>
  326. <dl>
  327. <dt><a name="index-USE_005fLOAD_005fPOST_005fDECREMENT"></a>Macro: <strong>USE_LOAD_POST_DECREMENT</strong> <em>(<var>mode</var>)</em></dt>
  328. <dd><p>A C expression used to determine whether a load postdecrement is a good
  329. thing to use for a given mode. Defaults to the value of
  330. <code>HAVE_POST_DECREMENT</code>.
  331. </p></dd></dl>
  332. <dl>
  333. <dt><a name="index-USE_005fLOAD_005fPRE_005fINCREMENT"></a>Macro: <strong>USE_LOAD_PRE_INCREMENT</strong> <em>(<var>mode</var>)</em></dt>
  334. <dd><p>A C expression used to determine whether a load preincrement is a good
  335. thing to use for a given mode. Defaults to the value of
  336. <code>HAVE_PRE_INCREMENT</code>.
  337. </p></dd></dl>
  338. <dl>
  339. <dt><a name="index-USE_005fLOAD_005fPRE_005fDECREMENT"></a>Macro: <strong>USE_LOAD_PRE_DECREMENT</strong> <em>(<var>mode</var>)</em></dt>
  340. <dd><p>A C expression used to determine whether a load predecrement is a good
  341. thing to use for a given mode. Defaults to the value of
  342. <code>HAVE_PRE_DECREMENT</code>.
  343. </p></dd></dl>
  344. <dl>
  345. <dt><a name="index-USE_005fSTORE_005fPOST_005fINCREMENT"></a>Macro: <strong>USE_STORE_POST_INCREMENT</strong> <em>(<var>mode</var>)</em></dt>
  346. <dd><p>A C expression used to determine whether a store postincrement is a good
  347. thing to use for a given mode. Defaults to the value of
  348. <code>HAVE_POST_INCREMENT</code>.
  349. </p></dd></dl>
  350. <dl>
  351. <dt><a name="index-USE_005fSTORE_005fPOST_005fDECREMENT"></a>Macro: <strong>USE_STORE_POST_DECREMENT</strong> <em>(<var>mode</var>)</em></dt>
  352. <dd><p>A C expression used to determine whether a store postdecrement is a good
  353. thing to use for a given mode. Defaults to the value of
  354. <code>HAVE_POST_DECREMENT</code>.
  355. </p></dd></dl>
  356. <dl>
  357. <dt><a name="index-USE_005fSTORE_005fPRE_005fINCREMENT"></a>Macro: <strong>USE_STORE_PRE_INCREMENT</strong> <em>(<var>mode</var>)</em></dt>
  358. <dd><p>This macro is used to determine whether a store preincrement is a good
  359. thing to use for a given mode. Defaults to the value of
  360. <code>HAVE_PRE_INCREMENT</code>.
  361. </p></dd></dl>
  362. <dl>
  363. <dt><a name="index-USE_005fSTORE_005fPRE_005fDECREMENT"></a>Macro: <strong>USE_STORE_PRE_DECREMENT</strong> <em>(<var>mode</var>)</em></dt>
  364. <dd><p>This macro is used to determine whether a store predecrement is a good
  365. thing to use for a given mode. Defaults to the value of
  366. <code>HAVE_PRE_DECREMENT</code>.
  367. </p></dd></dl>
  368. <dl>
  369. <dt><a name="index-NO_005fFUNCTION_005fCSE"></a>Macro: <strong>NO_FUNCTION_CSE</strong></dt>
  370. <dd><p>Define this macro to be true if it is as good or better to call a constant
  371. function address than to call an address kept in a register.
  372. </p></dd></dl>
  373. <dl>
  374. <dt><a name="index-LOGICAL_005fOP_005fNON_005fSHORT_005fCIRCUIT"></a>Macro: <strong>LOGICAL_OP_NON_SHORT_CIRCUIT</strong></dt>
  375. <dd><p>Define this macro if a non-short-circuit operation produced by
  376. &lsquo;<samp>fold_range_test ()</samp>&rsquo; is optimal. This macro defaults to true if
  377. <code>BRANCH_COST</code> is greater than or equal to the value 2.
  378. </p></dd></dl>
  379. <dl>
  380. <dt><a name="index-TARGET_005fOPTAB_005fSUPPORTED_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_OPTAB_SUPPORTED_P</strong> <em>(int <var>op</var>, machine_mode <var>mode1</var>, machine_mode <var>mode2</var>, optimization_type <var>opt_type</var>)</em></dt>
  381. <dd><p>Return true if the optimizers should use optab <var>op</var> with
  382. modes <var>mode1</var> and <var>mode2</var> for optimization type <var>opt_type</var>.
  383. The optab is known to have an associated <samp>.md</samp> instruction
  384. whose C condition is true. <var>mode2</var> is only meaningful for conversion
  385. optabs; for direct optabs it is a copy of <var>mode1</var>.
  386. </p>
  387. <p>For example, when called with <var>op</var> equal to <code>rint_optab</code> and
  388. <var>mode1</var> equal to <code>DFmode</code>, the hook should say whether the
  389. optimizers should use optab <code>rintdf2</code>.
  390. </p>
  391. <p>The default hook returns true for all inputs.
  392. </p></dd></dl>
  393. <dl>
  394. <dt><a name="index-TARGET_005fRTX_005fCOSTS"></a>Target Hook: <em>bool</em> <strong>TARGET_RTX_COSTS</strong> <em>(rtx <var>x</var>, machine_mode <var>mode</var>, int <var>outer_code</var>, int <var>opno</var>, int *<var>total</var>, bool <var>speed</var>)</em></dt>
  395. <dd><p>This target hook describes the relative costs of RTL expressions.
  396. </p>
  397. <p>The cost may depend on the precise form of the expression, which is
  398. available for examination in <var>x</var>, and the fact that <var>x</var> appears
  399. as operand <var>opno</var> of an expression with rtx code <var>outer_code</var>.
  400. That is, the hook can assume that there is some rtx <var>y</var> such
  401. that &lsquo;<samp>GET_CODE (<var>y</var>) == <var>outer_code</var></samp>&rsquo; and such that
  402. either (a) &lsquo;<samp>XEXP (<var>y</var>, <var>opno</var>) == <var>x</var></samp>&rsquo; or
  403. (b) &lsquo;<samp>XVEC (<var>y</var>, <var>opno</var>)</samp>&rsquo; contains <var>x</var>.
  404. </p>
  405. <p><var>mode</var> is <var>x</var>&rsquo;s machine mode, or for cases like <code>const_int</code> that
  406. do not have a mode, the mode in which <var>x</var> is used.
  407. </p>
  408. <p>In implementing this hook, you can use the construct
  409. <code>COSTS_N_INSNS (<var>n</var>)</code> to specify a cost equal to <var>n</var> fast
  410. instructions.
  411. </p>
  412. <p>On entry to the hook, <code>*<var>total</var></code> contains a default estimate
  413. for the cost of the expression. The hook should modify this value as
  414. necessary. Traditionally, the default costs are <code>COSTS_N_INSNS (5)</code>
  415. for multiplications, <code>COSTS_N_INSNS (7)</code> for division and modulus
  416. operations, and <code>COSTS_N_INSNS (1)</code> for all other operations.
  417. </p>
  418. <p>When optimizing for code size, i.e. when <code>speed</code> is
  419. false, this target hook should be used to estimate the relative
  420. size cost of an expression, again relative to <code>COSTS_N_INSNS</code>.
  421. </p>
  422. <p>The hook returns true when all subexpressions of <var>x</var> have been
  423. processed, and false when <code>rtx_cost</code> should recurse.
  424. </p></dd></dl>
  425. <dl>
  426. <dt><a name="index-TARGET_005fADDRESS_005fCOST"></a>Target Hook: <em>int</em> <strong>TARGET_ADDRESS_COST</strong> <em>(rtx <var>address</var>, machine_mode <var>mode</var>, addr_space_t <var>as</var>, bool <var>speed</var>)</em></dt>
  427. <dd><p>This hook computes the cost of an addressing mode that contains
  428. <var>address</var>. If not defined, the cost is computed from
  429. the <var>address</var> expression and the <code>TARGET_RTX_COST</code> hook.
  430. </p>
  431. <p>For most CISC machines, the default cost is a good approximation of the
  432. true cost of the addressing mode. However, on RISC machines, all
  433. instructions normally have the same length and execution time. Hence
  434. all addresses will have equal costs.
  435. </p>
  436. <p>In cases where more than one form of an address is known, the form with
  437. the lowest cost will be used. If multiple forms have the same, lowest,
  438. cost, the one that is the most complex will be used.
  439. </p>
  440. <p>For example, suppose an address that is equal to the sum of a register
  441. and a constant is used twice in the same basic block. When this macro
  442. is not defined, the address will be computed in a register and memory
  443. references will be indirect through that register. On machines where
  444. the cost of the addressing mode containing the sum is no higher than
  445. that of a simple indirect reference, this will produce an additional
  446. instruction and possibly require an additional register. Proper
  447. specification of this macro eliminates this overhead for such machines.
  448. </p>
  449. <p>This hook is never called with an invalid address.
  450. </p>
  451. <p>On machines where an address involving more than one register is as
  452. cheap as an address computation involving only one register, defining
  453. <code>TARGET_ADDRESS_COST</code> to reflect this can cause two registers to
  454. be live over a region of code where only one would have been if
  455. <code>TARGET_ADDRESS_COST</code> were not defined in that manner. This effect
  456. should be considered in the definition of this macro. Equivalent costs
  457. should probably only be given to addresses with different numbers of
  458. registers on machines with lots of registers.
  459. </p></dd></dl>
  460. <dl>
  461. <dt><a name="index-TARGET_005fMAX_005fNOCE_005fIFCVT_005fSEQ_005fCOST"></a>Target Hook: <em>unsigned int</em> <strong>TARGET_MAX_NOCE_IFCVT_SEQ_COST</strong> <em>(edge <var>e</var>)</em></dt>
  462. <dd><p>This hook returns a value in the same units as <code>TARGET_RTX_COSTS</code>,
  463. giving the maximum acceptable cost for a sequence generated by the RTL
  464. if-conversion pass when conditional execution is not available.
  465. The RTL if-conversion pass attempts to convert conditional operations
  466. that would require a branch to a series of unconditional operations and
  467. <code>mov<var>mode</var>cc</code> insns. This hook returns the maximum cost of the
  468. unconditional instructions and the <code>mov<var>mode</var>cc</code> insns.
  469. RTL if-conversion is cancelled if the cost of the converted sequence
  470. is greater than the value returned by this hook.
  471. </p>
  472. <p><code>e</code> is the edge between the basic block containing the conditional
  473. branch to the basic block which would be executed if the condition
  474. were true.
  475. </p>
  476. <p>The default implementation of this hook uses the
  477. <code>max-rtl-if-conversion-[un]predictable</code> parameters if they are set,
  478. and uses a multiple of <code>BRANCH_COST</code> otherwise.
  479. </p></dd></dl>
  480. <dl>
  481. <dt><a name="index-TARGET_005fNOCE_005fCONVERSION_005fPROFITABLE_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_NOCE_CONVERSION_PROFITABLE_P</strong> <em>(rtx_insn *<var>seq</var>, struct noce_if_info *<var>if_info</var>)</em></dt>
  482. <dd><p>This hook returns true if the instruction sequence <code>seq</code> is a good
  483. candidate as a replacement for the if-convertible sequence described in
  484. <code>if_info</code>.
  485. </p></dd></dl>
  486. <dl>
  487. <dt><a name="index-TARGET_005fNO_005fSPECULATION_005fIN_005fDELAY_005fSLOTS_005fP"></a>Target Hook: <em>bool</em> <strong>TARGET_NO_SPECULATION_IN_DELAY_SLOTS_P</strong> <em>(void)</em></dt>
  488. <dd><p>This predicate controls the use of the eager delay slot filler to disallow
  489. speculatively executed instructions being placed in delay slots. Targets
  490. such as certain MIPS architectures possess both branches with and without
  491. delay slots. As the eager delay slot filler can decrease performance,
  492. disabling it is beneficial when ordinary branches are available. Use of
  493. delay slot branches filled using the basic filler is often still desirable
  494. as the delay slot can hide a pipeline bubble.
  495. </p></dd></dl>
  496. <hr>
  497. <div class="header">
  498. <p>
  499. Next: <a href="Scheduling.html#Scheduling" accesskey="n" rel="next">Scheduling</a>, Previous: <a href="Condition-Code.html#Condition-Code" accesskey="p" rel="prev">Condition Code</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>
  500. </div>
  501. </body>
  502. </html>