-One: Disable any Low Level Common Subexpression Elimination

Group

OPTIMIZATIONS

Scope

Function

Syntax
  -One
  
  
Arguments

None

Default

None

Defines

None

Pragmas

None

Description

This option prevents the Compiler from reusing common subexpressions, such as array indexes and array base addresses. The code size may increase. The low-level CSE does not have the alias problems of the frontend CSE and is therefore switched on by default.

The two CSE optimizations do not cover the same cases. The low-level CSE has a finer granularity but does not handle all cases of the frontend CSE.

Use this option only to generate more readable code for debugging.

Listing: Example (Abstract Code)


void main(int i) {
  int a[10];

  a[i] = a[i-1];

}

Listing: Case (1) Without Option (Optimized) listing shows a case that does not use -One and Listing: Case (2) -One (Not Optimized, Readable) shows a case that uses -One.

Listing: Case (1) Without Option (Optimized)


tmp1    LD    i
tmp2    LSL   tmp1,#1

tmp3    SUB   tmp2,#2

tmp4    ADR   a

tmp5    ADD   tmp3, tmp4

tmp6    LD    (tmp5)

2(tmp5) ST    tmp6
Listing: Case (2) -One (Not Optimized, Readable)


tmp1    LD    i
tmp2    LSL   tmp1,#1

tmp3    SUB   tmp2,#2

tmp4    ADR   a

tmp5    ADD   tmp3,tmp4

tmp6    LSL   tmp1,#1   ;calculated twice

tmp7    ADR   a         ;calculated twice

tmp8    ADD   tmp6,tmp7

tmp9    LD    (tmp5)

(tmp8)  ST    tmp9
Example

-One