aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-01-04 23:39:08 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-01-04 23:49:49 -0700
commit713d2a9b3883942491b40738245232680877cc66 (patch)
tree9b28339bd354a4739344197042d26c38315147a0 /src/codegen/llvm.zig
parent4bc6b4925c2a09a34bf0af861c1b77f93a7df511 (diff)
downloadzig-713d2a9b3883942491b40738245232680877cc66.tar.gz
zig-713d2a9b3883942491b40738245232680877cc66.zip
Sema: better code generated for struct literals
Add a variant of the `validate_struct_init` ZIR instruction: `validate_struct_init_comptime` which is the same thing except it indicates a comptime scope. Sema code for this instruction now handles default struct field values and detects when the struct initialization resulted in a comptime value, replacing the already-emitted AIR instructions to store each individual field with a single `store` instruction with a comptime struct value as the operand. In the case of a comptime scope, there is a simpler path that only evals the implicit store instructions for default field values, avoiding the mechanism for detecting comptime values. This regressed one test case for the wasm backend, but it's just hitting a different prong of `emitConstant` which currently has "TODO" in there, so I think it's fine.
Diffstat (limited to 'src/codegen/llvm.zig')
0 files changed, 0 insertions, 0 deletions