English
Language : 

CC78K4 Datasheet, PDF (299/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 11 EXTENDED FUNCTIONS
Register Variables
register
EXAMPLE 2
2. Example of register variable allocation to register and saddr2 area
(With the large model, and when the optimization option -QR is specified)
(C source 2)
void main () {
register unsigned int a, b, c, d;
d = a - b;
d = b - c;
}
(Output object of compiler)
EXTRN
PUBLIC
@@CODE
_main;
push
push
push
movw
push
movw
subw
movw
movw
subw
movw
pop
movw
pop
pop
pop
ret
SADDR2(_@KREG00)
_main
CSEG
uup
rp3
vvp
ax, _@KREG00
ax
ax, rp3
ax, up
vp, ax
ax, up
ax, _@KREG00
vp, ax
ax
_@KREG00, ax
vvp
rp3
uup
; Performs reference declaration of saddr2 area to be used.
; Saves register contents at the beginning of the function.
;
;
; Saves contents of saddr2 are at the beginning of the function.
;
; a−b
; Assigns the result of a − b to d
; b−c
; Assigns the result of b − c to d
; Restores contents of saddr2 area at the end of the function.
; Restores register contents at the end of the function.
User’s Manual U15556EJ1V0UM
299