Optimization Level of SOFTUNE C Compiler in FR Family FR81S MCUs – KBA218675
Employee
Jun 06, 2017
01:59 AM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Jun 06, 2017
01:59 AM
Version: **
Translation - Japanese: FRファミリFR81S MCUのSOFTUNE Cコンパイラの最適化レベル - KBA218675 - Community Translated (JA)
Answer:
- Optimization Level 0
No optimization will be effected. This level is equivalent to not specifying -O
- Optimization Level 1
Optimization will be effected in accordance with detailed analyses of a program flow.Before Optimization After Optimization A=x; (deletion) if (...) { if (...) { A=y;{ A=y; } else { } else { B=z; B=z; A=x; } } Before Optimization After Optimization t1=a+b; t1=a+b; t2=a+b; t2=t1; Before Optimization After Optimization a=b; (deletion) /*Not use "a" after this*/ =a; =0; /*Replace "a" to "0"*/ Before Optimization After Optimization a=b; (deletion) /*Do not use "a" after this*/ /*Not define "a" and "b" between this.*/ =a; =b; /*Replace "a" by "b"*/ Before Optimization After Optimization a=b; (deletion) /*Do not use "a" after this*/ Before Optimization After Optimization a=b; a=b; b=a; (deletion) Before Optimization After Optimization a=b*2; a=b<<2; - Deletion of a immediately after a branch
- Deletion of a continuous branch
- Change the following execution order
- Deletion of common formula
- Deletion of common formula
If the constant can be calculated, it is done at during compile
- Propagation of constanta
The variable that the constant substitutes is replaced by the constant. - Deletion of non-execution sentences
If there is a sentence which is not executed, such statements are not generated.
- Moving of an unchanged formula in loop
The formula that is not changed in a loop is moved out of the loop.
- Propagation of copy
- Deletion of unused variables
- Deletion of simple substitution
- Strength Reduction
Replacing to high-speed calculation. - In-line expansion of functions (same as those effected by specifying -x func).
- Table branching of "switch-case"
- Implementing instruction scheduling (same as those effected by specifying -Kschedule)
- Best use of the delay branch instruction
- Avoiding an interlock for the LD instruction
- Optimization of the assembler instruction
- Assignment of resistor
- Optimization Level 2
This Level is optimized as follows (including optimization Level 1)Before unrolling for(i=0;i<3;i++){ a=0;} After unrolling a[0]=0;
a[1]=0;
a[2]=0;- Loop unrolling
Loop unrolling reduces the loop number of times, and improves execution speed. However, it increases the object size. Therefore, if the object size is important, this optimization should not be used.
- Loop unrolling
- Optimization Level 3
The following optimization features are exercised in addition to the features provided by optimization level 2. However, the translation time will increase.- Loop unrolling of a loop has two exits
- Loop unrolling of a loop has a branch in the "if" sentence
- Optimization function is repeated.
- Optimization Level 4
The following optimization features are exercised in addition to the features provided by optimization level 3.- Arithmetic Operation Evaluation Type Change (same as those effected by specifying -K EOPT)
- Standard Function Expansion/Change (same as those effected by specifying -K LIB)
Standard function (strcpy, strcmp, strlen, memcpy, memset) inline expansion is implemented.
Labels
Rate this article: