# stage2: codegen for conditional branching · gitcafe/zig

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

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

Visibility: public

Requested revision: e97157f71c79257ab575598d142f3caa785a2a76

Requested commit: e97157f71c79257ab575598d142f3caa785a2a76

Commit: e97157f71c79257ab575598d142f3caa785a2a76

Tree: 0484774fa99b759668a134a06d1bc76216e0b811

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: codegen for conditional branching

 * Move branch-local register and stack allocation metadata to the
   function-local struct. Conditional branches clone this data in order
   to restore it after generating machine code for a branch.
   Branch-local data is now only the instruction table mapping *ir.Inst
   to MCValue.
 * Implement conditional branching
   - Process operand deaths
   - Handle register and stack allocation metadata
 * Avoid storing unreferenced or void typed instructions into
   the branch-local instruction table.
 * Fix integer types reporting the wrong value for hasCodeGenBits.
 * Remove the codegen optimization for eliding length-0 jumps. I need to
   reexamine how this works because it was causing invalid jumps to be
   emitted.

```

## Parents

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

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