about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/layout_test.rs
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-10-29 13:37:26 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-10-29 14:56:00 -0700
commit7086dd83cca1cf694c7bd171efbf262fa8ffb4aa (patch)
treea01a9f48b7bc1e43128c0fdd0294dfb1d8bc345a /compiler/rustc_passes/src/layout_test.rs
parent2dece5bb62f234f5622a08289c5a3d1555cd7843 (diff)
downloadrust-7086dd83cca1cf694c7bd171efbf262fa8ffb4aa.tar.gz
rust-7086dd83cca1cf694c7bd171efbf262fa8ffb4aa.zip
compiler: `rustc_abi::Abi` => `BackendRepr`
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.
Diffstat (limited to 'compiler/rustc_passes/src/layout_test.rs')
-rw-r--r--compiler/rustc_passes/src/layout_test.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs
index 0b6cf82ca8b..7260c12f278 100644
--- a/compiler/rustc_passes/src/layout_test.rs
+++ b/compiler/rustc_passes/src/layout_test.rs
@@ -81,8 +81,12 @@ fn dump_layout_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId, attr: &Attribute) {
             let meta_items = attr.meta_item_list().unwrap_or_default();
             for meta_item in meta_items {
                 match meta_item.name_or_empty() {
+                    // FIXME: this never was about ABI and now this dump arg is confusing
                     sym::abi => {
-                        tcx.dcx().emit_err(LayoutAbi { span, abi: format!("{:?}", ty_layout.abi) });
+                        tcx.dcx().emit_err(LayoutAbi {
+                            span,
+                            abi: format!("{:?}", ty_layout.backend_repr),
+                        });
                     }
 
                     sym::align => {