0% found this document useful (0 votes)
38 views68 pages

H8S, H8/300 Series C/C++ Compiler Supplementary Information

Uploaded by

Thanh Trụ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views68 pages

H8S, H8/300 Series C/C++ Compiler Supplementary Information

Uploaded by

Thanh Trụ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 68

H8S,H8/300 Series C/C++ Compiler

Supplementary Information
Notes
When using this document, keep the following in mind:
(1)This document may, wholly or partially, be subject to change without notice.
(2)All rights are reserved: No one is permitted to reproduce or duplicate, in any form,
the whole or part of this document without Hitachi's permission.
(3)Hitachi will not be held responsible for any damage to the user that may result from
accidents or any other reasons during operation of the user's unit according to this
document.
Preface

This document supplements H8S,H8/300 Series C/C++ Compiler User's Manual.

This manual includes the following.


(a) Guide to Accessing On-chip Supporting Modules
(b) Stack and Memory Size Listing of Standard Libraries and EC++ Class
Libraries
(c) Notes on Using This Compiler
Contents

Guide to Accessing On-chip Supporting Modules

1. Accessing On-chip Supporting Modules -------------------------- 3


1.1 Handling Absolute Address --------------------------------- 3
1.2 Testing and Setting Flags --------------------------------- 4
1.2.1 Bitwise Operations ---------------------------------------- 4
1.2.2 Single-Bit Control Using Bitfield Declarations ------------- 5
1.3 General Example ----------------------------------------------- 6

2. Using the H8/3003 Header Files --------------------------------- 8


2.1 Making an On-Chip Supporting Module Register into a Union ------ 8
2.2 Making On-Chip Supporting Module Registers into a Structure ----- 10
2.3 volatile Type Qualifiers --------------------------------- 12
2.4 Header File ---------------------------------------------- 14

Stack and Memory Size Listing of Standard C Libraries and EC++ Class
Libraries

1. Memory Size ---------------------------------------------- 28


2. Stack Size Listing of Standard C Libraries ------------------- 29
3. Stack Size Listing of EC++ Class Libraries ------------------- 35
4. Stack Size Listing of Runtime Routines -------------------------- 53

Notes on Using This Compiler

1. Inter-Module Optimizer for Libraries -------------------------- 55


2. Restriction of Structure Alignment -------------------------- 56
3. Restriction of Inter-Module Optimizer -------------------------- 56
4. Class ----------------------------------------------------- 57
5. Pointer to Member ---------------------------------------------- 58
6. 6446 Error ----------------------------------------------------- 59
7. 104 Error at Linking --------------------------------------- 60
8. Others ----------------------------------------------------- 61
Guide to Accessing On-Chip Supporting Modules

1
Preface
This compiler provides header files for accessing the on-chip supporting modules. Using sample
programs also provided by the compiler, this manual describes how to access the on-chip supporting
modules and how to use the header files. The table below lists the provided sample programs and
their corresponding header files.

File Type File Name


Header file 300 310.h, 3101.h, 3102.h, 3103.h, 3217s.h, 325s.h, 3297s.h,
329s.h, 330.h, 3314.h, 3318.h, 3332.h, 3334f.h, 3337s.h,
338s.h, 3397s.h, 3434f.h, 3437s.h, 350.h, 3502.h, 3522.h,
3534.h, 3614s.h, 3644f.h, 3644s.h, 3657s.h, 3714s.h, 3724s.h,
3754s.h, 3814s.h, 3834s.h, 3877ns.h, 3877s.h, 3927s.h, 3947s.h
300H 3001.h, 3002.h, 3003.h, 3004.h, 3005.h, 3006.h, 3007.h,
3032s.h, 3035s.h, 3039s.h, 3042s.h, 3048f.h, 3048s.h, 3062f.h
3062s.h, 3067f.h, 3067s.h, 3072.h
2000 2124s.h, 2128s.h, 2134s.h, 2138s.h, 2144s.h, 2148s.h, 2227s.h,
2237s.h, 2245s.h, 2345s.h, 2350s.h, 2355s.h, 2357.h, 2357f.h
2600 2655s.h
Program using 300 310.c, 3101.c, 3102.c, 3103.c, 3217s.c, 325s.c, 3297s.c, 329s.c
the header file 330.c, 3314.c, 3318.c, 3332.c, 3334f.c, 3337s.c, 338s.c,
3397s.c, 3434f.c, 3437s.c, 350.c, 3502.c, 3522.c, 3534.c,
3614s.c, 3644f.c, 3644s.c, 3657s.c, 3714s.c, 3724s.c, 3754s.c,
3814s.c, 3834s.c, 3877ns.c, 3877s.c, 3927s.c, 3947s.c
300H 3001.c, 3002.c, 3003.c, 3004.c, 3005.c, 3006.c, 3007.c,
3032s.c, 3035s.c, 3039s.c, 3042s.c, 3048f.c, 3048s.c, 3062f.c,
3062s.c, 3067f.c, 3067s.c, 3072.c
2000 2124s.c, 2128s.c, 2134s.c, 2138s.c, 2144s.c, 2148s.c, 2227s.c,
2237s.c, 2245s.c, 2345s.c, 2350s.c, 2355s.c, 2357.c, 2357f.c
2600 2655s.c
Low level routine _closeal.c, _init.c, _initlib.c, _initsct.src, _iolib.c, _otherlb.c,
abort.c, callmain.c, exit.c, lowlvl.adv, lowlvl.nor, lowlvl.reg,
lowsrc.c, onexit.c, vec_tbl.c
Sample for tutorial cmain.c, cppmain.cpp, init.c, scttbl.c, vectbl.c, 300.cpu, 300l.cpu
300hn.cpu, 300ha.cpu, 2000n.cpu, 2000a.cpu, 2600n.cpu,
2600a.cpu, c300.sub, c300l.sub, c300hn.sub, c300ha.sub,
c2000n.sub, c2000a.sub, c2600n.sub, c2600a.sub, cpp300.sub,
cpp300l.sub, cpp300hn.sub, cpp300ha.sub, cpp2000n.sub,
cpp2000a.sub, cpp2600n.sub, cpp2600a.sub, test1.c, test1.sub,
test2.sub

Note: The header file names and program names correspond to the H8S,H8/300-series MCU names. For example,
3001.h and 3001.c correspond to the H8/3001-series MCU.

2 2
Section 1 Accessing the On-Chip Supporting Modules
This section describes how to access the on-chip supporting modules in the language.

1.1 Handling Absolute Addresses

To control the on-chip supporting modules in the H8S,H8/300-series devices, data must be read from and written to
specific addresses (absolute addresses of on-chip supporting module registers). For this purpose, addresses can be
converted into pointers to unsigned data (cast operator) corresponding to the on-chip supporting module register size,
which can then be defined with an easy to understand character string for use in the program.

Program Example 1-1

Figure 1-1 shows a program that initializes port A in the H8/3003 as an input port, sets the value read from port A as
unsigned char type variable data, and sets the Timer counter (TCNT) of 16-bit integrated timer pulse unit 0(ITU0) to
0x5000.

1: #define PADDR ((unsigned char *)0xFFFFD1)


2: #define PADR (*(unsigned char *)0xFFFFD3)
3: #define ITU0_TCNT ((unsigned int *)0xFFFF68)
4:
5: main()
6: {
7: unsigned char data;
8:
9: *PADDR = 0;
10: data = PADR;
11:
12: *ITU0_TCNT = 0x5000;
13: }

Figure 1-1 Program for Handling Absolute Addresses

Description

Line 1: Converts value 0xFFFFD1 into a pointer to unsigned char type data corresponding to 1-byte register size
and defines it as PADDR.

Line 2: Converts value 0xFFFFD3 into a pointer to unsigned char type data corresponding to 1-byte register size
and defines the contents of the pointer (the contents of address H'FFFFD3) as PADR.

Line 3: Converts value 0xFFFF68 into a pointer to unsigned int type data corresponding to 2-byte register size and
defines it as ITU0_TCNT.

Line 9: Sets PADDR (address 0xFFFFD3) to 0 to set port A as an input port.

Line 10: Reads the contents of PADR (address 0xFFFFD3) into variable data.

Line 12: Sets ITU0_TCNT (address 0xFFFF68) to value 0x5000.

3
1.2 Testing and Setting Flags

To control the on-chip supporting modules, bit value of registers must be tested and 1 or 0 must be set to single or
multiple bits as necessary. For such bit manipulation, bitwise operations for basic type data are sufficient if multiple
bits are to be manipulated and operations for bitfield type data are sufficient if a single bit is to be manipulated. Two
program examples are described below.

1.2.1 Bitwise Operations

Program Example 1-2

Figure 1-2 shows a program that sets the upper 4 bits of port A in the H8/3003 as output and the lower 4 bits as input,
and sets bits 27 and 26 of port A to 1 if the lower 4 bits are B'1100 and to 0 otherwise.

1: #define PADDR (*(unsigned char *)0xFFFFD1)


2: #define PADR ((unsigned char *)0xFFFFD3)
3:
4: main()
5: {
6: PADDR = 0xF0;
7:
8: if( (*PADR & 0x0F) == 0x0C )
9: *PADR |= 0xC0;
10: else
11: *PADR &= 0x3F;
12: }

Figure 1-2 Program for Testing and Setting Flags Using Bitwise Operations

Description

Line 1: Converts value 0xFFFFD1 into a pointer to unsigned char type data corresponding to 1-byte register size
and defines the contents of the pointer (the contents of address H'FFFFD1) as PADDR.

Line 2: Converts value 0xFFFFD3 into a pointer to unsigned char type data corresponding to 1-byte register size
and defines it as PADR.

Line 6: Sets PADDR to 0xF0 to initialize the upper 4 bits of port A as output and the lower 4 bits as input.

Line 8: Performs a bitwise AND operation between PADR and 0x0F, and checks if the lower 4 bits of the result is
B'1100 (0x0C).

Line 9: Performs a bitwise OR operation between PADR and 0xC0 to set bits 27 and 26 to 1 without changing bits
25 to 20, and sets the result to PADR.

Line 11: Performs a bitwise AND operation between PADR and 0x3F to set bits 27 and 26 to 0 without changing
bits 25 to 20, and sets the result to PADR .

4
1.2.2 Single-Bit Control Using Bitfield Declarations

Program Example 1-3

Figure 1-3 shows a program that sets 1 to all bits of port A when Input capture/compare match flag A (IMFA) of the
timer status register (TSR) of ITU0 in the H8/3003 becomes 1, and that clears all bits of port A when Input
cupture/compare match flag B (IMFB) of the timer status register (TSR) of ITU0 becomes 1.

1: #define ITU0_TSR (*(struct tsr *)0xFFFF67)


2: #define PADR (*(unsigned char *)0xFFFFD3)
3:
4: struct tsr {
5: unsigned char wk :1;
6: unsigned char OVF :1;
7: unsigned char IMFB :1;
8: unsigned char IMFA :1;
9: };
10:
11: main()
12: {
13: while( ITU0_TSR.IMFA == 0 ) ;
14: PADR = 0xFF;
15: ITU0_TSR.IMFA = 0;
16:
17: while( ITU0_TSR.IMFB == 0 ) ;
18: PADR = 0;
19: ITU0_TSR.IMFB = 0;
20: }
Figure 1-3 Program for Testing and Setting Flags Using Bitfield Declarations

Description

Line 1: Converts value 0xFFFF67 into a pointer to struct tsr type data using absolute address operations and
defines the contents of the pointer (the contents of address H'FFFF67) as ITU0_TSR.

Line 2: Converts value 0xFFFFD3 into a pointer to unsigned char type data using absolute address
operations and defines the contents of the pointer (the contents of address H'FFFF67) as PADR.

Lines 4 to9: Declares the timer status register (TSR) of ITU0. The bits making up TCSR have different
functions. For such registers, each bitfield must be declared accordingly. TSR above is declared
as an 8-bitfield register with a structure tag named struct tsr.

Line 13: Waits for the input capture/compare match flag A (IMFA) of TSR to become 1 using a while
statement. Each bitfield can be referred to in the same way as a member of a structure.

Line 14: Changes all bits of port A to 1.

Line 15: Changes IMFA of TSR to 0.

Lines 17 to 19: Waits for the input capture/compare match flag B (IMFA) of TSR to become 1 using a while
statement. Changes all bits of port A to 0, and changes IMFB of TSR to 0.

5
1.3 General Example

As a review of section 1, a program example is described below that includes absolute address handling, bitwise
operations, and bitfield declarations.

Program Example 1-4

Figure 1-4 shows a program that sets or clears even-numbered bits of port B each time TCNT reaches 0x8000 when
ITU0 in the H8/3003 operates on the following conditions:
o No interrupts or compare-match outputs are used
o Internal clock is phi/2
o TCNT is cleared at compare-match A

1: #define PBDDR (*(unsigned char *)0xFFFFD4)


2: #define PBDR (*(unsigned char *)0xFFFFD6)
3: #define ITU_TSTR (*(unsigned char *)0xFFFF60)
4: #define ITU_TSNC (*(unsigned char *)0xFFFF61)
5: #define ITU0_TCR (*(unsigned char *)0xFFFF64)
6: #define ITU0_TIOR (*(unsigned char *)0xFFFF65)
7: #define ITU0_TIER (*(unsigned char *)0xFFFF66)
8: #define ITU0_TSR (*(struct tsr *)0xFFFF67)
9: #define ITU0_GRA (*(unsigned int *)0xFFFF6A)
10:
11: struct tsr {
12: unsigned char wk :7;
13: unsigned char IMFA :1;
14: };
15:
16: main()
17: {
18: ITU_TSNC = 0; /* Initialize */
19: ITU0_TCR = 0x21; /* TCR is B’-0100001 */
20: ITU0_TIOR = 0; /* TCR is B’-000-000 */
21: ITU0_TIER = 0; /* TCR is B’-----000 */
22: ITU0_GRA = 0x8000; /* GRA Value = H’8000 */
23: ITU0_TSTR = 0x01; /* ITU0 Start */
24:
25: PBDDR = 0x55; /* PB Even is Output */
26: PBDR = 0; /* Output Low Level */
27:
28: while(1)
29: {
30: while( !ITU0_TSR.IMFA ) ; /* Wait IMFA = 1 */
31:
32: if( PBDR & 0x80 ) /* Bit7 of PB is B'1 ? */
33: PBDR &= 0x55; /* Output is B'-1-1-1-1 */
34: else /* */
35: PBDR |= 0xAA; /* Output is B'-0-0-0-0 */
36:
37: ITU0_TSR.IMFA = 0; /* Clear IMFA */
38: }
39: }
Figure 1-4 General Program Example

6
Description

Lines 1 to 9: Defines the absolute addresses of registers used in the program:

Lines 11 to 14: Declares each bit of TSR of ITU0 as a bitfield to enable bit by bit control. Here, all the bits except
IMFA are declared as non-used bitfields “wk”, since only IMFA are used in this program.

Lines 18 to 23: Initializes the registers of ITU0 according to specific conditions.

Lines 25 and 26: Initializes the even-numbered bits of port B as an output port and the odd-numbered bits of port B
as an input port.

Line 30: Waits for the input capture/compare match flag A (IMFA) of TSR to become 1.

Lines 32 to 35: Sets the even-numbered bits of port B if the 27 bit of port B is 1, Clears the even-numbered bits of
port B if the 27 bit of port B is 0.

Line 37: Clears IMFA of TSR.

7
Section 2 Using the H8/3003 Header Files
This section describes the header file for the H8/3003 (3003.h) and also describes unions, structures, and volatile type
qualifiers used in the file. The other header files are not described, but can be used in a similar manner.

2.1 Making an On-Chip Supporting Module Register into a Union

Program Example 2-1

Figure 2-1, 2-2 shows a program that sends the ascii ‘A’ by SCI0 in the H8/3003.

1: #define SCI0_TDR (*(unsigned char *)0xFFFFB3)


2: #define SCI0_SSR_BYTE (*(unsigned char *)0xFFFFB4)
3: #define SCI0_SSR_BIT (*(struct ssr *)0xFFFFB4)
4:
5: struct ssr {
6: unsigned char TDRE:1;
7: };
8:
9: main()
10: {
11: SCI0_SSR_BYTE &= 0x80;
12:
13: while( SCI0_SSR_BIT.TDRE == 0 )
14: ;
15: SCI0_TDR = ‘A’;
16: SCI0_SSR_BIT.TDRE = 0;
17: }
Figure 2-1 Program not Using Unions

Description

Line 2: Defines SSR of SCI0 to enable register access in byte units.

Line 3: Defines SSR of SCI0 to enable register access in bit units.

Lines 5 to 7: Declares each bit of SSR as a bitfield.

Line 11: Initializes SSR in byte units using SCI0_SSR_BYTE, since byte access is more effective here.

Line 13 to 14: Waits for TDRE of SSR to become 1 using SCI0_SSR_BIT, since bit access is more effective to test
only TDRE.

Line 16: Clears TDRE of SSR using SCI0_SSR_BIT, since bit access is more effective to change only TDRE.

Although the program shown in figure 2-1 performs its function, it requires byte-access and bit-access declarations for
the same register. In the same way, an actual user system may need several different types of declarations for the same
register if the register must be accessed by different types.

8
A union type is effective for accessing the same register by different types of declarations (figure 2-2).

1: #define SCI0_TDR (*(unsigned char *)0xFFFFB3)


2: #define SCI0_SSR (*(union ssr *)0xFFFFB4)
3:
4: union ssr {
5: unsigned char BYTE;
6: struct {
7: unsigned char TDRE:1;
8: } BIT ;
9: };
10:
11: main()
12: {
13: SCI0_SSR.BYTE &= 0x80;
14:
15: while( SCI0_SSR.BIT.TDRE == 0 )
16: ;
17: SCI0_TDR = ‘A’;
18: SCI0_SSR.BIT.TDRE = 0;
19: }

Figure 2-2 Program Using Unions

Description

Line 2: Defines SSR of SCI0 to enable register access as a union type.

Lines 4 to 9: Declares SSR as a union. If SSR is accessed in byte units, declaration of line 5 is used and if SSR is
accessed in bit units, bitfield declaration of lines 6 to 9 is used.

Line 13: Initializes SSR using byte-access union declaration.

Lines 15 to 16: Waits for TDRE of SSR to become 1 using bitfield declaration.

Line 18: Sets TDRE of SSR to 1 using bitfield declaration.

9
2.2 Making On-Chip Supporting Module Registers into a Structure

Program Example 2-2

Figure 2-3 shows a program that initializes SCI0 and SCI1 in the H8/3003 on the following conditions:
o SCI0 is asynchronous mode, 9600bps, 8bit, even parity-bit, 1stop-bit.
o SCI1 is asynchronous mode, 9600bps, 8bit, odd parity-bit, 1stop-bit.

1: #define SCI0_SMR (*(unsigned char *)0xFFFFB0)


2: #define SCI0_BRR (*(unsigned char *)0xFFFFB1)
3: #define SCI0_SCR (*(unsigned char *)0xFFFFB2)
4: #define SCI0_SSR (*(unsigned char *)0xFFFFB4)
5: #define SCI1_SMR (*(unsigned char *)0xFFFFB8)
6: #define SCI1_BRR (*(unsigned char *)0xFFFFB9)
7: #define SCI1_SCR (*(unsigned char *)0xFFFFBA)
8: #define SCI1_SSR (*(unsigned char *)0xFFFFBC)
9:
10: main()
11: {
12: SCI0_SMR = 0x20; /* Set SMR B'00100000 */
13: SCI0_BRR = 51; /* Set BRR 51 (9600bps) */
14: SCI0_SCR = 0x30; /* Set SCR B’00110000 */
15: SCI0_SSR &= 0x80; /* Set SSR B’10000000 */
16:
12: SCI1_SMR = 0x30; /* Set SMR B'00110000 */
13: SCI1_BRR = 51; /* Set BRR 51 (9600bps) */
14: SCI1_SCR = 0x30; /* Set SCR B’00110000 */
15: SCI1_SSR &= 0x80; /* Set SSR B’10000000 */
21: }
Figure 2-3 Program not Using Structures

Description

Lines 1 to 8: Defines the absolute addresses of registers used in the program.

Lines 12 to 15: Initializes SCI0.

Lines 17 to 20: Initializes SCI1.

Again, the program shown in figure 2-3 performs its function, but it requires many #define statements. In fact, an
actual user system may need more #define statements, since this program uses only two supporting modules: SCI0 and
SCI1.

To eliminate such redundancy, the registers can be grouped together using the same structure in each module (figure 2-4).

10
1: #define SCI0 (*(struct st_sci *)0xFFFFB0)
2: #define FRT2 (*(struct st_sci *)0xFFFFB8)
3:
4: struct st_sci {
5: unsigned char SMR;
6: unsigned char BRR;
7: unsigned char SCR;
8: unsigned char TDR;
9: unsigned char SSR;
10: unsigned int RDR;
11: char work[2];
12: };
13:
14: main()
15: {
12: SCI0.SMR = 0x20; /* Set SMR B'00100000 */
13: SCI0.BRR = 51; /* Set BRR 51 (9600bps) */
14: SCI0.SCR = 0x30; /* Set SCR B’00110000 */
15: SCI0.SSR &= 0x80; /* Set SSR B’10000000 */
16:
12: SCI1.SMR = 0x30; /* Set SMR B'00110000 */
13: SCI1.BRR = 51; /* Set BRR 51 (9600bps) */
14: SCI1.SCR = 0x30; /* Set SCR B’00110000 */
15: SCI1.SSR &= 0x80; /* Set SSR B’10000000 */
25: }
Figure 2-4 Program Using Structures

Description

Lines 1 and 2: Converts values 0xFFFFB0 and 0xFFFFB8 into pointers to struct st_sci type data and defines their
contents as SCI0 and SCI1, respectively.

Lines 4 to 12: Declares SCI registers as a structure with a structure tag named struct st_sci with each register as a
member of the structure. Any unused area must be reserved appropriately considering the 8-byte
address boundary of each channel.

Lines 16 to 19: Initializes SCI0 using SCI0, where each register of SCI0 is accessed as a member of the structure.

Lines 21 to 24: Initializes SCI1 using SCI1, where each register of SCI1 is accessed as a member of the structure.

11
2.3 Volatile Type Qualifiers

Program Example 2-3

Figure 2-5 shows a program that sets port 4 in the H8/3003 to 1, 2, and 3 sequentially and sets port 5 to 3, 2, and 1
sequentially.

1: #define P4DR (*(unsigned char *)0xFFFFC7)


2: #define P5DR (*(unsigned char *)0xFFFFCA)
3:
4: main()
5: {
6: P4DR = 1; /* Set P4DR is 1 */
7: P4DR = 2; /* Set P4DR is 2 */
8: P4DR = 3; /* Set P4DR is 3 */
9:
10: P5DR = 3; /* Set P5DR is 3 */
11: P5DR = 2; /* Set P5DR is 2 */
12: P5DR = 1; /* Set P5DR is 1 */
13: }
Figure 2-5 Program not using Volatile Type Qualifiers

Description

Lines 1 and 2: Defines the absolute addresses of registers used in the program.

Lines 6 to 8: Sets port 4.

Lines 10 to 12: Sets port 5.

The program shown in figure 2-5 works fine but will output the following results when compiled
(figure 2-6).

1: .CPU 300HA
2: .EXPORT _main
3: .SECTION P,CODE,ALIGN=2
4: _main: ; function: main
5: MOV.B #1:8,R0L
6: MOV.B #2:8,R0L
7: MOV.B #3:8,R0L
8: MOV.B R0L,@16777159:8
9: MOV.B #2:8,R0L
10: MOV.B #1:8,R0L
11: MOV.B R0L,@16777162:8
12: RTS
13: .END
Figure 2-6 Compilation of Program Example 2-5

As shown in figure 2-6, there is only one line generated for each of port 4 and port 5 (line 8 and line 11). This is not a
compiler bug; the compiler simply optimizes a program that sets an ascending or descending sequence of values at the
same address by removing all values except for the last one. This is not a problem when the values are set to a normal

12
variable. However, in the above program, the values are set to I/O ports; if the ports are used as strobe signals to
peripheral devices, the devices will not operate at all.

To prevent such erroneous optimization, the C language provides volatile type qualifiers. Volatile type qualifiers are
effective for variables and registers such as the on-chip supporting module registers, which change independently of
program execution.

The program example shown in figure 2-5 can be improved by using volatile type qualifiers, as shown in figure 2-7.

1: #define P4DR (*(volatile unsigned char *)0xFFFFC7)


2: #define P5DR (*(volatile unsigned char *)0xFFFFCA)
3:
4: main()
5: {
6: P4DR = 1; /* Set P4DR is 1 */
7: P4DR = 2; /* Set P4DR is 2 */
8: P4DR = 3; /* Set P4DR is 3 */
9:
10: P5DR = 3; /* Set P5DR is 3 */
11: P5DR = 2; /* Set P5DR is 2 */
12: P5DR = 1; /* Set P5DR is 1 */
13: }
Figure 2-7 Program using Volatile Type Qualifiers

Description

Lines 1 and 2: By using volatile type qualifiers, directs the compiler not to optimize the contents of the addresses.

Lines 6 to 8: Sets port 7.

Lines 10 to 12: Sets port 9.

The program shown in figure 2-7 is compiled as shown in figure 2-8. As shown, the compiler compiles the program
without optimizing port 4 and port 5 settings.

1: .CPU 300HA
2: .EXPORT _main
3: .SECTION P,CODE,ALIGN=2
4: _main: ; function: main
5: MOV.B #1:8,R0L
6: MOV.B R0L,@16777159:8
7: MOV.B #2:8,R0L
8: MOV.B R0L,@16777159:8
9: MOV.B #3:8,R0L
10: MOV.B R0L,@16777159:8
11: MOV.B R0L,@16777162:8
12: MOV.B #2:8,R0L
13: MOV.B R0L,@16777162:8
14: MOV.B #1:8,R0L
15: MOV.B R0L,@16777162:8
16: RTS
17: .END
Figure 2-8 Compilation of Program Example 2-7

13
14
2.4 Header File

The following shows the prepared H8/3003 header file (3003.h) related to the programs described in sections 2.1 to 2.3.

/******************************************************************************/
/* H8/3003 Include File Ver 1.1 */
/******************************************************************************/
struct st_sam { /* struct DMAC */
void *MAR; /* MAR */
unsigned int ETCR; /* ETCR */
unsigned char IOAR; /* IOAR */
union { /* DTCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char DTE :1; /* DTE */
unsigned char DTSZ:1; /* DTSZ */
unsigned char DTID:1; /* DTID */
unsigned char RPE :1; /* RPE */
unsigned char DTIE:1; /* DTIE */
unsigned char DTS :3; /* DTS */
} BIT; /* */
} DTCR; /* */
}; /* */
struct st_fam { /* struct DMAC */
void *MARA; /* MARA */
unsigned int ETCRA; /* ETCRA */
char wk1; /* */
union { /* DTCRA */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char DTE :1; /* DTE */
unsigned char DTSZ :1; /* DTSZ */
unsigned char SAID :1; /* SAID */
unsigned char SAIDE:1; /* SAIDE */
unsigned char DTIE :1; /* DTIE */
unsigned char DTS :3; /* DTS */
} BIT; /* */
} DTCRA; /* */
void *MARB; /* MARB */
unsigned int ETCRB; /* ETCRB */
char wk2; /* */
union { /* DTCRB */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char DTME :1; /* DTME */
unsigned char :1; /* */
unsigned char DAID :1; /* DAID */
unsigned char DAIDE:1; /* DAIDE */
unsigned char TMS :1; /* TMS */
unsigned char DTS :3; /* DTS */
} BIT; /* */
} DTCRB; /* */
}; /* */
struct st_itu { /* struct ITU */
union { /* TSTR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :3; /* */
unsigned char STR4:1; /* STR4 */
unsigned char STR3:1; /* STR3 */
unsigned char STR2:1; /* STR2 */

15
unsigned char STR1:1; /* STR1 */
unsigned char STR0:1; /* STR0 */
} BIT; /* */
} TSTR; /* */
union { /* TSNC */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :3; /* */
unsigned char SYNC4:1; /* SYNC4 */
unsigned char SYNC3:1; /* SYNC3 */
unsigned char SYNC2:1; /* SYNC2 */
unsigned char SYNC1:1; /* SYNC1 */
unsigned char SYNC0:1; /* SYNC0 */
} BIT; /* */
} TSNC; /* */
union { /* TMDR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :1; /* */
unsigned char MDF :1; /* MDF */
unsigned char FDIR:1; /* FDIR */
unsigned char PWM4:1; /* PWM4 */
unsigned char PWM3:1; /* PWM3 */
unsigned char PWM2:1; /* PWM2 */
unsigned char PWM1:1; /* PWM1 */
unsigned char PWM0:1; /* PWM0 */
} BIT; /* */
} TMDR; /* */
union { /* TFCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :2; /* */
unsigned char CMD :2; /* CMD */
unsigned char BFB4:1; /* BFB4 */
unsigned char BFA4:1; /* BFA4 */
unsigned char BFB3:1; /* BFB3 */
unsigned char BFA3:1; /* BFA3 */
} BIT; /* */
} TFCR; /* */
char wk[44]; /* */
union { /* TOER */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :2; /* */
unsigned char EXB4:1; /* EXB4 */
unsigned char EXA4:1; /* EXA4 */
unsigned char EB3 :1; /* EB3 */
unsigned char EB4 :1; /* EB4 */
unsigned char EA4 :1; /* EA4 */
unsigned char EA3 :1; /* EA3 */
} BIT; /* */
union { /* TOCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :3; /* */
unsigned char XTGD:1; /* XTGD */
unsigned char :2; /* */
unsigned char OLS4:1; /* OLS4 */
unsigned char OLS3:1; /* OLS3 */
} BIT; /* */
} TOCR; /* */
}; /* */

