# stage2: introduce new ZIR instruction: arg · gitcafe/zig

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

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

Visibility: public

Requested revision: 077b8d3def537b9a36330c14c39bfa77b2e122bc

Requested commit: 077b8d3def537b9a36330c14c39bfa77b2e122bc

Commit: 077b8d3def537b9a36330c14c39bfa77b2e122bc

Tree: 4a90916b4a0f6813c82b4fadf7a59b62b082cf41

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: introduce new ZIR instruction: arg

 * AstGen: LocalVal and LocalPtr use string table indexes for their
   names. This is more efficient because local variable declarations do
   need to include the variable names so that semantic analysis can emit
   a compile error if a declaration is shadowed. So we take advantage of
   this fact by comparing string table indexes when resolving names.

 * The arg ZIR instructions are needed for the above reasoning, as well
   as to emit equivalent AIR instructions for debug info.
   Now that we have these arg instructions, get rid of the special
   `Zir.Inst.Ref` range for parameters. ZIR instructions now refer
   to the arg instructions for parameters.

 * Move identAsString and strLitAsString from Module.GenZir to AstGen
   where they belong.

```

## Parents

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

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