# compiler: stop LLVM bossing the frontend around · gitcafe/zig

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

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

Visibility: public

Requested revision: 1ccada04521d13fe4b43cf36bdd8c980f831f570

Requested commit: 1ccada04521d13fe4b43cf36bdd8c980f831f570

Commit: 1ccada04521d13fe4b43cf36bdd8c980f831f570

Tree: 2258503baa991972546e03654586863a2f97ead9

Author: Matthew Lugg

Committer: Matthew Lugg

## Message

```
compiler: stop LLVM bossing the frontend around

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.

```

## Parents

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

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