Repository navigation
Commit 5c845c6
authored
Rollup merge of #163143 - Zalathar:check-features, r=davidtwco
cg_llvm: Use fewer FFI calls to check the target CPU's features
The existing code makes a separate FFI call to `MCSubtargetInfo::checkFeatures` for each feature-dependency of the feature being checked, and also performs string-manipulation on the C++ side to add a leading `+` to each feature name.
What we can do instead is prepare a single string on the Rust side in the form `"+foo,+bar,+baz,"` for each Rust target feature, and pass that to LLVM as a pointer/length string. LLVM already knows how to check that all of the listed features are present.
This change makes the code simpler overall. All of the string manipulation now takes place either in Rust code or in LLVM itself, and not in our C++ wrapper.
There should be no change to compiler output.4 files changed
Lines changed: 23 additions & 20 deletions
File tree
- compiler
- rustc_codegen_llvm/src
- back
- llvm
- rustc_llvm/llvm-wrapper
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
36 | 45 | | |
37 | 46 | | |
38 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2422 | 2422 | | |
2423 | 2423 | | |
2424 | 2424 | | |
2425 | | - | |
| 2425 | + | |
2426 | 2426 | | |
2427 | | - | |
| 2427 | + | |
| 2428 | + | |
2428 | 2429 | | |
2429 | 2430 | | |
2430 | 2431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
375 | 367 | | |
376 | 368 | | |
377 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
0 commit comments