160
Section 3: Assembler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
3.5.4.
Addressing Mode Selection
The assembler performs various optimizations and coercions on eligible effective
addressing modes in order to produce more efficient code. The following
addressing modes are not affected:
•
Data register direct.
•
Address register direct.
•
Address register indirect.
•
Address register indirect with postincrement.
•
Address register indirect with predecrement.
•
Immediate data.
For all other addressing modes, the mode selection is carried out in three
phases. First, coercion to a PC-relative addressing mode is performed, if
possible. Using a PC-relative mode typically results in a smaller, faster
instruction. This step can be bypassed with the .opt nopc / OPT NOPC directive.
Second, displacements are sized minimally for the current set of user-specified
effective address options. Finally, the mode selection is made.
3.5.4.1. PC-relative
Coercion
The effective address specifications that are eligible for PC-relative coercion are
those that have a displacement and no base register. This includes the absolute
addressing modes, the register indirect modes, and the memory indirect modes.
The following criteria must be met for coercion to be performed:
1. The appropriate PC addressing mode must be legal for the instruction.
2. The displacement must not have a size qualifier.
3. The settings of the PC-relative coercion options must allow it.
In the following discussion, pcb32 / PCB32 is included for completeness, but is
not supported by Texas Instruments. The options related to PC-relative coercion
(see .opt / OPT directive) are the following:
pcb16 / PCB16
pcf / PCF
nopc / NOPC
pcb32 / PCB32
pca / PCA
nopca / NOPCA
These settings are used as described below to control the situations in which
PC-relative coercion is performed. The primary consideration is whether or not a
PC-relative displacement can be computed when its associated effective address
is encountered. The computation can be performed if the displacement involves
no forward or external references, and the effective address and referenced