# stage2: codegen handles undefined values · gitcafe/zig

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

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

Visibility: public

Requested revision: 4beff80b2f30ad85f2127b1281053b8b25b0cc33

Requested commit: 4beff80b2f30ad85f2127b1281053b8b25b0cc33

Commit: 4beff80b2f30ad85f2127b1281053b8b25b0cc33

Tree: 9937e9ee95d3060afa021449439caefd6476b5c2

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: codegen handles undefined values

 * `optimize_mode` is passed to `link.File` and stored there
 * improve the debugging function `Module.dumpInst`
 * get rid of `Value.the_one_possible_value` in favor of a few more
   specific values for different types. This is less buggy, one less
   footgun.
 * `Type.onePossibleValue` now returns a `?Value` instead of `bool`.
 * codegen handles undefined values. `undef` is a new `MCValue` tag.
   It uses 0xaa values depending on optimization mode. However
   optimization mode does not yet support scope overrides.
 * link.zig: move the `Options` field from `File.Elf` and `File.C` to
   the base struct.
   - fix the Tag enum to adhere to style conventions
 * ZIR now supports emitting undefined values.
 * Fix the logic of comptime math to properly compare against zero using
   the `compareWithZero` function.

```

## Parents

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

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