16
struct st_itu0 { /* struct ITU0 */
union { /* TCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :1; /* */
unsigned char CCLR:2; /* CCLR */
unsigned char CKEG:2; /* CKEG */
unsigned char TPSC:3; /* TPSC */
} BIT; /* */
} TCR; /* */
union { /* TIOR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :1; /* */
unsigned char IOB:3; /* IOB */
unsigned char :1; /* */
unsigned char IOA:3; /* IOA */
} BIT; /* */
} TIOR; /* */
union { /* TIER */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :5; /* */
unsigned char OVIE :1; /* OVIE */
unsigned char IMIEB:1; /* IMIEB */
unsigned char IMIEA:1; /* IMIEA */
} BIT; /* */
} TIER; /* */
union { /* TSR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :5; /* */
unsigned char OVF :1; /* OVF */
unsigned char IMFB:1; /* IMFB */
unsigned char IMFA:1; /* IMFA */
} BIT; /* */
} TSR; /* */
unsigned int TCNT; /* TCNT */
unsigned int GRA; /* GRA */
unsigned int GRB; /* GRB */
}; /* */
struct st_itu3 { /* struct ITU3 */
union { /* TCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :1; /* */
unsigned char CCLR:2; /* CCLR */
unsigned char CKEG:2; /* CKEG */
unsigned char TPSC:3; /* TPSC */
} BIT; /* */
} TCR; /* */
union { /* TIOR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :1; /* */
unsigned char IOB:3; /* IOB */
unsigned char :1; /* */
unsigned char IOA:3; /* IOA */
} BIT; /* */
} TIOR; /* */
union { /* TIER */
unsigned char BYTE; /* Byte Access */

17
struct { /* Bit Access */
unsigned char wk :5; /* */
unsigned char OVIE :1; /* OVIE */
unsigned char IMIEB:1; /* IMIEB */
unsigned char IMIEA:1; /* IMIEA */
} BIT; /* */
} TIER; /* */
union { /* TSR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :5; /* */
unsigned char OVF :1; /* OVF */
unsigned char IMFB:1; /* IMFB */
unsigned char IMFA:1; /* IMFA */
} BIT; /* */
} TSR; /* */
unsigned int TCNT; /* TCNT */
unsigned int GRA; /* GRA */
unsigned int GRB; /* GRB */
unsigned int BRA; /* BRA */
unsigned int BRB; /* BRB */
char wk[2]; /* */
}; /* */
struct st_tpc { /* struct TPC */
union { /* TPMR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :4; /* */
unsigned char G3NOV:1; /* G3NOV */
unsigned char G2NOV:1; /* G2NOV */
unsigned char G1NOV:1; /* G1NOV */
unsigned char G0NOV:1; /* G0NOV */
} BIT; /* */
} TPMR; /* */
union { /* TPCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char G3CMS:2; /* G3CMS */
unsigned char G2CMS:2; /* G2CMS */
unsigned char G1CMS:2; /* G1CMS */
unsigned char G0CMS:2; /* G0CMS */
} BIT; /* */
} TPCR; /* */
union { /* NDERB */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B15:1; /* NDER15 */
unsigned char B14:1; /* NDER14 */
unsigned char B13:1; /* NDER13 */
unsigned char B12:1; /* NDER12 */
unsigned char B11:1; /* NDER11 */
unsigned char B10:1; /* NDER10 */
unsigned char B9 :1; /* NDER9 */
unsigned char B8 :1; /* NDER8 */
} BIT; /* */
} NDERB; /* */
union { /* NDERA */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* NDER7 */
unsigned char B6:1; /* NDER6 */
unsigned char B5:1; /* NDER5 */

18
unsigned char B4:1; /* NDER4 *
unsigned char B3:1; /* NDER3 */
unsigned char B2:1; /* NDER2 */
unsigned char B1:1; /* NDER1 */
unsigned char B0:1; /* NDER0 */
} BIT; /* */
} NDERA; /* */
union { /* NDRB (H'A4) */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B15:1; /* NDR15 */
unsigned char B14:1; /* NDR14 */
unsigned char B13:1; /* NDR13 */
unsigned char B12:1; /* NDR12 */
unsigned char B11:1; /* NDR11 */
unsigned char B10:1; /* NDR10 */
unsigned char B9 :1; /* NDR9 */
unsigned char B8 :1; /* NDR8 */
} BIT; /* */
} NDRB1; /* */
union { /* NDRA (H'A5) */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* NDR7 */
unsigned char B6:1; /* NDR6 */
unsigned char B5:1; /* NDR5 */
unsigned char B4:1; /* NDR4 */
unsigned char B3:1; /* NDR3 */
unsigned char B2:1; /* NDR2 */
unsigned char B1:1; /* NDR1 */
unsigned char B0:1; /* NDR0 */
} BIT; /* */
} NDRA1; /* */
union { /* NDRB (H'A6) */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :4; /* */
unsigned char B11:1; /* NDR11 */
unsigned char B10:1; /* NDR10 */
unsigned char B9 :1; /* NDR9 */
unsigned char B8 :1; /* NDR8 */
} BIT; /* */
} NDRB2; /* */
union { /* NDRA (H'A7) */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk:4; /* */
unsigned char B3:1; /* NDR3 */
unsigned char B2:1; /* NDR2 */
unsigned char B1:1; /* NDR1 */
unsigned char B0:1; /* NDR0 */
} BIT; /* */
} NDRA2; /* */
}; /* */
struct st_rfshc { /* struct RFSHC */
union { /* RFSHCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char SRFMD :1; /* SRFMD */
unsigned char PSRAME:1; /* PSRAME */
unsigned char DRAME :1; /* DRAME */
unsigned char CASWE :1; /* CASWE */

19
unsigned char M9M8 :1; /* M9M8 */
unsigned char PFSHE :1; /* PFSHE */
unsigned char :1; /* */
unsigned char RCYCE :1; /* RCYCE */
} BIT; /* */
} RFSHCR; /* */
union { /* RTMCSR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char CMF :1; /* CMF */
unsigned char CMIE:1; /* CMIE */
unsigned char CKS :3; /* CKS */
} BIT; /* */
} RTMCSR; /* */
unsigned char RTCNT; /* RTCNT */
unsigned char RTCOR; /* RTCOR */
}; /* */
struct st_sci { /* struct SCI */
union { /* SMR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char CA :1; /* C/A */
unsigned char CHR :1; /* CHR */
unsigned char PE :1; /* PE */
unsigned char OE :1; /* O/E */
unsigned char STOP:1; /* STOP */
unsigned char MP :1; /* MP */
unsigned char CKS :2; /* CKS */
} BIT; /* */
} SMR; /* */
unsigned char BRR; /* BRR */
union { /* SCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char TIE :1; /* TIE */
unsigned char RIE :1; /* RIE */
unsigned char TE :1; /* TE */
unsigned char RE :1; /* RE */
unsigned char MPIE:1; /* MPIE */
unsigned char TEIE:1; /* TEIE */
unsigned char CKE :2; /* CKE */
} BIT; /* */
} SCR; /* */
unsigned char TDR; /* TDR */
union { /* SSR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char TDRE:1; /* TDRE */
unsigned char RDRF:1; /* RDRF */
unsigned char ORER:1; /* ORER */
unsigned char FER :1; /* FER */
unsigned char PER :1; /* PER */
unsigned char TEND:1; /* TEND */
unsigned char MPB :1; /* MPB */
unsigned char MPBT:1; /* MPBT */
} BIT; /* */
} SSR; /* */
unsigned char RDR; /* RDR */
char wk[2]; /* */
}; /* */
struct st_p4 { /* struct P4 */
unsigned char DDR; /* P4DDR */

20
char wk1; /* */
union { /* P4DR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} DR; /* */
char wk2[18]; /* */
union { /* P4PCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} PCR; /* */
}; /* */
struct st_p5 { /* struct P5 */
unsigned char DDR; /* P5DDR */
char wk1; /* */
union { /* P5DR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} DR; /* */
char wk2[16]; /* */
union { /* P5PCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} PCR; /* */
}; /* */
struct st_p6 { /* struct P6 */
unsigned char DDR; /* P6DDR */

21
char wk; /* */
union { /* P6DR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk:1; /* */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} DR; /* */
}; /* */
struct st_p7 { /* struct P7 */
union { /* P7DR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} DR; /* */
}; /* */
struct st_p8 { /* struct P8 */
unsigned char DDR; /* P8DDR */
char wk; /* */
union { /* P8DR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk:3; /* */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} DR; /* */
}; /* */
struct st_p9 { /* struct P9 */
unsigned char DDR; /* P9DDR */
char wk; /* */
union { /* P9DR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk:2; /* */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} DR; /* */
}; /* */
struct st_pa { /* struct PA */

22
unsigned char DDR; /* PADDR */
char wk; /* */
union { /* PADR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} DR; /* */
}; /* */
struct st_ad { /* struct A/D */
unsigned int DRA; /* ADDRA */
unsigned int DRB; /* ADDRB */
unsigned int DRC; /* ADDRC */
unsigned int DRD; /* ADDRD */
union { /* ADCSR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char ADF :1; /* ADF */
unsigned char ADIE:1; /* ADIE */
unsigned char ADST:1; /* ADST */
unsigned char SCAN:1; /* SCAN */
unsigned char CKS :1; /* CKS */
unsigned char CH :3; /* CH */
} BIT; /* */
} CSR; /* */
union { /* ADCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char TRGE:1; /* TRGE */
} BIT; /* */
} CR; /* */
}; /* */
struct st_bsc { /* struct BSC */
union { /* ABWCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} ABWCR; /* */
union { /* ASTCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */

23
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} ASTCR; /* */
union { /* WCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :4; /* */
unsigned char WMS:2; /* WMS */
unsigned char WC :2; /* WC */
} BIT; /* */
} WCR; /* */
union { /* WCER */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* Bit 7 */
unsigned char B6:1; /* Bit 6 */
unsigned char B5:1; /* Bit 5 */
unsigned char B4:1; /* Bit 4 */
unsigned char B3:1; /* Bit 3 */
unsigned char B2:1; /* Bit 2 */
unsigned char B1:1; /* Bit 1 */
unsigned char B0:1; /* Bit 0 */
} BIT; /* */
} WCER; /* */
char wk[3]; /* */
union { /* BRCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :7; /* */
unsigned char BRLE:1; /* BRLE */
} BIT; /* */
} BRCR; /* */
}; /* */
union un_mdcr { /* union MDCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char wk :5; /* */
unsigned char MDS:3; /* MDS */
} BIT; /* */
}; /* */
union un_syscr { /* union SYSCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char SSBY :1; /* SSBY */
unsigned char STS :3; /* STS */
unsigned char UE :1; /* UE */
unsigned char NMIEG:1; /* NMIEG */
unsigned char :1; /* */
unsigned char RAME :1; /* RAME */
} BIT; /* */
}; /* */
struct st_intc { /* struct INTC */
union { /* ISCR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char IRQ7SC:1; /* IRQ7SC */
unsigned char IRQ6SC:1; /* IRQ6SC */
unsigned char IRQ5SC:1; /* IRQ5SC */
unsigned char IRQ4SC:1; /* IRQ4SC */
unsigned char IRQ3SC:1; /* IRQ3SC */
unsigned char IRQ2SC:1; /* IRQ2SC */

24
unsigned char IRQ1SC:1; /* IRQ1SC */
unsigned char IRQ0SC:1; /* IRQ0SC */
} BIT; /* */
} ISCR; /* */
union { /* IER */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char IRQ7E:1; /* IRQ7E */
unsigned char IRQ6E:1; /* IRQ6E */
unsigned char IRQ5E:1; /* IRQ5E */
unsigned char IRQ4E:1; /* IRQ4E */
unsigned char IRQ3E:1; /* IRQ3E */
unsigned char IRQ2E:1; /* IRQ2E */
unsigned char IRQ1E:1; /* IRQ1E */
unsigned char IRQ0E:1; /* IRQ0E */
} BIT; /* */
} IER; /* */
union { /* ISR */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char IRQ7F:1; /* IRQ7F */
unsigned char IRQ6F:1; /* IRQ6F */
unsigned char IRQ5F:1; /* IRQ5F */
unsigned char IRQ4F:1; /* IRQ4F */
unsigned char IRQ3F:1; /* IRQ3F */
unsigned char IRQ2F:1; /* IRQ2F */
unsigned char IRQ1F:1; /* IRQ1F */
unsigned char IRQ0F:1; /* IRQ0F */
} BIT; /* */
} ISR; /* */
char wk; /* */
union { /* IPRA */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* IRQ0 */
unsigned char B6:1; /* IRQ1 */
unsigned char B5:1; /* IRQ2,IRQ3 */
unsigned char B4:1; /* IRQ4-IRQ7 */
unsigned char B3:1; /* WDT,RFSHC */
unsigned char B2:1; /* ITU0 */
unsigned char B1:1; /* ITU1 */
unsigned char B0:1; /* ITU2 */
} BIT; /* */
} IPRA; /* */
union { /* IPRB */
unsigned char BYTE; /* Byte Access */
struct { /* Bit Access */
unsigned char B7:1; /* ITU3 */
unsigned char B6:1; /* ITU4 */
unsigned char B5:1; /* DMAC0 Gr */
unsigned char B4:1; /* DMAC1 Gr */
unsigned char B3:1; /* SCI0 */
unsigned char B2:1; /* SCI1 */
unsigned char B1:1; /* A/D */
} BIT; /* */
} IPRB; /* */
}; /* */
#define DMAC0A (*(volatile struct st_sam *)0xFFFF20) /* DMAC 0A Addr */
#define DMAC0B (*(volatile struct st_sam *)0xFFFF28) /* DMAC 0B Addr */
#define DMAC1A (*(volatile struct st_sam *)0xFFFF30) /* DMAC 1A Addr */
#define DMAC1B (*(volatile struct st_sam *)0xFFFF38) /* DMAC 1B Addr */
#define DMAC2A (*(volatile struct st_sam *)0xFFFF40) /* DMAC 2A Addr */

