Previous: , Up: S12Z Syntax   [Contents][Index]


9.24.2.3 Register Notation

Without a register prefix (see S12Z Options), S12Z assembler code is expected in the traditional format like this:

lea s, (-2,s)
st d2, (0,s)
ld x,  symbol
tfr d2, d6
cmp d6, #1532

However, if as is started with (for example) -mreg-prefix=% then all register names must be prefixed with % as follows:

lea %s, (-2,%s)
st %d2, (0,%s)
ld %x,  symbol
tfr %d2, %d6
cmp %d6, #1532

The register prefix feature is intended to be used by compilers to avoid ambiguity between symbols and register names. Consider the following assembler instruction:

st d0, d1

The destination operand of this instruction could either refer to the register D1, or it could refer to the symbol named d1. If the latter is intended then as must be invoked with -mreg-prefix=pfx and the code written as

st pfxd0, d1

where pfx is the chosen register prefix. For this reason, compiler back-ends should choose a register prefix which cannot be confused with a symbol name.