Hello,
leledumbo wrote 8 lines
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