25
#define DMAC2B (*(volatile struct st_sam *)0xFFFF48) /* DMAC 2B Addr */
#define DMAC3A (*(volatile struct st_sam *)0xFFFF50) /* DMAC 3A Addr */
#define DMAC3B (*(volatile struct st_sam *)0xFFFF58) /* DMAC 3B Addr */
#define DMAC0 (*(volatile struct st_fam *)0xFFFF20) /* DMAC 0 Addr */
#define DMAC1 (*(volatile struct st_fam *)0xFFFF30) /* DMAC 1 Addr */
#define DMAC2 (*(volatile struct st_fam *)0xFFFF40) /* DMAC 2 Addr */
#define DMAC3 (*(volatile struct st_fam *)0xFFFF50) /* DMAC 3 Addr */
#define ITU (*(volatile struct st_itu *)0xFFFF60) /* ITU Address */
#define ITU0 (*(volatile struct st_itu0 *)0xFFFF64) /* ITU0 Address */
#define ITU1 (*(volatile struct st_itu0 *)0xFFFF6E) /* ITU1 Address */
#define ITU2 (*(volatile struct st_itu0 *)0xFFFF78) /* ITU2 Address */
#define ITU3 (*(volatile struct st_itu3 *)0xFFFF82) /* ITU3 Address */
#define ITU4 (*(volatile struct st_itu3 *)0xFFFF92) /* ITU4 Address */
#define TPC (*(volatile struct st_tpc *)0xFFFFA0) /* TPC Address */
#define RFSHC (*(volatile struct st_rfshc *)0xFFFFAC) /* RFSHC Address */
#define SCI0 (*(volatile struct st_sci *)0xFFFFB0) /* SCI0 Address */
#define SCI1 (*(volatile struct st_sci *)0xFFFFB8) /* SCI1 Address */
#define P4 (*(volatile struct st_p4 *)0xFFFFC5) /* P4 Address */
#define P5 (*(volatile struct st_p5 *)0xFFFFC8) /* P5 Address */
#define P6 (*(volatile struct st_p6 *)0xFFFFC9) /* P6 Address */
#define P7 (*(volatile struct st_p7 *)0xFFFFCE) /* P7 Address */
#define P8 (*(volatile struct st_p8 *)0xFFFFCD) /* P8 Address */
#define P9 (*(volatile struct st_p9 *)0xFFFFD0) /* P9 Address */
#define PA (*(volatile struct st_pa *)0xFFFFD1) /* PA Address */
#define PB (*(volatile struct st_pa *)0xFFFFD4) /* PB Address */
#define PC (*(volatile struct st_pa *)0xFFFFD5) /* PC Address */
#define AD (*(volatile struct st_ad *)0xFFFFE0) /* A/D Address */
#define BSC (*(volatile struct st_bsc *)0xFFFFEC) /* BSC Address */
#define MDCR (*(volatile union un_mdcr *)0xFFFFF1) /* MDCR Address */
#define SYSCR (*(volatile union un_syscr *)0xFFFFF2) /* SYSCR Address */
#define INTC (*(volatile struct st_intc *)0xFFFFF4) /* INTC Address */
#define st_itu1 st_itu0 /* Change Struct ITU1 */
#define st_itu2 st_itu0 /* Change Struct ITU2 */
#define st_itu4 st_itu3 /* Change Struct ITU4 */
#define st_pb st_pa /* Change Struct PB->PA */
#define st_pc st_pa /* Change Struct PC->PA */

In the above header file, each bitfield of every I/O port is declared. However, a different type of declaration may be
appropriate for the I/O ports used in the user system. This header file also provides several #define statements so that
all the on-chip supporting modules can be accessed by absolute addresses. Figure 2-10 shows program echo back the
recieved data using this header file.

1: #include "3003.h"
2:
3: main()
4: {
5: unsigned char data;
6:
7: SCI0.SMR.BYTE = 0x20; /* SMR = B’00100000 */
8: SCI0.BRR = 51; /* BRR = 51 (9600bps) */
9: SCI0.SCR.BYTE = 0x20; /* SCR = B’00110000 */
10:
11: while(1)
12: {
13: while(!(SCI0.SSR.BYTE & 0x78)); /* Wait Receive Data */
14: if( SCI0.SSR.BIT.RDRF ) /* Exit Error ? */
15: {
16: data = SCI0.RDR; /* Receive data -> data */

26
17: SCI0.SSR.BIT.RDRF = 0; /* Clear RDRF */
18: while(!SCI0.SSR.BIT.TDRE); /* Wait TDRE is B’1 */
19: SCI0.TDR = data; /* data -> Transmit Data */
20: SCI0.SSR.BIT.TDRE = 0; /* Clear TDRE */
21: }
22: else
23: SCI0.SSR.BYTE &= 0xC7; /* Clear ORER, FER, PER */
24: }
25: }
Figure 2-10 Program Example Using the H8/3003 Header File

Description
Line 1: Specifies the H8/3003 header file.

Lines 5 to 7: Initializes SCI0. Initializes SMR and SCR in byte units.

Line 13: Waits receiving data for SSR in byte units.

Line 14: Checks RDRF of SSR in bit units.

Lines 16 to 20: Echoes back the received data if receive in normal.

Line 23: Clears error flags in SSR if receive in error.

27
Stack and Memory Size Listing of Standard C
Libraries and EC++ Class Libraries
1. Memory Size

Memory size listing of standard C libraries is not included in this document.


Please refer to linkage map list of the linkage editor.

Example of Link Command :

lnk(RET)

subcommand :
input init,sample
:
library c38ha.lib <- Specify the library corresponding to cpu option
print sample <- Specify output of linkage map list
:
exit

28
2. Stack Size Listing of Standard C Libraries
Table 2-1 Stack Size Listing of Standard C Libraries (regparam=2)(1)
Stack Size (byte)
Size Priority Speed Priority Remarks
No header function 300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
1 stddef.h offsetof - - - - - - - - - - macro
2 assert.h assert - - - - - - - - - - macro
3 ctype.h isalnum 2 2 8 2 8 2 2 8 2 8
isalpha 2 2 8 2 8 2 2 8 2 8
iscntrl 2 2 8 2 8 2 2 8 2 8
isdigit 2 2 8 2 8 2 2 8 2 8
isgraph 2 2 8 2 8 2 2 8 2 8
islower 2 2 8 2 8 2 2 8 2 8
isprint 2 2 8 2 8 2 2 8 2 8
ispunct 2 2 8 2 8 2 2 8 2 8
isspace 2 2 8 2 8 2 2 8 2 8
isupper 2 2 8 2 8 2 2 8 2 8
isxdigit 2 2 8 2 8 2 2 8 2 8
tolower 4 4 12 4 12 4 4 6 4 6
toupper 4 4 12 4 12 4 4 6 4 6
4 math.h acos 446 492 546 486 536 468 524 570 534 572
asin 416 462 510 456 500 430 482 522 490 524
atan 318 354 396 354 386 3232 374 408 382 410
atan2 382 418 480 418 458 402 442 484 454 486
cos 220 258 298 254 288 234 276 310 286 312
sin 222 258 302 254 292 236 276 314 286 316
tan 236 274 294 274 296 244 286 306 288 308
cosh 304 344 368 338 366 312 350 380 256 382
sinh 304 344 368 338 366 312 350 380 256 382
tanh 328 368 392 362 390 336 374 404 380 406
exp 230 260 280 260 282 238 268 292 272 294
frexp 22 24 28 24 28 22 24 28 24 28
ldexp 80 92 100 80 88 88 90 100 92 100
log 222 260 280 256 282 230 270 292 272 294
log10 252 290 316 286 318 268 312 340 316 342
modf 142 158 188 148 168 148 168 184 170 184
pow 336 376 400 372 402 344 384 412 388 414
sqrt 88 102 106 102 110 96 112 118 114 122
ceil 126 168 184 154 176 134 176 196 180 196
fabs 18 16 20 16 20 18 16 20 16 20
floor 126 168 184 154 176 134 176 196 180 196
fmod 114 136 146 126 138 120 132 146 134 150
5 mathf.h acosf 316 334 388 352 378 338 354 400 388 402
asinf 294 312 360 330 350 308 324 364 356 366
atanf 224 232 274 256 264 238 244 278 276 280
atan2f 268 290 350 302 316 288 290 330 322 332
cosf 158 168 208 188 198 172 180 212 212 214
sinf 160 168 312 188 202 174 180 214 212 218
tanf 166 176 196 200 198 174 182 204 210 206
coshf 218 230 254 248 252 226 234 262 264 264
sinhf 218 230 254 248 252 226 234 262 264 264
tanhf 234 246 270 264 268 242 250 278 280 280
expf 164 166 186 190 188 172 172 194 200 196
frexpf 14 8 12 10 12 14 8 12 10 12
ldexpf 56 64 68 50 56 64 56 64 56 64
logf 156 166 186 186 188 164 166 194 200 196
log10f 178 188 214 208 216 194 196 230 232 232
modff 104 112 140 104 128 110 118 132 120 136

- 29 -
Table 2-1 Stack Size Listing of Standard C Libraries (regparam=2) (2)
Stack Size(byte)
Size Priority Speed Priority Remarks
No header function 300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
5 mathf.h powf 238 264 286 272 276 246 252 282 282 284
sqrtf 60 52 60 52 60 68 60 68 62 68
ceilf 92 112 132 98 120 100 118 140 122 136
fabsf 10 2 4 2 4 10 2 4 2 4
floorf 92 112 132 98 120 100 118 140 122 136
fmodf 80 88 98 76 90 86 84 94 84 94
6 setjmp.h setjmp 2 2 4 2 4 2 2 4 2 4
longjmp 2 2 4 4 4 2 2 4 2 4
7 stdarg.h va_start - - - - - - - - - - macro
va_arg - - - - - - - - - - macro
va_end 2 2 4 2 4 2 2 4 2 4
8 stdio.h fclose 40 70 80 32 40 26 24 46 32 48
fflush 24 44 48 14 16 8 8 12 14 16
fopen 48 70 120 38 84 36 34 76 40 76
freopen 50 88 116 44 76 30 34 68 44 68
setbuf 24 6 48 6 16 8 6 14 6 16
setvbuf 32 44 54 14 22 16 12 20 14 22
fprintf 708 676 792 644 760 676 622 724 624 728
fprintf 320 324 390 308 360 308 292 342 292 342 Simplified I/O
fscanf 492 478 580 450 556 486 436 548 450 542
fscanf 126 124 196 112 152 132 104 152 104 146 Simplified I/O
printf 706 674 776 642 756 674 620 720 622 724
printf 318 322 374 306 356 306 290 338 290 338 Simplified I/O
scanf 490 476 564 448 552 484 434 544 448 538
scanf 124 122 180 110 148 130 102 148 102 142 Simplified I/O
sprintf 708 676 792 644 760 676 622 724 624 728
sprintf 320 324 390 308 360 308 292 342 292 342 Simplified I/O
sscanf 492 478 580 450 556 486 436 548 450 542
sscanf 126 124 196 112 152 132 104 152 104 146 Simplified I/O
vfprintf 716 674 796 642 768 680 620 732 622 736
vfprintf 328 322 394 306 368 312 290 350 290 350 Simplified I/O
vprintf 714 674 792 642 764 678 620 728 622 732
vprintf 326 322 390 306 364 310 290 346 290 346 Simplified I/O
vsprintf 716 674 796 642 768 680 620 732 622 736
vsprintf 328 322 394 306 368 312 290 350 290 350 Simplified I/O
fgetc 78 106 162 68 122 58 60 100 70 106
fgets 100 128 182 90 150 80 80 132 92 134
fputc 82 100 156 54 108 56 50 88 56 92
fputs 94 106 180 60 126 66 56 106 62 110
getc 76 104 146 66 114 56 58 96 68 98
getchar 74 102 146 64 114 54 56 96 66 98
gets 88 126 170 80 132 64 66 114 82 118
putc 82 100 156 54 108 56 50 88 56 92
putchar 82 116 156 58 110 56 52 94 60 94
puts 94 112 180 64 132 66 58 108 66 112
ungetc 60 94 132 48 94 40 40 74 50 78
fread 90 110 162 72 130 70 70 114 74 114
fwrite 98 108 158 70 126 78 68 110 72 110
fseek 42 54 62 32 38 30 30 38 32 38
ftell 34 44 48 14 16 18 10 12 14 16
rewind 10 6 4 6 16 10 6 14 6 16
clearerr 2 2 4 2 4 2 2 4 2 4
feof 2 2 4 2 4 2 2 4 2 4
ferror 2 2 816 2 4 2 2 4 2 4
perror 720 698 466 658 780 684 630 744 638 748

- 30 -
Table 2-1 Stack Size Listing of Standard C Libraries (regparam=2) (3)
Stack Size(byte)
Size Priority Speed Priority Remarks
No header function 300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
9 stdlib.h atof 428 406 466 378 454 414 364 446 378 446
atoi 90 56 82 44 70 78 42 56 42 56
atol 86 56 80 44 68 74 42 54 42 54
strtod 424 402 458 374 446 410 360 438 374 438
strtol 80 54 76 42 64 68 40 50 40 50
rand 36 14 22 14 22 36 4 8 4 8
srand 2 6 8 6 8 2 6 8 6 8
calloc 48 88 108 42 80 28 36 60 44 64
free 24 44 48 14 16 12 10 24 14 24
malloc 42 66 84 28 64 22 26 48 30 48
realloc 60 88 120 46 100 42 44 84 48 84
bsearch 36 46 72 20 60 24 20 48 20 48
qsort 50 58 98 36 86 38 36 74 36 74 Recursively
abs 40 4 6 4 6 4 4 6 4 6
div 18 6 10 6 10 18 6 10 6 10
labs 18 6 8 6 8 12 6 8 6 8
ldiv 24 20 32 20 32 24 20 32 20 32
10 string.h memcpy 24 22 44 26 44 24 22 44 26 44
strcpy 24 44 48 10 16 8 8 16 10 16
strncpy 26 6 52 6 24 12 8 24 10 24
strcat 24 44 48 10 16 8 8 16 10 16
strncat 26 44 52 14 28 14 8 28 14 28
memcmp 14 18 24 18 24 14 18 24 18 24
strcmp 6 6 48 6 12 6 6 12 6 12
strncmp 26 44 52 10 24 12 10 24 14 24
memchr 26 6 52 6 20 10 6 20 6 20
strchr 4 4 8 4 8 4 4 8 4 8
strcspn 24 44 48 10 24 12 8 24 10 24
strpbrk 24 44 48 10 24 12 8 24 10 24
strrchr 24 44 72 12 28 14 10 26 12 28
strspn 24 44 48 10 24 12 8 24 10 24
strstr 30 44 80 34 56 30 32 56 34 56
strtok 36 66 72 24 40 20 16 40 24 40
memset 10 10 16 10 16 10 10 16 10 16
strerror 12 2 48 2 28 8 2 14 2 16
strlen 6 2 48 2 12 6 2 12 2 12
memmove 36 34 66 38 66 36 34 66 38 66

- 31 -
Table 2-2 Stack Size Listing of Standard C Libraries (regparam=3)(1)
Stack Size(byte)
Size Priority Speed Priority Remarks
No header function 300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
1 stddef.h offsetof - - - - - - - - - - macro
2 assert.h asse - - - - - - - - - - macro
3 ctype.h isalnum 2 2 8 2 8 2 2 8 2 8
isalpha 2 2 8 2 8 2 2 8 2 8
iscntrl 2 2 8 2 8 2 2 8 2 8
isdigit 2 2 8 2 8 2 2 8 2 8
isgraph 2 2 8 2 8 2 2 8 2 8
islower 2 2 8 2 8 2 2 8 2 8
isprint 2 2 8 2 8 2 2 8 2 8
ispunct 2 2 8 2 8 2 2 8 2 8
isspace 2 2 8 2 8 2 2 8 2 8
isupper 2 2 8 2 8 2 2 8 2 8
isxdigit 2 2 8 2 8 2 2 8 2 8
tolower 4 4 6 4 6 4 4 6 4 6
toupper 4 4 6 4 6 4 4 6 4 6
4 math.h acos 470 496 574 494 568 478 520 598 534 600
asin 438 466 538 464 532 442 480 550 490 552
atan 334 362 412 362 406 338 376 424 386 426
atan2 400 424 480 424 474 406 442 496 452 498
cos 224 254 290 252 284 228 266 302 278 304
sin 226 254 294 252 286 230 266 306 278 308
tan 246 280 310 280 312 250 290 322 294 324
cosh 302 338 364 336 366 306 342 376 350 378
sinh 302 338 364 336 366 306 342 376 350 378
tanh 326 362 388 360 390 330 366 400 374 402
exp 230 258 280 258 282 234 264 292 270 294
frexp 22 24 28 24 28 22 24 28 24 28
ldexp 82 88 96 80 88 86 84 96 88 96
log 226 260 284 260 286 230 268 296 272 298
log10 258 290 320 290 322 266 308 344 316 346
modf 138 152 168 148 164 144 158 176 162 176
pow 338 372 400 372 402 338 380 412 384 414
sqrt 90 102 106 102 110 94 110 118 114 122
ceil 126 152 180 152 172 130 168 192 176 192
fabs 18 16 20 16 20 18 16 20 16 20
floor 126 152 180 152 172 130 168 192 176 192
fmod 118 132 142 124 138 118 130 142 134 146
5 mathf.h acosf 340 338 416 360 410 348 362 432 394 434
asinf 316 316 388 338 382 320 332 396 362 398
atanf 240 240 290 306 284 244 256 298 286 300
atan2f 286 292 346 186 332 292 298 346 328 348
cosf 162 164 200 186 194 166 176 208 210 210
sinf 164 164 204 206 196 168 176 210 210 212
tanf 176 182 212 246 214 180 190 220 216 222
coshf 216 224 250 246 252 220 228 258 258 260
sinhf 216 224 250 262 252 220 228 258 258 260
tanhf 232 240 266 188 268 236 244 274 274 276
expf 164 164 186 10 188 168 170 194 198 196
frexpf 14 8 12 48 12 14 8 12 10 12
ldexpf 58 58 64 190 56 62 56 64 58 64
logf 160 166 190 212 192 164 170 198 200 200
log10f 184 188 218 102 220 192 200 234 232 236
modff 100 106 120 270 124 106 110 124 112 138

