What is stage1 and stage2 in the compiler

Hello! I’m wondering what stage1 and stage2 are in the compiler. I had an answer in the IRC but I’d like to open it up to more specification.
Is stage2 the “self-hosted compiler” people are talking about?
If this is the case, is it worth submitting "TODO: " bugs about stage1 if the self-hosted compiler will be out soon?

stage1 is an LLVM backend written in C++. It has its own frontend, but also shares some of the frontend with stage2, such as the CLI, caching system, and translate-c.

stage2 is the self-hosted compiler with several zig backends written in zig, which all share the same frontend:

stage3 is stage2 built with itself. Building stage3 with itself just outputs stage3 again. stage3 is the final build artifact that is “the self-hosted compiler”.

If you want to learn about the internals check out this excellent series.

No, it’s not. Wait until 0.10.0, at which point we will ship stage3 as the zig compiler everyone is using, and then if you still experience the bug then report it at that time.

Current progress report:

  • 187,678 lines of code
  • Behavior Tests Passing:
    • LLVM: 1012/1104 (92%)
    • WASM: 789/1104 (71%)
    • C: 718/1104 (65%)
    • x86_64: 668/1104 (61%)
    • arm: 490/1104 (44%)
    • aarch64: 399/1104 (36%)

Here’s the ship it issue.

10 Likes

Ah thank you so much. This really clears up a lot. I’ll wait for 0.10.0 to come out.