EasyManua.ls Logo

Panasonic PanaXSeries MN1030 Series - Page 63

Panasonic PanaXSeries MN1030 Series
340 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 4 Optimization
Usage Example 51
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.
(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).
global _0func
_TEXT section CODE, PUBLIC, 1
:
call _0func (1)
:
global _0func, _func
_TEXT section CODE, PUBLIC, 1
_func
movm [D2], (SP) (2)
add -4, SP
_0func funcinfo _func, 8, [D2]
:
:(3)
ret

Table of Contents

Related product manuals