- 32-
Table 2-2 Stack Size Listing of Standard C Libraries (regparam=3)(2)
Stack Size(byte)
Size Priority Speed Priority Remarks
No header function 300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
5 mathf.h powf 240 256 282 270 276 240 248 282 280 284
sqrtf 62 52 60 52 60 66 60 68 62 68
ceilf 92 96 128 96 116 96 114 136 118 132
fabsf 10 2 4 20 4 10 2 4 2 4
floorf 92 96 128 96 116 96 114 136 118 132
fmodf 84 84 94 76 90 84 84 94 84 94
6 setjmp.h setjmp 2 2 4 2 4 2 2 4 2 4
longjmp 2 2 4 2 4 2 2 4 2 4
7 stdarg.h va_start - - - - - - - - - - macro
va_arg - - - - - - - - - - macro
va_end 2 2 4 2 4 2 2 4 2 4
8 stdio.h fclose 34 58 68 32 40 24 24 42 32 44
fflush 20 36 40 14 16 8 8 12 14 16
fopen 40 58 100 38 72 34 34 72 40 72
freopen 40 72 92 42 62 34 32 62 42 62
setbuf 10 6 40 6 16 6 6 12 6 16
setvbuf 26 36 44 14 20 12 10 16 14 20
fprintf 688 634 728 616 712 652 594 684 598 684
fprintf 318 308 364 296 348 304 282 326 282 326 Simplified I/O
fscanf 464 436 522 416 506 462 402 498 414 492
fscanf 118 110 168 102 136 124 94 136 94 130 Simplified I/O
printf 686 632 716 614 708 650 592 680 596 680
printf 316 306 352 294 344 302 280 322 280 322 Simplified I/O
scanf 462 434 510 414 502 460 400 494 412 488
scanf 116 108 156 100 132 122 92 132 92 126 Simplified I/O
sprintf 688 634 728 616 712 652 594 684 598 684
sprintf 318 308 364 296 348 304 282 326 282 326 Simplified I/O
sscanf 464 436 522 416 506 462 402 498 414 492
sscanf 118 110 168 102 136 124 94 136 94 130 Simplified I/O
vfprintf 688 632 728 614 716 652 592 684 596 688
vfprintf 318 306 364 294 352 304 280 326 280 330 Simplified I/O
vprintf 688 630 728 612 716 652 590 684 594 688
vprintf 318 304 364 292 352 304 278 326 278 330 Simplified I/O
vsprintf 688 630 728 612 716 652 590 684 594 688
vsprintf 318 304 364 292 352 304 278 326 278 330 Simplified I/O
fgetc 70 90 138 64 114 54 56 98 66 106
fgets 88 108 154 82 134 72 74 122 84 126
fputc 68 84 132 54 104 50 44 84 56 96
fputs 78 90 152 60 116 58 50 100 62 108
getc 68 88 126 62 106 52 54 94 64 98
getchar 66 86 126 60 106 50 52 94 62 98
gets 78 106 146 76 124 60 62 112 78 118
putc 68 84 132 54 100 50 44 84 56 92
putchar 72 96 132 58 106 52 46 92 60 98
puts 78 102 152 64 120 60 52 104 66 112
ungetc 48 66 112 40 88 36 36 70 42 80
fread 82 94 142 68 122 66 64 110 70 114
fwrite 88 92 138 66 118 72 62 106 68 110
fseek 38 46 54 28 34 28 28 34 28 34
ftell 22 36 40 14 16 16 10 12 14 16
rewind 10 6 40 6 16 10 6 14 6 16
clearerr 2 2 4 2 4 2 2 4 2 4
feof 2 2 4 2 4 2 2 4 2 4
ferror 2 2 4 2 4 2 2 4 2 4
perror 698 652 748 630 732 660 602 704 612 704

- 33-
Table 2-2 Stack Size Listing of Standard C Libraries (regparam=3)(3)
Stack Size(byte)
Size Priority Speed Priority Remarks
No header function 300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
9 stdlib.h atof 406 370 424 350 416 396 336 408 348 408
atoi 74 48 70 40 62 72 38 50 38 50
atol 70 48 70 40 62 68 38 50 38 50
strtod 402 356 416 346 408 392 332 400 344 400
strtol 66 46 66 38 58 64 36 46 36 46
rand 34 6 22 14 22 34 4 8 4 8
srand 2 72 8 6 8 2 6 8 6 8
calloc 42 36 92 42 76 26 32 60 44 68
free 20 54 40 14 16 10 10 20 14 20
malloc 36 72 72 28 60 20 24 48 30 52
realloc 52 36 104 44 92 36 40 80 46 84
bsearch 30 54 60 20 52 20 20 40 20 40
qsort 44 72 90 32 82 34 32 66 32 66 Recursively
abs 4 38 6 4 6 4 4 6 4 6
div 16 50 10 6 10 16 6 10 6 10
labs 18 4 8 6 8 12 6 8 6 8
ldiv 22 6 28 18 28 22 18 28 18 28
10 string.h memcpy 20 6 36 24 36 20 20 36 24 36
strcpy 20 18 40 10 16 8 8 16 10 16
strncpy 20 20 40 6 16 8 8 16 10 16
strcat 20 36 40 10 16 8 8 16 10 16
strncat 20 6 40 14 20 10 8 20 14 20
memcmp 10 36 18 16 18 20 16 18 16 18
strcmp 6 6 40 6 12 6 6 12 6 12
strncmp 20 4 40 10 20 10 10 20 14 20
memchr 6 36 40 6 12 6 6 12 6 12
strchr 4 36 80 4 8 4 4 8 4 8
strcspn 20 36 40 10 20 10 8 20 10 20
strpbrk 20 36 40 10 20 10 8 20 10 20
strrchr 20 36 60 12 28 14 10 26 12 28
strspn 20 36 40 10 20 10 8 20 10 20
strstr 24 36 68 32 46 24 30 46 32 46
strtok 30 54 60 24 36 18 16 36 24 36
memset 6 4 8 4 8 6 4 8 4 8
strerror 12 2 40 2 24 8 2 12 2 12
strlen 6 2 40 2 12 6 2 12 2 12
memmove 28 28 50 32 50 28 28 50 32 50

- 34-
3. Stack Size Listing of EC++ Class Libraries
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (1)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
io_base void _ec2p_init_base() 4 4 6 4 6 4 4 6 4 6
void _ec2p_copy_base(ios_base& ios_base_dt) 6 4 24 4 12 6 4 12 4 12
ios_base() 2 2 4 2 4 2 2 4 2 4
~ios_base() 2 2 4 2 4 2 2 4 2 4
fmtflags flags() const 2 2 4 2 4 2 2 4 2 4
fmtflags flags(fmtflags fmtflg) 6 4 6 4 6 6 4 6 4 6
fmtflags setf(fmtflags fmtflg) 12 6 8 6 8 8 6 8 6 8
fmtflags setf(fmtflags fmtflg, fmtflags mask) 14 6 24 6 16 10 6 10 6 16
void unsetf(fmtflags mask) 4 2 6 2 6 4 2 6 2 6
char fill() const 2 2 4 2 4 2 2 4 2 4
char fill(char ch) 2 2 4 2 4 2 2 4 2 4
int precision() const 2 2 4 2 4 2 2 4 2 4
streamsize precision(streamsize preci) 4 2 8 2 8 4 2 8 2 8
streamsize width() const 2 2 4 2 4 2 2 4 2 4
streamsize width(streamsize wd) 4 2 8 2 8 4 2 8 2 8
ios ios() 2 2 4 2 4 2 2 4 2 4
ios(streambuf *sbptr) 4 4 32 4 8 4 4 8 4 8
void init(streambuf *sbptr) 12 8 48 8 24 12 8 22 8 24
virtual ~ios() 0 0 0 0 0 0 0 0 0 0
operator void*() const 0 0 0 0 0 0 0 0 0 0
bool operator !() const 0 0 0 0 0 0 0 0 0 0
iostate rdstate() const 0 0 0 0 0 0 0 0 0 0
void clear(iostate st=goodbit) 6 4 24 4 12 6 4 10 4 12
void setstate(iostate st) 6 4 8 4 8 6 4 8 4 8
bool good() const 0 0 0 0 0 0 0 0 0 0
bool eof() const 0 0 0 0 0 0 0 0 0 0
bool bad() const 0 0 0 0 0 0 0 0 0 0
bool fail() const 0 0 0 0 0 0 0 0 0 0
ostream* tie() const 0 0 0 0 0 0 0 0 0 0
ostream* tie(ostream* tstrptr) 4 2 8 2 8 4 2 8 2 8
streambuf* rdbuf() const 0 0 0 0 0 0 0 0 0 0
streambuf* rdbuf(streambuf* sbptr) 4 4 8 4 8 8 4 14 4 16
ios & copyfmt(const ios & rhs) 12 10 48 10 24 12 10 24 10 24
ios_base& boolalpha(ios_base& str) - - - - - - - - - -
ios_base& noboolalpha(ios_base& str) - - - - - - - - - -
ios_base& showbase(ios_base& str) 16 10 16 10 16 12 10 16 10 16
ios_base& noshowbase(ios_base& str) 8 6 14 6 14 8 6 14 6 14
ios_base& showpoint(ios_base& str) 16 10 16 10 16 12 10 16 10 16
ios_base& noshowpoint(ios_base& str) 8 6 14 6 14 8 6 14 6 14
ios_base& showpos(ios_base& str) 16 10 16 10 16 12 10 16 10 16
ios_base& noshowpos(ios_base& str) 8 6 14 6 14 8 6 14 6 14
ios_base& skipws(ios_base& str) 16 10 16 10 16 12 10 16 10 16
ios_base& noskipws(ios_base& str) 8 6 14 6 14 8 6 14 6 14
ios_base& uppercase(ios_base& str) 16 10 16 10 16 12 10 16 10 16
ios_base& nouppercase(ios_base& str) 8 6 14 6 14 8 6 14 6 14
ios_base& internal(ios_base& str) 18 10 32 10 24 14 10 18 10 24
ios_base& left(ios_base& str) 18 10 32 10 24 14 10 18 10 24
ios_base& right(ios_base& str) 18 10 32 10 24 14 10 18 10 24
ios_base& dec(ios_base& str) 18 10 32 10 24 14 10 18 10 24
ios_base& hex(ios_base& str) 18 10 32 10 24 14 10 18 10 24
ios_base& oct(ios_base& str) 18 10 32 10 24 14 10 18 10 24
ios_base& fixed(ios_base& str) 18 10 32 10 24 14 10 18 10 24
ios_base& scientific(ios_base& str) 18 10 32 10 24 14 10 18 10 24
streambuf char* _ec2p_getflag() const - - - - - - - - - -
char* & _ec2p_gnptr() 2 2 4 2 4 2 2 4 2 4
char* & _ec2p_pnptr() 0 0 0 0 0 0 0 0 0 0
void _ec2p_bcntplus() 8 2 4 2 4 2 2 4 2 4
void _ec2p_bcntminus() 8 2 4 2 4 2 2 4 2 4
void _ec2p_setbPtr(char** begptr, char** 12 8 24 8 24 12 8 24 8 24
curptr,long* cntptr,long* lenptr,char* flgptr)
streambuf() 4 4 8 4 8 4 4 8 4 8

-35-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2)(2)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
virtual ~streambuf() 0 0 0 0 0 0 0 0 0 0
streambuf* pubsetbuf(char* s, streamsize n) 22 42 44 12 20 10 10 20 12 20
pos_type pubseekoff(off_type off, 30 42 44 14 20 18 14 20 14 20
ios _base::seekdir way,
ios_base::openmode which=ios_base::in|ios_base::out)
pos_type pubseekpos(pos_type sp, 30 42 44 14 20 18 14 20 14 20
ios_base::openmode which=ios_base::in |
ios_base::out)
int pubsync() 4 4 44 14 20 18 14 20 14 20
streamsize in_avail() 22 42 44 14 20 10 10 20 14 20
int_type snextc() 2 2 4 2 4 2 2 4 2 4
int_type sbumpc() 16 26 32 18 24 12 16 24 18 24
int_type sgetc() 16 26 32 18 28 14 14 28 18 28
int sgetn(char* s,streamsize n) 14 22 28 10 24 12 8 24 10 24
int_type sputbackc(char c) 14 24 28 24 28 14 20 28 24 28
int sungetc() 14 24 28 16 20 10 14 20 16 20
int sputc(char c) 16 26 32 26 32 16 20 30 26 32
int_type sputn(const char* s, streamsize n) 14 22 28 10 24 12 8 24 10 24
char* eback() const 2 2 4 2 4 2 2 4 2 4
char* gptr() const 2 2 4 2 4 2 2 4 2 4
char* egptr() const 4 4 8 4 8 4 4 8 4 8
void gbump(int n) 16 22 24 10 20 14 10 20 10 20
void setg(char* gbeg,char* gnext, char* gend) 22 42 44 14 16 10 8 16 14 16
char* pbase() const 0 0 0 0 0 0 0 0 0 0
char* pptr() const 2 2 4 2 4 2 2 4 2 4
char* epptr() const 4 4 8 4 8 4 4 8 4 8
void pbump( int n) 16 22 24 8 20 14 8 20 8 20
void setp(char* pbeg,char* pend) 22 42 44 12 12 6 10 12 12 12
virtual streambuf *setbuf(char* s, streamsize n) 4 2 8 2 8 4 2 8 2 8
virtual pos_type seekoff(off_type off, 14 4 8 4 8 14 4 8 4 8
ios_base::seekdir way,
ios_base::openmode=(ios_base::openmode)
(ios_base::in | ios_base::out))
virtual pos_type seekpos(pos_type sp, 12 2 6 2 6 12 2 6 2 6
ios_base::openmode=(ios_base::openmode)
(ios_base::in | ios_base::out))
virtual int sync() 2 2 4 2 4 2 2 4 2 4
virtual int showmanyc() 2 2 4 2 4 2 2 4 2 4
virtual streamsize xsgetn(char* s, streamsize n) 52 44 98 44 98 52 42 90 48 90
virtual int_type underflow() 2 42 4 2 4 2 2 4 2 4
virtual int_type uflow() 6 222 24 8 16 8 8 12 8 16
virtual int_type pbackfail(int type c=eof) 2 22 4 2 4 2 2 4 2 4
virtual streamsize xsputn( const char* s,streamsize n) 46 244 88 44 88 52 42 90 48 90
virtual int_type overflow(int type c=eof) 2 2 4 2 4 2 2 4 2 4
istream sentry(istream &is, bool noskipws=_FALSE) 32 48 58 40 54 28 32 54 40 54
::sentry ~sentry() 0 0 0 0 0 0 0 0 0 0
operator bool() 2 2 4 2 4 2 2 4 2 4
istream int::_ec2p_getistr(char* str, unsigned int dig,int 38 48 70 46 66 36 40 66 46 66
mode)
istream(streambuf *sb) 4 4 44 4 8 4 4 6 4 8
~istream() 0 0 0 0 0 0 0 0 0 0
istream& operator >>(bool &n) 136 118 144 110 134 124 98 132 110 134
istream& operator >>(short &n) 136 118 144 104 134 124 94 132 104 134
istream& operator >>(unsigned short &n) 132 108 138 102 130 124 94 130 102 130
istream& operator >>(int &n) 550 540 650 506 622 544 488 614 506 608
istream& operator >>(unsigned int &n) 132 108 138 102 130 124 94 130 102 130
istream& operator >>(long &n) 550 540 650 506 626 544 492 616 506 612
istream& operator >>(unsigned long &n) 132 108 138 102 134 124 94 134 102 134
istream& operator >>(float &n) 486 474 538 440 526 472 422 516 440 518
istream& operator >>(double &n) 486 474 538 440 526 472 422 516 440 518
istream& operator >>(long double &n) 486 474 538 440 526 472 422 516 440 518
istream& operator >>(void* &p) 136 112 142 104 138 130 100 138 100 138
istream& operator >>(streambuf *sb) 80 104 120 90 116 76 80 114 90 116
streamsize gcount() 0 0 0 0 0 0 0 0 0 0

-36-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (3)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
int_type get() 40 72 84 52 68 36 42 68 52 68
istream& get(char &c) 46 72 84 56 76 40 44 76 56 76
istream& get(signed char &c) 2 2 4 2 4 12 12 22 16 22
istream& get(unsigned char &c) 2 2 4 2 4 12 12 22 16 22
istream& get(char* s,streamsize n) 58 78 136 64 120 76 80 156 92 156
istream& get(signed char* s, streamsize n) 66 84 150 70 134 102 104 206 118 206
istream& get(unsigned char* s, streamsize n) 66 84 150 70 134 102 104 206 118 206
istream& get(char* s,streamsize n, char delim) 56 76 108 64 104 62 6 114 72 114
istream& get(signed char* s, streamsize n,char delim) 64 82 122 70 118 88 90 164 98 164
istream& get(unsigned char* s, streamsize n,char 64 82 122 70 118 88 90 164 98 164
delim)
istream& get(streambuf &sb) 4 2 6 2 6 4 2 6 2 6
istream& get(streambuf &sb,char delim) 50 72 90 60 86 46 50 86 60 86
istream& getline(char* s,streamsize n) 8 4 28 4 16 22 22 42 24 42
istream& getline(signed char* s, streamsize n) 8 4 28 4 16 22 22 42 24 42
istream& getline(unsigned char* s, streamsize n) 8 4 28 4 16 22 22 42 24 42
istream& getline(char* s,streamsize n,char delim) 50 74 108 60 104 54 58 114 68 114
istream& getline(signed char* s, streamsize n,char 58 80 122 66 118 80 82 164 94 164
delim)
istream& getline(unsigned char* s, streamsize n,char 58 80 122 66 118 80 82 164 94 164
delim)
istream& ignore(unsigned streamsize n=1, int_type 48 72 86 58 82 44 50 82 58 82
delim=streambuf::eof)
int_type peek() 40 56 84 48 68 36 40 68 48 68
istream& read(char* s,streamsize n) 50 72 92 58 88 46 50 88 58 88
istream& read(signed char* s, streamsize n) 6 2 104 2 100 18 16 122 18 122
istream& read(unsgined char* s, streamsize n) 6 2 104 2 100 18 16 122 18 122
streamsize readsome(char* s, streamsize n) 54 72 100 64 96 50 54 96 64 96
streamsize readsome(signed char* s, streamsize n) 60 74 112 66 108 56 56 108 66 108
streamsize readsome(unsigned char* s, 60 74 112 66 108 56 56 108 66 108
streamsize n)
istream& putback(char c) 46 72 84 58 76 40 44 74 58 76
istream& unget() 40 56 84 48 68 36 40 68 48 68
int sync() 46 72 84 52 72 38 42 72 52 72
pos_type tellg() 56 72 84 56 76 52 46 76 56 76
istream& seekg(pos_type & pos) 58 72 88 58 84 54 50 82 58 84
istream& seekg(off_type &off, ios_base::seekdir dir) 60 76 90 64 86 56 56 86 64 86
istream& ws(istream &is) 46 72 84 52 72 38 42 72 52 72
istream& operator >>(istream& in,char* s) 48 72 88 58 84 44 48 86 58 88
istream& operator >>(istream& in, signed char* s) 50 74 92 60 88 46 50 90 60 92
istream& operator >>(istream& in, unsigned char* s) 50 74 92 60 88 46 50 90 60 92
istream& operator >> (istream& in, char &s) 46 72 84 56 74 40 44 74 56 74
istream& operator >> (istream& in, singed char &s) 2 2 4 2 4 12 12 20 16 20
istream& operator >> (istream& in, unsigned char &s) 2 2 4 2 4 12 12 20 16 20
ostream:: sentry(ostrream &os) 30 48 56 28 44 26 20 44 28 44
sentry ~sentry() 22 30 40 18 32 18 16 32 18 32
operator bool() 2 2 4 2 4 2 2 4 2 4
ostream ostream(streambuf *sbptr) 4 4 44 4 8 4 4 6 4 8
~ostream() 0 0 0 0 0 0 0 0 0 0
ostream & operator << (bool n) 4 4 44 4 8 4 4 6 4 8
ostream & operator << (short n) 852 830 950 786 910 816 764 872 766 878
ostream & operator << (unsigned short n) 852 830 950 786 910 816 764 872 766 878
ostream & operator << (int n) 852 830 950 786 910 816 764 872 766 878
ostream & operator << ( unsigned int n) 852 830 950 786 910 816 764 872 766 878
ostream & operator << (long n) 850 830 950 786 910 818 764 874 766 878
ostream & operator << (unsigned long n) 850 830 950 786 910 818 764 874 766 878
ostream & operator << (float n) 938 924 1054 876 1014 906 852 978 856 982
ostream & operator << (double n) 934 908 1054 872 1010 902 848 974 852 978
ostream & operator << (long double n) 934 908 1054 872 1010 902 848 974 852 978
ostream & operator << (void *n) 792 766 886 730 850 758 706 814 710 818
ostream & operator << (streambuf *sbptr) 82 106 124 80 112 76 70 108 80 108
ostream & put(char c) 16 26 30 18 22 12 12 20 18 22
ostream & write(const char* s, streamsize n) 50 74 94 50 82 46 40 82 50 82
ostream & write(const signed char* s, streamsize n) 6 2 106 2 94 20 18 120 20 120

