English
Language : 

CC78K0S Datasheet, PDF (447/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 11 EXTENDED FUNCTIONS
11.7.2 Ordinary function call interface
When all the arguments are allocated to registers and there are no automatic variables, the ordinary function call
interface is the same as noauto function call interface.
(1) Passing arguments
• There are two types of arguments: arguments that are allocated to registers and normal arguments.
• An argument that is allocated to a register is an argument that has undergone register declaration and is
allocated to a register or _@KREGxx as long as an allocatable register and _@KREGxx exist. However,
arguments are allocated to _@KREGxx only when -QR is specified. Arguments that are allocated to a
register or _@KREGxx are referred to as register arguments hereafter.
• Refer to APPENDIX A LIST OF LABELS FOR saddr AREA for _@KREGxx.
• The remaining arguments are allocated to a stack.
• On the function call side, both the arguments declared with registers and the ordinary arguments are passed
in the same manner. The second argument and later are passed via a stack, and the first argument is passed
via a register or stack.
• On the function definition side, arguments passed via register or stack are saved in the place where
arguments are allocated.
• Register arguments are copied to a register or _@KREGxx. Even when the arguments are passed via
registers, register copying is necessary since the registers on the function caller (passing side) are different to
those on the function definition side (receiving side).
• Normal arguments are loaded on a stack. When an argument is passed via a stack, the area where the
arguments are passed to becomes the area to which they are allocated.
• Saving and restoring registers to which arguments are allocated is performed on the function definition side.
• The location where the first argument is passed is shown in Table 11-17.
Table 11-17. Location Where First Argument Is Passed (on Function Call Side)
Type
1-byte dataNote
2-byte dataNote
3-byte dataNote
4-byte dataNote
Floating-point number (float type)
Floating-point number (double type)
Others
Option
AX
AX, BC
AX, BC
AX, BC
AX, BC
Passed via stack
Normal Model
Note 1- to 4-byte data includes structures, unions, and pointers.
User’s Manual U14872EJ1V0UM
447