-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add all known target_feature
configs to check-cfg
#118908
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
Portable SIMD is developed in its own repository. If possible, consider making this change to rust-lang/portable-simd instead. |
This comment has been minimized.
This comment has been minimized.
7ddc854
to
3f58f62
Compare
Some changes occurred in compiler/rustc_codegen_gcc Portable SIMD is developed in its own repository. If possible, consider making this change to rust-lang/portable-simd instead. |
This comment has been minimized.
This comment has been minimized.
3f58f62
to
ada0e07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks super cool, thanks!
Is there any chance the target features can be somewhere like |
It should be possible if we are willing to publicly expose the individual lists or remove the Basically everywhere we can have a dependency on |
pub fn supported_target_features(sess: &crate::Session) -> &'static [(&'static str, Stability)] { | ||
match &*sess.target.arch { | ||
"arm" => ARM_ALLOWED_FEATURES, | ||
"aarch64" => AARCH64_ALLOWED_FEATURES, | ||
"x86" | "x86_64" => X86_ALLOWED_FEATURES, | ||
"hexagon" => HEXAGON_ALLOWED_FEATURES, | ||
"mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_ALLOWED_FEATURES, | ||
"powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES, | ||
"riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES, | ||
"wasm32" | "wasm64" => WASM_ALLOWED_FEATURES, | ||
"bpf" => BPF_ALLOWED_FEATURES, | ||
"csky" => CSKY_ALLOWED_FEATURES, | ||
"loongarch64" => LOONGARCH_ALLOWED_FEATURES, | ||
_ => &[], | ||
} | ||
} | ||
|
||
pub fn tied_target_features(sess: &crate::Session) -> &'static [&'static [&'static str]] { | ||
match &*sess.target.arch { | ||
"aarch64" => AARCH64_TIED_FEATURES, | ||
_ => &[], | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These taking a Session is not particularly intrinsic to their functionality. What matters is that we're burning a path to sess.target.arch
, which means we're already going through rustc_target::Target
. These can be turned into functions implemented on Target
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. This is much cleaner now. Thank you very much.
ada0e07
to
fb9b31c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that, the portable-simd change looks good to me. Thanks!
Thanks! @bors r+ |
…aKO8Ki Add all known `target_feature` configs to check-cfg This PR adds all the known `target_feature` from ~~`rustc_codegen_ssa`~~ `rustc_target` to the well known list of check-cfg. It does so by moving the list from `rustc_codegen_ssa` to `rustc_target` ~~`rustc_session` (I not sure about this, but some of the moved function take a `Session`)~~, then using it the `fill_well_known` function. This already proved to be useful since portable-simd had a bad cfg. cc `@nnethercote` (since we discussed it in rust-lang#118494)
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
fb9b31c
to
3ea1331
Compare
@bors r=TaKO8Ki,GuillaumeGomez,workingjubilee |
…kingjubilee Rollup of 4 pull requests Successful merges: - rust-lang#118908 (Add all known `target_feature` configs to check-cfg) - rust-lang#118933 (Cleanup errors handlers even more) - rust-lang#118943 (update `measureme` to 10.1.2 to deduplicate `parking_lot`) - rust-lang#118948 (Use the `Waker::noop` API in tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#118908 - Urgau:check-cfg-target-features, r=TaKO8Ki,GuillaumeGomez,workingjubilee Add all known `target_feature` configs to check-cfg This PR adds all the known `target_feature` from ~~`rustc_codegen_ssa`~~ `rustc_target` to the well known list of check-cfg. It does so by moving the list from `rustc_codegen_ssa` to `rustc_target` ~~`rustc_session` (I not sure about this, but some of the moved function take a `Session`)~~, then using it the `fill_well_known` function. This already proved to be useful since portable-simd had a bad cfg. cc `@nnethercote` (since we discussed it in rust-lang#118494)
This PR adds all the known
target_feature
fromrustc_codegen_ssa
rustc_target
to the well known list of check-cfg.It does so by moving the list from
rustc_codegen_ssa
torustc_target
, then using it therustc_session
(I not sure about this, but some of the moved function take aSession
)fill_well_known
function.This already proved to be useful since portable-simd had a bad cfg.
cc @nnethercote (since we discussed it in #118494)