# Zir: add instructions to fetch std.builtin types · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/de49a9a17352a36a0888b03905f207b0584fc269)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: de49a9a17352a36a0888b03905f207b0584fc269

Requested commit: de49a9a17352a36a0888b03905f207b0584fc269

Commit: de49a9a17352a36a0888b03905f207b0584fc269

Tree: ebda829424b7df833084bc0f8275815d42a6eeec

Author: mlugg

Committer: mlugg

## Message

```
Zir: add instructions to fetch std.builtin types

This replaces the constant `Zir.Inst.Ref` tags (and the analagous tags
in `Air.Inst.Ref`, `InternPool.Index`) referring to types in
`std.builtin` with a ZIR instruction `extended(builtin_type(...))` which
instructs Sema to fetch such a type, effectively as if it were a
shorthand for the ZIR for `@import("std").builtin.xyz`.

Previously, this was achieved through constant tags in `Ref`. The
analagous `InternPool` indices began as `simple_type` values, and were
later rewritten to the correct type information. This system was kind of
brittle, and more importantly, isn't compatible with incremental
compilation of std, since incremental compilation relies on the ability
to recreate types at different indices when they change. Replacing the
old system with this instruction slightly increases the size of ZIR, but
it simplifies logic and allows incremental compilation to work correctly
on the standard library.

This shouldn't have a significant impact on ZIR size or compiler
performance, but I will take measurements in the PR to confirm this.

```

## Parents

- [a239d8d4e2c0e5a7f3eb4b9973f869afdb3bbe05](https://git.cafe/gitcafe/zig/commit/a239d8d4e2c0e5a7f3eb4b9973f869afdb3bbe05?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/de49a9a17352a36a0888b03905f207b0584fc269?format=markdown)
