MMIX_002dPseudos.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2017 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: MMIX-Pseudos</title>
  15. <meta name="description" content="Using as: MMIX-Pseudos">
  16. <meta name="keywords" content="Using as: MMIX-Pseudos">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="MMIX_002dSyntax.html#MMIX_002dSyntax" rel="up" title="MMIX-Syntax">
  25. <link href="MMIX_002dmmixal.html#MMIX_002dmmixal" rel="next" title="MMIX-mmixal">
  26. <link href="MMIX_002dRegs.html#MMIX_002dRegs" rel="prev" title="MMIX-Regs">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style:oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="MMIX_002dPseudos"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="MMIX_002dRegs.html#MMIX_002dRegs" accesskey="p" rel="prev">MMIX-Regs</a>, Up: <a href="MMIX_002dSyntax.html#MMIX_002dSyntax" accesskey="u" rel="up">MMIX-Syntax</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Assembler-Directives-3"></a>
  64. <h4 class="subsubsection">9.28.3.4 Assembler Directives</h4>
  65. <a name="index-assembler-directives_002c-MMIX"></a>
  66. <a name="index-pseudo_002dops_002c-MMIX"></a>
  67. <a name="index-MMIX-assembler-directives"></a>
  68. <a name="index-MMIX-pseudo_002dops"></a>
  69. <dl compact="compact">
  70. <dt><code>LOC</code></dt>
  71. <dd><a name="index-assembler-directive-LOC_002c-MMIX"></a>
  72. <a name="index-pseudo_002dop-LOC_002c-MMIX"></a>
  73. <a name="index-MMIX-assembler-directive-LOC"></a>
  74. <a name="index-MMIX-pseudo_002dop-LOC"></a>
  75. <a name="MMIX_002dloc"></a><p>The <code>LOC</code> directive sets the current location to the value of the
  76. operand field, which may include changing sections. If the operand is a
  77. constant, the section is set to either <code>.data</code> if the value is
  78. <code>0x2000000000000000</code> or larger, else it is set to <code>.text</code>.
  79. Within a section, the current location may only be changed to
  80. monotonically higher addresses. A LOC expression must be a previously
  81. defined symbol or a &ldquo;pure&rdquo; constant.
  82. </p>
  83. <p>An example, which sets the label <var>prev</var> to the current location, and
  84. updates the current location to eight bytes forward:
  85. </p><div class="smallexample">
  86. <pre class="smallexample">prev LOC @+8
  87. </pre></div>
  88. <p>When a LOC has a constant as its operand, a symbol
  89. <code>__.MMIX.start..text</code> or <code>__.MMIX.start..data</code> is defined
  90. depending on the address as mentioned above. Each such symbol is
  91. interpreted as special by the linker, locating the section at that
  92. address. Note that if multiple files are linked, the first object file
  93. with that section will be mapped to that address (not necessarily the file
  94. with the LOC definition).
  95. </p>
  96. </dd>
  97. <dt><code>LOCAL</code></dt>
  98. <dd><a name="index-assembler-directive-LOCAL_002c-MMIX"></a>
  99. <a name="index-pseudo_002dop-LOCAL_002c-MMIX"></a>
  100. <a name="index-MMIX-assembler-directive-LOCAL"></a>
  101. <a name="index-MMIX-pseudo_002dop-LOCAL"></a>
  102. <a name="MMIX_002dlocal"></a><p>Example:
  103. </p><div class="smallexample">
  104. <pre class="smallexample"> LOCAL external_symbol
  105. LOCAL 42
  106. .local asymbol
  107. </pre></div>
  108. <p>This directive-operation generates a link-time assertion that the operand
  109. does not correspond to a global register. The operand is an expression
  110. that at link-time resolves to a register symbol or a number. A number is
  111. treated as the register having that number. There is one restriction on
  112. the use of this directive: the pseudo-directive must be placed in a
  113. section with contents, code or data.
  114. </p>
  115. </dd>
  116. <dt><code>IS</code></dt>
  117. <dd><a name="index-assembler-directive-IS_002c-MMIX"></a>
  118. <a name="index-pseudo_002dop-IS_002c-MMIX"></a>
  119. <a name="index-MMIX-assembler-directive-IS"></a>
  120. <a name="index-MMIX-pseudo_002dop-IS"></a>
  121. <a name="MMIX_002dis"></a><p>The <code>IS</code> directive:
  122. </p><div class="smallexample">
  123. <pre class="smallexample">asymbol IS an_expression
  124. </pre></div>
  125. <p>sets the symbol &lsquo;<samp>asymbol</samp>&rsquo; to &lsquo;<samp>an_expression</samp>&rsquo;. A symbol may not
  126. be set more than once using this directive. Local labels may be set using
  127. this directive, for example:
  128. </p><div class="smallexample">
  129. <pre class="smallexample">5H IS @+4
  130. </pre></div>
  131. </dd>
  132. <dt><code>GREG</code></dt>
  133. <dd><a name="index-assembler-directive-GREG_002c-MMIX"></a>
  134. <a name="index-pseudo_002dop-GREG_002c-MMIX"></a>
  135. <a name="index-MMIX-assembler-directive-GREG"></a>
  136. <a name="index-MMIX-pseudo_002dop-GREG"></a>
  137. <a name="MMIX_002dgreg"></a><p>This directive reserves a global register, gives it an initial value and
  138. optionally gives it a symbolic name. Some examples:
  139. </p>
  140. <div class="smallexample">
  141. <pre class="smallexample">areg GREG
  142. breg GREG data_value
  143. GREG data_buffer
  144. .greg creg, another_data_value
  145. </pre></div>
  146. <p>The symbolic register name can be used in place of a (non-special)
  147. register. If a value isn&rsquo;t provided, it defaults to zero. Unless the
  148. option &lsquo;<samp>--no-merge-gregs</samp>&rsquo; is specified, non-zero registers allocated
  149. with this directive may be eliminated by <code>as</code>; another
  150. register with the same value used in its place.
  151. Any of the instructions
  152. &lsquo;<samp>CSWAP</samp>&rsquo;,
  153. &lsquo;<samp>GO</samp>&rsquo;,
  154. &lsquo;<samp>LDA</samp>&rsquo;,
  155. &lsquo;<samp>LDBU</samp>&rsquo;,
  156. &lsquo;<samp>LDB</samp>&rsquo;,
  157. &lsquo;<samp>LDHT</samp>&rsquo;,
  158. &lsquo;<samp>LDOU</samp>&rsquo;,
  159. &lsquo;<samp>LDO</samp>&rsquo;,
  160. &lsquo;<samp>LDSF</samp>&rsquo;,
  161. &lsquo;<samp>LDTU</samp>&rsquo;,
  162. &lsquo;<samp>LDT</samp>&rsquo;,
  163. &lsquo;<samp>LDUNC</samp>&rsquo;,
  164. &lsquo;<samp>LDVTS</samp>&rsquo;,
  165. &lsquo;<samp>LDWU</samp>&rsquo;,
  166. &lsquo;<samp>LDW</samp>&rsquo;,
  167. &lsquo;<samp>PREGO</samp>&rsquo;,
  168. &lsquo;<samp>PRELD</samp>&rsquo;,
  169. &lsquo;<samp>PREST</samp>&rsquo;,
  170. &lsquo;<samp>PUSHGO</samp>&rsquo;,
  171. &lsquo;<samp>STBU</samp>&rsquo;,
  172. &lsquo;<samp>STB</samp>&rsquo;,
  173. &lsquo;<samp>STCO</samp>&rsquo;,
  174. &lsquo;<samp>STHT</samp>&rsquo;,
  175. &lsquo;<samp>STOU</samp>&rsquo;,
  176. &lsquo;<samp>STSF</samp>&rsquo;,
  177. &lsquo;<samp>STTU</samp>&rsquo;,
  178. &lsquo;<samp>STT</samp>&rsquo;,
  179. &lsquo;<samp>STUNC</samp>&rsquo;,
  180. &lsquo;<samp>SYNCD</samp>&rsquo;,
  181. &lsquo;<samp>SYNCID</samp>&rsquo;,
  182. can have a value nearby <a name="GREG_002dbase"></a>an initial value in place of its
  183. second and third operands. Here, &ldquo;nearby&rdquo; is defined as within the
  184. range 0&hellip;255 from the initial value of such an allocated register.
  185. </p>
  186. <div class="smallexample">
  187. <pre class="smallexample">buffer1 BYTE 0,0,0,0,0
  188. buffer2 BYTE 0,0,0,0,0
  189. &hellip;
  190. GREG buffer1
  191. LDOU $42,buffer2
  192. </pre></div>
  193. <p>In the example above, the &lsquo;<samp>Y</samp>&rsquo; field of the <code>LDOUI</code> instruction
  194. (LDOU with a constant Z) will be replaced with the global register
  195. allocated for &lsquo;<samp>buffer1</samp>&rsquo;, and the &lsquo;<samp>Z</samp>&rsquo; field will have the value
  196. 5, the offset from &lsquo;<samp>buffer1</samp>&rsquo; to &lsquo;<samp>buffer2</samp>&rsquo;. The result is
  197. equivalent to this code:
  198. </p><div class="smallexample">
  199. <pre class="smallexample">buffer1 BYTE 0,0,0,0,0
  200. buffer2 BYTE 0,0,0,0,0
  201. &hellip;
  202. tmpreg GREG buffer1
  203. LDOU $42,tmpreg,(buffer2-buffer1)
  204. </pre></div>
  205. <p>Global registers allocated with this directive are allocated in order
  206. higher-to-lower within a file. Other than that, the exact order of
  207. register allocation and elimination is undefined. For example, the order
  208. is undefined when more than one file with such directives are linked
  209. together. With the options &lsquo;<samp>-x</samp>&rsquo; and &lsquo;<samp>--linker-allocated-gregs</samp>&rsquo;,
  210. &lsquo;<samp>GREG</samp>&rsquo; directives for two-operand cases like the one mentioned above
  211. can be omitted. Sufficient global registers will then be allocated by the
  212. linker.
  213. </p>
  214. </dd>
  215. <dt><code>BYTE</code></dt>
  216. <dd><a name="index-assembler-directive-BYTE_002c-MMIX"></a>
  217. <a name="index-pseudo_002dop-BYTE_002c-MMIX"></a>
  218. <a name="index-MMIX-assembler-directive-BYTE"></a>
  219. <a name="index-MMIX-pseudo_002dop-BYTE"></a>
  220. <a name="MMIX_002dbyte"></a><p>The &lsquo;<samp>BYTE</samp>&rsquo; directive takes a series of operands separated by a comma.
  221. If an operand is a string (see <a href="Strings.html#Strings">Strings</a>), each character of that string
  222. is emitted as a byte. Other operands must be constant expressions without
  223. forward references, in the range 0&hellip;255. If you need operands having
  224. expressions with forward references, use &lsquo;<samp>.byte</samp>&rsquo; (see <a href="Byte.html#Byte">Byte</a>). An
  225. operand can be omitted, defaulting to a zero value.
  226. </p>
  227. </dd>
  228. <dt><code>WYDE</code></dt>
  229. <dt><code>TETRA</code></dt>
  230. <dt><code>OCTA</code></dt>
  231. <dd><a name="index-assembler-directive-WYDE_002c-MMIX"></a>
  232. <a name="index-pseudo_002dop-WYDE_002c-MMIX"></a>
  233. <a name="index-MMIX-assembler-directive-WYDE"></a>
  234. <a name="index-MMIX-pseudo_002dop-WYDE"></a>
  235. <a name="index-assembler-directive-TETRA_002c-MMIX"></a>
  236. <a name="index-pseudo_002dop-TETRA_002c-MMIX"></a>
  237. <a name="index-MMIX-assembler-directive-TETRA"></a>
  238. <a name="index-MMIX-pseudo_002dop-TETRA"></a>
  239. <a name="index-assembler-directive-OCTA_002c-MMIX"></a>
  240. <a name="index-pseudo_002dop-OCTA_002c-MMIX"></a>
  241. <a name="index-MMIX-assembler-directive-OCTA"></a>
  242. <a name="index-MMIX-pseudo_002dop-OCTA"></a>
  243. <a name="MMIX_002dconstants"></a><p>The directives &lsquo;<samp>WYDE</samp>&rsquo;, &lsquo;<samp>TETRA</samp>&rsquo; and &lsquo;<samp>OCTA</samp>&rsquo; emit constants of
  244. two, four and eight bytes size respectively. Before anything else happens
  245. for the directive, the current location is aligned to the respective
  246. constant-size boundary. If a label is defined at the beginning of the
  247. line, its value will be that after the alignment. A single operand can be
  248. omitted, defaulting to a zero value emitted for the directive. Operands
  249. can be expressed as strings (see <a href="Strings.html#Strings">Strings</a>), in which case each
  250. character in the string is emitted as a separate constant of the size
  251. indicated by the directive.
  252. </p>
  253. </dd>
  254. <dt><code>PREFIX</code></dt>
  255. <dd><a name="index-assembler-directive-PREFIX_002c-MMIX"></a>
  256. <a name="index-pseudo_002dop-PREFIX_002c-MMIX"></a>
  257. <a name="index-MMIX-assembler-directive-PREFIX"></a>
  258. <a name="index-MMIX-pseudo_002dop-PREFIX"></a>
  259. <a name="MMIX_002dprefix"></a><p>The &lsquo;<samp>PREFIX</samp>&rsquo; directive sets a symbol name prefix to be prepended to
  260. all symbols (except local symbols, see <a href="MMIX_002dSymbols.html#MMIX_002dSymbols">MMIX-Symbols</a>), that are not
  261. prefixed with &lsquo;<samp>:</samp>&rsquo;, until the next &lsquo;<samp>PREFIX</samp>&rsquo; directive. Such
  262. prefixes accumulate. For example,
  263. </p><div class="smallexample">
  264. <pre class="smallexample"> PREFIX a
  265. PREFIX b
  266. c IS 0
  267. </pre></div>
  268. <p>defines a symbol &lsquo;<samp>abc</samp>&rsquo; with the value 0.
  269. </p>
  270. </dd>
  271. <dt><code>BSPEC</code></dt>
  272. <dt><code>ESPEC</code></dt>
  273. <dd><a name="index-assembler-directive-BSPEC_002c-MMIX"></a>
  274. <a name="index-pseudo_002dop-BSPEC_002c-MMIX"></a>
  275. <a name="index-MMIX-assembler-directive-BSPEC"></a>
  276. <a name="index-MMIX-pseudo_002dop-BSPEC"></a>
  277. <a name="index-assembler-directive-ESPEC_002c-MMIX"></a>
  278. <a name="index-pseudo_002dop-ESPEC_002c-MMIX"></a>
  279. <a name="index-MMIX-assembler-directive-ESPEC"></a>
  280. <a name="index-MMIX-pseudo_002dop-ESPEC"></a>
  281. <a name="MMIX_002dspec"></a><p>A pair of &lsquo;<samp>BSPEC</samp>&rsquo; and &lsquo;<samp>ESPEC</samp>&rsquo; directives delimit a section of
  282. special contents (without specified semantics). Example:
  283. </p><div class="smallexample">
  284. <pre class="smallexample"> BSPEC 42
  285. TETRA 1,2,3
  286. ESPEC
  287. </pre></div>
  288. <p>The single operand to &lsquo;<samp>BSPEC</samp>&rsquo; must be number in the range
  289. 0&hellip;255. The &lsquo;<samp>BSPEC</samp>&rsquo; number 80 is used by the GNU binutils
  290. implementation.
  291. </p></dd>
  292. </dl>
  293. <hr>
  294. <div class="header">
  295. <p>
  296. Previous: <a href="MMIX_002dRegs.html#MMIX_002dRegs" accesskey="p" rel="prev">MMIX-Regs</a>, Up: <a href="MMIX_002dSyntax.html#MMIX_002dSyntax" accesskey="u" rel="up">MMIX-Syntax</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  297. </div>
  298. </body>
  299. </html>