about summary refs log tree commit diff
path: root/compiler/rustc_abi/src/layout
AgeCommit message (Collapse)AuthorLines
2025-09-27compiler: remove AbiAlign inside TargetDataLayoutJubilee Young-13/+14
This maintains AbiAlign usage in public API and most of the compiler, but direct access of these fields is now in terms of Align only.
2025-07-03Remove PointerLike traitMichael Goulet-11/+1
2025-06-20compiler: Rename LayoutS to LayoutData in commentsZachary S-1/+1
2025-06-08Remove rustc's notion of "preferred" alignment AKA `__alignof`Jubilee Young-2/+2
In PR 90877 T-lang decided not to remove `intrinsics::pref_align_of`. However, the intrinsic and its supporting code 1. is a nightly feature, so can be removed at compiler/libs discretion 2. requires considerable effort in the compiler to support, as it necessarily complicates every single site reasoning about alignment 3. has been justified based on relevance to codegen, but it is only a requirement for C++ (not C, not Rust) stack frame layout for AIX, in ways Rust would not consider even with increased C++ interop 4. is only used by rustc to overalign some globals, not correctness 5. can be adequately replaced by other rules for globals, as it mostly affects alignments for a few types under 16 bytes of alignment 6. has only one clear benefactor: automating C -> Rust translation for GNU extensions like `__alignof` 7. such code was likely intended to be `alignof` or `_Alignof`, because the GNU extension is a "false friend" of the C keyword, which makes the choice to support such a mapping very questionable 8. makes it easy to do incorrect codegen in the compiler by its mere presence as usual Rust rules of alignment (e.g. `size == align * N`) do not hold with preferred alignment The implementation is clearly damaging the code quality of the compiler. Thus it is within the compiler team's purview to simply rip it out. If T-lang wishes to have this intrinsic restored for c2rust's benefit, it would have to use a radically different implementation that somehow does not cause internal incorrectness. Until then, remove the intrinsic and its supporting code, as one tool and an ill-considered GCC extension cannot justify risking correctness. Because we touch a fair amount of the compiler to change this at all, and unfortunately the duplication of AbiAndPrefAlign is deep-rooted, we keep an "AbiAlign" type which we can wean code off later.
2025-06-06Update compiler/rustc_abi/src/layout/ty.rsscottmcm-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-06-05Update `InterpCx::project_field` to take `FieldIdx`Scott McMurray-2/+9
As suggested by Ralf in 142005.
2025-06-03Change `tag_field` to `FieldIdx` in `Variants::Multiple`Scott McMurray-2/+2
It was already available as a generic parameter anyway, and it's not like we'll ever put a tag in the 5-billionth field.
2025-03-08Move coroutine layout logic to `rustc_abi`Moulins-0/+320
2025-03-08Move SIMD layout logic to `rustc_abi`Moulins-0/+6
2025-03-08Remove most manual LayoutData creations and move them to `rustc_abi`Moulins-0/+148
...either as: - methods on LayoutCalculator, for faillible operations; - constructors on LayoutData, for infaillible ones.
2025-02-28rename BackendRepr::Vector → SimdVectorRalf Jung-1/+1
2025-02-06compiler: reorganize rustc_abi to be more internally uniformJubilee Young-4/+8
General housekeeping: - Use less reexports from its rustc_target era - Unify some imports as a result - Split the Reg(ister) types into their own files Generally moving stuff around because it makes the crate more consistent.
2024-11-14Support s390x z13 vector ABITaiki Endo-0/+18
2024-10-29compiler: `rustc_abi::Abi` => `BackendRepr`Jubilee Young-6/+6
The initial naming of "Abi" was an awful mistake, conveying wrong ideas about how psABIs worked and even more about what the enum meant. It was only meant to represent the way the value would be described to a codegen backend as it was lowered to that intermediate representation. It was never meant to mean anything about the actual psABI handling! The conflation is because LLVM typically will associate a certain form with a certain ABI, but even that does not hold when the special cases that actually exist arise, plus the IR annotations that modify the ABI. Reframe `rustc_abi::Abi` as the `BackendRepr` of the type, and rename `BackendRepr::Aggregate` as `BackendRepr::Memory`. Unfortunately, due to the persistent misunderstandings, this too is now incorrect: - Scattered ABI-relevant code is entangled with BackendRepr - We do not always pre-compute a correct BackendRepr that reflects how we "actually" want this value to be handled, so we leave the backend interface to also inject various special-cases here - In some cases `BackendRepr::Memory` is a "real" aggregate, but in others it is in fact using memory, and in some cases it is a scalar! Our rustc-to-backend lowering code handles this sort of thing right now. That will eventually be addressed by lifting duplicated lowering code to either rustc_codegen_ssa or rustc_target as appropriate.
2024-10-27compiler: Rename LayoutS to LayoutDataJubilee Young-5/+5
The last {UninternedType}S is in captivity. The galaxy is at peace.
2024-10-11compiler: Wire `{TyAnd,}Layout` into `rustc_abi`Jubilee Young-3/+1
This finally unites TyAndLayout, Layout, and LayoutS into the same crate, as one might imagine they would be placed. No functional changes.
2024-10-11compiler: Empty out rustc_target::abiJubilee Young-0/+269