-37-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (4)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
ostream & write(const unsigned char* s, streamsize n) 6 2 106 2 94 20 18 120 20 120
ostream & flush() 18 26 32 14 24 14 12 24 14 24
pos_type tellp() 18 22 24 14 20 18 12 20 14 20
ostream & seekp(pos_type& pos) 24 22 28 14 28 24 12 26 14 28
ostream & seekp(off_type & off, seekdir dir) 26 22 30 18 30 26 18 30 18 30
ostream & endl(ostream &os) 50 78 94 50 74 56 48 98 66 100
ostream & ends(ostream &os) 50 78 94 50 74 50 44 86 64 88
ostream & flush(ostream &os) 4 4 8 4 8 10 10 20 14 20
ostream& operator <<(ostream& os,char s) 50 78 94 50 74 42 36 72 50 74
ostream& operator <<(ostream& os, signed char s) 50 78 94 50 74 42 36 72 50 74
ostream& operator <<(ostream& os, unsigned char s) 50 78 94 50 74 42 36 72 50 74
ostream& operator << (ostream& os, const char* s) 48 58 120 58 92 48 50 90 58 94
ostream& operator << (ostream& os, signed char* s) 2 2 4 2 4 10 10 18 10 18
ostream& operator << (ostream& os, unsigned char* s) 2 2 4 2 4 10 10 18 10 18
smanip smanip resetiosflags(ios_base::fmtflags mask) 30 32 72 46 52 20 22 34 24 34
smanip setiosflags(ios_base::fmtflags mask) 30 32 72 46 52 20 22 34 24 34
smanip setbase(int base) 34 36 72 40 58 34 38 58 44 58
smanip setfill(char c) 34 36 72 40 58 34 38 58 44 58
smanip setprecision(int n) 34 36 72 40 60 34 38 60 44 60
smanip setw(int n) 34 36 72 40 60 34 38 60 44 60
mystrbuf mystrbuf() 2 2 4 2 4 2 2 4 2 4
mystrbuf(void *ptr) 4 4 44 4 8 4 4 8 4 8
~mystrbuf() 4 4 44 4 8 4 4 8 4 8
void *myfptr() const 0 0 0 0 0 0 0 0 0 0
mystrbuf *open(const char* filename, int mode) 66 92 154 56 118 54 50 110 58 110
mystrbuf *close() 46 76 104 38 48 32 30 58 38 56
virtual streambuf *setbuf(char* s,stremsize n) 40 48 82 18 38 24 16 36 18 38
virtual pos_type seekoff(off_type off, 62 78 90 48 58 48 44 58 48 58
ios_base::seekdir way,
ios_base::openmode=(ios_base::openmode)(ios_base::
in | ios_base::out))
virtual pos_type seekpos(pos_type sp, 60 76 88 46 56 44 40 56 46 56
ios_base::openmode=(ios_base::openmode)
(ios_base::in | ios_base::out))
virtual int sync() 46 58 70 36 46 34 34 46 36 46
virtual int showmanyc() 2 2 4 2 4 2 2 4 2 4
virtual int_type underflow() 90 128 186 82 138 66 68 116 84 122
virtual int_type pbackfail(int type c=streambuf::eof) 72 116 156 62 118 52 52 98 64 102
virtual int_type overflow(int type c=streambuf::eof) 94 122 180 68 128 66 60 106 70 112
void _init(_f_type * fp) 18 12 48 12 36 18 12 36 12 36
new void* operator new(size_t size) 54 88 108 38 80 30 34 64 40 64
void* operator new[](size_t size) 56 90 112 40 84 32 36 68 42 68
void* operator new(size_t size,void *ptr) 2 2 4 2 4 2 2 4 2 4
void* operator new[](size_t size, void *ptr) 2 2 4 2 4 2 2 4 2 4
void operator delete(void* ptr) 8 8 16 8 16 8 8 16 8 16
void operator delete[](void* ptr) 2 2 4 2 4 2 2 4 2 4
new_handler set_new_handler(new_handler new_P) 2 2 4 2 4 2 2 4 2 4
float_ float_complex(float re=0.0f,float im=0.0f) 6 0 0 0 0 6 0 0 0 0
complex float_complex(const double_complex& rhs) 44 52 56 44 48 44 46 56 48 56
float real() const 0 0 0 0 0 0 0 0 0 0
float imag() const 6 2 4 2 4 8 2 4 2 4
float_complex& operator=(float rhs) 6 0 0 0 0 6 0 0 0 0
float_complex& operator+=(float rhs) 28 42 44 26 28 28 24 28 26 28
float_complex& operator-=(float rhs) 28 42 44 26 28 28 24 28 26 28
float_complex& operator*=(float rhs) 40 42 44 26 28 40 24 28 26 28
float_complex& operator/=(float rhs) 40 42 44 30 32 40 28 32 30 32
float_complex& operator=(const float_complex&rhs) 12 4 4 4 4 8 4 4 4 4
float_complex& operator+=(const float_complex& 34 42 44 30 32 26 28 32 30 32
rhs)
float_complex& operator-=(const float_complex& rhs) 30 42 44 30 32 26 28 32 30 32
float_complex& operator*=(const float_complex& 74 52 56 52 56 74 50 56 52 56
rhs)
float_complex& operator/=(const float_complex& rhs) 78 56 60 56 60 74 54 60 56 60
float_complex operator+(const float_complex& lhs) 38 40 68 44 56 40 48 60 52 60

-38-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (5)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
float_complex operator+(const float_complex& lhs, 54 58 68 56 68 54 56 68 60 68
const float_complex& rhs)
float_complex operator+(const float_complex& 54 58 68 56 68 54 54 68 60 68
lhs,const float& rhs)
float_complex operator+(const float& lhs,const 58 58 68 54 64 56 52 64 56 64
float_complex& rhs)
float_complex operator-(const float_complex& lhs) 56 56 68 46 56 54 44 56 48 56
float_complex operator-(const float_complex& 54 58 68 56 68 54 56 68 60 68
lhs,const float_complex& rhs)
float_complex operator-(const float_complex& 54 58 68 56 68 54 52 68 56 68
lhs,const float& rhs)
float_complex operator-(const float& lhs,const 58 58 68 54 64 56 52 64 56 64
float_complex& rhs)
float_complex operator*(const float_complex& 104 92 100 78 92 134 102 112 104 112
lhs,const float_complex& rhs)
float_complex operator*(const float_complex& 66 58 68 56 64 66 52 64 54 64
lhs,const float& rhs)
float_complex operator*(const float& lhs,const 112 92 100 80 92 132 96 108 100 108
float_complex& rhs)
float_complex operator/ (const float_complex& 108 96 104 82 96 104 86 96 88 96
lhs,const float_complex& rhs)
float_complex operator/ (const float_complex& 66 62 68 58 64 66 54 64 54 64
lhs,const float& rhs)
float_complex operator/ (const float& lhs,const 116 96 104 84 96 110 84 96 88 96
float_complex& rhs)
bool operator==(const float_complex& lhs,const 40 30 36 30 36 38 26 36 30 36
float_complex& rhs)
bool operator==(const float_complex& lhs,const 32 30 36 22 24 28 18 24 22 24
float& rhs)
bool operator== (const float& lhs,const 32 30 36 18 24 28 16 24 18 24
float_complex& rhs)
bool operator!=(const float_complex& lhs,const 40 30 36 30 36 38 26 36 30 36
float_complex& rhs)
bool operator!=(const float_complex& lhs,const float& 32 30 36 22 24 28 18 24 22 24
rhs)
bool operator!=(const float& lhs,const float_complex& 32 30 36 22 28 28 18 28 22 28
rhs)
istream& operator>>(istream& is, float_complex& x) 538 520 586 480 574 524 462 564 480 566
ostream& operator<<(ostream& os, const 958 946 1078 890 1030 922 864 994 870 998
float_complex& x)
float real(const float_complex& x) 10 6 8 6 8 10 6 8 6 8
float imag(const float_complex& x) 10 6 8 6 8 12 6 8 6 8
float abs(const float_comlex& x) 94 74 84 62 72 100 70 80 72 80
float arg(const float_complex& x) 242 262 322 278 292 252 256 294 292 300
float norm(const float_complex& x) 104 110 116 106 116 102 106 116 106 116
float_complex conj(const float_complex& x) 52 56 68 48 56 50 44 56 48 56
float_complex polar(const float& rho, const float& 130 134 170 152 156 134 136 162 164 164
theta)
float_complex cos(const float_complex& x) 246 254 278 272 276 244 250 278 278 280
float_complex cosh(const float_complex& x) 292 302 330 308 316 334 322 354 350 356
float_complex exp(const float_complex&) 184 182 202 202 200 182 176 198 202 200
float_complex log(const float_complex& x) 278 302 366 312 332 290 290 334 328 340
float_complex log10(const float_complex& x) 278 302 366 312 332 290 290 334 328 340
float_complex pow(const float_complex& x,int y) 328 362 430 366 392 338 340 392 382 400
float_complex pow(const float_complex& x,const 324 358 426 354 384 332 334 386 376 392
float& y)
float_complex pow(const float_complex& x,const 324 358 426 354 384 332 334 386 376 392
float_complex& y)
float_complex pow(const float& x,const 230 234 258 240 248 224 216 246 246 248
float_complex& y)
float_complex sin(const float_complex& x) 242 254 278 272 276 240 250 278 278 280
float_complex sinh(const float_complex& x) 304 318 346 324 336 340 338 370 366 372
float_complex sqrt(const float_complex& x) 288 302 366 312 332 294 292 334 328 340
float_complex tan(const float_complex& x) 292 310 338 322 332 288 296 334 328 336
float_complex tanh(const float_complex& x) 350 374 406 374 392 384 384 426 416 428
dounble_ double_complex(double re=0.0,double im=0.0) 38 40 44 40 44 36 38 40 40 40
complex double_complex(const float_complex&) 44 46 54 50 54 36 38 40 40 40
double real() const 10 8 8 8 8 10 8 8 8 8

-39-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (6)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
double imag() const 10 12 20 12 20 14 18 28 22 28
double_complex& operator=(double rhs) 14 16 20 16 20 12 14 16 16 16
double_complex& operator+=(double rhs) 52 40 58 42 48 52 42 46 46 48
double_complex& operator-=(double rhs) 52 58 78 60 68 52 60 66 64 68
double_complex& operator*=(double rhs) 60 66 84 66 72 60 68 72 70 72
double_complex& operator/=(double rhs) 60 42 60 42 48 60 44 48 46 48
double_complex& operator=(const double_complex& 24 26 60 26 32 22 20 28 28 28
rhs)
double_complex& operator+=(const 66 64 66 54 60 62 52 58 54 60
double_complex& rhs)
double_complex& operator-=(const double_complex& 66 82 86 70 80 62 70 78 52 80
rhs)
double_complex& operator*=(const 0 0 0 0 0 0 0 0 0 0
double_complex& rhs)
double_complex& operator/=(const double_complex& 196 212 216 206 212 196 206 216 208 216
rhs)
double_complex operator+(const double_complex& 54 56 84 60 72 56 62 70 68 76
lhs)
double_complex operator+(const double_complex& 102 100 106 88 100 102 94 106 98 108
lhs,const double_complex& rhs)
double_complex operator+(const double_complex& 94 92 98 80 92 94 88 98 90 100
lhs,const double& rhs)
double_complex operator+(const double& lhs,const 118 116 122 104 116 118 110 122 114 124
double_complex& rhs)
double_complex operator-(const double_complex& 92 104 116 94 108 90 100 112 104 112
lhs)
double_complex operator-(const double_complex& 102 118 126 106 120 102 112 126 116 128
lhs,const double_complex& rhs)
double_complex operator-(const double_complex& 94 110 126 98 112 94 106 118 108 120
lhs,const double& rhs)
double_complex operator-(const double& lhs,const 118 134 142 122 136 118 128 142 132 144
double_complex& rhs)
double_complex operator*(const double_complex& 164 190 200 170 192 222 238 260 244 260
lhs,const double_complex& rhs)
double_complex operator*(const double_complex& 102 118 124 104 116 102 114 124 114 124
lhs,const double& rhs)
double_complex operator*(const double& lhs,const 180 206 216 286 208 230 244 268 248 268
double_complex& rhs)
double_complex operator/ (const double_complex& 242 268 276 248 264 242 258 276 264 276
lhs,const double_complex& rhs)
double_complex operator/ (const double_complex& 102 94 100 80 92 102 90 100 90 100
lhs,const double& rhs)
double_complex operator/ (const double& lhs,const 258 284 292 264 280 258 272 292 276 292
double_complex& rhs)
bool operator==(const double_complex& lhs,const 56 80 84 76 84 56 74 84 80 84
double_complex& rhs)
bool operator==(const double_complex& lhs,const 40 64 68 58 64 42 56 68 60 68
double& rhs)
bool operator==(const double& lhs,const 40 64 68 58 64 42 56 68 60 68
double_complex& rhs)
bool operator!=(const double_complex& lhs,const 56 80 84 76 84 56 74 84 80 84
double_complex& rhs)
bool operator!=(const double_complex& lhs,const 40 64 68 58 64 42 56 68 60 68
double& rhs)
bool operator!=(const double& lhs,const 40 64 68 58 64 42 56 68 60 68
double_complex& rhs)
istream& operator>>(istream& is, double_complex& 600 596 666 556 654 586 536 644 558 646
x)
ostream& operator<<(ostream& os, double_complex& 962 946 1094 902 1042 930 880 1014 886 1018
x)
double real(const double_complex& x) 18 20 28 20 28 22 30 36 30 36
double imag(const double_complex& x) 18 20 20 20 20 22 30 36 30 36
double abs(const double_comlex& x) 166 190 198 184 198 172 194 206 198 210
double arg(const double_complex& x) 28 30 52 30 40 30 38 44 38 44
double norm(const double_complex& x) 110 126 132 112 124 106 118 124 118 124
double_complex conj(const double_complex& x) 92 104 116 94 108 90 100 112 104 112
double_complex polar(const double& rho, const 140 160 168 148 160 136 144 160 152 160
double& theta)
double_complex cos(const double_complex& x) 166 182 188 176 184 164 178 184 178 184

-40-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (7)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
double_complex cosh(const double_complex& x) 260 286 296 266 284 362 386 396 386 396
double_complex exp(const double_complex&) 174 190 196 184 192 172 186 192 186 192
double_complex log(const double_complex& x) 230 254 282 248 270 238 264 282 270 286
double_complex log10(const double_complex& x) 230 254 282 248 270 238 264 282 268 286
double_complex pow(const double_complex& x,int y) 316 350 382 338 366 322 352 376 362 382
double_complex pow(const double_complex& x,const 308 342 374 322 354 312 342 366 350 370
double& y)
double_complex pow(const double_complex& x,const 308 342 374 322 354 312 242 366 350 370
double_complex& y)
double_complex pow(const double& x, const 244 270 280 254 268 238 256 268 258 268
double_complex& y)
double_complex sin(const double_complex& x) 158 174 180 168 176 156 170 176 170 176
double_complex sinh(const double_complex& x) 290 326 340 300 328 444 468 496 476 496
double_complex sqrt(const double_complex& x) 252 286 298 266 290 254 280 298 284 302
double_complex tan(const double_complex& x) 320 356 368 330 352 318 338 364 348 364
double_complex tanh(const double_complex& x) 368 414 432 382 416 520 548 584 560 584
string string(void) 2 2 4 2 4 2 2 4 2 4
string(const string& str,size_t pos=0, size_t n=npos) 22 42 44 12 20 10 10 20 12 20
string(const char*str,size_t n) 22 42 44 12 12 6 6 12 12 12
string(const char* str) 4 4 44 4 8 4 4 8 4 8
string(size_t n,char c) 22 42 44 8 12 6 6 10 8 12
~string() 4 4 44 4 8 4 4 8 4 8
string& operator=(const string& str) 10 8 32 8 20 16 12 32 4 32
string& operator=(const char* str) 92 142 180 78 146 66 68 130 66 130
string& operator=(char c) 92 142 182 80 152 68 70 136 84 136
iterator begin() 0 0 0 0 0 0 0 0 0 0
const_iterator begin() const 0 0 0 0 0 0 0 0 0 0
iterator end() 0 0 0 0 0 0 0 0 0 0
const_iterator end() const 0 0 0 0 0 0 0 0 0 0
size_t size() const 2 2 4 2 4 2 2 4 2 4
size_t length() const 0 0 0 0 0 0 0 0 0 0
size_t max_size() const 0 0 0 0 0 0 0 0 0 0
void resize(size_t n,char c) 76 134 170 64 130 52 58 114 66 114
void resize(size_t n) 4 2 176 2 136 4 2 120 2 120
size_t capacity() const 0 0 0 0 0 0 0 0 0 0
void reserve(size_t res_arg = 0) 80 134 168 68 132 52 56 116 70 116
void clear() 102 162 224 184 84 76 180 92 180
bool empty() const 0 0 0 0 0 0 0 0 0 0
const char & operator[](size_t pos) const 4 2 8 2 8 4 2 8 2 8
char & operator[](size_t pos) 0 0 0 0 0 0 0 0 0 0
const char & at(size_t pos) const 2 2 4 2 4 6 2 12 2 12
char & at(size_t pos) 0 0 0 0 0 0 0 0 0 0
string& operator+=(const string& str) 10 8 32 8 20 16 12 32 18 32
string& operator+=(const char* str) 92 142 180 78 146 66 68 130 80 130
string& operator+=(char c) 92 142 182 80 152 68 70 136 82 136
string& append(const string& str) 6 4 24 4 12 6 4 12 4 12
string& append(const char* str) 92 134 180 78 146 66 68 130 80 130
string& append(const string& str, size_t pos,size_t n) 84 142 176 64 148 60 58 132 66 132
string& append(const char* str,size_t n) 94 142 184 82 156 70 72 138 84 140
string& append(size_t n,char c) 96 144 184 84 154 72 74 140 86 138
string& assign(const string& str) 6 4 24 4 12 6 4 12 4 12
string& assign(const char* str) 92 134 180 78 146 66 68 130 80 130
string& assign(const string& str, size_t pos,size_t n) 84 142 176 64 148 60 58 132 66 132
string& assign(const char* str,size_t n) 94 142 184 82 156 70 72 138 84 140
string& assign(size_t n,char c) 96 144 184 84 154 72 74 140 86 138
string& insert(size_t pos1,const string& str) 8 22 28 10 16 8 8 16 10 16
string& insert(size_t pos1,const string& str,size_t 90 136 188 74 160 66 68 144 76 144
pos2,size_t n)
string& insert(size_t pos,const char* s,size_t n) 98 142 192 82 164 74 74 146 84 148
string& insert(size_t pos,const char* str) 94 142 184 80 156 70 72 138 82 140
string& insert(size_t pos,size_t n, char c) 100 144 192 82 162 78 76 152 84 146
iterator insert(iterator p,char c=char()) 82 134 170 68 142 58 60 124 70 126
void insert(iterator p,size_t n,char c) 84 136 174 72 142 58 62 126 74 126
string& erase(size_t pos=0,size_t n=npos) 82 134 172 70 144 58 60 128 72 128
-41-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (8)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
iterator erase(iterator position) 88 140 196 76 156 64 66 140 78 140
iterator erase(iterator first, iterator last) 96 156 200 80 172 72 68 156 82 156
string& replace(size_t pos1,size_t n1, const string& 10 22 32 10 20 10 8 20 10 20
str)
string& replace(size_t pos1,size_t n1, const char* str) 96 142 188 80 160 74 76 148 84 148
string& replace(size_t pos1,size_t n1, const string& 92 138 192 76 164 68 70 148 78 148
str,size_t pos2,size_t n2)
string& replace(size_t pos,size_t n1, const char* 100 144 196 84 168 76 78 150 86 152
str,size_t n2)
string& replace(size_t pos,size_t n1, size_t n2,char c) 102 144 196 82 166 80 78 156 84 190
string& replace(iterator i1,iterator i2,const string& str) 88 134 184 76 156 64 68 140 78 140
string& replace(iterator i1,iterator i2,const char* str) 110 162 228 100 200 86 88 182 102 184
string& replace(iterator i1,iterator i2,const char* 114 164 236 102 208 90 92 190 104 192
str,size_t n)
string& replace(iterator i1,iterator i2,size_t n,char c) 116 164 236 100 206 92 92 192 102 150
size_t copy(char* str,size_t n,size_t pos=0) const 40 44 76 42 76 40 36 76 42 76
void swap(string& str) 114 170 224 104 196 100 100 196 112 196
const char* c_str() const 0 0 0 0 0 0 0 0 0 0
const char* data() const 2 2 4 2 4 2 2 4 2 4
size_t find(const string& str,size_t pos=0) const 30 40 56 34 56 30 30 56 34 56
size_t find(const char* str,size_t pos=0) const 94 142 184 80 150 72 74 144 82 144
size_t find(const char* str,size_t pos, size_t n) const 96 142 188 80 160 74 76 148 84 148
size_t find(char c,size_t pos=0) const 94 142 188 80 156 72 72 144 80 144
size_t rfind(const string& str,size_t pos=npos) const 32 40 60 34 60 32 34 60 34 60
size_t rfind(const char* str,size_t pos=npos)const 94 142 184 80 150 76 78 152 84 152
size_t rfind(const char* str,size_t pos=npos,size_t n) 96 142 188 80 160 78 78 156 84 156
const
size_t rfind(char c,size_t pos=npos) const 94 142 188 80 156 76 76 152 82 152
size_t find_first_of(const string& str, size_t pos=0) 16 24 32 18 32 20 14 40 18 40
const
size_t find_first_of(const char* str, size_t pos=0) 94 142 184 80 150 72 72 144 82 144
size_t find_first_of(const char* str, size_t pos,size_t n) 96 142 188 80 160 74 74 148 84 148
const
size_t find_first_of(char c,size_t pos=0) const 94 142 188 80 156 72 72 144 82 144
size_t find_last_of(const string& str,size_t pos=npos) 20 24 40 18 40 24 18 48 18 48
const
size_t find_last_of(const char* str, size_t pos) const 94 142 184 80 150 78 78 156 84 156
size_t find_last_of(const char* str, size_t pos,size_t n) 96 142 188 80 160 80 78 160 84 160
const
size_t find_last_of(char c,size_t pos=npos) const 94 142 188 80 156 78 78 156 84 156
size_t find_first_not_of(const string& str,size_t pos=0) 22 24 42 18 42 26 16 48 18 50
const
size_t find_first_not_of(const char* str,size_t pos=0) 94 142 184 80 150 76 74 150 82 150
const
size_t find_first_not_of(const char* str,size_t 96 142 188 80 160 78 76 154 84 154
pos,size_t n)
size_t find_first_not_of(char c, size_t pos=0) const 94 142 188 80 156 76 74 152 82 152
size_t find_last_not_of(const string& str,size_t 24 24 46 20 46 28 20 54 20 54
pos=npos) const
size_t find_last_not_of(const char* str,size_t 94 142 184 80 150 68 72 134 82 134
pos=npos) const
size_t find_last_not_of(const char* str,size_t 96 142 188 80 160 72 74 142 82 144
pos,size_t pos=npos) const
size_t find_last_not_of(char c,size_t pos=0) const 94 142 188 80 156 70 72 142 82 140
string substr(size_t pos=0,size_t n=npos) const 104 150 204 88 176 80 84 160 92 160
int compare(const string& str) const 26 40 48 32 48 26 30 48 32 48
int compare(size_t pos1,size_t n1, const string& str) 98 142 192 82 164 74 76 168 84 148
const
int compare(size_t pos1,size_t n1, const string& 108 152 212 92 184 84 86 168 94 168
str,size_t pos2,size_t n2) const
int compare(const char* str) const 92 142 180 78 146 68 70 134 80 136
int compare(size_t pos1,size_t n1,const char* str,size_t 106 150 208 90 146 82 84 164 92 164
n2=npos) const
string operator +(const string &lhs, const string &rhs) 104 150 204 90 188 82 88 164 96 164
string operator +(const char *lhs, const string &rhs) 102 150 200 88 172 78 84 156 92 156
string operator +(char lhs,const string &rhs) 104 150 204 90 172 80 88 160 96 156
string operator +(const string &lhs, const char *rhs) 110 156 216 96 188 88 94 176 102 176

