diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-12-05 18:03:09 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-12-05 19:58:42 +0000 |
| commit | 8f849684f46ad0835bd9591f420e49e212880cb2 (patch) | |
| tree | ebf5d639609a744108f4e9a356d0074c25a640d9 /src/codegen/c | |
| parent | 7f3211a101d8763ec5f0009b219f6819dba2cd35 (diff) | |
| download | zig-8f849684f46ad0835bd9591f420e49e212880cb2.tar.gz zig-8f849684f46ad0835bd9591f420e49e212880cb2.zip | |
std.zig.Zir: improve instruction tracking
The main change here is to partition tracked instructions found within a
declaration. It's very unlikely that, for instance, a `struct { ... }`
type declaration was intentionally turned into a reification or an
anonymous initialization, so it makes sense to track things in a few
different arrays.
In particular, this fixes an issue where a `func` instruction could
wrongly be mapped to something else if the types of function parameters
changed. This would cause huge problems further down the pipeline; we
expect that if a `declaration` is tracked, and it previously contained a
`func`/`func_inferred`/`func_fancy`, then this instruction is either
tracked to another `func`/`func_inferred`/`func_fancy` instruction, or
is lost.
Also, this commit takes the opportunity to rename the functions actually
doing this logic. `Zir.findDecls` was a name that might have made sense
at some point, but nowadays, it's definitely not finding declarations,
and it's not *exclusively* finding type declarations. Instead, the point
is to find instructions which we want to track; hence the new name,
`Zir.findTrackable`.
Lastly, a nice side effect of partitioning the output of `findTrackable`
is that `Zir.declIterator` no longer needs to accept input instructions
which aren't type declarations (e.g. `reify`, `func`).
Diffstat (limited to 'src/codegen/c')
0 files changed, 0 insertions, 0 deletions
