|
ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
|
Build one file at a named optimization level instead of the framework's. More...
Go to the source code of this file.
Macros | |
| #define | PC_TU_PRAGMA(directive) |
| #define | PC_OPTIMIZE_O2 PC_TU_PRAGMA(GCC optimize("O2")) |
| Build this file at optimization level 2, overriding the framework's size-optimized level. | |
Build one file at a named optimization level instead of the framework's.
The framework's size-optimized level is appended after any build-system flags, so a consumer cannot raise it from outside. That level declines to inline small functions, and an appender chain that does not inline cannot fold: a literal's length stays a runtime scan and a bounded copy stays a call. Put PC_OPTIMIZE_O2 at the top of such a .cpp, after its includes.
The level is in the name rather than behind a knob, so a file states what it is built at and a reader does not have to resolve a second macro to find out. A macro rather than the pragma itself because core carries no toolchain language.
O2 is the only level here because O2 is what has been measured (docs/FEATURE_PERFORMANCE.md 2b). O3 is untested on this path - not rejected. A file that needs another level adds the macro for it here rather than redefining this one.
Apply only where there are no secrets or the code is constant-time by structure. An optimizer can turn a branchless mask-select into a data-dependent branch; crypto/crypto_opt.h is the crypto policy layer with per-die levels and those caveats.
Definition in file speed_opt.h.
| #define PC_TU_PRAGMA | ( | directive | ) |
Definition at line 39 of file speed_opt.h.
| #define PC_OPTIMIZE_O2 PC_TU_PRAGMA(GCC optimize("O2")) |
Build this file at optimization level 2, overriding the framework's size-optimized level.
Definition at line 43 of file speed_opt.h.