1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-09-27 12:57:41 +00:00
millfork/docs/abi/inlining.md
2019-12-01 03:16:09 +01:00

29 lines
899 B
Markdown

[< back to index](../doc_index.md)
# Macros and inlining
## Macros
`macro` keyword
## Automatic inlining
You can control inlining behavior in several ways:
* functions declared with the `inline` keyword will be inlined if possible
* functions declared with the `noinline` keyword will never be inlined
* the remaining functions may be inlined only if the `-finline` command-line option is enabled
and the compiler decides the function is worth doing
## Automatic subroutine extraction
Subroutine extraction is the opposite of inlining.
When given the `-fsubroutine-extraction`, the compiler will attempt to extract common code fragments to new subroutines.
The code will get smaller and slower.
Generally, when using `-fsubroutine-extraction`, it's recommended to also use `-finline`.
This allows the compiler to first inline and optimize code and then extract it back when appropriate.