-alias


< Compile Options / Optimize Options >

[Format]

-alias = { noansi | ansi }

 

-

[Default]

The default for this option is alias=noansi.

[Description]

-

This option selects whether to perform optimization with consideration for the type of the data indicated by the pointer.

-

When alias=ansi is specified, based on the ANSI standard, optimization considering the type of the data indicated by the pointer is performed. Although the performance of object code is generally better than when alias=noansi is specified, the results of execution may differ according to whether alias=ansi or alias=noansi is specified.

-

In the same way as in V. 1.00, ANSI-standard based optimization in consideration of the type of data indicated by pointers is not performed when alias=noansi is specified.

[Example]

long x;
long n;
void func(short * ps)
{
    n = 1;
    *ps = 2;
    x = n;
}

-

[When alias=noansi is specified]

The value of n is reloaded at (A) since it is regarded that there is a possibility of the value of n being rewritten by *ps = 2.

_func:
    MOV.L       #_n,R4
    MOV.L       #1,[R4]    ; n = 1;
    MOV.W       #2,[R1]    ; *ps = 2;
    MOV.L       [R4],R5    ; (A) n is reloaded
    MOV.L       #_x,R4
    MOV.L       R5,[R4]
    RTS

-

[When alias=ansi is specified]

The value used in assignment at n = 1 is reused at (B) because it is regarded that the value of n will not change at *ps = 2 since *ps and n have different types.
(If the value of n is changed by *ps = 2, the result is also changed.)

_func:
    MOV.L       #_n,R4
    MOV.L       #1,[R4]    ; n = 1;
    MOV.W       #2,[R1]    ; *ps = 2;
    MOV.L       #_x,R4
    MOV.L       #1,[R4]    ; (B) Value used in assignment at n = 1 is reused
    RTS

[Remarks]

-

When optimize=0 or optimize=1 is valid and the alias option is specified, the alias=ansi specification will be ignored and code will always be generated as if alias=noansi has been selected.