Tuesday, August 9, 2022

Implementing Parts of the Swift Compiler in Swift

Douglas Gregor:

Here’s a proposed build process for the Swift compiler with Swift code in it:

  1. Build C++ bits with the host C++ compiler
  2. Build mandatory Swift bits with the host Swift compiler
  3. Link a “minimal stage 1" Swift compiler
  4. 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.
  5. Link a “full stage 2” Swift compiler
  6. Rebuild optional Swift bits with the stage 2 compiler.
  7. 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.

Comments RSS · Twitter

Leave a Comment