English
Language : 

CC78K0S Datasheet, PDF (488/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 13 EFFECTIVE UTILIZATION OF COMPILER
• Functions that do not use automatic variables
Functions that do not use automatic variables should be defined as a noauto function. This function does not
output code for stack frame formation and its arguments are passed to registers as much as possible, which
helps shorten object code and improve program execution speed.
Remark Refer to 11.5 (5) noauto function, 11.7.3 noauto function call interface about noauto
function definition (noauto int sub1 (int i) ...).
• Functions that use automatic variables
If the saddr area can be used for a function that does not use automatic variables, declare the function with
the register storage class specifier. By this register declaration, the declared object will be allocated to a
register. A program using registers operates faster than one using memory, and object code can be
shortened as well.
Remark Refer to 11.5 (2) Register variables for the definition of register variables (register int i; ...).
• Functions that use internal static variables
If the saddr area can be used for a function that uses internal static variables, declare the function with
_ _sreg or specify the -RS option. In the same way as with sreg variables, the object code can be shortened
and the execution speed can be improved.
Remark Refer to 11.5 (3) How to use the saddr area.
In addition, the code efficiency and the execution speed can be improved by the following method.
• Use of SFR name (or SFR bit name).
#pragma sfr
• Use of _ _sreg declaration for bit fields which consist only of 1-bit members (unsigned char type can be
used for members).
_ _sreg struct bf {
unsigned char a : 1 ;
unsigned char b : 1 ;
unsigned char c : 1 ;
unsigned char d : 1 ;
unsigned char e : 1 ;
unsigned char f : 1 ;
} bf_1 ;
• Use of multiplication and division embedded function.
#pragma mul
#pragma div
• Description of only the modules whose speed needs to be improved in the assembly language.
488
User’s Manual U14872EJ1V0UM