Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

759 lines
30KB

  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>Machine Modes (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Machine Modes (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Machine Modes (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="Constants.html#Constants" rel="next" title="Constants">
  31. <link href="Flags.html#Flags" rel="prev" title="Flags">
  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="Machine-Modes"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Constants.html#Constants" accesskey="n" rel="next">Constants</a>, Previous: <a href="Flags.html#Flags" accesskey="p" rel="prev">Flags</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="Machine-Modes-1"></a>
  68. <h3 class="section">14.6 Machine Modes</h3>
  69. <a name="index-machine-modes"></a>
  70. <a name="index-machine_005fmode"></a>
  71. <p>A machine mode describes a size of data object and the representation used
  72. for it. In the C code, machine modes are represented by an enumeration
  73. type, <code>machine_mode</code>, defined in <samp>machmode.def</samp>. Each RTL
  74. expression has room for a machine mode and so do certain kinds of tree
  75. expressions (declarations and types, to be precise).
  76. </p>
  77. <p>In debugging dumps and machine descriptions, the machine mode of an RTL
  78. expression is written after the expression code with a colon to separate
  79. them. The letters &lsquo;<samp>mode</samp>&rsquo; which appear at the end of each machine mode
  80. name are omitted. For example, <code>(reg:SI 38)</code> is a <code>reg</code>
  81. expression with machine mode <code>SImode</code>. If the mode is
  82. <code>VOIDmode</code>, it is not written at all.
  83. </p>
  84. <p>Here is a table of machine modes. The term &ldquo;byte&rdquo; below refers to an
  85. object of <code>BITS_PER_UNIT</code> bits (see <a href="Storage-Layout.html#Storage-Layout">Storage Layout</a>).
  86. </p>
  87. <dl compact="compact">
  88. <dd><a name="index-BImode"></a>
  89. </dd>
  90. <dt><code>BImode</code></dt>
  91. <dd><p>&ldquo;Bit&rdquo; mode represents a single bit, for predicate registers.
  92. </p>
  93. <a name="index-QImode"></a>
  94. </dd>
  95. <dt><code>QImode</code></dt>
  96. <dd><p>&ldquo;Quarter-Integer&rdquo; mode represents a single byte treated as an integer.
  97. </p>
  98. <a name="index-HImode"></a>
  99. </dd>
  100. <dt><code>HImode</code></dt>
  101. <dd><p>&ldquo;Half-Integer&rdquo; mode represents a two-byte integer.
  102. </p>
  103. <a name="index-PSImode"></a>
  104. </dd>
  105. <dt><code>PSImode</code></dt>
  106. <dd><p>&ldquo;Partial Single Integer&rdquo; mode represents an integer which occupies
  107. four bytes but which doesn&rsquo;t really use all four. On some machines,
  108. this is the right mode to use for pointers.
  109. </p>
  110. <a name="index-SImode"></a>
  111. </dd>
  112. <dt><code>SImode</code></dt>
  113. <dd><p>&ldquo;Single Integer&rdquo; mode represents a four-byte integer.
  114. </p>
  115. <a name="index-PDImode"></a>
  116. </dd>
  117. <dt><code>PDImode</code></dt>
  118. <dd><p>&ldquo;Partial Double Integer&rdquo; mode represents an integer which occupies
  119. eight bytes but which doesn&rsquo;t really use all eight. On some machines,
  120. this is the right mode to use for certain pointers.
  121. </p>
  122. <a name="index-DImode"></a>
  123. </dd>
  124. <dt><code>DImode</code></dt>
  125. <dd><p>&ldquo;Double Integer&rdquo; mode represents an eight-byte integer.
  126. </p>
  127. <a name="index-TImode"></a>
  128. </dd>
  129. <dt><code>TImode</code></dt>
  130. <dd><p>&ldquo;Tetra Integer&rdquo; (?) mode represents a sixteen-byte integer.
  131. </p>
  132. <a name="index-OImode"></a>
  133. </dd>
  134. <dt><code>OImode</code></dt>
  135. <dd><p>&ldquo;Octa Integer&rdquo; (?) mode represents a thirty-two-byte integer.
  136. </p>
  137. <a name="index-XImode"></a>
  138. </dd>
  139. <dt><code>XImode</code></dt>
  140. <dd><p>&ldquo;Hexadeca Integer&rdquo; (?) mode represents a sixty-four-byte integer.
  141. </p>
  142. <a name="index-QFmode"></a>
  143. </dd>
  144. <dt><code>QFmode</code></dt>
  145. <dd><p>&ldquo;Quarter-Floating&rdquo; mode represents a quarter-precision (single byte)
  146. floating point number.
  147. </p>
  148. <a name="index-HFmode"></a>
  149. </dd>
  150. <dt><code>HFmode</code></dt>
  151. <dd><p>&ldquo;Half-Floating&rdquo; mode represents a half-precision (two byte) floating
  152. point number.
  153. </p>
  154. <a name="index-TQFmode"></a>
  155. </dd>
  156. <dt><code>TQFmode</code></dt>
  157. <dd><p>&ldquo;Three-Quarter-Floating&rdquo; (?) mode represents a three-quarter-precision
  158. (three byte) floating point number.
  159. </p>
  160. <a name="index-SFmode"></a>
  161. </dd>
  162. <dt><code>SFmode</code></dt>
  163. <dd><p>&ldquo;Single Floating&rdquo; mode represents a four byte floating point number.
  164. In the common case, of a processor with IEEE arithmetic and 8-bit bytes,
  165. this is a single-precision IEEE floating point number; it can also be
  166. used for double-precision (on processors with 16-bit bytes) and
  167. single-precision VAX and IBM types.
  168. </p>
  169. <a name="index-DFmode"></a>
  170. </dd>
  171. <dt><code>DFmode</code></dt>
  172. <dd><p>&ldquo;Double Floating&rdquo; mode represents an eight byte floating point number.
  173. In the common case, of a processor with IEEE arithmetic and 8-bit bytes,
  174. this is a double-precision IEEE floating point number.
  175. </p>
  176. <a name="index-XFmode"></a>
  177. </dd>
  178. <dt><code>XFmode</code></dt>
  179. <dd><p>&ldquo;Extended Floating&rdquo; mode represents an IEEE extended floating point
  180. number. This mode only has 80 meaningful bits (ten bytes). Some
  181. processors require such numbers to be padded to twelve bytes, others
  182. to sixteen; this mode is used for either.
  183. </p>
  184. <a name="index-SDmode"></a>
  185. </dd>
  186. <dt><code>SDmode</code></dt>
  187. <dd><p>&ldquo;Single Decimal Floating&rdquo; mode represents a four byte decimal
  188. floating point number (as distinct from conventional binary floating
  189. point).
  190. </p>
  191. <a name="index-DDmode"></a>
  192. </dd>
  193. <dt><code>DDmode</code></dt>
  194. <dd><p>&ldquo;Double Decimal Floating&rdquo; mode represents an eight byte decimal
  195. floating point number.
  196. </p>
  197. <a name="index-TDmode"></a>
  198. </dd>
  199. <dt><code>TDmode</code></dt>
  200. <dd><p>&ldquo;Tetra Decimal Floating&rdquo; mode represents a sixteen byte decimal
  201. floating point number all 128 of whose bits are meaningful.
  202. </p>
  203. <a name="index-TFmode"></a>
  204. </dd>
  205. <dt><code>TFmode</code></dt>
  206. <dd><p>&ldquo;Tetra Floating&rdquo; mode represents a sixteen byte floating point number
  207. all 128 of whose bits are meaningful. One common use is the
  208. IEEE quad-precision format.
  209. </p>
  210. <a name="index-QQmode"></a>
  211. </dd>
  212. <dt><code>QQmode</code></dt>
  213. <dd><p>&ldquo;Quarter-Fractional&rdquo; mode represents a single byte treated as a signed
  214. fractional number. The default format is &ldquo;s.7&rdquo;.
  215. </p>
  216. <a name="index-HQmode"></a>
  217. </dd>
  218. <dt><code>HQmode</code></dt>
  219. <dd><p>&ldquo;Half-Fractional&rdquo; mode represents a two-byte signed fractional number.
  220. The default format is &ldquo;s.15&rdquo;.
  221. </p>
  222. <a name="index-SQmode"></a>
  223. </dd>
  224. <dt><code>SQmode</code></dt>
  225. <dd><p>&ldquo;Single Fractional&rdquo; mode represents a four-byte signed fractional number.
  226. The default format is &ldquo;s.31&rdquo;.
  227. </p>
  228. <a name="index-DQmode"></a>
  229. </dd>
  230. <dt><code>DQmode</code></dt>
  231. <dd><p>&ldquo;Double Fractional&rdquo; mode represents an eight-byte signed fractional number.
  232. The default format is &ldquo;s.63&rdquo;.
  233. </p>
  234. <a name="index-TQmode"></a>
  235. </dd>
  236. <dt><code>TQmode</code></dt>
  237. <dd><p>&ldquo;Tetra Fractional&rdquo; mode represents a sixteen-byte signed fractional number.
  238. The default format is &ldquo;s.127&rdquo;.
  239. </p>
  240. <a name="index-UQQmode"></a>
  241. </dd>
  242. <dt><code>UQQmode</code></dt>
  243. <dd><p>&ldquo;Unsigned Quarter-Fractional&rdquo; mode represents a single byte treated as an
  244. unsigned fractional number. The default format is &ldquo;.8&rdquo;.
  245. </p>
  246. <a name="index-UHQmode"></a>
  247. </dd>
  248. <dt><code>UHQmode</code></dt>
  249. <dd><p>&ldquo;Unsigned Half-Fractional&rdquo; mode represents a two-byte unsigned fractional
  250. number. The default format is &ldquo;.16&rdquo;.
  251. </p>
  252. <a name="index-USQmode"></a>
  253. </dd>
  254. <dt><code>USQmode</code></dt>
  255. <dd><p>&ldquo;Unsigned Single Fractional&rdquo; mode represents a four-byte unsigned fractional
  256. number. The default format is &ldquo;.32&rdquo;.
  257. </p>
  258. <a name="index-UDQmode"></a>
  259. </dd>
  260. <dt><code>UDQmode</code></dt>
  261. <dd><p>&ldquo;Unsigned Double Fractional&rdquo; mode represents an eight-byte unsigned
  262. fractional number. The default format is &ldquo;.64&rdquo;.
  263. </p>
  264. <a name="index-UTQmode"></a>
  265. </dd>
  266. <dt><code>UTQmode</code></dt>
  267. <dd><p>&ldquo;Unsigned Tetra Fractional&rdquo; mode represents a sixteen-byte unsigned
  268. fractional number. The default format is &ldquo;.128&rdquo;.
  269. </p>
  270. <a name="index-HAmode"></a>
  271. </dd>
  272. <dt><code>HAmode</code></dt>
  273. <dd><p>&ldquo;Half-Accumulator&rdquo; mode represents a two-byte signed accumulator.
  274. The default format is &ldquo;s8.7&rdquo;.
  275. </p>
  276. <a name="index-SAmode"></a>
  277. </dd>
  278. <dt><code>SAmode</code></dt>
  279. <dd><p>&ldquo;Single Accumulator&rdquo; mode represents a four-byte signed accumulator.
  280. The default format is &ldquo;s16.15&rdquo;.
  281. </p>
  282. <a name="index-DAmode"></a>
  283. </dd>
  284. <dt><code>DAmode</code></dt>
  285. <dd><p>&ldquo;Double Accumulator&rdquo; mode represents an eight-byte signed accumulator.
  286. The default format is &ldquo;s32.31&rdquo;.
  287. </p>
  288. <a name="index-TAmode"></a>
  289. </dd>
  290. <dt><code>TAmode</code></dt>
  291. <dd><p>&ldquo;Tetra Accumulator&rdquo; mode represents a sixteen-byte signed accumulator.
  292. The default format is &ldquo;s64.63&rdquo;.
  293. </p>
  294. <a name="index-UHAmode"></a>
  295. </dd>
  296. <dt><code>UHAmode</code></dt>
  297. <dd><p>&ldquo;Unsigned Half-Accumulator&rdquo; mode represents a two-byte unsigned accumulator.
  298. The default format is &ldquo;8.8&rdquo;.
  299. </p>
  300. <a name="index-USAmode"></a>
  301. </dd>
  302. <dt><code>USAmode</code></dt>
  303. <dd><p>&ldquo;Unsigned Single Accumulator&rdquo; mode represents a four-byte unsigned
  304. accumulator. The default format is &ldquo;16.16&rdquo;.
  305. </p>
  306. <a name="index-UDAmode"></a>
  307. </dd>
  308. <dt><code>UDAmode</code></dt>
  309. <dd><p>&ldquo;Unsigned Double Accumulator&rdquo; mode represents an eight-byte unsigned
  310. accumulator. The default format is &ldquo;32.32&rdquo;.
  311. </p>
  312. <a name="index-UTAmode"></a>
  313. </dd>
  314. <dt><code>UTAmode</code></dt>
  315. <dd><p>&ldquo;Unsigned Tetra Accumulator&rdquo; mode represents a sixteen-byte unsigned
  316. accumulator. The default format is &ldquo;64.64&rdquo;.
  317. </p>
  318. <a name="index-CCmode"></a>
  319. </dd>
  320. <dt><code>CCmode</code></dt>
  321. <dd><p>&ldquo;Condition Code&rdquo; mode represents the value of a condition code, which
  322. is a machine-specific set of bits used to represent the result of a
  323. comparison operation. Other machine-specific modes may also be used for
  324. the condition code. These modes are not used on machines that use
  325. <code>cc0</code> (see <a href="Condition-Code.html#Condition-Code">Condition Code</a>).
  326. </p>
  327. <a name="index-BLKmode"></a>
  328. </dd>
  329. <dt><code>BLKmode</code></dt>
  330. <dd><p>&ldquo;Block&rdquo; mode represents values that are aggregates to which none of
  331. the other modes apply. In RTL, only memory references can have this mode,
  332. and only if they appear in string-move or vector instructions. On machines
  333. which have no such instructions, <code>BLKmode</code> will not appear in RTL.
  334. </p>
  335. <a name="index-VOIDmode"></a>
  336. </dd>
  337. <dt><code>VOIDmode</code></dt>
  338. <dd><p>Void mode means the absence of a mode or an unspecified mode.
  339. For example, RTL expressions of code <code>const_int</code> have mode
  340. <code>VOIDmode</code> because they can be taken to have whatever mode the context
  341. requires. In debugging dumps of RTL, <code>VOIDmode</code> is expressed by
  342. the absence of any mode.
  343. </p>
  344. <a name="index-QCmode"></a>
  345. <a name="index-HCmode"></a>
  346. <a name="index-SCmode"></a>
  347. <a name="index-DCmode"></a>
  348. <a name="index-XCmode"></a>
  349. <a name="index-TCmode"></a>
  350. </dd>
  351. <dt><code>QCmode, HCmode, SCmode, DCmode, XCmode, TCmode</code></dt>
  352. <dd><p>These modes stand for a complex number represented as a pair of floating
  353. point values. The floating point values are in <code>QFmode</code>,
  354. <code>HFmode</code>, <code>SFmode</code>, <code>DFmode</code>, <code>XFmode</code>, and
  355. <code>TFmode</code>, respectively.
  356. </p>
  357. <a name="index-CQImode"></a>
  358. <a name="index-CHImode"></a>
  359. <a name="index-CSImode"></a>
  360. <a name="index-CDImode"></a>
  361. <a name="index-CTImode"></a>
  362. <a name="index-COImode"></a>
  363. <a name="index-CPSImode"></a>
  364. </dd>
  365. <dt><code>CQImode, CHImode, CSImode, CDImode, CTImode, COImode, CPSImode</code></dt>
  366. <dd><p>These modes stand for a complex number represented as a pair of integer
  367. values. The integer values are in <code>QImode</code>, <code>HImode</code>,
  368. <code>SImode</code>, <code>DImode</code>, <code>TImode</code>, <code>OImode</code>, and <code>PSImode</code>,
  369. respectively.
  370. </p>
  371. <a name="index-BND32mode"></a>
  372. <a name="index-BND64mode"></a>
  373. </dd>
  374. <dt><code>BND32mode BND64mode</code></dt>
  375. <dd><p>These modes stand for bounds for pointer of 32 and 64 bit size respectively.
  376. Mode size is double pointer mode size.
  377. </p></dd>
  378. </dl>
  379. <p>The machine description defines <code>Pmode</code> as a C macro which expands
  380. into the machine mode used for addresses. Normally this is the mode
  381. whose size is <code>BITS_PER_WORD</code>, <code>SImode</code> on 32-bit machines.
  382. </p>
  383. <p>The only modes which a machine description <i>must</i> support are
  384. <code>QImode</code>, and the modes corresponding to <code>BITS_PER_WORD</code>,
  385. <code>FLOAT_TYPE_SIZE</code> and <code>DOUBLE_TYPE_SIZE</code>.
  386. The compiler will attempt to use <code>DImode</code> for 8-byte structures and
  387. unions, but this can be prevented by overriding the definition of
  388. <code>MAX_FIXED_MODE_SIZE</code>. Alternatively, you can have the compiler
  389. use <code>TImode</code> for 16-byte structures and unions. Likewise, you can
  390. arrange for the C type <code>short int</code> to avoid using <code>HImode</code>.
  391. </p>
  392. <a name="index-mode-classes"></a>
  393. <p>Very few explicit references to machine modes remain in the compiler and
  394. these few references will soon be removed. Instead, the machine modes
  395. are divided into mode classes. These are represented by the enumeration
  396. type <code>enum mode_class</code> defined in <samp>machmode.h</samp>. The possible
  397. mode classes are:
  398. </p>
  399. <dl compact="compact">
  400. <dd><a name="index-MODE_005fINT"></a>
  401. </dd>
  402. <dt><code>MODE_INT</code></dt>
  403. <dd><p>Integer modes. By default these are <code>BImode</code>, <code>QImode</code>,
  404. <code>HImode</code>, <code>SImode</code>, <code>DImode</code>, <code>TImode</code>, and
  405. <code>OImode</code>.
  406. </p>
  407. <a name="index-MODE_005fPARTIAL_005fINT"></a>
  408. </dd>
  409. <dt><code>MODE_PARTIAL_INT</code></dt>
  410. <dd><p>The &ldquo;partial integer&rdquo; modes, <code>PQImode</code>, <code>PHImode</code>,
  411. <code>PSImode</code> and <code>PDImode</code>.
  412. </p>
  413. <a name="index-MODE_005fFLOAT"></a>
  414. </dd>
  415. <dt><code>MODE_FLOAT</code></dt>
  416. <dd><p>Floating point modes. By default these are <code>QFmode</code>,
  417. <code>HFmode</code>, <code>TQFmode</code>, <code>SFmode</code>, <code>DFmode</code>,
  418. <code>XFmode</code> and <code>TFmode</code>.
  419. </p>
  420. <a name="index-MODE_005fDECIMAL_005fFLOAT"></a>
  421. </dd>
  422. <dt><code>MODE_DECIMAL_FLOAT</code></dt>
  423. <dd><p>Decimal floating point modes. By default these are <code>SDmode</code>,
  424. <code>DDmode</code> and <code>TDmode</code>.
  425. </p>
  426. <a name="index-MODE_005fFRACT"></a>
  427. </dd>
  428. <dt><code>MODE_FRACT</code></dt>
  429. <dd><p>Signed fractional modes. By default these are <code>QQmode</code>, <code>HQmode</code>,
  430. <code>SQmode</code>, <code>DQmode</code> and <code>TQmode</code>.
  431. </p>
  432. <a name="index-MODE_005fUFRACT"></a>
  433. </dd>
  434. <dt><code>MODE_UFRACT</code></dt>
  435. <dd><p>Unsigned fractional modes. By default these are <code>UQQmode</code>, <code>UHQmode</code>,
  436. <code>USQmode</code>, <code>UDQmode</code> and <code>UTQmode</code>.
  437. </p>
  438. <a name="index-MODE_005fACCUM"></a>
  439. </dd>
  440. <dt><code>MODE_ACCUM</code></dt>
  441. <dd><p>Signed accumulator modes. By default these are <code>HAmode</code>,
  442. <code>SAmode</code>, <code>DAmode</code> and <code>TAmode</code>.
  443. </p>
  444. <a name="index-MODE_005fUACCUM"></a>
  445. </dd>
  446. <dt><code>MODE_UACCUM</code></dt>
  447. <dd><p>Unsigned accumulator modes. By default these are <code>UHAmode</code>,
  448. <code>USAmode</code>, <code>UDAmode</code> and <code>UTAmode</code>.
  449. </p>
  450. <a name="index-MODE_005fCOMPLEX_005fINT"></a>
  451. </dd>
  452. <dt><code>MODE_COMPLEX_INT</code></dt>
  453. <dd><p>Complex integer modes. (These are not currently implemented).
  454. </p>
  455. <a name="index-MODE_005fCOMPLEX_005fFLOAT"></a>
  456. </dd>
  457. <dt><code>MODE_COMPLEX_FLOAT</code></dt>
  458. <dd><p>Complex floating point modes. By default these are <code>QCmode</code>,
  459. <code>HCmode</code>, <code>SCmode</code>, <code>DCmode</code>, <code>XCmode</code>, and
  460. <code>TCmode</code>.
  461. </p>
  462. <a name="index-MODE_005fCC"></a>
  463. </dd>
  464. <dt><code>MODE_CC</code></dt>
  465. <dd><p>Modes representing condition code values. These are <code>CCmode</code> plus
  466. any <code>CC_MODE</code> modes listed in the <samp><var>machine</var>-modes.def</samp>.
  467. See <a href="Jump-Patterns.html#Jump-Patterns">Jump Patterns</a>,
  468. also see <a href="Condition-Code.html#Condition-Code">Condition Code</a>.
  469. </p>
  470. <a name="index-MODE_005fPOINTER_005fBOUNDS"></a>
  471. </dd>
  472. <dt><code>MODE_POINTER_BOUNDS</code></dt>
  473. <dd><p>Pointer bounds modes. Used to represent values of pointer bounds type.
  474. Operations in these modes may be executed as NOPs depending on hardware
  475. features and environment setup.
  476. </p>
  477. <a name="index-MODE_005fRANDOM"></a>
  478. </dd>
  479. <dt><code>MODE_RANDOM</code></dt>
  480. <dd><p>This is a catchall mode class for modes which don&rsquo;t fit into the above
  481. classes. Currently <code>VOIDmode</code> and <code>BLKmode</code> are in
  482. <code>MODE_RANDOM</code>.
  483. </p></dd>
  484. </dl>
  485. <a name="index-machine-mode-wrapper-classes"></a>
  486. <p><code>machmode.h</code> also defines various wrapper classes that combine a
  487. <code>machine_mode</code> with a static assertion that a particular
  488. condition holds. The classes are:
  489. </p>
  490. <dl compact="compact">
  491. <dd><a name="index-scalar_005fint_005fmode"></a>
  492. </dd>
  493. <dt><code>scalar_int_mode</code></dt>
  494. <dd><p>A mode that has class <code>MODE_INT</code> or <code>MODE_PARTIAL_INT</code>.
  495. </p>
  496. <a name="index-scalar_005ffloat_005fmode"></a>
  497. </dd>
  498. <dt><code>scalar_float_mode</code></dt>
  499. <dd><p>A mode that has class <code>MODE_FLOAT</code> or <code>MODE_DECIMAL_FLOAT</code>.
  500. </p>
  501. <a name="index-scalar_005fmode"></a>
  502. </dd>
  503. <dt><code>scalar_mode</code></dt>
  504. <dd><p>A mode that holds a single numerical value. In practice this means
  505. that the mode is a <code>scalar_int_mode</code>, is a <code>scalar_float_mode</code>,
  506. or has class <code>MODE_FRACT</code>, <code>MODE_UFRACT</code>, <code>MODE_ACCUM</code>,
  507. <code>MODE_UACCUM</code> or <code>MODE_POINTER_BOUNDS</code>.
  508. </p>
  509. <a name="index-complex_005fmode"></a>
  510. </dd>
  511. <dt><code>complex_mode</code></dt>
  512. <dd><p>A mode that has class <code>MODE_COMPLEX_INT</code> or <code>MODE_COMPLEX_FLOAT</code>.
  513. </p>
  514. <a name="index-fixed_005fsize_005fmode"></a>
  515. </dd>
  516. <dt><code>fixed_size_mode</code></dt>
  517. <dd><p>A mode whose size is known at compile time.
  518. </p></dd>
  519. </dl>
  520. <p>Named modes use the most constrained of the available wrapper classes,
  521. if one exists, otherwise they use <code>machine_mode</code>. For example,
  522. <code>QImode</code> is a <code>scalar_int_mode</code>, <code>SFmode</code> is a
  523. <code>scalar_float_mode</code> and <code>BLKmode</code> is a plain
  524. <code>machine_mode</code>. It is possible to refer to any mode as a raw
  525. <code>machine_mode</code> by adding the <code>E_</code> prefix, where <code>E</code>
  526. stands for &ldquo;enumeration&rdquo;. For example, the raw <code>machine_mode</code>
  527. names of the modes just mentioned are <code>E_QImode</code>, <code>E_SFmode</code>
  528. and <code>E_BLKmode</code> respectively.
  529. </p>
  530. <p>The wrapper classes implicitly convert to <code>machine_mode</code> and to any
  531. wrapper class that represents a more general condition; for example
  532. <code>scalar_int_mode</code> and <code>scalar_float_mode</code> both convert
  533. to <code>scalar_mode</code> and all three convert to <code>fixed_size_mode</code>.
  534. The classes act like <code>machine_mode</code>s that accept only certain
  535. named modes.
  536. </p>
  537. <a name="index-opt_005fmode"></a>
  538. <p><samp>machmode.h</samp> also defines a template class <code>opt_mode&lt;<var>T</var>&gt;</code>
  539. that holds a <code>T</code> or nothing, where <code>T</code> can be either
  540. <code>machine_mode</code> or one of the wrapper classes above. The main
  541. operations on an <code>opt_mode&lt;<var>T</var>&gt;</code> <var>x</var> are as follows:
  542. </p>
  543. <dl compact="compact">
  544. <dt>&lsquo;<samp><var>x</var>.exists ()</samp>&rsquo;</dt>
  545. <dd><p>Return true if <var>x</var> holds a mode rather than nothing.
  546. </p>
  547. </dd>
  548. <dt>&lsquo;<samp><var>x</var>.exists (&amp;<var>y</var>)</samp>&rsquo;</dt>
  549. <dd><p>Return true if <var>x</var> holds a mode rather than nothing, storing the
  550. mode in <var>y</var> if so. <var>y</var> must be assignment-compatible with <var>T</var>.
  551. </p>
  552. </dd>
  553. <dt>&lsquo;<samp><var>x</var>.require ()</samp>&rsquo;</dt>
  554. <dd><p>Assert that <var>x</var> holds a mode rather than nothing and return that mode.
  555. </p>
  556. </dd>
  557. <dt>&lsquo;<samp><var>x</var> = <var>y</var></samp>&rsquo;</dt>
  558. <dd><p>Set <var>x</var> to <var>y</var>, where <var>y</var> is a <var>T</var> or implicitly converts
  559. to a <var>T</var>.
  560. </p></dd>
  561. </dl>
  562. <p>The default constructor sets an <code>opt_mode&lt;<var>T</var>&gt;</code> to nothing.
  563. There is also a constructor that takes an initial value of type <var>T</var>.
  564. </p>
  565. <p>It is possible to use the <samp>is-a.h</samp> accessors on a <code>machine_mode</code>
  566. or machine mode wrapper <var>x</var>:
  567. </p>
  568. <dl compact="compact">
  569. <dd><a name="index-is_005fa"></a>
  570. </dd>
  571. <dt>&lsquo;<samp>is_a &lt;<var>T</var>&gt; (<var>x</var>)</samp>&rsquo;</dt>
  572. <dd><p>Return true if <var>x</var> meets the conditions for wrapper class <var>T</var>.
  573. </p>
  574. </dd>
  575. <dt>&lsquo;<samp>is_a &lt;<var>T</var>&gt; (<var>x</var>, &amp;<var>y</var>)</samp>&rsquo;</dt>
  576. <dd><p>Return true if <var>x</var> meets the conditions for wrapper class <var>T</var>,
  577. storing it in <var>y</var> if so. <var>y</var> must be assignment-compatible with
  578. <var>T</var>.
  579. </p>
  580. </dd>
  581. <dt>&lsquo;<samp>as_a &lt;<var>T</var>&gt; (<var>x</var>)</samp>&rsquo;</dt>
  582. <dd><p>Assert that <var>x</var> meets the conditions for wrapper class <var>T</var>
  583. and return it as a <var>T</var>.
  584. </p>
  585. </dd>
  586. <dt>&lsquo;<samp>dyn_cast &lt;<var>T</var>&gt; (<var>x</var>)</samp>&rsquo;</dt>
  587. <dd><p>Return an <code>opt_mode&lt;<var>T</var>&gt;</code> that holds <var>x</var> if <var>x</var> meets
  588. the conditions for wrapper class <var>T</var> and that holds nothing otherwise.
  589. </p></dd>
  590. </dl>
  591. <p>The purpose of these wrapper classes is to give stronger static type
  592. checking. For example, if a function takes a <code>scalar_int_mode</code>,
  593. a caller that has a general <code>machine_mode</code> must either check or
  594. assert that the code is indeed a scalar integer first, using one of
  595. the functions above.
  596. </p>
  597. <p>The wrapper classes are normal C++ classes, with user-defined
  598. constructors. Sometimes it is useful to have a POD version of
  599. the same type, particularly if the type appears in a <code>union</code>.
  600. The template class <code>pod_mode&lt;<var>T</var>&gt;</code> provides a POD version
  601. of wrapper class <var>T</var>. It is assignment-compatible with <var>T</var>
  602. and implicitly converts to both <code>machine_mode</code> and <var>T</var>.
  603. </p>
  604. <p>Here are some C macros that relate to machine modes:
  605. </p>
  606. <dl compact="compact">
  607. <dd><a name="index-GET_005fMODE"></a>
  608. </dd>
  609. <dt><code>GET_MODE (<var>x</var>)</code></dt>
  610. <dd><p>Returns the machine mode of the RTX <var>x</var>.
  611. </p>
  612. <a name="index-PUT_005fMODE"></a>
  613. </dd>
  614. <dt><code>PUT_MODE (<var>x</var>, <var>newmode</var>)</code></dt>
  615. <dd><p>Alters the machine mode of the RTX <var>x</var> to be <var>newmode</var>.
  616. </p>
  617. <a name="index-NUM_005fMACHINE_005fMODES"></a>
  618. </dd>
  619. <dt><code>NUM_MACHINE_MODES</code></dt>
  620. <dd><p>Stands for the number of machine modes available on the target
  621. machine. This is one greater than the largest numeric value of any
  622. machine mode.
  623. </p>
  624. <a name="index-GET_005fMODE_005fNAME"></a>
  625. </dd>
  626. <dt><code>GET_MODE_NAME (<var>m</var>)</code></dt>
  627. <dd><p>Returns the name of mode <var>m</var> as a string.
  628. </p>
  629. <a name="index-GET_005fMODE_005fCLASS"></a>
  630. </dd>
  631. <dt><code>GET_MODE_CLASS (<var>m</var>)</code></dt>
  632. <dd><p>Returns the mode class of mode <var>m</var>.
  633. </p>
  634. <a name="index-GET_005fMODE_005fWIDER_005fMODE"></a>
  635. </dd>
  636. <dt><code>GET_MODE_WIDER_MODE (<var>m</var>)</code></dt>
  637. <dd><p>Returns the next wider natural mode. For example, the expression
  638. <code>GET_MODE_WIDER_MODE (QImode)</code> returns <code>HImode</code>.
  639. </p>
  640. <a name="index-GET_005fMODE_005fSIZE"></a>
  641. </dd>
  642. <dt><code>GET_MODE_SIZE (<var>m</var>)</code></dt>
  643. <dd><p>Returns the size in bytes of a datum of mode <var>m</var>.
  644. </p>
  645. <a name="index-GET_005fMODE_005fBITSIZE"></a>
  646. </dd>
  647. <dt><code>GET_MODE_BITSIZE (<var>m</var>)</code></dt>
  648. <dd><p>Returns the size in bits of a datum of mode <var>m</var>.
  649. </p>
  650. <a name="index-GET_005fMODE_005fIBIT"></a>
  651. </dd>
  652. <dt><code>GET_MODE_IBIT (<var>m</var>)</code></dt>
  653. <dd><p>Returns the number of integral bits of a datum of fixed-point mode <var>m</var>.
  654. </p>
  655. <a name="index-GET_005fMODE_005fFBIT"></a>
  656. </dd>
  657. <dt><code>GET_MODE_FBIT (<var>m</var>)</code></dt>
  658. <dd><p>Returns the number of fractional bits of a datum of fixed-point mode <var>m</var>.
  659. </p>
  660. <a name="index-GET_005fMODE_005fMASK"></a>
  661. </dd>
  662. <dt><code>GET_MODE_MASK (<var>m</var>)</code></dt>
  663. <dd><p>Returns a bitmask containing 1 for all bits in a word that fit within
  664. mode <var>m</var>. This macro can only be used for modes whose bitsize is
  665. less than or equal to <code>HOST_BITS_PER_INT</code>.
  666. </p>
  667. <a name="index-GET_005fMODE_005fALIGNMENT"></a>
  668. </dd>
  669. <dt><code>GET_MODE_ALIGNMENT (<var>m</var>)</code></dt>
  670. <dd><p>Return the required alignment, in bits, for an object of mode <var>m</var>.
  671. </p>
  672. <a name="index-GET_005fMODE_005fUNIT_005fSIZE"></a>
  673. </dd>
  674. <dt><code>GET_MODE_UNIT_SIZE (<var>m</var>)</code></dt>
  675. <dd><p>Returns the size in bytes of the subunits of a datum of mode <var>m</var>.
  676. This is the same as <code>GET_MODE_SIZE</code> except in the case of complex
  677. modes. For them, the unit size is the size of the real or imaginary
  678. part.
  679. </p>
  680. <a name="index-GET_005fMODE_005fNUNITS"></a>
  681. </dd>
  682. <dt><code>GET_MODE_NUNITS (<var>m</var>)</code></dt>
  683. <dd><p>Returns the number of units contained in a mode, i.e.,
  684. <code>GET_MODE_SIZE</code> divided by <code>GET_MODE_UNIT_SIZE</code>.
  685. </p>
  686. <a name="index-GET_005fCLASS_005fNARROWEST_005fMODE"></a>
  687. </dd>
  688. <dt><code>GET_CLASS_NARROWEST_MODE (<var>c</var>)</code></dt>
  689. <dd><p>Returns the narrowest mode in mode class <var>c</var>.
  690. </p></dd>
  691. </dl>
  692. <p>The following 3 variables are defined on every target. They can be
  693. used to allocate buffers that are guaranteed to be large enough to
  694. hold any value that can be represented on the target. The first two
  695. can be overridden by defining them in the target&rsquo;s mode.def file,
  696. however, the value must be a constant that can determined very early
  697. in the compilation process. The third symbol cannot be overridden.
  698. </p>
  699. <dl compact="compact">
  700. <dd><a name="index-BITS_005fPER_005fUNIT"></a>
  701. </dd>
  702. <dt><code>BITS_PER_UNIT</code></dt>
  703. <dd><p>The number of bits in an addressable storage unit (byte). If you do
  704. not define this, the default is 8.
  705. </p>
  706. <a name="index-MAX_005fBITSIZE_005fMODE_005fANY_005fINT"></a>
  707. </dd>
  708. <dt><code>MAX_BITSIZE_MODE_ANY_INT</code></dt>
  709. <dd><p>The maximum bitsize of any mode that is used in integer math. This
  710. should be overridden by the target if it uses large integers as
  711. containers for larger vectors but otherwise never uses the contents to
  712. compute integer values.
  713. </p>
  714. <a name="index-MAX_005fBITSIZE_005fMODE_005fANY_005fMODE"></a>
  715. </dd>
  716. <dt><code>MAX_BITSIZE_MODE_ANY_MODE</code></dt>
  717. <dd><p>The bitsize of the largest mode on the target. The default value is
  718. the largest mode size given in the mode definition file, which is
  719. always correct for targets whose modes have a fixed size. Targets
  720. that might increase the size of a mode beyond this default should define
  721. <code>MAX_BITSIZE_MODE_ANY_MODE</code> to the actual upper limit in
  722. <samp><var>machine</var>-modes.def</samp>.
  723. </p></dd>
  724. </dl>
  725. <a name="index-byte_005fmode"></a>
  726. <a name="index-word_005fmode"></a>
  727. <p>The global variables <code>byte_mode</code> and <code>word_mode</code> contain modes
  728. whose classes are <code>MODE_INT</code> and whose bitsizes are either
  729. <code>BITS_PER_UNIT</code> or <code>BITS_PER_WORD</code>, respectively. On 32-bit
  730. machines, these are <code>QImode</code> and <code>SImode</code>, respectively.
  731. </p>
  732. <hr>
  733. <div class="header">
  734. <p>
  735. Next: <a href="Constants.html#Constants" accesskey="n" rel="next">Constants</a>, Previous: <a href="Flags.html#Flags" accesskey="p" rel="prev">Flags</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>
  736. </div>
  737. </body>
  738. </html>