-42-
Table 3-1 Stack Size Listing of EC++ Class Libraries (regparam=2) (9)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
string operator +(const string &lhs, char rhs) 112 156 222 96 190 90 96 174 104 174
bool operator ==(const string &lhs, const string &rhs) 28 42 52 34 52 38 42 72 46 72
bool operator ==(const char *lhs, const string &rhs) 92 142 180 78 146 68 70 134 80 136
bool operator ==(const string &lhs, const char *rhs) 92 142 180 78 146 68 70 134 80 136
bool operator !=(const string &lhs, const string &rhs) 30 44 56 36 56 50 52 96 60 96
bool operator !=(const char *lhs, const string &rhs) 92 142 180 78 146 68 70 134 80 136
bool operator !=(const string &lhs, const char *rhs) 92 142 180 78 146 68 70 134 80 136
bool operator <(const string &lhs, const string &rhs) 28 42 52 34 52 38 42 72 46 72
bool operator <(const char *lhs,const string &rhs) 92 142 180 78 146 68 70 134 80 136
bool operator <(const string &lhs, const char *rhs) 92 142 180 78 146 68 70 134 80 136
bool operator >(const string &lhs, const string &rhs) 28 42 52 34 52 38 42 72 46 72
bool operator >(const char *lhs,const string &rhs) 92 142 180 78 146 68 70 134 80 136
bool operator >(const string &lhs, const char *rhs) 92 142 180 78 146 68 70 134 80 136
bool operator <=(const string &lhs, const string &rhs) 28 42 52 34 52 30 42 72 46 72
bool operator <=(const char *lhs, const string &rhs) 92 142 180 78 146 68 70 134 80 136
bool operator <=(const string &lhs, const char *rhs) 102 148 200 86 172 78 78 156 80 156
bool operator >=(const string &lhs, const string 28 42 52 34 52 38 42 72 46 72
&rhs)
bool operator >=(const char *lhs,const string &rhs) 92 142 180 78 146 68 70 134 80 136
bool operator >=(const string &lhs, const char *rhs) 92 142 180 78 146 68 70 134 80 136
void swap(string &lhs,string &rhs) 2 2 4 2 4 30 28 58 28 56
istream & operator >> (istream &is, string &str) 112 168 214 100 184 88 90 170 102 168
ostream & operator << (ostream &os, const string 50 74 94 50 82 46 40 82 50 82
&str)
istream & getline(istream &is,string & str,char delim) 114 170 216 106 186 90 90 172 104 170
istream & getline(istream &is,string &str) 118 172 222 108 192 94 92 178 106 176

-43-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (1)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
io_base void _ec2p_init_base() 2 2 4 2 4 2 2 4 2 4
void _ec2p_copy_base(ios_base& ios_base_dt) 4 4 8 4 8 4 4 8 4 8
ios_base() 2 2 4 2 4 2 2 4 2 4
~ios_base() 2 2 4 2 4 2 2 4 2 4
fmtflags flags() const 2 2 4 2 4 2 2 4 2 4
fmtflags flags(fmtflags fmtflg) 4 4 4 4 4 4 4 4 4 4
fmtflags setf(fmtflags fmtflg) 6 4 6 4 6 6 4 6 4 6
fmtflags setf(fmtflags fmtflg, fmtflags mask) 6 4 8 4 8 6 4 8 4 8
void unsetf(fmtflags mask) 2 2 4 2 4 2 2 4 2 4
char fill() const 2 2 4 2 4 2 2 4 2 4
char fill(char ch) 2 2 4 2 4 2 2 4 2 4
int precision() const 2 2 4 2 4 2 2 4 2 4
streamsize precision(streamsize preci) 4 2 8 2 8 4 2 8 2 8
streamsize width() const 2 2 4 2 4 2 2 4 2 4
streamsize width(streamsize wd) 4 2 8 2 8 4 2 8 2 8
ios ios() 2 2 4 2 4 2 2 4 2 4
ios(streambuf *sbptr) 4 4 36 4 8 4 4 8 4 8
void init(streambuf *sbptr) 8 6 14 6 14 8 6 14 6 14
virtual ~ios() 0 0 0 0 0 0 0 0 0 0
operator void*() const 0 0 0 0 0 0 0 0 0 0
bool operator !() const 0 0 0 0 0 0 0 0 0 0
iostate rdstate() const 0 0 0 0 0 0 0 0 0 0
void clear(iostate st=goodbit) 4 2 6 2 6 4 2 6 2 6
void setstate(iostate st) 4 2 6 2 6 4 2 6 2 6
bool good() const 0 0 0 0 0 0 0 0 0 0
bool eof() const 0 0 0 0 0 0 0 0 0 0
bool bad() const 0 0 0 0 0 0 0 0 0 0
bool fail() const 0 0 0 0 0 0 0 0 0 0
ostream* tie() const 0 0 0 0 0 0 0 0 0 0
ostream* tie(ostream* tstrptr) 4 2 8 2 8 4 2 8 2 8
streambuf* rdbuf() const 0 0 0 0 0 0 0 0 0 0
streambuf* rdbuf(streambuf* sbptr) 4 4 8 4 8 6 2 10 2 10
ios & copyfmt(const ios & rhs) 8 10 16 10 16 8 10 16 10 16
ios_base& boolalpha(ios_base& str) - - - - - - - - - -
ios_base& noboolalpha(ios_base& str) - - - - - - - - - -
ios_base& showbase(ios_base& str) 10 8 14 8 14 10 8 14 8 14
ios_base& noshowbase(ios_base& str) 6 6 12 6 12 6 6 12 6 12
ios_base& showpoint(ios_base& str) 10 8 14 8 14 10 8 14 8 14
ios_base& noshowpoint(ios_base& str) 6 6 12 6 12 6 6 12 6 12
ios_base& showpos(ios_base& str) 10 8 14 8 14 10 8 14 8 14
ios_base& noshowpos(ios_base& str) 6 6 12 6 12 6 6 12 6 12
ios_base& skipws(ios_base& str) 10 8 14 8 14 10 8 14 8 14
ios_base& noskipws(ios_base& str) 6 6 12 6 12 6 6 12 6 12
ios_base& uppercase(ios_base& str) 10 8 14 8 14 10 8 14 8 14
ios_base& nouppercase(ios_base& str) 6 6 12 6 12 6 6 12 6 12
ios_base& internal(ios_base& str) 10 8 16 8 16 10 8 16 8 16
ios_base& left(ios_base& str) 10 8 16 8 16 10 8 16 8 16
ios_base& right(ios_base& str) 10 8 16 8 16 10 8 16 8 16
ios_base& dec(ios_base& str) 10 8 16 8 16 10 8 16 8 16
ios_base& hex(ios_base& str) 10 8 16 8 16 10 8 16 8 16
ios_base& oct(ios_base& str) 10 8 16 8 16 10 8 16 8 16
ios_base& fixed(ios_base& str) 10 8 16 8 16 10 8 16 8 16
ios_base& scientific(ios_base& str) 10 8 16 8 16 10 8 16 8 16
streambuf char* _ec2p_getflag() const - - - - - - - - - -
char* & _ec2p_gnptr() 2 2 4 2 4 2 2 4 2 4
char* & _ec2p_pnptr() 0 0 0 0 0 0 0 0 0 0
void _ec2p_bcntplus() 8 2 4 2 4 2 2 4 2 4
void _ec2p_bcntminus() 8 2 4 2 4 2 2 4 2 4
void _ec2p_setbptr(char** begptr, char** 10 2 20 2 20 10 2 20 2 20
curptr,long* cntptr,long* lenptr,char* flgptr)
streambuf() 4 4 8 4 8 4 4 8 4 8
virtual ~streambuf() 0 0 0 0 0 0 0 0 0 0
streambuf* pubsetbuf(char* s, streamsize n) 18 34 36 8 16 8 8 16 8 16

-44-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (2)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
pos_type pubseekoff(off_type off, ios _base::seekdir 30 34 40 14 20 18 14 22 14 20
way, ios_base::openmode
which=ios_base::in|ios_base::out)
pos_type pubseekpos(pos_type sp, 30 34 40 14 20 18 14 22 14 20
ios_base::openmode which=ios_base::in |
ios_base::out)
int pubsync() 4 4 36 4 8 4 4 8 4 8
streamsize in_avail() 18 34 36 16 16 8 10 16 16 16
int_type snextc() 2 2 4 2 4 2 2 4 2 4
int_type sbumpc() 14 22 28 18 24 12 14 24 18 24
int_type sgetc() 14 22 28 18 28 14 14 28 18 28
int sgetn(char* s,streamsize n) 14 6 28 6 24 12 6 24 6 24
int_type sputbackc(char c) 14 20 28 20 28 14 16 28 20 28
int sungetc() 12 20 28 16 20 10 12 20 16 20
int sputc(char c) 14 22 24 20 28 14 16 26 20 28
int_type sputn(const char* s, streamsize n) 14 6 28 6 24 12 6 24 6 24
char* eback() const 2 2 4 2 4 2 2 4 2 4
char* gptr() const 2 2 4 2 4 2 2 4 2 4
char* egptr() const 4 4 8 4 8 4 4 8 4 8
void gbump(int n) 14 6 20 6 16 12 6 16 6 16
void setg(char* gbeg,char* gnext, char* gend) 18 34 36 12 12 8 6 12 12 12
char* pbase() const 0 0 0 0 0 0 0 0 0 0
char* pptr() const 2 2 4 2 4 2 2 4 2 4
char* epptr() const 4 4 8 4 8 4 4 8 4 8
void pbump( int n) 14 6 20 6 16 12 6 16 6 16
void setp(char* pbeg,char* pend) 18 34 36 12 12 4 10 12 12 12
virtual streambuf *setbuf(char* s, streamsize n) 2 2 4 2 4 2 2 4 2 4
virtual pos_type seekoff(off_type off, 12 2 4 2 4 12 2 4 2 4
ios_base::seekdir way,
ios_base::openmode=(ios_base::openmode)
(ios_base::in | ios_base::out))
virtual pos_type seekpos(pos_type sp, 10 2 4 2 4 10 2 4 2 4
ios_base::openmode=(ios_base::openmode)
(ios_base::in | ios_base::out))
virtual int sync() 2 2 4 2 4 2 2 4 2 4
virtual int showmanyc() 2 2 4 2 4 2 2 4 2 4
virtual streamsize xsgetn(char* s, streamsize n) 44 38 82 42 82 44 38 74 42 74
virtual int_type underflow() 2 2 4 2 4 2 2 4 2 4
virtual int_type uflow() 6 18 20 8 16 6 8 12 8 16
virtual int_type pbackfail(int type c=eof) 2 2 4 2 4 2 2 4 2 4
virtual streamsize xsputn( const char* s,streamsize n) 40 38 76 42 76 44 38 74 42 74
virtual int_type overflow(int type c=eof) 2 2 4 2 4 2 2 4 2 4
istream sentry(istream &is, bool noskipws=_FALSE) 24 40 48 34 48 24 26 48 34 48
::sentry ~sentry() 0 0 0 0 0 0 0 0 0 0
operator bool() 2 2 4 2 4 2 2 4 2 4
istream int::_ec2p_getistr(char* str, unsigned int dig,int 34 40 58 38 58 34 34 62 38 62
mode)
istream(streambuf *sb) 4 4 36 4 8 4 4 6 4 8
~istream() 0 0 0 0 0 0 0 0 0 0
istream& operator >>(bool &n) 120 106 130 96 122 118 90 126 96 126
istream& operator >>(short &n) 120 106 130 96 122 118 90 126 96 126
istream& operator >>(unsigned short &n) 124 96 122 94 122 122 90 126 94 126
istream& operator >>(int &n) 522 494 588 472 570 520 454 562 470 556
istream& operator >>(unsigned int &n) 124 96 122 94 122 122 90 126 94 126
istream& operator >>(long &n) 520 494 588 472 572 518 458 564 470 558
istream& operator >>(unsigned long &n) 124 96 122 94 122 122 90 126 94 126
istream& operator >>(float &n) 462 434 492 410 484 452 392 474 408 476
istream& operator >>(double &n) 462 434 492 410 484 452 392 474 408 476
istream& operator >>(long double &n) 462 434 492 410 484 452 392 474 408 476
istream& operator >>(void* &p) 128 100 126 96 126 126 94 130 94 130
istream& operator >>(streambuf *sb) 70 92 106 84 106 70 74 104 84 106
streamsize gcount() const 0 0 0 0 0 0 0 0 0 0
int_type get() 32 60 70 46 62 32 36 62 46 62
istream& get(char &c) 36 60 70 50 66 34 38 66 50 66
istream& get(signed char &c) 2 2 4 2 4 10 12 18 16 18

-45-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (3)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
istream& get(unsigned char &c) 2 2 4 2 4 10 12 18 16 18
istream& get(char* s,streamsize n) 44 62 102 54 102 64 68 136 76 136
istream& get(signed char* s, streamsize n) 50 64 110 56 110 86 88 178 96 178
istream& get(unsigned char* s, streamsize n) 50 64 110 56 110 86 88 178 96 178
istream& get(char* s,streamsize n, char delim) 50 62 96 58 96 56 56 102 60 102
istream& get(signed char* s, streamsize n,char delim) 56 64 104 60 104 78 76 144 80 144
istream& get(unsigned char* s, streamsize n,char 56 64 104 60 104 78 76 144 80 144
delim)
istream& get(streambuf &sb) 2 2 4 2 4 2 2 4 2 4
istream& get(streambuf &sb,char delim) 40 60 76 52 76 40 42 76 52 76
istream& getline(char* s,streamsize n) 4 2 6 2 6 18 20 34 20 34
istream& getline(signed char* s, streamsize n) 4 2 6 2 6 18 20 34 20 34
istream& getline(unsigned char* s, streamsize n) 4 2 6 2 6 18 20 34 20 34
istream& getline(char* s,streamsize n,char delim) 40 60 96 52 96 46 48 102 56 102
istream& getline(signed char* s, streamsize n,char 46 62 104 54 104 68 68 144 76 144
delim)
istream& getline(unsigned char* s, streamsize n,char 46 62 104 54 104 68 68 144 76 144
delim)
istream& ignore(unsigned streamsize n=1, int_type 38 60 72 50 72 38 42 72 50 72
delim=streambuf::eof)
int_type peek() 32 48 70 42 62 32 34 62 42 62
istream& read(char* s,streamsize n) 44 60 86 50 86 44 42 86 50 86
istream& read(signed char* s, streamsize n) 2 2 90 2 90 20 14 124 16 124
istream& read(unsgined char* s, streamsize n) 2 2 90 2 90 20 14 124 16 124
streamsize readsome(char* s, streamsize n) 42 60 86 54 86 42 46 86 54 86
streamsize readsome(signed char* s, streamsize n) 44 62 90 56 90 44 48 90 56 90
streamsize readsome(unsigned char* s, 44 62 90 56 90 44 48 90 56 90
streamsize n)
istream& putback(char c) 36 60 70 50 66 34 36 64 50 66
istream& unget() 32 48 70 42 62 32 34 62 42 62
int sync() 36 60 70 46 66 34 36 66 46 66
pos_type tellg() 50 60 70 50 70 50 40 70 50 70
istream& seekg(pos_type & pos) 48 60 82 50 82 48 42 80 50 82
istream& seekg(off_type &off, ios_base::seekdir dir) 54 68 82 62 82 54 54 82 62 82
istream& ws(istream &is) 36 60 70 46 66 34 36 66 46 66
istream& operator >>(istream& in,char* s) 38 60 74 52 74 38 42 78 52 78
istream& operator >>(istream& in, signed char* s) 40 62 78 54 78 40 44 82 54 82
istream& operator >>(istream& in, unsigned char* s) 40 62 78 54 78 40 44 82 54 82
istream& operator >> (istream& in, char &s) 36 60 70 50 66 34 38 66 50 66
istream& operator >> (istream& in, singed char &s) 2 2 4 2 4 10 12 18 16 18
istream& operator >> (istream& in, unsigned char &s) 2 2 4 2 4 10 12 18 16 18
ostream::s sentry(ostrream &os) 24 38 46 26 40 22 18 40 26 40
entry
~sentry() 18 24 34 16 30 16 14 30 16 30
operator bool() 2 2 4 2 4 2 2 4 2 4
ostream ostream(streambuf *sbptr) 4 4 36 4 8 4 4 6 4 8
~ostream() 0 0 0 0 0 0 0 0 0 0
ostream & operator << (bool &n) 4 4 36 4 8 4 4 6 4 8
ostream & operator << (short n) 830 784 882 758 862 792 736 832 740 834
ostream & operator << (unsigned short n) 830 784 882 758 862 792 736 832 740 834
ostream & operator << (int n) 830 784 882 758 862 792 736 832 740 834
ostream & operator << ( unsigned int n) 830 784 882 758 862 792 736 832 740 834
ostream & operator << (long n) 830 784 882 758 862 794 736 832 740 834
ostream & operator << (unsigned long n) 830 784 882 758 862 794 736 832 740 834
ostream & operator << (float n) 914 874 978 846 958 878 822 930 828 930
ostream & operator << (double n) 910 862 978 842 954 874 818 926 824 926
ostream & operator << (long double n) 910 862 978 842 954 874 818 926 824 926
ostream & operator << (void *n) 770 720 818 702 802 734 678 774 684 774
ostream & operator << (streambuf *sbptr) 74 92 110 78 104 70 68 100 78 100
ostream & put(char c) 14 22 26 18 22 12 12 20 18 22
ostream & write(const char* s, streamsize n) 48 60 92 46 86 46 36 86 46 86
ostream & write(signed char* s, streamsize n) 2 2 96 2 90 22 16 128 18 128
ostream & write(unsigned char* s, streamsize n) 2 2 96 2 90 22 16 128 18 128
ostream & flush() 14 20 26 12 22 12 10 22 12 22

