rust/compiler
Alex Crichton 97658e58f0 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.
2021-05-06 08:52:03 -07:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast
rustc_ast_lowering Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis 2021-05-04 08:09:23 +00:00
rustc_ast_passes
rustc_ast_pretty parser: Remove support for inner attributes on non-block expressions 2021-05-03 13:33:53 +03:00
rustc_attr
rustc_builtin_macros
rustc_codegen_cranelift Merge commit '15c8d31392b9fbab3b3368b67acc4bbe5983115a' into cranelift-rebase 2021-04-30 18:46:59 +02:00
rustc_codegen_llvm rustc: Support Rust-specific features in -Ctarget-feature 2021-05-06 08:52:03 -07:00
rustc_codegen_ssa Auto merge of #84468 - iladin:iladin/fix-84467, r=petrochenkov 2021-05-06 07:02:06 +00:00
rustc_data_structures
rustc_driver
rustc_error_codes Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis 2021-05-04 08:09:23 +00:00
rustc_errors lazify backtrace formatting for delayed diagnostics 2021-05-05 22:57:48 +02:00
rustc_expand use full path for E0761 2021-05-03 18:57:48 +08:00
rustc_feature Auto merge of #84401 - crlf0710:impl_main_by_path, r=petrochenkov 2021-04-30 06:59:37 +00:00
rustc_fs_util
rustc_graphviz
rustc_hir Add type to differentiate between fake and real DefId's 2021-05-04 19:34:12 +02:00
rustc_hir_pretty
rustc_incremental
rustc_index Change bitwise operator to more easily keep data in vector registers 2021-05-04 11:55:18 -04:00
rustc_infer
rustc_interface Auto merge of #84401 - crlf0710:impl_main_by_path, r=petrochenkov 2021-04-30 06:59:37 +00:00
rustc_lexer
rustc_lint Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis 2021-05-04 08:09:23 +00:00
rustc_lint_defs Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis 2021-05-04 08:09:23 +00:00
rustc_llvm Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_None 2021-04-29 15:25:17 -07:00
rustc_macros
rustc_metadata Add type to differentiate between fake and real DefId's 2021-05-04 19:34:12 +02:00
rustc_middle Rollup merge of #84903 - hyd-dev:dead-check-in-alloc-msg, r=RalfJung 2021-05-05 17:52:28 +02:00
rustc_mir Change 'NULL' to 'null' 2021-05-02 17:46:00 -06:00
rustc_mir_build
rustc_parse parser: Remove support for inner attributes on non-block expressions 2021-05-03 13:33:53 +03:00
rustc_parse_format
rustc_passes
rustc_plugin_impl
rustc_privacy
rustc_query_impl Move iter_results to dyn FnMut rather than a generic 2021-04-29 17:26:46 -04:00
rustc_query_system Avoid generating QueryMap::extend for each key type 2021-05-01 20:13:18 -04:00
rustc_resolve add suggestion for unit enum variant when matched with a patern 2021-05-02 13:58:38 +02:00
rustc_save_analysis
rustc_serialize
rustc_session Rollup merge of #84803 - jyn514:duplicate-macros, r=petrochenkov 2021-05-05 17:52:22 +02:00
rustc_span Use new thread-local const-init 2021-05-02 14:06:07 -04:00
rustc_symbol_mangling
rustc_target Rollup merge of #84072 - nagisa:target-family-two-the-movie, r=petrochenkov 2021-05-03 00:32:40 +02:00
rustc_trait_selection
rustc_traits
rustc_ty_utils
rustc_type_ir Make TypeFoldable::is_global() false when fresh tys/consts are present 2021-05-01 16:58:33 -04:00
rustc_typeck Rollup merge of #84913 - estebank:issue-84831, r=varkor 2021-05-05 17:52:29 +02:00