| <html lang="en"> | |
| <head> | |
| <title>RX-Modifiers - 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="RX_002dDependent.html#RX_002dDependent" title="RX-Dependent"> | |
| <link rel="prev" href="RX_002dOpts.html#RX_002dOpts" title="RX-Opts"> | |
| <link rel="next" href="RX_002dDirectives.html#RX_002dDirectives" title="RX-Directives"> | |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> | |
| <!-- | |
| This file documents the GNU Assembler "as". | |
| Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | |
| 2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010, 2011 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="RX-Modifiers"></a> | |
| <a name="RX_002dModifiers"></a> | |
| <p> | |
| Next: <a rel="next" accesskey="n" href="RX_002dDirectives.html#RX_002dDirectives">RX-Directives</a>, | |
| Previous: <a rel="previous" accesskey="p" href="RX_002dOpts.html#RX_002dOpts">RX-Opts</a>, | |
| Up: <a rel="up" accesskey="u" href="RX_002dDependent.html#RX_002dDependent">RX-Dependent</a> | |
| <hr> | |
| </div> | |
| <h4 class="subsection">9.34.2 Symbolic Operand Modifiers</h4> | |
| <p><a name="index-RX-modifiers-1657"></a><a name="index-syntax_002c-RX-1658"></a><a name="index-g_t_0025gp-1659"></a> | |
| The assembler supports one modifier when using symbol addresses | |
| in RX instruction operands. The general syntax is the following: | |
| <pre class="smallexample"> %gp(symbol) | |
| </pre> | |
| <p>The modifier returns the offset from the <var>__gp</var> symbol to the | |
| specified symbol as a 16-bit value. The intent is that this offset | |
| should be used in a register+offset move instruction when generating | |
| references to small data. Ie, like this: | |
| <pre class="smallexample"> mov.W %gp(_foo)[%gpreg], r1 | |
| </pre> | |
| <p>The assembler also supports two meta register names which can be used | |
| to refer to registers whose values may not be known to the | |
| programmer. These meta register names are: | |
| <a name="index-g_t_0040samp_007b_0025gpreg_007d-1660"></a> | |
| <dl><dt><code>%gpreg</code><dd>The small data address register. | |
| <p><a name="index-g_t_0040samp_007b_0025pidreg_007d-1661"></a><br><dt><code>%pidreg</code><dd>The PID base address register. | |
| </dl> | |
| <p>Both registers normally have the value r13, but this can change if | |
| some registers have been reserved for use by interrupt handlers or if | |
| both the small data limit and position independent data features are | |
| being used at the same time. | |
| </body></html> | |