English
Language : 

CC78K0S Datasheet, PDF (470/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 12 REFERENCING THE ASSEMBLER
12.1 Accessing Arguments/Automatic Variables
The procedure to access arguments and automatic variables of this C compiler is described below.
12.1.1 Normal model
• On the function call side, register arguments are passed in the same way as regular arguments.
The first argument uses the following registers and stacks, and subsequent arguments are passed via
stacks.
Table 12-1. Passing Arguments (Function Call Side)
Type
1-byte, 2-byte data
3-byte, 4-byte data
Floating-point number
Others
Passing Location (First Argument)
AX
AX, BC
AX, BC
Stack passing
Passing Location (Second and Later Arguments)
Stack passing
Stack passing
Stack passing
Stack passing
Remark 1- to 4-byte data includes structures and unions.
• On the function definition side, arguments passed via a register or stack are stored in the argument allocation
location.
Register arguments are copied to a register or saddr area (_@KREGxx). Even when passing is done via a
register, the registers on the function call side (passing side) and the function definition side (receiving side)
differ, and therefore register copying is performed.
Normal arguments passed via a register are pushed to a stack on the function definition side. If passing is
done via a stack, the passing location simply becomes the argument allocation location.
Saving and restoring registers to which arguments are allocated is performed on the function definition side.
• The arguments of functions and the values of automatic variables declared inside functions are stored in the
following registers, saddr areas, or stack frames using an option. The base pointer used when storing in a
stack frame uses the HL register.
If the function argument is register-declared or specified by the -QV option and specified by the -QR option, it
is allocated to the saddr area.
470
User’s Manual U14872EJ1V0UM