Files
rust/compiler/rustc_codegen_ssa
Jacob Pratt 4200fb100f Rollup merge of #159164 - scottmcm:remove-is-backend-blah, r=workingjubilee
[cg_ssa] Eliminate the `is_backend_{immediate,scalar_pair,ref}` methods

These methods are just mostly just matches on [`BackendRepr`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.BackendRepr.html) now, which makes then not not very valuable.  Notably, `cg_clif` gets along just fine without them.  In general, it's much nicer to match on `BackendRepr` than to use an `if`-`else` chain of `is_zst`+`is_backend_immediate`+`is_backend_scalar_pair`.

And having them be on `LayoutTypeCodegenMethods` means you need a context to use them, making it more annoying to use them in things like [`OperandValue::is_expected_variant_for_type`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/operand/enum.OperandValue.html#method.is_expected_variant_for_type).

So this just removes them, as well as the `is_llvm_*` and `is_gcc_*` versions.

How I migrated callers:
- `is_backend_ref` becomes a (logical-not-ed) call to a new `.is_ssa_standalone()` method.  (Better name suggestions welcome for this one.  I wanted something to hopefully phrase intent better and positively.)
- `is_backend_immediate` becomes a call to `.backend_repr.is_scalar_or_simd()`.
- `is_backend_scalar_pair` becomes a pattern-match against `BackendRepr::ScalarPair { .. }`.
- some places that used multiples just became a match over `BackendRepr`.

The intent is that this has zero impact on the codegen.  It should be a refactor only.

r? codegen
2026-07-17 23:33:30 -04:00
..
2026-06-24 23:18:10 +01:00
…

Please read the rustc-dev-guide chapter on Backend Agnostic Codegen.