-46-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (4)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
pos_type tellp() 20 18 20 14 20 20 12 20 14 20
ostream & seekp(pos_type& pos) 22 18 28 10 28 22 10 28 10 28
ostream & seekp(off_type & off, seekdir dir) 28 18 32 18 32 28 18 32 18 32
ostream & endl(ostream &os) 42 64 80 48 70 50 46 90 64 92
ostream & ends(ostream &os) 42 64 80 48 70 46 42 82 62 84
ostream & flush(ostream &os) 4 4 8 4 8 10 10 20 14 20
ostream& operator <<(ostream& os,char s) 42 64 80 48 70 38 34 68 48 70
ostream& operator <<(ostream& os, signed char s) 42 64 80 48 70 38 34 68 48 70
ostream& operator <<(ostream& os, unsigned char s) 42 64 80 48 70 38 34 68 48 70
ostream& operator << (ostream& os, const char* s 46 50 108 48 88 46 44 88 48 90
ostream& operator << (ostream& os, signed char* s) 2 2 4 2 4 10 10 18 10 18
ostream& operator << (ostream& os, unsigned char* s) 2 2 4 2 4 10 10 18 10 18
smanip smanip resetiosflags(ios_base::fmtflags mask) 30 32 64 36 52 20 22 34 22 34
smanip setiosflags(ios_base::fmtflags mask) 28 30 60 34 46 18 22 28 20 32
smanip setbase(int base) 34 36 68 40 58 34 38 58 42 58
smanip setfill(char c) 34 36 68 40 58 34 38 58 42 58
smanip setprecision(int n) 34 36 68 40 60 34 38 60 42 60
smanip setw(int n) 34 36 68 40 60 34 38 60 42 60
mystrbuf mystrbuf() 2 2 4 2 4 2 2 4 2 4
mystrbuf(void *ptr) 4 4 36 4 8 4 4 8 4 8
~mystrbuf() 4 4 36 4 8 4 4 8 4 8
void *myfptr() const 0 0 0 0 0 0 0 0 0 0
mystrbuf *open(const char* filename, int mode) 56 76 130 54 102 48 48 100 56 100
mystrbuf *close() 40 64 88 38 48 30 30 54 38 52
virtual streambuf *setbuf(char* s, stremsize n) 32 40 64 18 32 18 14 28 18 32
virtual pos_type seekoff(pos_type off, 54 64 74 42 54 44 40 52 42 54
ios_base::seekdir way,
ios_base::openmode=(ios_base::openmode)(ios_base::
in | ios_base::out))
virtual pos_type seekpos(pos_type sp, 50 64 74 38 50 40 36 50 38 50
ios_base::openmode=(ios_base::openmode)
(ios_base::in | ios_base::out))
virtual int sync() 42 50 62 32 42 32 32 42 32 42
virtual int showmanyc() 2 2 4 2 4 2 2 4 2 4
virtual int_type underflow() 80 108 158 78 130 62 64 114 80 122
virtual int_type pbackfail(int type c=streambuf::eof) 60 84 136 54 112 48 48 94 56 104
virtual int_type overflow(int type c=streambuf::eof) 78 102 152 68 124 60 54 102 70 116
void _init(_f_type * fp) 14 6 28 6 28 14 6 28 6 28
new void* operator new(size_t size) 46 72 92 38 76 28 32 64 40 68
void* operator new[](size_t size) 48 74 96 40 80 30 34 68 42 72
void* operator new(size_t size,void *ptr) 2 2 4 2 4 2 2 4 2 4
void* operator new[](size_t size, void *ptr) 2 2 4 2 4 2 2 4 2 4
void operator delete(void* ptr) 8 8 16 8 16 8 8 16 8 8
void operator delete[](void* ptr) 2 2 4 2 4 2 2 4 2 4
new_handler set_new_handler(new_handler new_P) 2 2 4 2 4 2 2 4 2 4
float_ float_complex(float re=0.0f,float im=0.0f) 6 0 0 0 0 6 0 0 0 0
complex float_complex(const double_complex& rhs) 42 48 52 44 48 42 42 52 44 52
float real() const 0 0 0 0 0 0 0 0 0 0
float imag() const 6 2 4 2 4 6 2 4 2 4
float_complex& operator=(float rhs) 6 0 0 0 0 6 0 0 0 0
float_complex& operator+=(float rhs) 26 34 36 26 28 26 24 28 26 28
float_complex& operator-=(float rhs) 26 34 36 26 28 26 24 28 26 28
float_complex& operator*=(float rhs) 38 34 36 26 28 38 24 28 26 28
float_complex& operator/=(float rhs) 38 38 40 30 32 38 28 32 30 32
float_complex& operator=(const float_complex&rhs) 12 4 4 4 4 8 4 4 4 4
float_complex& operator+=(const float_complex& 28 34 36 30 32 28 28 32 30 32
rhs)
float_complex& operator-=(const float_complex& rhs) 28 34 36 30 32 28 28 32 30 32
float_complex& operator*=(const float_complex& 72 48 52 48 52 72 46 52 48 52
rhs)
float_complex& operator/=(const float_complex& rhs) 76 52 56 52 56 72 50 56 52 56
float_complex operator+(const float_complex& lhs) 36 38 52 42 52 38 44 56 48 56
float_complex operator+(const float_complex& lhs, 52 54 64 52 64 52 52 64 56 64
const float_complex& rhs)

-47-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (5)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
float_complex operator+(const float_complex& 48 54 64 52 64 52 50 64 54 64
lhs,const float& rhs)
float_complex operator+(const float& lhs,const 52 54 64 52 60 54 48 60 52 60
float_complex& rhs)
float_complex operator-(const float_complex& lhs) 50 40 52 44 52 52 40 52 44 52
float_complex operator-(const float_complex& 52 54 64 52 64 52 52 64 56 64
lhs,const float_complex& rhs)
float_complex operator-(const float_complex& 48 54 64 52 64 52 48 64 52 64
lhs,const float& rhs)
float_complex operator-(const float& lhs,const 52 54 64 52 60 54 48 60 52 60
float_complex& rhs)
float_complex operator*(const float_complex& 100 84 92 80 88 130 94 104 96 104
lhs,const float_complex& rhs)
float_complex operator*(const float_complex& 60 54 64 52 60 64 48 60 52 60
lhs,const float& rhs)
float_complex operator*(const float& lhs,const 104 84 92 74 84 128 88 100 92 100
float_complex& rhs)
float_complex operator/ (const float_complex& 104 88 96 84 92 100 80 92 84 92
lhs,const float_complex& rhs)
float_complex operator/ (const float_complex& 60 58 64 54 60 64 50 60 54 60
lhs,const float& rhs)
float_complex operator/ (const float& lhs,const 108 88 96 78 88 106 76 88 78 88
float_complex& rhs)
float_complex operator==(const float_complex& 38 30 36 30 36 36 26 36 30 36
lhs,const float_complex& rhs)
float_complex operator==(const float_complex& 30 26 32 22 24 28 18 24 22 24
lhs,const float& rhs)
float_complex operator== (const float& lhs,const 30 26 32 18 24 28 16 24 18 24
float_complex& rhs)
float_complex operator!=(const float_complex& 38 30 36 30 36 36 26 36 30 36
lhs,const float_complex& rhs)
float_complex operator!=(const float_complex& 30 26 32 22 24 28 18 24 22 24
lhs,const float& rhs)
float_complex operator!=(const float& lhs,const 30 26 32 22 28 28 18 28 22 28
float_complex& rhs)
istream& operator>>(istream& is, float_complex& x) 512 476 536 450 528 502 432 518 448 520
ostream& operator<<(ostream& os, float_complex& 932 892 998 860 974 892 834 946 842 946
x)
float real(const float_complex& x) 10 6 8 6 8 8 6 8 6 8
float imag(const float_complex& x) 10 6 8 6 8 10 6 8 6 8
float abs(const float_comlex& x) 94 70 80 62 72 96 70 80 72 80
float arg(const float_complex& x) 254 264 318 284 308 258 264 310 296 316
float norm(const float_complex& x) 102 106 112 102 112 100 102 112 102 112
float_complex conj(const float_complex& x) 46 40 52 44 52 48 40 52 44 52
float_complex polar(const float& rho, const float& 132 130 162 150 152 130 132 158 162 160
theta)
float_complex cos(const float_complex& x) 240 244 270 266 272 240 240 270 268 272
float_complex cosh(const float_complex& x) 284 288 318 300 312 328 312 346 340 348
float_complex exp(const float_complex&) 180 176 198 200 200 180 174 198 200 200
float_complex log(const float_complex& x) 290 300 358 316 344 294 294 346 328 352
float_complex log10(const float_complex& x) 290 300 358 316 344 294 294 346 328 352
float_complex pow(const float_complex& x,int y) 338 356 418 370 400 340 344 402 384 408
float_complex pow(const float_complex& x,const 334 352 414 364 396 336 338 398 376 404
float& y)
float_complex pow(const float_complex& x,const 334 352 414 364 396 336 338 398 376 404
float_complex& y)
float_complex pow(const float& x,const 224 224 250 244 248 222 214 246 244 248
float_complex& y)
float_complex sin(const float_complex& x) 236 244 270 266 272 236 240 270 268 272
float_complex sinh(const float_complex& x) 396 304 334 316 328 334 328 362 356 364
float_complex sqrt(const float_complex& x) 394 300 358 316 344 298 296 346 328 352
float_complex tan(const float_complex& x) 284 296 326 316 328 284 286 326 320 328
float_complex tanh(const float_complex& x) 340 356 390 366 384 378 374 418 408 420
double_ double_complex(double re=0.0,double im=0.0) 38 40 44 40 44 34 34 36 34 36
complex double_complex(const float_complex&) 44 46 54 50 54 34 34 36 34 36
double rear() const 10 8 8 8 8 10 8 8 8 8
double imag() const 10 12 20 12 20 12 16 24 16 24
double_complex& operator=(double rhs) 14 16 20 16 20 10 10 12 10 12

-48-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (6)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
double_complex& operator+=(double rhs) 50 38 42 40 44 50 38 42 40 44
double_complex& operator-=(double rhs) 50 56 62 58 64 50 56 62 58 64
double_complex& operator*=(double rhs) 58 64 68 64 68 58 64 68 64 68
double_complex& operator/=(double rhs) 58 40 44 40 44 58 40 44 40 44
double_complex& operator=(const double_complex& 24 26 52 26 32 20 20 24 20 24
rhs)
double_complex& operator+=(const 60 48 62 50 66 60 48 54 50 56
double_complex& rhs)
double_complex& operator-=(const double_complex& 60 66 82 68 76 60 66 74 68 76
rhs)
double_complex& operator*=(const 0 0 0 0 0 0 0 0 0 0
double_complex& rhs)
double_complex& operator/=(const double_complex& 194 208 212 204 208 194 202 212 204 212
rhs)
double_complex operator+(const double_complex& 52 54 68 58 68 54 60 72 64 72
lhs)
double_complex operator+(const double_complex& 96 84 102 86 96 100 90 102 94 104
lhs,const double_complex& rhs)
double_complex operator+(const double_complex& 88 76 94 78 88 92 84 94 86 96
lhs,const double& rhs)
double_complex operator+(const double& lhs,const 112 100 118 102 112 116 106 118 110 120
double_complex& rhs)
double_complex operator-(const double_complex& 86 88 112 92 104 88 96 108 100 108
lhs)
double_complex operator-(const double_complex& 96 102 122 104 116 100 108 122 112 124
lhs,const double_complex& rhs)
double_complex operator-(const double_complex& 88 94 114 96 108 92 102 114 104 116
lhs,const double& rhs)
double_complex operator-(const double& lhs,const 112 118 138 120 132 116 124 138 128 140
double_complex& rhs)
double_complex operator*(const double_complex& 160 182 192 174 188 218 230 252 236 252
lhs,const double_complex& rhs)
double_complex operator*(const double_complex& 96 102 120 102 112 100 110 120 110 120
lhs,const double& rhs)
double_complex operator*(const double& lhs,const 172 186 208 182 200 226 236 260 240 260
double_complex& rhs)
double_complex operator/ (const double_complex& 238 260 268 252 260 238 250 268 256 268
lhs,const double_complex& rhs)
double_complex operator/ (const double_complex& 96 78 96 78 88 100 86 96 86 96
lhs,const double& rhs)
double_complex operator/ (const double& lhs,const 250 264 284 260 272 254 264 284 268 284
double_complex& rhs)
bool operator==(const double_complex& lhs,const 54 76 80 74 80 54 70 80 74 80
double_complex& rhs)
bool operator==(const double_complex& lhs,const 38 60 64 58 64 38 54 64 58 64
double& rhs)
bool operator==(const double& lhs,const 38 60 64 58 64 38 54 64 58 64
double_complex& rhs)
bool operator!=(const double_complex& lhs,const 54 76 80 74 80 54 70 80 74 80
double_complex& rhs)
bool operator!=(const double_complex& lhs,const 38 60 64 58 64 38 54 64 58 64
double& rhs)
bool operator!=(const double& lhs,const 38 60 64 58 64 38 54 64 58 64
double_complex& rhs)
istream& operator>>(istream& is, double_complex& 574 552 616 526 608 564 504 598 524 600
x)
ostream& operator<<(ostream& os, double_complex& 936 896 1014 872 986 900 846 962 854 962
x)
double real(const double_complex& x) 18 20 28 20 28 20 26 32 26 32
double imag(const double_complex& x) 18 20 28 20 28 20 26 32 26 32
double abs(const double_comlex& x) 116 186 194 182 194 168 188 202 194 206
double arg(const double_complex& x) 28 30 48 30 40 28 34 40 34 40
double norm(const double_complex& x) 104 110 128 110 120 104 114 120 114 120
double_complex conj(const double_complex& x) 86 88 112 92 104 88 96 108 100 108
double_complex polar(const double& rho, const 136 152 160 144 152 132 136 152 144 152
double& theta)
double_complex cos(const double_complex& x) 164 178 184 176 184 164 176 184 178 184
double_complex cosh(const double_complex& x) 256 278 288 272 284 360 380 392 382 382
double_complex exp(const double_complex&) 172 186 192 184 192 172 184 192 186 192

-49-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (7)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
double_complex log(const double_complex& x) 230 250 274 246 266 232 254 274 260 278
double_complex log10(const double_complex& x) 230 250 274 246 266 232 254 274 260 278
double_complex pow(const double_complex& x,int y) 314 342 370 336 358 314 340 366 352 370
double_complex pow(const double_complex& x,const 306 334 362 326 350 306 330 358 340 362
double& y)
double_complex pow(const double_complex& x,const 306 334 362 326 350 306 330 358 340 362
double_complex& y)
double_complex pow(const double& x, const 240 262 272 256 268 238 252 268 258 268
double_complex& y)
double_complex sin(const double_complex& x) 156 170 176 168 176 156 168 176 170 176
double_complex sinh(const double_complex& x) 284 314 328 304 324 438 456 484 464 484
double_complex sqrt(const double_complex& x) 246 266 290 262 282 248 270 290 276 294
double_complex tan(const double_complex& x) 314 344 356 334 348 314 328 356 340 356
double_complex tanh(const double_complex& x) 360 398 416 386 412 514 534 572 548 572
string string(void) 2 2 4 2 4 2 2 4 2 4
string(const string& str,size_t pos=0, size_t n=npos) 20 34 36 12 20 10 10 20 12 20
string(const char*str,size_t n) 18 34 36 12 12 6 6 12 12 12
string(const char* str) 4 4 36 4 8 4 4 8 4 8
string(size_t n,char c) 18 34 36 8 12 6 6 10 8 12
~string() 4 4 36 4 8 4 4 8 4 8
string& operator=(const string& str) 8 8 16 8 16 12 12 24 18 24
string& operator=(const char* str) 80 116 156 76 136 60 64 124 78 128
string& operator=(char c) 80 116 158 78 140 62 66 130 80 132
iterator begin() 0 0 0 0 0 0 0 0 0 0
const_iterator begin() const 0 0 0 0 0 0 0 0 0 0
iterator end() 0 0 0 0 0 0 0 0 0 0
const_iterator end() const 0 0 0 0 0 0 0 0 0 0
size_t size() const 2 2 4 2 4 2 2 4 2 4
size_t length() const 0 0 0 0 0 0 0 0 0 0
size_t max_size() const 0 0 0 0 0 0 0 0 0 0
void resize(size_t n,char c) 70 110 144 64 124 50 56 110 66 116
void resize(size_t n) 2 2 148 2 128 2 2 114 2 120
size_t capacity() const 0 0 0 0 0 0 0 0 0 0
void reserve(size_t res_arg = 0) 70 110 144 68 124 50 54 112 70 116
void clear() 86 134 184 84 160 72 72 156 90 160
bool empty() const 0 0 0 0 0 0 0 0 0 0
const char & operator[](size_t pos) const 2 2 4 2 4 2 2 4 2 4
char & operator[](size_t pos) 0 0 0 0 0 0 0 0 0 0
const char & at(size_t pos) const 2 2 4 2 4 4 2 8 2 8
char & at(size_t pos) 0 0 0 0 0 0 0 0 0 0
string& operator+=(const string& str) 8 8 16 8 16 12 12 24 18 24
string& operator+=(const char* str) 80 116 156 76 136 60 64 124 78 128
string& operator+=(char c) 80 116 158 78 140 62 66 130 80 132
string& append(const string& str) 4 4 8 4 8 4 4 8 4 8
string& append(const char* str) 80 116 156 64 136 60 64 124 78 128
string& append(const string& str, size_t pos,size_t n) 72 110 148 78 132 54 56 120 66 132
string& append(const char* str,size_t n) 80 116 156 76 140 62 66 128 80 124
string& append(size_t n,char c) 82 118 158 80 140 64 68 130 82 132
string& assign(const string& str) 4 4 8 4 8 4 4 8 4 8
string& assign(const char* str) 80 116 156 64 136 60 64 124 78 128
string& assign(const string& str, size_t pos,size_t n) 72 110 148 78 132 54 56 120 66 124
string& assign(const char* str,size_t n) 80 116 156 76 140 62 66 128 80 132
string& assign(size_t n,char c) 82 118 158 80 140 64 68 130 82 132
string& insert(size_t pos1,const string& str) 6 6 20 6 12 6 6 12 6 12
string& insert(size_t pos1,const string& str,size_t 80 110 164 72 148 62 64 136 74 140
pos2,size_t n)
string& insert(size_t pos,const char* s,size_t n) 84 116 164 78 148 66 68 136 80 140
string& insert(size_t pos,const char* str) 80 116 156 76 140 62 66 128 80 132
string& insert(size_t pos,size_t n, char c) 86 116 166 78 146 68 70 138 80 138
iterator insert(iterator p,char c=char()) 74 110 150 68 134 54 58 138 70 122
void insert(iterator p,size_t n,char c) 72 110 146 70 130 54 58 118 72 122
string& erase(size_t pos=0,size_t n=npos) 70 110 144 68 128 52 56 116 70 120
iterator erase(iterator position) 76 116 164 74 140 58 62 128 76 132
iterator erase(iterator first, iterator last) 80 128 164 78 148 62 64 136 80 140

-50-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (8)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
string& replace(size_t pos1,size_t n1, const string& 8 6 24 6 16 8 6 16 6 16
str)
string& replace(size_t pos1,size_t n1, const char* str) 84 116 164 94 148 66 70 136 80 140
string& replace(size_t pos1,size_t n1, const string& 80 110 164 72 148 62 64 136 74 140
str,size_t pos2,size_t n2)
string& replace(size_t pos,size_t n1, const char* 88 116 212 78 156 70 70 144 80 148
str,size_t n2)
string& replace(size_t pos,size_t n1, size_t n2,char c) 90 116 214 78 154 72 72 146 80 146
string& replace(iterator i1,iterator i2,const string& str) 80 110 164 72 148 62 64 136 74 140
string& replace(iterator i1,iterator i2,const char* str) 100 134 204 94 188 82 82 176 96 180
string& replace(iterator i1,iterator i2,const char* 104 134 212 94 196 86 84 184 96 188
str,size_t n)
string& replace(iterator i1,iterator i2,size_t n,char c) 106 134 174 94 194 88 86 186 96 186
size_t copy(char* str,size_t n,size_t pos=0) const 32 38 60 38 60 32 32 60 38 60
void swap(string& str) 98 140 192 100 176 92 94 186 108 184
const char* c_str() const 0 0 0 0 0 0 0 0 0 0
const char* data() const 2 2 4 2 4 2 2 4 2 4
size_t find(const string& str,size_t pos=0) const 24 34 46 32 46 24 28 46 32 46
size_t find(const char* str,size_t pos=0) const 80 116 156 76 140 66 68 136 78 140
size_t find(const char* str,size_t pos, size_t n) const 84 116 164 76 148 68 70 140 80 144
size_t find(char c,size_t pos=0) const 82 116 165 76 144 66 68 136 78 140
size_t rfind(const string& str,size_t pos=npos) const 28 34 54 32 54 28 32 54 32 54
size_t rfind(const char* str,size_t pos=npos)const 80 116 156 76 140 70 72 144 80 148
size_t rfind(const char* str,size_t pos=npos,size_t n) 84 116 164 76 148 72 72 148 80 152
const
size_t rfind(char c,size_t pos=npos) const 82 116 164 78 144 70 72 144 80 148
size_t find_first_of(const string& str, size_t pos=0) 16 20 32 18 32 18 14 36 18 36
const
size_t find_first_of(const char* str, size_t pos=0) 80 116 156 76 140 66 68 136 80 140
size_t find_first_of(const char* str, size_t pos,size_t n) 84 116 164 76 148 68 68 140 80 144
const
size_t find_first_of(char c,size_t pos=0) const 82 116 164 78 144 66 68 136 80 140
size_t find_last_of(const string& str,size_t pos=npos) 20 20 40 18 40 22 18 44 18 44
const
size_t find_last_of(const char* str, size_t pos) const 80 116 156 76 140 70 72 144 80 148
size_t find_last_of(const char* str, size_t pos,size_t n) 84 116 164 76 148 72 72 148 80 152
const
size_t find_last_of(char c,size_t pos=npos) const 82 116 164 78 144 70 72 144 80 148
size_t find_first_not_of(const string& str,size_t pos=0) 18 20 34 18 34 20 16 38 18 38
const
size_t find_first_not_of(const char* str,size_t pos=0) 80 116 156 76 140 68 70 140 80 144
const
size_t find_first_not_of(const char* str,size_t 84 116 164 76 148 70 70 148 80 150
pos,size_t n)
size_t find_first_not_of(char c, size_t pos=0) const 82 116 164 78 144 68 70 140 80 144
size_t find_last_not_of(const string& str,size_t 22 20 42 20 42 24 20 46 20 46
pos=npos) const
size_t find_last_not_of(const char* str,size_t 80 116 156 76 140 62 66 128 78 132
pos=npos) const
size_t find_last_not_of(const char* str,size_t 84 116 164 76 148 66 68 136 78 140
pos,size_t pos=npos) const
size_t find_last_not_of(char c,size_t pos=0) const 82 116 164 78 144 64 68 136 80 136
string substr(size_t pos=0,size_t n=npos) const 90 124 176 84 160 72 76 148 86 152
int compare(const string& str) const 20 34 38 30 38 20 28 38 30 38
int compare(size_t pos1,size_t n1, const string& str) 84 116 164 78 148 66 70 136 80 140
const
int compare(size_t pos1,size_t n1, const string& 94 122 184 86 168 76 80 156 88 160
str,size_t pos2,size_t n2) const
int compare(const char* str) const 80 116 156 76 136 62 66 128 78 132
int compare(size_t pos1,size_t n1,const char* str,size_t 92 122 180 84 164 74 78 152 86 156
n2=npos) const
string operator +(const string &lhs, const string &rhs) 92 124 180 86 164 76 80 156 88 160
string operator +(const char *lhs, const string &rhs) 90 124 176 84 160 72 76 148 86 152
string operator +(char lhs,const string &rhs) 92 124 180 86 160 74 80 152 88 152
string operator +(const string &lhs, const char *rhs) 98 130 192 92 176 82 86 168 94 172
string operator +(const string &lhs, char rhs) 100 130 198 94 178 84 90 166 98 170
bool operator ==(const string &lhs, const string &rhs) 22 36 42 32 80 30 70 58 44 58

-51-
Table 3-2 Stack Size Listing of EC++ Class Libraries (regparam=3) (9)
Stack Size (byte)
class function Size Priority Speed Priority
300 300H 300H H8S H8S 300 300H 300H H8S H8S
NML ADV NML ADV NML ADV NML ADV
bool operator ==(const char *lhs, const string &rhs) 80 116 156 76 64 62 54 128 78 132
bool operator ==(const string &lhs, const char *rhs) 80 116 156 76 64 62 54 128 78 132
bool operator !=(const string &lhs, const string &rhs) 24 38 46 34 80 54 70 80 58 78
bool operator !=(const char *lhs, const string &rhs) 80 116 156 76 64 38 54 64 78 132
bool operator !=(const string &lhs, const char *rhs) 80 116 156 76 64 38 54 64 78 132
bool operator <(const string &lhs, const string &rhs) 22 36 42 32 42 30 40 58 44 58
bool operator <(const char *lhs,const string &rhs) 80 116 156 76 136 62 66 128 78 132
bool operator <(const string &lhs, const char *rhs) 80 116 156 76 136 62 66 128 78 132
bool operator >(const string &lhs, const string &rhs) 22 36 42 32 42 30 40 58 44 58
bool operator >(const char *lhs,const string &rhs) 80 116 156 76 136 62 66 128 78 132
bool operator >(const string &lhs, const char *rhs) 80 116 156 76 136 62 66 128 78 132
bool operator <=(const string &lhs, const string &rhs) 22 36 42 32 42 30 40 58 44 58
bool operator <=(const char *lhs, const string &rhs) 80 116 156 76 136 62 66 128 78 132
bool operator <=(const string &lhs, const char *rhs) 90 122 176 84 160 72 76 148 86 152
bool operator >=(const string &lhs, const string 22 36 42 32 42 30 40 58 44 58
&rhs)
bool operator >=(const char *lhs,const string &rhs) 80 116 156 76 136 62 66 128 78 132
bool operator >=(const string &lhs, const char *rhs) 80 116 156 76 136 62 66 128 78 132
void swap(string &lhs,string &rhs) 2 2 4 2 4 30 28 58 108 184
istream & operator >> (istream &is, string &str) 96 138 184 96 166 78 84 156 98 158
ostream & operator << (ostream &os, const string 48 60 92 46 86 46 36 86 46 86
&str)
istream & getline(istream &is,string & str,char delim) 98 140 186 100 168 80 84 158 100 160
istream & getline(istream &is,string &str) 100 142 190 102 172 82 86 162 102 164

-52-
4.Stack Size Listing of Runtime Routines
Table 4 Stack Size Listing of Runtime Routines (1)
stack size (byte)
No. routine H8/300 H8/300H H8/300H H8S H8S
Normal mode Advanced mode Normal mode Advanced mode
1 $ADDD$3 40 28 30 30 32
2 $ADDF$3 20 18 20 18 20
3 $ADDL$3 6 - - - -
4 $ANDL$3 6 6 8 6 8
5 $BFINC$3 6 6 8 6 8
6 $BFINCR$3 6 8 10 10 12
7 $BFINI$3 8 10 12 10 12
8 $BFINIR$3 8 14 16 14 16
9 $BFINL$3 12 14 16 14 16
10 $BFINLR$3 - 4 6 4 6
11 $BFSC$3 4 4 6 4 6
12 $BFSI$3 4 8 10 8 10
13 $BFSL$3 14 4 6 4 6
14 $BFUC$3 4 4 6 4 6
15 $BFUI$3 4 8 10 8 10
16 $BFUL$3 14 - - - -
17 $CDVC$3 12 - - - -
18 $CDVI$3 14 - - - -
19 $CDVUI$3 10 - - - -
20 $CMDC$3 12 - - - -
21 $CMDI$3 14 - - - -
22 $CMDUI$3 10 - - - -
23 $CMLI$3 12 - - - -
24 $CMPL$3 10 - - - -
25 $CTOL$3 6 - - - -
26 $DIVC$3 6 - - - -
27 $DIVD$3 48 30 32 30 32
28 $DIVF$3 32 22 24 22 24
29 $DIVI$3 8 - - - -
30 $DIVL$3 18 10 14 10 14
31 $DIVUI$3 4 - - - -
32 $DIVUL$3 16 6 8 6 8
33 $DIVXSB$3 6 - - - -
34 $DIVXSW$3 10 - - - -
35 $DIVXUW$3 10 - - - -
36 $DSLC$3 6 6 8 6 8
37 $DSLI$3 6 6 8 6 8
38 $DSLL$3 - 8 10 10 12
39 $DSRC$3 6 6 8 6 8
40 $DSRI$3 6 6 8 6 8
41 $DSRL$3 - 8 10 10 12
42 $DSRUC$3 6 6 8 6 8
43 $DSRUI$3 6 6 8 6 8
44 $DSRUL$3 - 8 10 10 12
45 $DTOF$3 16 14 16 14 16
46 $DTOI$3 18 - - - -
47 $DTOL$3 14 10 12 10 12
48 $EQD$3 12 26 28 26 28
49 $EQF$3 12 8 12 8 12
50 $fp_regld$3 2 2 4 - -
51 $fp_regsv$3 2 2 4 - -
52 $fp_rgld3$3 2 2 4 - -
53 $fp_rgsv3$3 2 2 4 - -
54 $FTOD$3 10 10 12 10 12
55 $FTOI$3 14 - - - -
56 $FTOL$3 10 6 8 6 8
57 $GED$3 12 26 28 26 28
58 $GEF$3 12 8 12 8 12
59 $GTD$3 12 26 28 26 28
60 $GTF$3 12 8 12 8 12

-53-
Table 4 Stack Size Listing of Runtime Routines (2)
stack size (byte)
No. routine H8/300 H8/300H H8/300H H8S H8S
Normal mode Advanced mode Normal mode Advanced mode
61 $ITOD$3 6 6 8 6 8
62 $ITOF$3 8 4 6 4 6
63 $ITOL$3 4 - - - -
64 $LED$3 12 26 28 26 28
65 $LEF$3 12 8 12 8 12
66 $LTD$3 12 26 28 26 28
67 $LTF$3 12 8 12 8 12
68 $LTOD$3 10 10 12 10 12
69 $LTOF$3 8 8 10 8 10
70 $MODL$3 18 - - - -
71 $MODUL$3 16 - - - -
72 $MULD$3 48 54 56 54 56
73 $MULF$3 32 18 20 18 20
74 $MULI$3 8 - - - -
75 $MULL$3 14 10 12 10 12
76 $MULXSB$3 4 - - - -
77 $MULXSW$3 10 - - - -
78 $MULXUW$3 10 - - - -
79 $MV4$3 4 - - - -
80 $MV8$3 4 6 8 6 8
81 $MVN$3 10 12 18 16 18
82 $NED$3 12 26 28 26 28
83 $NEF$3 12 8 12 8 12
84 $NEGD$3 4 6 8 6 8
85 $NEGF$3 4 - - - -
86 $NEGL$3 6 - - - -
87 $ORL$3 6 - - - -
88 $PODD$3 46 36 42 40 44
89 $POID$3 46 36 42 40 44
90 $PODF$3 26 - - - -
91 $POIF$3 26 - - - -
92 $PODL$3 8 - - - -
93 $POIL$3 8 - - - -
94 $PRDD$3 46 34 42 36 44
95 $PRDF$3 26 24 28 24 28
96 $PRDL$3 4 - - - -
97 $PRID$3 46 34 42 36 44
98 $PRIF$3 26 24 28 24 28
99 $PRIL$3 4 - - - -
100 $SLI$3 6 - - - -
101 $SLL$3 8 - - - -
102 $sp_regld$3 2 2 4 - -
103 $sp_regsv$3 2 2 4 - -
104 $sp_rgld3$3 2 2 4 - -
105 $sp_rgsv3$3 2 2 4 - -
106 $spregld2$3 0 0 0 - -
107 $sprgld23$3 0 0 0 - -
108 $SRI$3 6 - - - -
109 $SRL$3 8 - - - -
110 $SRUI$3 6 - - - -
111 $SRUL$3 8 - - - -
112 $SUBD$3 40 46 50 48 52
113 $SUBF$3 20 18 20 18 20
114 $SUBL$3 6 - - - -
115 $SWI$3 10 - - - -
116 $ULTOD$3 10 10 12 10 12
117 $ULTOF$3 8 6 8 6 8
118 $UTOD$3 6 6 8 6 8
119 $UTOF$3 6 2 4 2 4
120 $XORL$3 6 - - - -
121 _INITSCT 10 10 18 10 18

-54-
Notes on Using This Compiler

There are several restrictions of C++ language specification and notes.

1. Inter-Module Optimizer for Libraries


The inter-module optimizer can optimize any library function.

<PC>
(1)Optimizing all library functions
There are supplementary files for inter-module optimizing of library under library directory in
compressed form. Please double click <library name>.exe to create a directory that includes
supplementary files for library functions.
The inter-module optimizer optimizes all library functions.

ex)Use C:¥HIM¥TOOLCHAINS¥HITACHI¥CH38¥V30¥LIB¥C38HA.LIB
· Double click C:¥HIM¥TOOLCHAINS¥HITACHI¥CH38¥V30¥LIB¥C38HA.EXE
· Creates C:¥HIM¥TOOLCHAINS¥HITACHI¥CH38¥V30¥LIB¥C38HA automatically

