Commit 18362eb
committed
Zir: refactor
The new representation is often more compact. It is also more
straightforward to understand: for instance, `extern` is represented on
the `declaration` instruction itself rather than using a special
instruction. The same applies to `var`, making both of these far more
compact.
This commit also separates the type and value bodies of a `declaration`
instruction. This is a prerequisite for #131.
In general, `declaration` now directly encodes details of the syntax
form used, and the embedded ZIR bodies are for actual expressions. The
only exception to this is functions, where ZIR is effectively designed
as if we had #1717. `extern fn` declarations are modeled as
`extern const` with a function type, and normal `fn` definitions are
modeled as `const` with a `func{,_fancy,_inferred}` instruction. This
may change in the future, but improving on this was out of scope for
this commit.declaration instruction representation1 parent af5e731 commit 18362eb
File tree
14 files changed
+1248
-1119
lines changed- lib/std/zig
- src
- Zcu
- codegen
- link
- Wasm
- test/cases/compile_errors
14 files changed
+1248
-1119
lines changedLarge diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2018 | 2018 | | |
2019 | 2019 | | |
2020 | 2020 | | |
2021 | | - | |
2022 | 2021 | | |
2023 | 2022 | | |
2024 | 2023 | | |
| |||
2741 | 2740 | | |
2742 | 2741 | | |
2743 | 2742 | | |
2744 | | - | |
2745 | 2743 | | |
2746 | 2744 | | |
2747 | 2745 | | |
| |||
5573 | 5571 | | |
5574 | 5572 | | |
5575 | 5573 | | |
5576 | | - | |
5577 | | - | |
5578 | | - | |
5579 | 5574 | | |
5580 | 5575 | | |
5581 | 5576 | | |
| |||
6928 | 6923 | | |
6929 | 6924 | | |
6930 | 6925 | | |
6931 | | - | |
6932 | 6926 | | |
6933 | 6927 | | |
6934 | 6928 | | |
| |||
7575 | 7569 | | |
7576 | 7570 | | |
7577 | 7571 | | |
7578 | | - | |
7579 | 7572 | | |
7580 | 7573 | | |
7581 | 7574 | | |
| |||
0 commit comments