about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/transform/coverage/debug.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-05-07 16:19:22 +0200
committerGitHub <noreply@github.com>2021-05-07 16:19:22 +0200
commita3fbde4240628b7d83989a22351e39f1242ed209 (patch)
tree2bb7357bea2d75547bdfa0fc9ffc8c98ec45e6b7 /compiler/rustc_mir/src/transform/coverage/debug.rs
parentcea6e4d6b915b3f88fb850499fd3684d7a6c708e (diff)
parent97658e58f0f5af5fec694c5c5df143685ee421b0 (diff)
downloadrust-a3fbde4240628b7d83989a22351e39f1242ed209.tar.gz
rust-a3fbde4240628b7d83989a22351e39f1242ed209.zip
Rollup merge of #84991 - alexcrichton:target-feature-remap, r=nagisa
rustc: Support Rust-specific features in -Ctarget-feature

Since the beginning of time the `-Ctarget-feature` flag on the command
line has largely been passed unmodified to LLVM. Afterwards, though, the
`#[target_feature]` attribute was stabilized and some of the names in
this attribute do not match the corresponding LLVM name. This is because
Rust doesn't always want to stabilize the exact feature name in LLVM for
the equivalent functionality in Rust. This creates a situation, however,
where in Rust you'd write:

    #[target_feature(enable = "pclmulqdq")]
    unsafe fn foo() {
        // ...
    }

but on the command line you would write:

    RUSTFLAGS="-Ctarget-feature=+pclmul" cargo build --release

This difference is somewhat odd to deal with if you're a newcomer and
the situation may be made worse with upcoming features like [WebAssembly
SIMD](https://github.com/rust-lang/rust/issues/74372) which may be more
prevalent.

This commit implements a mapping to translate requests via
`-Ctarget-feature` through the same name-mapping functionality that's
present for attributes in Rust going to LLVM. This means that
`+pclmulqdq` will work on x86 targets where as previously it did not.

I've attempted to keep this backwards-compatible where the compiler will
just opportunistically attempt to remap features found in
`-Ctarget-feature`, but if there's something it doesn't understand it
gets passed unmodified to LLVM just as it was before.
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions