rust/compiler/rustc_codegen_ssa/src/traits
bors 327c7ee436 Auto merge of #133099 - RalfJung:forbidden-hardfloat-features, r=workingjubilee
forbid toggling x87 and fpregs on hard-float targets

Part of https://github.com/rust-lang/rust/issues/116344, follow-up to https://github.com/rust-lang/rust/pull/129884:

The `x87`  target feature on x86 and the `fpregs` target feature on ARM must not be disabled on a hardfloat target, as that would change the float ABI. However, *enabling* `fpregs` on ARM is [explicitly requested](https://github.com/rust-lang/rust/issues/130988) as it seems to be useful. Therefore, we need to refine the distinction of "forbidden" target features and "allowed" target features: all (un)stable target features can determine on a per-target basis whether they should be allowed to be toggled or not. `fpregs` then checks whether the current target has the `soft-float` feature, and if yes, `fpregs` is permitted -- otherwise, it is not. (Same for `x87` on x86).

Also fixes https://github.com/rust-lang/rust/issues/132351. Since `fpregs` and `x87` can be enabled on some builds and disabled on others, it would make sense that one can query it via `cfg`. Therefore, I made them behave in `cfg` like any other unstable target feature.

The first commit prepares the infrastructure, but does not change behavior. The second commit then wires up `fpregs` and `x87` with that new infrastructure.

r? `@workingjubilee`
2024-12-13 19:43:00 +00:00
..
abi.rs Merge apply_attrs_callsite into call and invoke 2022-10-01 17:01:31 +00:00
asm.rs codegen #[naked] functions using global_asm! 2024-12-10 21:41:03 +01:00
backend.rs generalize 'forbidden feature' concept so that even (un)stable feature can be invalid to toggle 2024-12-11 22:11:15 +01:00
builder.rs Likely unlikely fix 2024-11-17 21:49:10 +01:00
consts.rs Reorder ConstMethods. 2024-09-19 20:10:42 +10:00
coverageinfo.rs Remove BackendTypes constraint from traits that don't need it. 2024-09-17 10:24:43 +10:00
debuginfo.rs CFI: Append debug location to CFI blocks 2024-11-11 09:17:43 +00:00
declare.rs Rename supertraits of CodegenMethods. 2024-09-17 10:24:43 +10:00
intrinsic.rs compiler: Directly use rustc_abi in codegen 2024-11-03 12:30:32 -08:00
misc.rs Rollup merge of #130457 - nnethercote:cleanup-codegen-traits, r=bjorn3 2024-09-18 17:49:43 +02:00
mod.rs compiler: Directly use rustc_abi in codegen 2024-11-03 12:30:32 -08:00
statics.rs compiler: Directly use rustc_abi in codegen 2024-11-03 12:30:32 -08:00
type_.rs move fn is_item_raw to TypingEnv 2024-11-19 18:06:20 +01:00
write.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00