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.

595 lines
28KB

  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>Processor pipeline description (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Processor pipeline description (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Processor pipeline description (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="Insn-Attributes.html#Insn-Attributes" rel="up" title="Insn Attributes">
  30. <link href="Conditional-Execution.html#Conditional-Execution" rel="next" title="Conditional Execution">
  31. <link href="Delay-Slots.html#Delay-Slots" rel="prev" title="Delay Slots">
  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="Processor-pipeline-description"></a>
  62. <div class="header">
  63. <p>
  64. Previous: <a href="Delay-Slots.html#Delay-Slots" accesskey="p" rel="prev">Delay Slots</a>, Up: <a href="Insn-Attributes.html#Insn-Attributes" accesskey="u" rel="up">Insn Attributes</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="Specifying-processor-pipeline-description"></a>
  68. <h4 class="subsection">17.19.9 Specifying processor pipeline description</h4>
  69. <a name="index-processor-pipeline-description"></a>
  70. <a name="index-processor-functional-units"></a>
  71. <a name="index-instruction-latency-time"></a>
  72. <a name="index-interlock-delays"></a>
  73. <a name="index-data-dependence-delays"></a>
  74. <a name="index-reservation-delays"></a>
  75. <a name="index-pipeline-hazard-recognizer"></a>
  76. <a name="index-automaton-based-pipeline-description"></a>
  77. <a name="index-regular-expressions"></a>
  78. <a name="index-deterministic-finite-state-automaton"></a>
  79. <a name="index-automaton-based-scheduler"></a>
  80. <a name="index-RISC"></a>
  81. <a name="index-VLIW"></a>
  82. <p>To achieve better performance, most modern processors
  83. (super-pipelined, superscalar <acronym>RISC</acronym>, and <acronym>VLIW</acronym>
  84. processors) have many <em>functional units</em> on which several
  85. instructions can be executed simultaneously. An instruction starts
  86. execution if its issue conditions are satisfied. If not, the
  87. instruction is stalled until its conditions are satisfied. Such
  88. <em>interlock (pipeline) delay</em> causes interruption of the fetching
  89. of successor instructions (or demands nop instructions, e.g. for some
  90. MIPS processors).
  91. </p>
  92. <p>There are two major kinds of interlock delays in modern processors.
  93. The first one is a data dependence delay determining <em>instruction
  94. latency time</em>. The instruction execution is not started until all
  95. source data have been evaluated by prior instructions (there are more
  96. complex cases when the instruction execution starts even when the data
  97. are not available but will be ready in given time after the
  98. instruction execution start). Taking the data dependence delays into
  99. account is simple. The data dependence (true, output, and
  100. anti-dependence) delay between two instructions is given by a
  101. constant. In most cases this approach is adequate. The second kind
  102. of interlock delays is a reservation delay. The reservation delay
  103. means that two instructions under execution will be in need of shared
  104. processors resources, i.e. buses, internal registers, and/or
  105. functional units, which are reserved for some time. Taking this kind
  106. of delay into account is complex especially for modern <acronym>RISC</acronym>
  107. processors.
  108. </p>
  109. <p>The task of exploiting more processor parallelism is solved by an
  110. instruction scheduler. For a better solution to this problem, the
  111. instruction scheduler has to have an adequate description of the
  112. processor parallelism (or <em>pipeline description</em>). GCC
  113. machine descriptions describe processor parallelism and functional
  114. unit reservations for groups of instructions with the aid of
  115. <em>regular expressions</em>.
  116. </p>
  117. <p>The GCC instruction scheduler uses a <em>pipeline hazard recognizer</em> to
  118. figure out the possibility of the instruction issue by the processor
  119. on a given simulated processor cycle. The pipeline hazard recognizer is
  120. automatically generated from the processor pipeline description. The
  121. pipeline hazard recognizer generated from the machine description
  122. is based on a deterministic finite state automaton (<acronym>DFA</acronym>):
  123. the instruction issue is possible if there is a transition from one
  124. automaton state to another one. This algorithm is very fast, and
  125. furthermore, its speed is not dependent on processor
  126. complexity<a name="DOCF5" href="#FOOT5"><sup>5</sup></a>.
  127. </p>
  128. <a name="index-automaton-based-pipeline-description-1"></a>
  129. <p>The rest of this section describes the directives that constitute
  130. an automaton-based processor pipeline description. The order of
  131. these constructions within the machine description file is not
  132. important.
  133. </p>
  134. <a name="index-define_005fautomaton"></a>
  135. <a name="index-pipeline-hazard-recognizer-1"></a>
  136. <p>The following optional construction describes names of automata
  137. generated and used for the pipeline hazards recognition. Sometimes
  138. the generated finite state automaton used by the pipeline hazard
  139. recognizer is large. If we use more than one automaton and bind functional
  140. units to the automata, the total size of the automata is usually
  141. less than the size of the single automaton. If there is no one such
  142. construction, only one finite state automaton is generated.
  143. </p>
  144. <div class="smallexample">
  145. <pre class="smallexample">(define_automaton <var>automata-names</var>)
  146. </pre></div>
  147. <p><var>automata-names</var> is a string giving names of the automata. The
  148. names are separated by commas. All the automata should have unique names.
  149. The automaton name is used in the constructions <code>define_cpu_unit</code> and
  150. <code>define_query_cpu_unit</code>.
  151. </p>
  152. <a name="index-define_005fcpu_005funit"></a>
  153. <a name="index-processor-functional-units-1"></a>
  154. <p>Each processor functional unit used in the description of instruction
  155. reservations should be described by the following construction.
  156. </p>
  157. <div class="smallexample">
  158. <pre class="smallexample">(define_cpu_unit <var>unit-names</var> [<var>automaton-name</var>])
  159. </pre></div>
  160. <p><var>unit-names</var> is a string giving the names of the functional units
  161. separated by commas. Don&rsquo;t use name &lsquo;<samp>nothing</samp>&rsquo;, it is reserved
  162. for other goals.
  163. </p>
  164. <p><var>automaton-name</var> is a string giving the name of the automaton with
  165. which the unit is bound. The automaton should be described in
  166. construction <code>define_automaton</code>. You should give
  167. <em>automaton-name</em>, if there is a defined automaton.
  168. </p>
  169. <p>The assignment of units to automata are constrained by the uses of the
  170. units in insn reservations. The most important constraint is: if a
  171. unit reservation is present on a particular cycle of an alternative
  172. for an insn reservation, then some unit from the same automaton must
  173. be present on the same cycle for the other alternatives of the insn
  174. reservation. The rest of the constraints are mentioned in the
  175. description of the subsequent constructions.
  176. </p>
  177. <a name="index-define_005fquery_005fcpu_005funit"></a>
  178. <a name="index-querying-function-unit-reservations"></a>
  179. <p>The following construction describes CPU functional units analogously
  180. to <code>define_cpu_unit</code>. The reservation of such units can be
  181. queried for an automaton state. The instruction scheduler never
  182. queries reservation of functional units for given automaton state. So
  183. as a rule, you don&rsquo;t need this construction. This construction could
  184. be used for future code generation goals (e.g. to generate
  185. <acronym>VLIW</acronym> insn templates).
  186. </p>
  187. <div class="smallexample">
  188. <pre class="smallexample">(define_query_cpu_unit <var>unit-names</var> [<var>automaton-name</var>])
  189. </pre></div>
  190. <p><var>unit-names</var> is a string giving names of the functional units
  191. separated by commas.
  192. </p>
  193. <p><var>automaton-name</var> is a string giving the name of the automaton with
  194. which the unit is bound.
  195. </p>
  196. <a name="index-define_005finsn_005freservation"></a>
  197. <a name="index-instruction-latency-time-1"></a>
  198. <a name="index-regular-expressions-1"></a>
  199. <a name="index-data-bypass"></a>
  200. <p>The following construction is the major one to describe pipeline
  201. characteristics of an instruction.
  202. </p>
  203. <div class="smallexample">
  204. <pre class="smallexample">(define_insn_reservation <var>insn-name</var> <var>default_latency</var>
  205. <var>condition</var> <var>regexp</var>)
  206. </pre></div>
  207. <p><var>default_latency</var> is a number giving latency time of the
  208. instruction. There is an important difference between the old
  209. description and the automaton based pipeline description. The latency
  210. time is used for all dependencies when we use the old description. In
  211. the automaton based pipeline description, the given latency time is only
  212. used for true dependencies. The cost of anti-dependencies is always
  213. zero and the cost of output dependencies is the difference between
  214. latency times of the producing and consuming insns (if the difference
  215. is negative, the cost is considered to be zero). You can always
  216. change the default costs for any description by using the target hook
  217. <code>TARGET_SCHED_ADJUST_COST</code> (see <a href="Scheduling.html#Scheduling">Scheduling</a>).
  218. </p>
  219. <p><var>insn-name</var> is a string giving the internal name of the insn. The
  220. internal names are used in constructions <code>define_bypass</code> and in
  221. the automaton description file generated for debugging. The internal
  222. name has nothing in common with the names in <code>define_insn</code>. It is a
  223. good practice to use insn classes described in the processor manual.
  224. </p>
  225. <p><var>condition</var> defines what RTL insns are described by this
  226. construction. You should remember that you will be in trouble if
  227. <var>condition</var> for two or more different
  228. <code>define_insn_reservation</code> constructions is TRUE for an insn. In
  229. this case what reservation will be used for the insn is not defined.
  230. Such cases are not checked during generation of the pipeline hazards
  231. recognizer because in general recognizing that two conditions may have
  232. the same value is quite difficult (especially if the conditions
  233. contain <code>symbol_ref</code>). It is also not checked during the
  234. pipeline hazard recognizer work because it would slow down the
  235. recognizer considerably.
  236. </p>
  237. <p><var>regexp</var> is a string describing the reservation of the cpu&rsquo;s functional
  238. units by the instruction. The reservations are described by a regular
  239. expression according to the following syntax:
  240. </p>
  241. <div class="smallexample">
  242. <pre class="smallexample"> regexp = regexp &quot;,&quot; oneof
  243. | oneof
  244. oneof = oneof &quot;|&quot; allof
  245. | allof
  246. allof = allof &quot;+&quot; repeat
  247. | repeat
  248. repeat = element &quot;*&quot; number
  249. | element
  250. element = cpu_function_unit_name
  251. | reservation_name
  252. | result_name
  253. | &quot;nothing&quot;
  254. | &quot;(&quot; regexp &quot;)&quot;
  255. </pre></div>
  256. <ul>
  257. <li> &lsquo;<samp>,</samp>&rsquo; is used for describing the start of the next cycle in
  258. the reservation.
  259. </li><li> &lsquo;<samp>|</samp>&rsquo; is used for describing a reservation described by the first
  260. regular expression <strong>or</strong> a reservation described by the second
  261. regular expression <strong>or</strong> etc.
  262. </li><li> &lsquo;<samp>+</samp>&rsquo; is used for describing a reservation described by the first
  263. regular expression <strong>and</strong> a reservation described by the
  264. second regular expression <strong>and</strong> etc.
  265. </li><li> &lsquo;<samp>*</samp>&rsquo; is used for convenience and simply means a sequence in which
  266. the regular expression are repeated <var>number</var> times with cycle
  267. advancing (see &lsquo;<samp>,</samp>&rsquo;).
  268. </li><li> &lsquo;<samp>cpu_function_unit_name</samp>&rsquo; denotes reservation of the named
  269. functional unit.
  270. </li><li> &lsquo;<samp>reservation_name</samp>&rsquo; &mdash; see description of construction
  271. &lsquo;<samp>define_reservation</samp>&rsquo;.
  272. </li><li> &lsquo;<samp>nothing</samp>&rsquo; denotes no unit reservations.
  273. </li></ul>
  274. <a name="index-define_005freservation"></a>
  275. <p>Sometimes unit reservations for different insns contain common parts.
  276. In such case, you can simplify the pipeline description by describing
  277. the common part by the following construction
  278. </p>
  279. <div class="smallexample">
  280. <pre class="smallexample">(define_reservation <var>reservation-name</var> <var>regexp</var>)
  281. </pre></div>
  282. <p><var>reservation-name</var> is a string giving name of <var>regexp</var>.
  283. Functional unit names and reservation names are in the same name
  284. space. So the reservation names should be different from the
  285. functional unit names and cannot be the reserved name &lsquo;<samp>nothing</samp>&rsquo;.
  286. </p>
  287. <a name="index-define_005fbypass"></a>
  288. <a name="index-instruction-latency-time-2"></a>
  289. <a name="index-data-bypass-1"></a>
  290. <p>The following construction is used to describe exceptions in the
  291. latency time for given instruction pair. This is so called bypasses.
  292. </p>
  293. <div class="smallexample">
  294. <pre class="smallexample">(define_bypass <var>number</var> <var>out_insn_names</var> <var>in_insn_names</var>
  295. [<var>guard</var>])
  296. </pre></div>
  297. <p><var>number</var> defines when the result generated by the instructions
  298. given in string <var>out_insn_names</var> will be ready for the
  299. instructions given in string <var>in_insn_names</var>. Each of these
  300. strings is a comma-separated list of filename-style globs and
  301. they refer to the names of <code>define_insn_reservation</code>s.
  302. For example:
  303. </p><div class="smallexample">
  304. <pre class="smallexample">(define_bypass 1 &quot;cpu1_load_*, cpu1_store_*&quot; &quot;cpu1_load_*&quot;)
  305. </pre></div>
  306. <p>defines a bypass between instructions that start with
  307. &lsquo;<samp>cpu1_load_</samp>&rsquo; or &lsquo;<samp>cpu1_store_</samp>&rsquo; and those that start with
  308. &lsquo;<samp>cpu1_load_</samp>&rsquo;.
  309. </p>
  310. <p><var>guard</var> is an optional string giving the name of a C function which
  311. defines an additional guard for the bypass. The function will get the
  312. two insns as parameters. If the function returns zero the bypass will
  313. be ignored for this case. The additional guard is necessary to
  314. recognize complicated bypasses, e.g. when the consumer is only an address
  315. of insn &lsquo;<samp>store</samp>&rsquo; (not a stored value).
  316. </p>
  317. <p>If there are more one bypass with the same output and input insns, the
  318. chosen bypass is the first bypass with a guard in description whose
  319. guard function returns nonzero. If there is no such bypass, then
  320. bypass without the guard function is chosen.
  321. </p>
  322. <a name="index-exclusion_005fset"></a>
  323. <a name="index-presence_005fset"></a>
  324. <a name="index-final_005fpresence_005fset"></a>
  325. <a name="index-absence_005fset"></a>
  326. <a name="index-final_005fabsence_005fset"></a>
  327. <a name="index-VLIW-1"></a>
  328. <a name="index-RISC-1"></a>
  329. <p>The following five constructions are usually used to describe
  330. <acronym>VLIW</acronym> processors, or more precisely, to describe a placement
  331. of small instructions into <acronym>VLIW</acronym> instruction slots. They
  332. can be used for <acronym>RISC</acronym> processors, too.
  333. </p>
  334. <div class="smallexample">
  335. <pre class="smallexample">(exclusion_set <var>unit-names</var> <var>unit-names</var>)
  336. (presence_set <var>unit-names</var> <var>patterns</var>)
  337. (final_presence_set <var>unit-names</var> <var>patterns</var>)
  338. (absence_set <var>unit-names</var> <var>patterns</var>)
  339. (final_absence_set <var>unit-names</var> <var>patterns</var>)
  340. </pre></div>
  341. <p><var>unit-names</var> is a string giving names of functional units
  342. separated by commas.
  343. </p>
  344. <p><var>patterns</var> is a string giving patterns of functional units
  345. separated by comma. Currently pattern is one unit or units
  346. separated by white-spaces.
  347. </p>
  348. <p>The first construction (&lsquo;<samp>exclusion_set</samp>&rsquo;) means that each
  349. functional unit in the first string cannot be reserved simultaneously
  350. with a unit whose name is in the second string and vice versa. For
  351. example, the construction is useful for describing processors
  352. (e.g. some SPARC processors) with a fully pipelined floating point
  353. functional unit which can execute simultaneously only single floating
  354. point insns or only double floating point insns.
  355. </p>
  356. <p>The second construction (&lsquo;<samp>presence_set</samp>&rsquo;) means that each
  357. functional unit in the first string cannot be reserved unless at
  358. least one of pattern of units whose names are in the second string is
  359. reserved. This is an asymmetric relation. For example, it is useful
  360. for description that <acronym>VLIW</acronym> &lsquo;<samp>slot1</samp>&rsquo; is reserved after
  361. &lsquo;<samp>slot0</samp>&rsquo; reservation. We could describe it by the following
  362. construction
  363. </p>
  364. <div class="smallexample">
  365. <pre class="smallexample">(presence_set &quot;slot1&quot; &quot;slot0&quot;)
  366. </pre></div>
  367. <p>Or &lsquo;<samp>slot1</samp>&rsquo; is reserved only after &lsquo;<samp>slot0</samp>&rsquo; and unit &lsquo;<samp>b0</samp>&rsquo;
  368. reservation. In this case we could write
  369. </p>
  370. <div class="smallexample">
  371. <pre class="smallexample">(presence_set &quot;slot1&quot; &quot;slot0 b0&quot;)
  372. </pre></div>
  373. <p>The third construction (&lsquo;<samp>final_presence_set</samp>&rsquo;) is analogous to
  374. &lsquo;<samp>presence_set</samp>&rsquo;. The difference between them is when checking is
  375. done. When an instruction is issued in given automaton state
  376. reflecting all current and planned unit reservations, the automaton
  377. state is changed. The first state is a source state, the second one
  378. is a result state. Checking for &lsquo;<samp>presence_set</samp>&rsquo; is done on the
  379. source state reservation, checking for &lsquo;<samp>final_presence_set</samp>&rsquo; is
  380. done on the result reservation. This construction is useful to
  381. describe a reservation which is actually two subsequent reservations.
  382. For example, if we use
  383. </p>
  384. <div class="smallexample">
  385. <pre class="smallexample">(presence_set &quot;slot1&quot; &quot;slot0&quot;)
  386. </pre></div>
  387. <p>the following insn will be never issued (because &lsquo;<samp>slot1</samp>&rsquo; requires
  388. &lsquo;<samp>slot0</samp>&rsquo; which is absent in the source state).
  389. </p>
  390. <div class="smallexample">
  391. <pre class="smallexample">(define_reservation &quot;insn_and_nop&quot; &quot;slot0 + slot1&quot;)
  392. </pre></div>
  393. <p>but it can be issued if we use analogous &lsquo;<samp>final_presence_set</samp>&rsquo;.
  394. </p>
  395. <p>The forth construction (&lsquo;<samp>absence_set</samp>&rsquo;) means that each functional
  396. unit in the first string can be reserved only if each pattern of units
  397. whose names are in the second string is not reserved. This is an
  398. asymmetric relation (actually &lsquo;<samp>exclusion_set</samp>&rsquo; is analogous to
  399. this one but it is symmetric). For example it might be useful in a
  400. <acronym>VLIW</acronym> description to say that &lsquo;<samp>slot0</samp>&rsquo; cannot be reserved
  401. after either &lsquo;<samp>slot1</samp>&rsquo; or &lsquo;<samp>slot2</samp>&rsquo; have been reserved. This
  402. can be described as:
  403. </p>
  404. <div class="smallexample">
  405. <pre class="smallexample">(absence_set &quot;slot0&quot; &quot;slot1, slot2&quot;)
  406. </pre></div>
  407. <p>Or &lsquo;<samp>slot2</samp>&rsquo; cannot be reserved if &lsquo;<samp>slot0</samp>&rsquo; and unit &lsquo;<samp>b0</samp>&rsquo;
  408. are reserved or &lsquo;<samp>slot1</samp>&rsquo; and unit &lsquo;<samp>b1</samp>&rsquo; are reserved. In
  409. this case we could write
  410. </p>
  411. <div class="smallexample">
  412. <pre class="smallexample">(absence_set &quot;slot2&quot; &quot;slot0 b0, slot1 b1&quot;)
  413. </pre></div>
  414. <p>All functional units mentioned in a set should belong to the same
  415. automaton.
  416. </p>
  417. <p>The last construction (&lsquo;<samp>final_absence_set</samp>&rsquo;) is analogous to
  418. &lsquo;<samp>absence_set</samp>&rsquo; but checking is done on the result (state)
  419. reservation. See comments for &lsquo;<samp>final_presence_set</samp>&rsquo;.
  420. </p>
  421. <a name="index-automata_005foption"></a>
  422. <a name="index-deterministic-finite-state-automaton-1"></a>
  423. <a name="index-nondeterministic-finite-state-automaton"></a>
  424. <a name="index-finite-state-automaton-minimization"></a>
  425. <p>You can control the generator of the pipeline hazard recognizer with
  426. the following construction.
  427. </p>
  428. <div class="smallexample">
  429. <pre class="smallexample">(automata_option <var>options</var>)
  430. </pre></div>
  431. <p><var>options</var> is a string giving options which affect the generated
  432. code. Currently there are the following options:
  433. </p>
  434. <ul>
  435. <li> <em>no-minimization</em> makes no minimization of the automaton. This is
  436. only worth to do when we are debugging the description and need to
  437. look more accurately at reservations of states.
  438. </li><li> <em>time</em> means printing time statistics about the generation of
  439. automata.
  440. </li><li> <em>stats</em> means printing statistics about the generated automata
  441. such as the number of DFA states, NDFA states and arcs.
  442. </li><li> <em>v</em> means a generation of the file describing the result automata.
  443. The file has suffix &lsquo;<samp>.dfa</samp>&rsquo; and can be used for the description
  444. verification and debugging.
  445. </li><li> <em>w</em> means a generation of warning instead of error for
  446. non-critical errors.
  447. </li><li> <em>no-comb-vect</em> prevents the automaton generator from generating
  448. two data structures and comparing them for space efficiency. Using
  449. a comb vector to represent transitions may be better, but it can be
  450. very expensive to construct. This option is useful if the build
  451. process spends an unacceptably long time in genautomata.
  452. </li><li> <em>ndfa</em> makes nondeterministic finite state automata. This affects
  453. the treatment of operator &lsquo;<samp>|</samp>&rsquo; in the regular expressions. The
  454. usual treatment of the operator is to try the first alternative and,
  455. if the reservation is not possible, the second alternative. The
  456. nondeterministic treatment means trying all alternatives, some of them
  457. may be rejected by reservations in the subsequent insns.
  458. </li><li> <em>collapse-ndfa</em> modifies the behavior of the generator when
  459. producing an automaton. An additional state transition to collapse a
  460. nondeterministic <acronym>NDFA</acronym> state to a deterministic <acronym>DFA</acronym>
  461. state is generated. It can be triggered by passing <code>const0_rtx</code> to
  462. state_transition. In such an automaton, cycle advance transitions are
  463. available only for these collapsed states. This option is useful for
  464. ports that want to use the <code>ndfa</code> option, but also want to use
  465. <code>define_query_cpu_unit</code> to assign units to insns issued in a cycle.
  466. </li><li> <em>progress</em> means output of a progress bar showing how many states
  467. were generated so far for automaton being processed. This is useful
  468. during debugging a <acronym>DFA</acronym> description. If you see too many
  469. generated states, you could interrupt the generator of the pipeline
  470. hazard recognizer and try to figure out a reason for generation of the
  471. huge automaton.
  472. </li></ul>
  473. <p>As an example, consider a superscalar <acronym>RISC</acronym> machine which can
  474. issue three insns (two integer insns and one floating point insn) on
  475. the cycle but can finish only two insns. To describe this, we define
  476. the following functional units.
  477. </p>
  478. <div class="smallexample">
  479. <pre class="smallexample">(define_cpu_unit &quot;i0_pipeline, i1_pipeline, f_pipeline&quot;)
  480. (define_cpu_unit &quot;port0, port1&quot;)
  481. </pre></div>
  482. <p>All simple integer insns can be executed in any integer pipeline and
  483. their result is ready in two cycles. The simple integer insns are
  484. issued into the first pipeline unless it is reserved, otherwise they
  485. are issued into the second pipeline. Integer division and
  486. multiplication insns can be executed only in the second integer
  487. pipeline and their results are ready correspondingly in 9 and 4
  488. cycles. The integer division is not pipelined, i.e. the subsequent
  489. integer division insn cannot be issued until the current division
  490. insn finished. Floating point insns are fully pipelined and their
  491. results are ready in 3 cycles. Where the result of a floating point
  492. insn is used by an integer insn, an additional delay of one cycle is
  493. incurred. To describe all of this we could specify
  494. </p>
  495. <div class="smallexample">
  496. <pre class="smallexample">(define_cpu_unit &quot;div&quot;)
  497. (define_insn_reservation &quot;simple&quot; 2 (eq_attr &quot;type&quot; &quot;int&quot;)
  498. &quot;(i0_pipeline | i1_pipeline), (port0 | port1)&quot;)
  499. (define_insn_reservation &quot;mult&quot; 4 (eq_attr &quot;type&quot; &quot;mult&quot;)
  500. &quot;i1_pipeline, nothing*2, (port0 | port1)&quot;)
  501. (define_insn_reservation &quot;div&quot; 9 (eq_attr &quot;type&quot; &quot;div&quot;)
  502. &quot;i1_pipeline, div*7, div + (port0 | port1)&quot;)
  503. (define_insn_reservation &quot;float&quot; 3 (eq_attr &quot;type&quot; &quot;float&quot;)
  504. &quot;f_pipeline, nothing, (port0 | port1))
  505. (define_bypass 4 &quot;float&quot; &quot;simple,mult,div&quot;)
  506. </pre></div>
  507. <p>To simplify the description we could describe the following reservation
  508. </p>
  509. <div class="smallexample">
  510. <pre class="smallexample">(define_reservation &quot;finish&quot; &quot;port0|port1&quot;)
  511. </pre></div>
  512. <p>and use it in all <code>define_insn_reservation</code> as in the following
  513. construction
  514. </p>
  515. <div class="smallexample">
  516. <pre class="smallexample">(define_insn_reservation &quot;simple&quot; 2 (eq_attr &quot;type&quot; &quot;int&quot;)
  517. &quot;(i0_pipeline | i1_pipeline), finish&quot;)
  518. </pre></div>
  519. <div class="footnote">
  520. <hr>
  521. <h4 class="footnotes-heading">Footnotes</h4>
  522. <h3><a name="FOOT5" href="#DOCF5">(5)</a></h3>
  523. <p>However, the size of the automaton depends on
  524. processor complexity. To limit this effect, machine descriptions
  525. can split orthogonal parts of the machine description among several
  526. automata: but then, since each of these must be stepped independently,
  527. this does cause a small decrease in the algorithm&rsquo;s performance.</p>
  528. </div>
  529. <hr>
  530. <div class="header">
  531. <p>
  532. Previous: <a href="Delay-Slots.html#Delay-Slots" accesskey="p" rel="prev">Delay Slots</a>, Up: <a href="Insn-Attributes.html#Insn-Attributes" accesskey="u" rel="up">Insn Attributes</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>
  533. </div>
  534. </body>
  535. </html>