| <html lang="en"> |
| <head> |
| <title>S12Z Register Notation - Using as</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Using as"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="S12Z-Syntax.html#S12Z-Syntax" title="S12Z Syntax"> |
| <link rel="prev" href="S12Z-Addressing-Modes.html#S12Z-Addressing-Modes" title="S12Z Addressing Modes"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| This file documents the GNU Assembler "as". |
| |
| Copyright (C) 1991-2019 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 |
| or any later version published by the Free Software Foundation; |
| with no Invariant Sections, with no Front-Cover Texts, and with no |
| Back-Cover Texts. A copy of the license is included in the |
| section entitled ``GNU Free Documentation License''. |
| |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="S12Z-Register-Notation"></a> |
| <p> |
| Previous: <a rel="previous" accesskey="p" href="S12Z-Addressing-Modes.html#S12Z-Addressing-Modes">S12Z Addressing Modes</a>, |
| Up: <a rel="up" accesskey="u" href="S12Z-Syntax.html#S12Z-Syntax">S12Z Syntax</a> |
| <hr> |
| </div> |
| |
| <h5 class="subsubsection">9.24.2.3 Register Notation</h5> |
| |
| <p><a name="index-register-notation_002c-S12Z-1531"></a>Without a register prefix (see <a href="S12Z-Options.html#S12Z-Options">S12Z Options</a>), S12Z assembler code is expected in the traditional |
| format like this: |
| <pre class="smallexample"> lea s, (-2,s) |
| st d2, (0,s) |
| ld x, symbol |
| tfr d2, d6 |
| cmp d6, #1532 |
| </pre> |
| <p class="noindent">However, if <code>as</code> is started with (for example) ‘<samp><span class="samp">-mreg-prefix=%</span></samp>’ |
| then all register names must be prefixed with ‘<samp><span class="samp">%</span></samp>’ as follows: |
| <pre class="smallexample"> lea %s, (-2,%s) |
| st %d2, (0,%s) |
| ld %x, symbol |
| tfr %d2, %d6 |
| cmp %d6, #1532 |
| </pre> |
| <p>The register prefix feature is intended to be used by compilers |
| to avoid ambiguity between symbols and register names. |
| Consider the following assembler instruction: |
| <pre class="smallexample"> st d0, d1 |
| </pre> |
| <p class="noindent">The destination operand of this instruction could either refer to the register |
| ‘<samp><span class="samp">D1</span></samp>’, or it could refer to the symbol named “d1”. |
| If the latter is intended then <code>as</code> must be invoked with |
| ‘<samp><span class="samp">-mreg-prefix=</span><var>pfx</var></samp>’ and the code written as |
| <pre class="smallexample"> st <var>pfx</var>d0, d1 |
| </pre> |
| <p class="noindent">where <var>pfx</var> is the chosen register prefix. |
| For this reason, compiler back-ends should choose a register prefix which |
| cannot be confused with a symbol name. |
| |
| <!-- Copyright (C) 2013-2019 Free Software Foundation, Inc. --> |
| <!-- Contributed by Imagination Technologies Ltd. --> |
| <!-- This is part of the GAS manual. --> |
| <!-- For copying conditions, see the file as.texinfo. --> |
| <!-- man end --> |
| </body></html> |
| |