mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-05-07 10:22:42 +03:00
0a246f5e67
I previously wrote some weird code in the compiler frontend solely because the LLVM backend has some weird requirements, but the better solution is to avoid those requirements. This commit does that by introducing "alignment forward references" to `std.zig.llvm.Builder`. Much like debug forward references, they allow you to reference an alignment value which will be populated at a later time (and which can be updated many times, which is important for incremental compilation). Then, when we want to reference a type's ABI alignment while the type is not necessarily resolved (required for `@"align"` attributes on function parameters and function call arguments), we create a forward reference and use `link.ConstPool` to populate it when ready. This allows us to remove from the compiler frontend some extremely arbitrary calls to `Sema.ensureLayoutResolved`, so that the language specification is not being built around the particular needs of our compiler implementation's LLVM code generation backend.