rust/compiler/rustc_codegen_llvm/src
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
..
back Rollup merge of #82483 - tmiasko:option-from-str, r=matthewjasper 2021-04-05 13:03:37 +02:00
coverageinfo Translate counters from Rust 1-based to LLVM 0-based counter ids 2021-04-02 17:16:36 -07:00
debuginfo Rollup merge of #80525 - devsnek:wasm64, r=nagisa 2021-04-05 00:24:23 +02:00
llvm Categorize and explain target features support 2021-04-09 10:16:04 -05:00
abi.rs Enable mutable noalias by default for LLVM 12 2021-03-21 20:10:54 +01:00
allocator.rs Remove redundant to_string calls 2021-02-17 11:25:55 +01:00
asm.rs Allow clobbering unsupported registers in asm! 2021-04-04 10:42:32 +01:00
attributes.rs rustc: Add a new wasm ABI 2021-04-08 08:03:18 -07:00
base.rs Move SanitizerSet to rustc_target 2021-04-03 00:37:49 +03:00
builder.rs Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
callee.rs Manually set dso_local when its valid to do so 2021-04-03 00:00:29 +03:00
common.rs
consts.rs Replace const_cstr with cstr crate 2021-02-14 09:45:35 +11:00
context.rs Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa 2021-03-25 13:11:18 +00:00
declare.rs
intrinsic.rs correct macro names 2021-03-19 03:47:13 +08:00
lib.rs Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
llvm_util.rs Categorize and explain target features support 2021-04-09 10:16:04 -05:00
metadata.rs fix review 2021-02-25 04:21:12 +03:00
mono_item.rs Manually set dso_local when its valid to do so 2021-04-03 00:00:29 +03:00
type_.rs
type_of.rs
va_arg.rs
value.rs