0-5 Optimiser Levels Need Extra Help Usage

Beta Testing discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
pykedgew
Posts: 164
Joined: 10 Dec 2005 02:22
Location: Brisbane Australia

0-5 Optimiser Levels Need Extra Help Usage

#1 Post by pykedgew » 13 Dec 2008 00:42

Hi mE Team

Would like some clarification on the usage of the 0 - 5 levels.

So how do you select Zero to Five for Output settings under Options Menu & how do they fit in with the statements below?

These below are taken from the Program Help
Output settings
By modifying Output Settings, user can configure the content of the output files.
You can enable or disable, for example, generation of ASM and List file.

Also, user can choose optimization level, and compiler specific settings,
which include case sensitivity, dynamic link for string literals setting
(described in mikroPascal PRO for AVR specifics).

Build all files as library enables user to use compiled library (*.mcl) on any AVR MCU.
Code Optimization
Optimizer has been added to extend the compiler usability, cut down the amount of code generated and speed-up its execution. The main features are:

Constant folding
All expressions that can be evaluated in the compile time (i.e. are constant) are being replaced by their results. (3 + 5 -> 7);

Constant propagation
When a constant value is being assigned to a certain variable, the compiler recognizes this and replaces the use of the variable by constant in the code that follows, as long as the value of a variable remains unchanged.

Copy propagation
The compiler recognizes that two variables have the same value and eliminates one of them
further in the code.

Value numbering
The compiler "recognizes" if two expressions yield the same result and can therefore
eliminate the entire computation for one of them.

"Dead code" ellimination
The code snippets that are not being used elsewhere in the programme do not affect the
final result of the application. They are automatically removed.

Stack allocation
Temporary registers ("Stacks") are being used more rationally, allowing VERY complex expressions to be evaluated with a minimum stack consumption.

Local vars optimization
No local variables are being used if their result does not affect some of the global or volatile variables.

Better code generation and local optimization
Code generation is more consistent and more attention is payed to implement specific solutions for the code "building bricks" that further reduce output code size.

Ken

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

#2 Post by filip » 17 Dec 2008 13:39

Hi,

If you wish to select certain level of optimization, go to :
Tools > Options > Output > Output settings, and simply choose the preferred one from the Optimization level box.

By choosing, lets say, level 4 of optimization, the compiler will go through the code four times, each time optimizing it more and more. Optimization features are listed below :
Code Optimization
Optimizer has been added to extend the compiler usability, cut down the amount of code generated and speed-up its execution. The main features are:

Constant folding
All expressions that can be evaluated in the compile time (i.e. are constant) are being replaced by their results. (3 + 5 -> 7);

Constant propagation
When a constant value is being assigned to a certain variable, the compiler recognizes this and replaces the use of the variable by constant in the code that follows, as long as the value of a variable remains unchanged.

Copy propagation
The compiler recognizes that two variables have the same value and eliminates one of them
further in the code.

Value numbering
The compiler "recognizes" if two expressions yield the same result and can therefore
eliminate the entire computation for one of them.

"Dead code" ellimination
The code snippets that are not being used elsewhere in the programme do not affect the
final result of the application. They are automatically removed.

Stack allocation
Temporary registers ("Stacks") are being used more rationally, allowing VERY complex expressions to be evaluated with a minimum stack consumption.

Local vars optimization
No local variables are being used if their result does not affect some of the global or volatile variables.

Better code generation and local optimization
Code generation is more consistent and more attention is payed to implement specific solutions for the code "building bricks" that further reduce output code size.
I hope this helps you.

Best regards,
Filip.

pykedgew
Posts: 164
Joined: 10 Dec 2005 02:22
Location: Brisbane Australia

#3 Post by pykedgew » 18 Dec 2008 00:04

Hi filip

Righto, now I see it. :oops:
It just I didn't interpret the Help manual well.
Much appreciated for your reply.

Ken

Post Reply

Return to “mikroPascal PRO for AVR Beta Testing”