s5u1c33000c Epson Electronics America, Inc., s5u1c33000c Datasheet - Page 103

no-image

s5u1c33000c

Manufacturer Part Number
s5u1c33000c
Description
Cmos 32-bit Single Chip Microcomputer S5u1c33000c Manual
Manufacturer
Epson Electronics America, Inc.
Datasheet
6.5.5 Stack Frame
When calling a function, the gcc33 creates the stack frame shown in Figure 6.5.5.1. The start address of the stack
frame is always a word (32-bit) boundary address.
Return address
Register save area
Local variable area
Argument area
Allocating and clearing the stack area
S5U1C33000C MANUAL
(C COMPILER PACKAGE FOR S1C33 FAMILY) (Ver. 4)
Low memory
This is the return address (1 word) to the calling function.
If any registers from R0 to R3 are used by the calling function, they are saved to this area in order of
register numbers beginning with the highest.
If none of the registers from R0 to R3 is used by the calling function, this area is not allocated.
If there are any local variables defined in the called function that cannot be stored in registers, an area is
allocated in the stack frame. Then they are saved sequentially beginning with the last-declared variable at
boundary addresses (4-byte boundaries for the double type) according to the data types.
Example: {
This area is not allocated if there is no local variable that needs to be saved in the stack.
If there are any arguments for another function call in the called function that cannot be stored in the
registers for passing argument, an area is allocated in the stack frame (see the preceding section). All
arguments are located at 4-byte boundaries. The 32 low-order double-type bits are saved at low-order
addresses, and the 32 high-order bits are saved at the high-order addresses.
This area is not allocated if there is no function call.
A stack area for the return address is allocated and the address is saved to this area by the call instruction.
The address is popped from the stack and the area is cleared by the ret instruction.
All other areas are allocated in the prologue processing of the function, and are cleared in the epilogue
processing.
Low memory
}
SP
char
short
int
:
Local start
Register save area
Local variable area
Fig. 6.5.5.2 Example of local variables saved to stack
Return address
Argument area
c;
s;
i;
+4
+0
Fig. 6.5.5.1 Stack frame
EPSON
R3 (4 registers at maximum)
R0
Last variable defined
First variable defined
Last argument
First argument stored in the stack
:
:
:
+0
c
Unused
+1
i
+2
CHAPTER 6: C COMPILER
Allocated by call
instruction, cleared by
ret instruction
Allocated by function
prologue processing
Cleared by function
epilogue processing
s
+3
87

Related parts for s5u1c33000c