CHAPTER 5: LINKER
102
EPSON
S5U1C63000A MANUAL
(S1C63 FAMILY ASSEMBLER PACKAGE)
5.11 Branch Optimization Function
The PC relative branch instructions (jr, jrc, jrnc, jrz, jrnz and calr) need an address extension instruction
(ldb %ext, imm8) when the relative distance to the destination address exceeds the -127 to 128 range.
Since the location of relocatable sections is not decided until the linking process is completed, the linker
has a function that automatically inserts, removes or corrects the extension codes. This makes it possible
to omit the address extension instruction in the source. However, this function is valid only for the branch
instructions that use a label to specify the destination address.
This branch optimization function (automatically insertion/deletion/correction of the extension codes) is
enabled by default and the branch codes will be optimized unless otherwise specified. All the insertion/
deletion/correction functions can be disabled by specifying the -d option. The -di and -dr options can
also be specified to disable the extension code insertion and deletion functions, respectively (if the -d
option is not specified).
The linker checks the distance from a PC relative branch instruction code to the branch destination label,
and inserts, removes or corrects the extension codes according to the check results.
(1) When the branch destination is located within the -127 to +128 range from the branch instruction:
If the branch instructon code does not have an extension code, no extension code is inserted.
If the branch instruction has an extension code, it is removed (if the -dr option is specified, existing
expansion code will not be removed).
Examples:
jr LABEL
→
jr LABEL
ldb %ext,LABEL@rh
calr LABEL@rl
→
calr LABEL@rl
(2) When the branch destination is located outside the -127 to +128 range from the branch instruction:
If the branch instructon code does not have an extension code, an appropriate extension code is
inserted.
If the branch instruction has an illegal extension code, it is replaced with a correct extension code.
Examples:
jr LABEL
→
ldb
%ext,LABEL@rh
jr LABEL@rl
ldb %ext,LABEL1@rh
→
ldb %ext,LABEL2@rh
calr LABEL2@rl
calr LABEL2@rl
Unused memory spaces may be generated between sections caused by the branch optimization. In this
case the linker moves the relocatable section following an unused area toward a lower address so that the
codes are embedded in the unused area.
Note: In the previous version, omission of the -d option enables automatic insertion and correction of the
extension codes, note, however, that deletion of the extension codes must be enabled using the -er
option. The current version has no -er option and all the insertion/deletion/correction functions are
enabled by default. To disable the deletion and insertion functions when the -d option is omitted,
the -dr option and -di option must be specified, respectively. Be aware that the current version may
generate an object different from that of the previous version because the current version uncondi-
tionally deletes unnecessary extension codes when the project for the previous version with no -d
option is processed. Specify the -dr option to generate the same optimized codes as the previous
version.
Содержание S5U1C63000A
Страница 1: ...MF910 06 CMOS 4 BIT SINGLE CHIP MICROCOMPUTER S1C63 Family Assembler Package S5U1C63000A Manual ...
Страница 4: ......
Страница 14: ......
Страница 304: ......
Страница 305: ...S1C63 Family Assembler Package Quick Reference ...