rust/compiler
Dylan DPC a3fbde4240
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.
2021-05-07 16:19:22 +02:00
..
rustc use jemallocator in rustc/rustdoc 2021-04-04 14:10:26 -07:00
rustc_apfloat Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_arena Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_ast Auto merge of #83386 - mark-i-m:stabilize-pat2015, r=nikomatsakis 2021-04-28 20:35:17 +00:00
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 Implement RFC 2951: Native link modifiers 2021-05-05 16:04:25 -07:00
rustc_ast_pretty parser: Remove support for inner attributes on non-block expressions 2021-05-03 13:33:53 +03:00
rustc_attr Allow specifying alignment for functions 2021-04-05 17:36:51 -04:00
rustc_builtin_macros Disallows #![feature(no_coverage)] on stable and beta 2021-05-05 07:52:26 -07:00
rustc_codegen_cranelift Implement RFC 2951: Native link modifiers 2021-05-05 16:04:25 -07:00
rustc_codegen_llvm Rollup merge of #84991 - alexcrichton:target-feature-remap, r=nagisa 2021-05-07 16:19:22 +02:00
rustc_codegen_ssa Rollup merge of #84866 - petrochenkov:wholesome, r=Mark-Simulacrum 2021-05-07 16:19:20 +02:00
rustc_data_structures Only compute Obligation cache_key once in register_obligation_at 2021-05-04 11:57:53 -07:00
rustc_driver Rollup merge of #83895 - eggyal:issue-83883, r=jyn514 2021-04-06 17:42:31 +02:00
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 Rollup merge of #84442 - jyn514:doc-cfg, r=petrochenkov 2021-05-07 16:19:19 +02:00
rustc_feature Rollup merge of #84871 - richkadel:no-coverage-unstable-only, r=nagisa 2021-05-07 00:38:40 +02:00
rustc_fs_util Optimize away a fs::metadata call. 2021-01-06 08:33:15 -08:00
rustc_graphviz Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_hir Add type to differentiate between fake and real DefId's 2021-05-04 19:34:12 +02:00
rustc_hir_pretty Handle pretty printing of else if let clauses 2021-04-23 13:29:18 -04:00
rustc_incremental Add [TRACKED_NO_CRATE_HASH] and [SUBSTRUCT] directives 2021-04-27 16:46:33 +00:00
rustc_index Change bitwise operator to more easily keep data in vector registers 2021-05-04 11:55:18 -04:00
rustc_infer remove unused variant 2021-05-06 14:59:53 +02:00
rustc_interface Implement RFC 2951: Native link modifiers 2021-05-05 16:04:25 -07:00
rustc_lexer Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
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 Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_metadata Implement RFC 2951: Native link modifiers 2021-05-05 16:04:25 -07:00
rustc_middle Rollup merge of #84972 - RalfJung:null-ptr-msg, r=oli-obk 2021-05-07 15:20:29 +09:00
rustc_mir Auto merge of #84797 - richkadel:cover-unreachable-statements, r=tmandry 2021-05-07 10:06:40 +00:00
rustc_mir_build Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk 2021-04-24 23:16:03 +00:00
rustc_parse Rollup merge of #84896 - estebank:issue-84772, r=jackh726 2021-05-07 00:38:42 +02:00
rustc_parse_format Rollup merge of #83348 - osa1:issue83344, r=jackh726 2021-03-28 01:33:13 +09:00
rustc_passes Implement RFC 1260 with feature_name imported_main. 2021-04-29 08:35:08 +08:00
rustc_plugin_impl Remove hir::Item::attrs. 2021-03-09 19:27:50 +01:00
rustc_privacy fix few typos 2021-04-19 15:57:08 +03:00
rustc_query_impl Move iter_results to dyn FnMut rather than a generic 2021-04-29 17:26:46 -04:00
rustc_query_system Auto merge of #84806 - Mark-Simulacrum:try-start-entry, r=cjgillot 2021-05-06 22:35:06 +00: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 Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
rustc_serialize Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillot 2021-03-26 01:28:59 +00:00
rustc_session Rollup merge of #84815 - richkadel:coverage-docs-update-2021-05, r=tmandry 2021-05-07 15:20:24 +09:00
rustc_span Implement RFC 2951: Native link modifiers 2021-05-05 16:04:25 -07:00
rustc_symbol_mangling Rollup merge of #80525 - devsnek:wasm64, r=nagisa 2021-04-05 00:24:23 +02:00
rustc_target Rollup merge of #84930 - hermitcore:target, r=nagisa 2021-05-07 16:19:21 +02:00
rustc_trait_selection Rollup merge of #84987 - lcnr:nits, r=Mark-Simulacrum 2021-05-07 00:38:45 +02:00
rustc_traits Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_ty_utils Split crate_hash from index_hir. 2021-04-29 21:36:48 +02:00
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 #84871 - richkadel:no-coverage-unstable-only, r=nagisa 2021-05-07 00:38:40 +02:00