Mikroelektronika MIKROE-350 データシート

ページ / 526
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 -> 8); 
Constant propagation
When a constant value is being assigned to a certain variable, the compiler recog-
nizes 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 there-
fore 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 com-
plex 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 spe-
cific solutions for the code "building bricks" that further reduce output code size. 
101
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Specifics
mikroBasic PRO for AVR
CHAPTER 3