mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:00:13 +01:00
Instead of allowing lower to pick whatever type layout it desires, compute the layouts of types as part of completing the type, and make lower build types that match that representation. For now we assume that all pointers are 64-bit, since we don't have access to target information. We allow tail padding reuse for structs and tuple types (and by extension, for classes, since they use structs as their object representation), but not for arrays. In order to build matching LLVM types, we create LLVM packed structs where necessary, and we insert inter-field padding on the end of the previous field so that GEP indexes still always match Carbon's ElementIndexes. We don't yet use the computed alignment much in LLVM IR generation -- in particular, `alloca`s, `load`s, and `store`s should probably use the computed type alignment, but don't. Assisted-by: Gemini via Antigravity