rust/compiler
bors dae9d6ac3e Auto merge of #84004 - mattico:print-target-features-improvements, r=petrochenkov
Categorize and explain target features support

There are 3 different uses of the `-C target-feature` args passed to rustc:
1. All of the features are passed to LLVM, which uses them to configure code-generation. This is sort-of stabilized since 1.0 though LLVM does change/add/remove target features regularly.
2. Target features which are in [the compiler's allowlist](69e1d22ddb/compiler/rustc_codegen_ssa/src/target_features.rs (L12-L34)) can be used in `cfg!(target_feature)` etc. These may have different names than in LLVM and are renamed before passing them to LLVM.
3. Target features which are in the allowlist and which are stabilized or feature-gate-enabled can be used in `#[target_feature]`.

It can be confusing that `rustc --print target-features` just prints out the LLVM features without separating out the rustc features or even mentioning that the dichotomy exists.

This improves the situation by separating out the rustc and LLVM target features and adding a brief explanation about the difference.

Abbreviated Example Output:
```
$ rustc --print target-features
Features supported by rustc for this target:
    adx                         - Support ADX instructions.
    aes                         - Enable AES instructions.
...
    xsaves                      - Support xsaves instructions.
    crt-static                  - Enables libraries with C Run-time Libraries(CRT) to be statically linked.

Code-generation features supported by LLVM for this target:
    16bit-mode                  - 16-bit mode (i8086).
    32bit-mode                  - 32-bit mode (80386).
...
    x87                         - Enable X87 float instructions.
    xop                         - Enable XOP instructions.

Use +feature to enable a feature, or -feature to disable it.
For example, rustc -C target-cpu=mycpu -C target-feature=+feature1,-feature2

Code-generation features cannot be used in cfg or #[target_feature],
and may be renamed or removed in a future version of LLVM or rustc.

```

Motivated by #83975.
CC https://github.com/rust-lang/rust/issues/49653
2021-04-09 21:14:50 +00:00
..
rustc use jemallocator in rustc/rustdoc 2021-04-04 14:10:26 -07:00
rustc_apfloat
rustc_arena
rustc_ast Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco 2021-04-08 20:29:58 +02:00
rustc_ast_lowering Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco 2021-04-08 20:29:58 +02:00
rustc_ast_passes rustc: Add a new wasm ABI 2021-04-08 08:03:18 -07:00
rustc_ast_pretty Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
rustc_attr Allow specifying alignment for functions 2021-04-05 17:36:51 -04:00
rustc_builtin_macros Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov 2021-04-07 13:07:14 +02:00
rustc_codegen_cranelift Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_codegen_llvm Auto merge of #84004 - mattico:print-target-features-improvements, r=petrochenkov 2021-04-09 21:14:50 +00:00
rustc_codegen_ssa Fix closed over variables not available in debuginfo for Windows MSVC 2021-04-08 14:08:56 -04:00
rustc_data_structures Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_driver Rollup merge of #83895 - eggyal:issue-83883, r=jyn514 2021-04-06 17:42:31 +02:00
rustc_error_codes Bump cfgs 2021-04-04 14:57:05 -04:00
rustc_errors Document compiler/ with -Aprivate-intra-doc-links 2021-04-05 08:38:09 -04:00
rustc_expand Rollup merge of #83816 - JohnTitor:unused-doc-comments-on-macros, r=varkor 2021-04-07 13:07:12 +02:00
rustc_feature Auto merge of #84008 - Dylan-DPC:rollup-invxvg8, r=Dylan-DPC 2021-04-08 19:38:54 +00:00
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco 2021-04-08 20:29:58 +02:00
rustc_hir_pretty Use AnonConst for asm! constants 2021-04-06 12:35:41 +01:00
rustc_incremental Also profile finishing the encoding. 2021-03-30 18:10:08 +02:00
rustc_index Add fixme comment to revert change once const_panic is stable 2021-04-03 13:07:03 +02:00
rustc_infer Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_interface Fix outdated crate names in rustc_interface::callbacks 2021-04-07 11:45:27 -05:00
rustc_lexer Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_lint Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco 2021-04-08 20:29:58 +02:00
rustc_lint_defs Fix rustc_lint_defs documentation typo 2021-04-03 12:00:28 -03:00
rustc_llvm Categorize and explain target features support 2021-04-09 10:16:04 -05:00
rustc_macros
rustc_metadata Rollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa 2021-04-05 00:24:33 +02:00
rustc_middle Auto merge of #83870 - jackh726:binder-refactor-fix, r=nikomatsakis 2021-04-09 01:50:01 +00:00
rustc_mir Auto merge of #83870 - jackh726:binder-refactor-fix, r=nikomatsakis 2021-04-09 01:50:01 +00:00
rustc_mir_build rustc: Add a new wasm ABI 2021-04-08 08:03:18 -07:00
rustc_parse Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco 2021-04-08 20:29:58 +02:00
rustc_parse_format
rustc_passes Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov 2021-04-07 13:07:14 +02:00
rustc_plugin_impl
rustc_privacy
rustc_query_impl Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_query_system Fix outdated crate names in compiler docs 2021-04-08 11:12:14 -05:00
rustc_resolve Auto merge of #83870 - jackh726:binder-refactor-fix, r=nikomatsakis 2021-04-09 01:50:01 +00:00
rustc_save_analysis Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
rustc_serialize
rustc_session Remove the insta-stable cfg(wasm) 2021-04-07 23:09:56 +03:00
rustc_span rustc: Add a new wasm ABI 2021-04-08 08:03:18 -07:00
rustc_symbol_mangling Rollup merge of #80525 - devsnek:wasm64, r=nagisa 2021-04-05 00:24:23 +02:00
rustc_target Auto merge of #84008 - Dylan-DPC:rollup-invxvg8, r=Dylan-DPC 2021-04-08 19:38:54 +00:00
rustc_trait_selection Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco 2021-04-08 20:29:58 +02:00
rustc_traits Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_ty_utils Track bound vars 2021-03-31 10:15:27 -04:00
rustc_type_ir Remove nightly features in rustc_type_ir 2021-04-03 10:00:09 +02:00
rustc_typeck Auto merge of #83956 - estebank:issue-83892, r=varkor 2021-04-09 04:19:25 +00:00