8-26
EPSOn
S5U1C17001C ManUal
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
8 aSSEMBlEr
8.7 Optimization of Extended instructions
The C compiler compiles all codes that reference a global symbol address and some codes that reference a local
symbol address into
s
*
or
x
*
extended instructions. As shown in the preceding section, these extended instructions
are expanded into a basic instruction with the
ext
instructions.
If the operand of an extended instruction is an immediate data, the assembler adds zero to two
ext
instructions to
the basic instruction according to the immediate data size. So the optimization is completed at this point.
If the operand of an extended instruction is a symbol, the assembler adds the required number of
ext
instructions
for referencing to the entire memory space, as the symbol value is not determined until linkage has completed.
Therefore, unnecessary
ext
instructions may be output and it increases the code size. The
-mc17_ext
option is
used for the optimization to remove unnecessary
ext
instructions.
-mc17_ext
option
-mc17_ext
filename
.dump
filename
.map
filename
.dump
File in which global and local symbol information is described. Use
objdump
to create this
file. The file name extension must be "
.dump
".
objdump -t
filename
.elf >
filename
.dump
filename
.map
File in which object mapping information is described. This file is delivered by the
ld
linker.
The file name extension must be "
.map
".
Example:
objdump -t test.elf > test.dump
as -mc17_ext test.dump test.map -otest.o test.s
Optimize procedure
The assembler needs the symbol address information determined in the linkage process for the optimization and
gets it from the link map and dump files specified with the
-mc17_ext
option. Therefore, the optimization
needs a two-pass make process. The procedure shown below should be written in the makefile to perform a
two-pass make process.
1. Compile
2. Assemble (without the
-mc17_ext
option)
3. Link (with a map file output)
4. Create a dump file from the elf file using
objdump
.
5. Reassemble (with the
-mc17_ext
option) * Specify the same input/output files as Step 2.
The makefile created by the
IDE
contains the procedure above.
Summary of Contents for S5U1C17001C
Page 6: ......
Page 17: ...1 General S5U1C17001C Manual 1 General ...
Page 18: ......
Page 21: ...1 2 Install S5U1C17001C Manual 2 Installation ...
Page 22: ......
Page 29: ...3 SoftDev S5U1C17001C Manual 3 Software Development Procedures ...
Page 30: ......
Page 103: ...4 SrcFiles S5U1C17001C Manual 4 Source files ...
Page 104: ......
Page 121: ...5 IDE S5U1C17001C Manual 5 gnU17 iDE ...
Page 122: ......
Page 365: ...6 Compiler S5U1C17001C Manual 6 C Compiler ...
Page 366: ......
Page 385: ...7 Library S5U1C17001C Manual 7 library ...
Page 386: ......
Page 405: ...8 Assemblr S5U1C17001C Manual 8 assembler ...
Page 406: ......
Page 439: ...9 Linker S5U1C17001C Manual 9 linker ...
Page 440: ......
Page 449: ...10 Debugger S5U1C17001C Manual 10 Debugger ...
Page 450: ......
Page 626: ...11 Tools S5U1C17001C Manual 11 Other Tools ...
Page 627: ......
Page 696: ...S1C17 Family C Compiler Package Quick Reference Reference ...