[fpc-pascal] Documentation bug

tom_at_work tom_at_work at gmx.at
Sun Aug 24 13:35:19 CEST 2008


Hello,

Am 22.08.2008 um 10:31 schrieb leledumbo:
> Thomas Schatzl wrote:
>>
>> Use fpc -i to query the available optimization options.
>>
> I know that, but what I need is an explanation about what each  
> optimization
> does. Plus, what are the defaults?
>

 From the programmer's manual about the $OPTIMIZATION switch (you  
need very recent docs for this) and the "Optimization" chapter:

Default is no optimization at all, i.e. all of the below disabled.

REGVAR - Try to keep local values in registers, avoiding memory traffic.

UNCERTAIN - Use uncertain optimizations, i.e. make some assumptions  
about pointer aliasing which give more opportunities in the other  
optimizations but may result in incorrect code otherwise; see the  
documentation for the rules.

SIZE - Try to generate smaller code; note that this counters some  
other optimizations.

STACKFRAME - Do not generate stackframes if possible (e.g. for leaf  
procedures).

PEEPHOLE - Peephole optimizations. Try to find code patterns that  
either do nothing (and remove them) or replace them with more  
efficient ones. See e.g. http://en.wikipedia.org/wiki/ 
Peephole_optimization for more information.

ASMCSE - Use common subexpression elimination at the assembler level.

LOOPUNROLL - Unroll loops: small loops are unrolled, i.e. loop bodies  
inlined multiple times into the code (plus some setup code) - note  
that specifying the target processor has great influence on what is  
considered "small" (e.g. -Op<x>)

TAILREC - Automatically try to convert tail recursions into iterations.

CSE - Use common subexpression elimination, for more information see  
e.g. http://en.wikipedia.org/wiki/Common_subexpression_elimination

DFA - Use data flow analysis, i.e. gathering more information about  
the data flow in the program in order to make other optimizations  
more effective. See e.g. http://en.wikipedia.org/wiki/ 
Data_flow_analysis for more information.

There are also LEVEL<1-3> "optimizations" that are shortcuts for some  
of the above.

Regards,
   Thomas




More information about the fpc-pascal mailing list