mirror of
https://github.com/apple/swift.git
synced 2026-10-02 10:58:03 +02:00
A function's stage had no representation in either textual or serialized SIL. - Text. A new `[stage=<name>]` attribute, printed only when the function is ahead of the module's stage floor. - Serialization. `SILFunctionLayout` gains a stage field, read on the SIL_FUNCTION header path. The deserializer seeds from it and only ever moves forward, so a body recorded behind the floor stays at the floor rather than regressing below it. - SIB floor. A SIB also records the stage floor its producer committed to. That floor becomes the module's only when SIBs are all a compilation lowers: `ASTLoweringRequest` commits the lowest recorded floor once they are loaded. Alongside source files the floor stays Raw, so the mandatory pipeline still runs over the SIL generated from source, and each SIB function keeps the stage recorded for it. - `SILCloner` propagates the stage on a whole-function clone, next to the existing lowered-addresses propagation, so cloning a function that is ahead of the floor cannot silently regress it. The stage spelling now lives in `getSILStageName` and `getSILStageByName`, shared by the `sil_stage` line, the new attribute, and both parsers. Adding a stage means extending those two functions. `[canonical]` is untouched. It stays the provenance bit and deliberately does not seed the stage, because a `[canonical]` function can still hold raw-only constructs. The two now print side by side, which makes the distinction visible.