0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/src/codegen
Andrew Kelley 05947ea870 stage2: implement @intToError with safety
This commit introduces a new AIR instruction `cmp_lt_errors_len`. It's
specific to this use case for two reasons:

 * The total number of errors is not stable during semantic analysis; it
   can only be reliably checked when flush() is called. So the backend
   that is lowering the instruction must emit a relocation of some kind
   and then populate it during flush().
 * The fewer AIR instructions in memory, the better for compiler
   performance, so we squish complex meanings into AIR tags without
   hesitation.

The instruction is implemented only in the LLVM backend so far. It does
this by creating a simple function which is gutted and re-populated
with each flush().

AstGen now uses ResultLoc.coerced_ty for `@intToError` and Sema does the
coercion.
History 2022-03-29 22:19:06 -07:00
..
llvm stage2: LLVM: (WIP) add union fields debug info 2022-03-28 16:24:51 -07:00
spirv spirv spec: do not align packed struct fields 2022-02-24 19:48:34 +02:00
c.zig stage2: implement @intToError with safety 2022-03-29 22:19:06 -07:00
llvm.zig stage2: implement @intToError with safety 2022-03-29 22:19:06 -07:00
spirv.zig stage2: lazy @alignOf 2022-03-22 15:45:58 -07:00