Implementing Parts of the Swift Compiler in Swift
Here’s a proposed build process for the Swift compiler with Swift code in it:
- Build C++ bits with the host C++ compiler
- Build mandatory Swift bits with the host Swift compiler
- Link a “minimal stage 1" Swift compiler
- Build optional Swift bits with the minimal stage 1 compiler. Note that these bits may not be fully optimized because the stage 1 compiler may lack some optimizer passes.
- Link a “full stage 2” Swift compiler
- Rebuild optional Swift bits with the stage 2 compiler.
- Link a “final stage 3” Swift compiler
[…]
Personally, I’m excited to open the door to having more Swift code in the compiler, but I want to make sure we’re doing so in a way that doesn’t make it unduly complicated to develop the Swift compiler or port to other host architectures.
Previously:
Update (2022-08-10): See also: Hacker News.