mirror of
https://github.com/KarolS/millfork.git
synced 2026-04-20 03:16:45 +00:00
Optimization refactoring:
– -Of should imply -finline – certain optimizations should be controllable – unused global symbols should be removed even if we're not optimizing
This commit is contained in:
@@ -139,35 +139,68 @@ Use a software stack for stack variables.
|
||||
|
||||
## Optimization options
|
||||
|
||||
* `-O0` – Disable all optimizations.
|
||||
* `-O0` – Disable all optimizations except unused global symbol removal.
|
||||
|
||||
* `-O`, `-O2` ... `-O8` – Optimize code, various levels. For most code, anything above `-O4` doesn't improve it anymore.
|
||||
|
||||
* `-O9` – Optimize code using superoptimizer (experimental). Computationally expensive, decent results.
|
||||
* `-O9` – Optimize code using superoptimizer (experimental). Computationally very expensive, decent results.
|
||||
|
||||
* `-finline`, `-fno-inline` – Whether should inline functions automatically.
|
||||
See the [documentation about inlining](../abi/inlining.md). Computationally easy, can give decent gains.
|
||||
`.ini` equivalent: `inline`.
|
||||
Default: no
|
||||
|
||||
* `-fipo`, `-fno-ipo` – Whether should perform interprocedural optimization.
|
||||
It enables certain optimization similar to what inlining would enable, but without actual inlining.
|
||||
`.ini` equivalent: `ipo`.
|
||||
Default: no.
|
||||
|
||||
* `-fregister-variables`, `-fno-register-variables` – Whether should allow moving local variables into CPU registers.
|
||||
Default: yes.
|
||||
|
||||
* `-foptimize-stdlib`, `-fno-optimize-stdlib` –
|
||||
Whether should replace some standard library calls with constant parameters with more efficient variants.
|
||||
Currently affects `putstrz` and `strzlen`, but may affect more functions in the future.
|
||||
`.ini` equivalent: `optimize_stdlib`.
|
||||
Default: no.
|
||||
|
||||
* `-ffunction-fallthrough`, `-fno-function-fallthrough` –
|
||||
Whether should replace a tail call by simply putting one function after another.
|
||||
`.ini` equivalent: `function_fallthrough`.
|
||||
Default: yes.
|
||||
|
||||
* `-ffunction-deduplication`, `-fno-function-deduplication` –
|
||||
Whether identical functions should be merged into one function.
|
||||
`.ini` equivalent: `function_deduplication`.
|
||||
Default: yes.
|
||||
|
||||
* `-fsubroutine-extraction`, `-fno-subroutine-extraction` –
|
||||
Whether identical fragments of functions should be extracted into subroutines.
|
||||
`.ini` equivalent: `subroutine_extraction`.
|
||||
Default: no.
|
||||
|
||||
* `-Os`, `--size` – Optimize for size, sacrificing some speed (experimental).
|
||||
Also enables `-fcode-deduplication`.
|
||||
|
||||
* `-Of`, `--fast` – Optimize for speed, even if it increases the size a bit (experimental).
|
||||
Also enables `-finline`.
|
||||
|
||||
* `-Ob`, `--blast-processing` – Optimize for speed, even if it increases the size a lot (experimental).
|
||||
Enables `-finline` automatically.
|
||||
Also enables `-finline`.
|
||||
|
||||
* `-Og`, `--optimize-debugging` – Disables optimizations that make debugging harder.
|
||||
Sets
|
||||
`-fno-optimize-stdlib`,
|
||||
`-fno-variable-overlap`,
|
||||
`-fno-register-variables`,
|
||||
`-fno-function-fallthrough`,
|
||||
`-fno-function-deduplication`,
|
||||
`-fno-subroutine-extraction`
|
||||
automatically.
|
||||
|
||||
* `-fdangerous-optimizations` – Use dangerous optimizations (experimental).
|
||||
Dangerous optimizations are more likely to result in broken code.
|
||||
Enables `-fipo` automatically.
|
||||
Also enables `-fipo` and `-foptimize-stdlib` automatically.
|
||||
`.ini` equivalent: `dangerous_optimizations`.
|
||||
|
||||
Note: for compatibility with versions 0.3.0 and earlier,
|
||||
|
||||
@@ -58,7 +58,7 @@ Default: the same as `encoding`.
|
||||
* `prevent_jmp_indirect_bug` – whether the compiler should try to avoid the indirect JMP bug,
|
||||
default is `false` on 65C02-compatible or non-6502 processors and `true` elsewhere
|
||||
|
||||
* `compact_dispatch_params` – whether parameter values in return dispatch statements may overlap other objects, default is `true`
|
||||
* `compact_dispatch_params` – whether parameter values in return dispatch statements may overlap other objects, default is `true`.
|
||||
This may cause problems if the parameter table is stored next to a hardware register that has side effects when reading.
|
||||
|
||||
* `lunix` – generate relocatable code for LUnix/LNG, default is `false`
|
||||
@@ -71,6 +71,12 @@ Default: the same as `encoding`.
|
||||
|
||||
* `ipo` - enable interprocedural optimization, default is `false`.
|
||||
|
||||
* `function_fallthrough` – whether should replace a tail call by simply putting one function after another, default is `true`.
|
||||
|
||||
* `function_deduplication` – whether identical functions should be merged into one function, default is `true`.
|
||||
|
||||
* `subroutine_extraction` – whether identical fragments of functions should be extracted into subroutines, default is `false`.
|
||||
|
||||
* `lenient_encoding` - allow for automatic substitution of invalid characters in string literals using the default encodings, default is `false`.
|
||||
|
||||
* `use_shadow_registers_for_irq` – use Z80 shadow registers in interrupt routines, default is `true` for Z80 and `false` otherwise
|
||||
|
||||
Reference in New Issue
Block a user