4.2.5 Using a Keyword

This section explains using the following keyword.

-

Description of access in specified size

(1)

Description of Access in Specified Size

__evenaccess <type specifier> <variable name>

<type specifier> __evenaccess <variable name>

A variable is accessed in the declared or defined size.

This extension guarantees access in the size of the target variable.

Access size is guaranteed for 4-byte or smaller scalar integer types (signed char, unsigned char, signed short, unsigned short, signed int, unsigned int, signed long, and unsigned long).

Example

C source description:

#pragma address A=0xff0178

unsigned long __evenaccess A;

void test(void)

{

A &= ~0x20;

}

Output code (__evenaccess not specified):

_test:

MOV.L #16712056,R1

BCLR #5,[R1] ; Memory access in 1 byte

RTS

Output code (__evenaccess specified):

_test:

MOV.L #16712056,R1

MOV.L [R1],R5 ; Memory access in 4 bytes

BCLR #5,R5

MOV.L R5,[R1] ; Memory access in 4 bytes

RTS

The __evenaccess is invalid to the case of accessing of members by a lump of these structure and union frame.

When __evenaccess is specified for a structure or a union, __evenaccess is applied to all members. In this case, the access size is guaranteed for 4-byte or smaller scalar integer types, but the size of access in structure or union units is not guaranteed.