(2) Forbid optimizing of several library functions


Uncompress <library name>.exe the same way as in (1), and change the file name of the
function whose optimizing is to be forbidden.

ex) Forbid optimizing of printf function


· Change file name
"C:¥HIM¥TOOLCHAINS¥HITACHI¥CH38¥V30¥LIB¥C38HA¥printf.iop"

(3) Forbid optimizing of all library functions


Delete the directory made by (1).

<UNIX>
In the case of UNIX, supplementary files for inter-module optimizing of all library functions
are installed. Therefore the inter-module optimizer optimizes all library functions in default.

(1) Forbid optimizing of several library functions


Change the file name of <library name>/<function name>.iop for the function whose
optimizing is to be forbidden.
ex) Forbid optimizing of printf function of c38ha.lib
· Change the file name "/usr/CH38/c38ha/printf.iop"

(2) Forbid optimizing of all library functions


Change the directory name which is the same as the library.
ex) Forbid optimizing of c38ha.lib
· Change the directory name "/usr/CH38/c38ha"

55
2. Restriction of Structure Alignment
In Version 3.0, the alignment of structure, union and class can be specified using pack option or
#pragma pack.
But in the following case, you cannot specify pack option or #pragma pack.

(1)Access using the pointer to even byte member of alignment=1


ex)
#pragma pack 1
struct S {
char x;
int y;
} s;
int *p=&s.y; // Address of s.y is odd
void test()
{
s.y=1; // Generates correct code
*p=1; // Generates incorrect code
}

(2)Call the virtual function of alignment=1


ex)
#pragma pack 1
class C {
public:
char x;
virtual void func(); // Address of pointer to virtual
}; // function table is odd
C *p;
void test()
{ p->func(); } // Cannot call C::func

3. Restriction of Inter-Module Optimizer

(1)Using global register


When using global register with #pragma global_register, you must not specify Inter-Module
optimizing for libraries.
Please forbid Inter-Module optimizing for libraries.

(2)Reference out of array area


When reference using pointer is out of array area, the inter-module optimizer may move or
delete the referenced area by optimizing. Please forbid Inter-Module optimizing for the
reference area with symbol_forbid or absolute_forbid.
ex)
char x[10];
char y[10]; // y is not referenced by name y
char *p=x; // Optimizer deletes y
:
p[15]; // p[15] is equal to y[6]
// Because b is deleted, cannot access p[15]
:

56
4. Class
(1) If a class will be derived from nested class, re-definition without virtual in derived class is not
effective for virtual function of based class.

ex)
class C1 {
public:
class C2 { // C1::C2 is nested class
public:
virtual void func1(){}
virtual void func2(){}
};
};
class C3 : public C1::C2 { // Class C3 is derived from C1::C2
public:
virtual void func1(){} // Re-defined virtual function
void func2(){} // Not a re-defined virtual function
};
void test()
{
C1::C2 *p = new C3;
p->func1(); // Calls C3::func1() correctly
p->func2(); // Calls C1::C2::func2() incorrectly
}

Work around: Please re-define with virtual in derived class, if you


want to re-define virtual function of based class which is nested.

(2)If a class with virtual function or virtual based class has constructor with some parameters,
calling the function which has the class type parameter with the data of constructor type as
parameter, the function cannot call virtual function nor access virtual based class.

ex)
class C { // Class C has virtual function public:
C(int); // Defines constructor
virtual void func(); // with int type parameter
};
void sub(C c) // Function sub has parameter of
{ // type C
C *p = &c;
p->func(); // Cannot call C::func()
}
void test()
{
sub(1); // Calls sub with int data parameter
}

Work around: Please specify class object in parameter clearly.


(ex) sub(C(1));

(3) When defining the struct array type using typedef before defining struct type, the even byte data
sometimes allocated to odd addresses.

ex)

57
typedef struct S T[2]; // Define T of struct array type
// before defining struct S
struct S {
int x;
};
char c;
T y; // Allocates int data x to odd address

Work around: Please define struct before declaration of typedef


(ex) struct S {
int x;
};
typedef struct S T[2];

5. Pointer to Member

(1)For the pointers to members of the derived class and based class which have common virtual
based class, assignment pointer to pointer is incorrect and the result of comparison pointers is
incorrect.

ex)
class C1 {public: int x;};
class C2 : virtual public C1 {int y;}; // C1 is virtual based class of C2
class C3 : public C2 {int z;}; // C2 is based class of C3
int C2::*c2p = &C1::x; // c2p is pointer to member of C2
int C3::*c3p = &C1::x; // c3p is pointer to member of C3
void func();
void test()
{
if (c2p == c3p) // The result is false,
func(); // and does not call func

c3p = c2p; // The result of assignment is incorrect


}

Work around: Please do not use assign or compare for pointers to


virtual based class members.

(2) When there is a based class which has data member but no virtual function and there is a
derived class which has data member and virtual function, assignment of virtual function into
pointer to member function of the derived class generates incorrect code.

ex)
class C1 {int x;}; // The based class C1 has data member
// but no virtual function
class C2 : public C1 { // The derived class C2 has data member
int y; // and virtual function
public:
virtual void func();
};
void (C2::*p)() = &C2::func; // Sets virtual function in pointer
// to member function of C2
void test()
{
C2 c2;

58
(c2.*p)(); // Cannot call C2::func()
}

Work around: Please define dummy virtual function in the based class.
(ex)class C1 {
int x;
public:
virtual void func();
};

(3) When the virtual function of a based class other than the first is assigned to the pointer to
member function of multiple derived class, generates incorrect code.

ex)
class C1 {int x;};
class C2 {
public:
virtual void func();
};
class C3 : public C1, public C2 {}; // C3 is multiple derived class
void (C3::*p)() = &C2::func; // Assigns virtual function of second based class C2
void test()
{
C3 c;
(c.*p)(); // Cannot call C2::func()
}

Work around: Please declare the based class first when setting the
virtual function of based class to the pointer to member function.
(ex)class C3 : public C2, public C1 {};
// Declares the derived class C2 at the head

6. 6446 Error
The 6446 error (Ambiguous function call) is caused by the following.

(1) The corresponding function not exists


class C{
C();
};
int func(C);
void test()
{ ...
func(3); // Constructor of casting int to class C not exist
}

Work around:Please define the constructor of casting int to class C.


(ex)
class C{
C();
public:
C(int);
};

59
(2)There are multiple coresponding functions multiple.
int func(int);
int func(int, int = 0)
void test()
{ ...
func(3); // Both of func(int) and func(int,int=0) are corresponding
}

Work around: Please change function name or parameter order.

(3)The default constructor of the based class


class C1{
public:
C1(int);
};

class C2:public C1{


public:
C2(int);
};
C2::C2(int ){ // Attempts to call the default constructor of the
// based class, but default constructor does not
...} // exists because C1(int) exist in based class.

Work around: Please define the default constructor in the based class.
(ex)class C1{
public:
C1();
C1(int);
};

(4)A class has an anonymous class as its member


class C{
struct {int n; }s; // 6446 error
public:
C(int i);
};
C c=1;
C::C(int){ s.n = i; }

Work around: Give a name to the anonymous class.


(ex)class C{
struct C1 {int n; } s;
public:
C(int i);
};

7. 104 Error (Duplicate symbol) at Linking

In the following cases, 104 error occurs at linking.


Please change class name.

60
(1) The local classes in different blocks of the same function have a virtual function table of the
same name.

ex)
void test()
{
{
class C {
virtual void func(){}
} c;
}
{
class C {
virtual void func(){}
} c;
}
}

(2) Classes with the same name nested in different classes have a virtual function table of the same
name.

ex)
class C1 {
class C3 {
virtual void func(){}
};
};
class C2 {
class C3{
virtual void func(){}
};
};

(3)The derived classes C2 which have the based class C1 and C1_C2 have a virtual function table
of the same name.

ex)
class C1 {
virtual void func(){}
};
class C2 : public C1 {
virtual void func(){}
};
class C1_C2 {
virtual void func(){}
};

8. Others

(1) When the left side of assignment is the conditional operator, the assignment operation has
priority.

ex)

61
int x, y, z;
void test()
{
x ? y : z = 2; // Equals to x ? y : (z = 2);
}
Work around: Please specify the conditional operation in parentheses
(ex) (x ? y : z) = 2;

(2) The static anonymous union definition in function becomes auto.


ex)
void test()
{
static union { // The values a and b are incorrect
int x; // from second time.
int y;
};
}

Work around:Please define The static anonymous union outside of the


function.
(ex)
static union {
int x;
int y;
};
void test(){ }

(3)When the function does not refer local class object in the return statement, executes destructor
before the return statement.

ex)
int x;
class C{
public:
C(){x=1;}
~C(){ x=0; }
}

int test()
{
C c; // Declares local class
:
return x; // Executes destructor before return statement,
} // and returns invalid code.

Work around: Please refer local class object inretern statement.


(ex)
int test()
{
C c;
return &c,x;
}

62
(4)When a variable address is initialized with the integer type, the initial value will be illegal (only
for C++).

ex)
int buff[0x400];
unsigned int data=(unsigned int)&buff[0x200];

output code:(cpu=300)
_data:
.data.w _buff //correct code is .data.w _buff+H'400

Work around: Specify the initial value after it has been substituted for a pointer-type variable.
(ex)
int buff[0x400];
int *p = &buff[0x200];
unsigned int data=(unsigned int)p;

63

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy