# stage2: rework a lot of stuff · gitcafe/zig

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

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

Visibility: public

Requested revision: a2abbeef90bc3fa33acaf85902b4b97383999aaf

Requested commit: a2abbeef90bc3fa33acaf85902b4b97383999aaf

Commit: a2abbeef90bc3fa33acaf85902b4b97383999aaf

Tree: ba7dfaf67adf2420ac40cbb765e01407387c399b

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: rework a lot of stuff

AstGen:
 * rename the known_has_bits flag to known_non_opv to make it better
   reflect what it actually means.
 * add a known_comptime_only flag.
 * make the flags take advantage of identifiers of primitives and the
   fact that zig has no shadowing.
 * correct the known_non_opv flag for function bodies.

Sema:
 * Rename `hasCodeGenBits` to `hasRuntimeBits` to better reflect what it
   does.
   - This function got a bit more complicated in this commit because of
     the duality of function bodies: on one hand they have runtime bits,
     but on the other hand they require being comptime known.
 * WipAnonDecl now takes a LazySrcDecl parameter and performs the type
   resolutions that it needs during finish().
 * Implement comptime `@ptrToInt`.

Codegen:
 * Improved handling of lowering decl_ref; make it work for
   comptime-known ptr-to-int values.
   - This same change had to be made many different times; perhaps we
     should look into merging the implementations of `genTypedValue`
     across x86, arm, aarch64, and riscv.

```

## Parents

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

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