Panasonic PanaXSeries MN1030 Series User Manual page 63

Panasonic microcomputer user's manual
Table of Contents

Advertisement

Optimization of function calls
This section describes the optimization of function calls by the linker.
The assembler provides advanced processing for function calls. This processing uses a combination of
the call and ret instructions and the global and funcinfo directives. The following is an example.
global
_TEXT
section
:
call
:
global
_TEXT
section
_func
movm
add
_0func
funcinfo
:
:
ret
(1) gives the call to the function _0func. (3) is the body of the function. (2) the section between the labels
_func and _0func, saves a register and sets up the stack frame.
When this source file is assembled and linked, the linker eliminates section (2). This section is preserved
when the symbol _func is referred.
For further details on machine instructions and directives, see the Instruction Manual and Section 9.4
"Writing Directives."
NOTE:
This optimization of function calls is always carried out regardless of the state of
the optimization option (-O). It is suppressed throughout if even one of the source
files to be linked contains a calls instruction with the operand (An).
_0func
CODE, PUBLIC, 1
_0func
_0func, _func
CODE, PUBLIC, 1
[D2], (SP)
-4, SP
_func, 8, [D2]
Chapter 4 Optimization
(1)
(2)
(3)
Usage Example 51

Advertisement

Table of Contents
loading

Table of Contents