summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
AgeCommit message (Collapse)AuthorLines
2023-05-18Auto merge of #111364 - cuviper:unhack-thinlto, r=nikicbors-57/+0
Remove the ThinLTO CU hack This reverts #46722, commit e0ab5d5feb4eb2d8af11b8dd9446c2b45fada8af. Since #111167, commit 10b69dde3fd15334ea2382d2dc9e9a261de1afaf, we are generating DWARF subprograms in a way that is meant to be more compatible with LLVM's expectations, so hopefully we don't need this workaround rewriting CUs anymore.
2023-05-12Usage of atomic counters for llvm code coverageEvgeniy A. Dushistov-0/+3
2023-05-09Correctly mark parameter `RustMappingRegions` as pointer-to-`const`Zalathar-1/+1
The regions don't need to be mutable because we pass a copy of them to LLVM instead, and this matches the `*const` in the Rust-side signature.
2023-05-09Isolate coverage FFI type layouts from their underlying LLVM C++ typesZalathar-7/+100
2023-05-08Remove the ThinLTO CU hackJosh Stone-57/+0
This reverts #46722, commit e0ab5d5feb4eb2d8af11b8dd9446c2b45fada8af. Since #111167, commit 10b69dde3fd15334ea2382d2dc9e9a261de1afaf, we are generating DWARF subprograms in a way that is meant to be more compatible with LLVM's expectations, so hopefully we don't need this workaround rewriting CUs anymore.
2023-05-06Rollup merge of #111274 - cuviper:print-target-cpus, r=Mark-SimulacrumMatthias Krüger-14/+16
Expand the LLVM coverage of `--print target-cpus` We've been relying on a custom patch to add `MCSubtargetInfo::getCPUTable` for `rustc --print target-cpus`, and just printing that it's not supported on external LLVM builds. LLVM `main` now has `getAllProcessorDescriptions` that can replace ours, so now we try to use that. In addition, the fallback path can at least print the native and default cpu options. There were also some mismatches in the function signatures here between `LLVM_RUSTLLVM` and otherwise; this is now mitigated by sharing these functions and only using cpp to adjust the function bodies.
2023-05-06Rollup merge of #111167 - cuviper:type-decl-disubprogram, r=michaelwoeristerMatthias Krüger-0/+22
debuginfo: split method declaration and definition When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. Now the subprogram definition gets added at the CU level with a specification link back to the abstract declaration. Both GCC and Clang write debuginfo this way for C++ class methods. Fixes #109730. Fixes #109934.
2023-05-05Expand the LLVM coverage of `--print target-cpus`Josh Stone-14/+16
We've been relying on a custom patch to add `MCSubtargetInfo::getCPUTable` for `rustc --print target-cpus`, and just printing that it's not supported on external LLVM builds. LLVM `main` now has `getAllProcessorDescriptions` that can replace ours, so now we try to use that. In addition, the fallback path can at least print the native and default cpu options. There were also some mismatches in the function signatures here between `LLVM_RUSTLLVM` and otherwise; this is now mitigated by sharing these functions and only using cpp to adjust the function bodies.
2023-05-04change expect() to unwrap_or_else() and update msgJames Dietz-2/+6
2023-05-04moved default CPU message inlineJames Dietz-9/+7
2023-05-04`--print target-cpus` shows default target cpu, updated docsJames Dietz-2/+9
2023-05-03debuginfo: split method declaration and definitionJosh Stone-0/+22
When we're adding a method to a type DIE, we only want a DW_AT_declaration there, because LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition. Now the subprogram definition gets added at the CU level with a specification link back to the abstract declaration.
2023-04-24[LLVM17] Adapt to `ExplicitEmulatedTLS` removal.Tim Neumann-0/+5
2023-04-23Rollup merge of #110668 - ehuss:fix-native-cpu-list, r=cuviperMatthias Krüger-1/+3
Fix printing native CPU on cross-compiled compiler. If `rustc` is cross-compiled from a different host, then the "native" entry in `rustc --print=target-cpus` would not appear. There is a check in the printing code that will avoid printing the "native" entry if the user has passed `--target`. However, that check was comparing the `--target` value with the `LLVM_TARGET_TRIPLE` which is the triple of the host that `rustc` was built on (the "build" target in Rust lingo), not the target it was being built for (the "host" in Rust lingo). This fixes it to use the target that LLVM was built for (which I'm pretty sure this is the correct function to determine that). This fixes the cpu listing for aarch64-apple-darwin which is built on CI using the x86_64-apple-darwin host.
2023-04-23Fix printing native CPU on cross-compiled compiler.Eric Huss-1/+3
2023-04-20Remove deprecated LLVM any_isaQiu Chaofan-8/+8
2023-04-19Recognize AIX style archive kindQiu Chaofan-0/+3
2023-04-17Spelling - compilerJosh Soref-1/+1
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiserMichael Goulet-0/+7
Initial support for loongarch64-unknown-linux-gnu Hi, We hope to add a new port in rust for LoongArch. LoongArch intro LoongArch is a RISC style ISA which is independently designed by Loongson Technology in China. It is divided into two versions, the 32-bit version (LA32) and the 64-bit version (LA64). LA64 applications have application-level backward binary compatibility with LA32 applications. LoongArch is composed of a basic part (Loongson Base) and an expanded part. The expansion part includes Loongson Binary Translation (LBT), Loongson VirtualiZation (LVZ), Loongson SIMD EXtension (LSX) and Loongson Advanced SIMD EXtension(LASX). Currently the LA464 processor core supports LoongArch ISA and the Loongson 3A5000 processor integrates 4 64-bit LA464 cores. LA464 is a four-issue 64-bit high-performance processor core. It can be used as a single core for high-end embedded and desktop applications, or as a basic processor core to form an on-chip multi-core system for server and high-performance machine applications. Documentations: ISA: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html ABI: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html More docs can be found at: https://loongson.github.io/LoongArch-Documentation/README-EN.html Since last year, we have locally adapted two versions of rust, rust1.41 and rust1.57, and completed the test locally. I'm not sure if I'm submitting all the patches at once, so I split up the patches and here's one of the commits
2023-04-08Auto merge of #109862 - klensy:llvm-dd, r=nikicbors-74/+3
llvm: replace some deprecated functions, add fixmes Replace some deprecated llvm functions, add FIXME's (for simpler future work), replace some rust custom functions with llvm ones.
2023-04-05reviewklensy-1/+1
2023-04-04replaceklensy-12/+1
LLVMRustBuildIntCast -> LLVMBuildIntCast2 LLVMRustAddHandler -> LLVMAddHandler
2023-04-04Use existing llvm methods, instead of rust wrappers for:klensy-49/+0
LLVMRustBuildCleanupPad -> LLVMBuildCleanupPad LLVMRustBuildCleanupRet -> LLVMBuildCleanupRet LLVMRustBuildCatchPad -> LLVMBuildCatchPad LLVMRustBuildCatchRet -> LLVMBuildCatchRet LLVMRustBuildCatchSwitch -> LLVMBuildCatchSwitch
2023-04-04replace LLVMRustAppendModuleInlineAsm with LLVMAppendModuleInlineAsm, ↵klensy-9/+0
LLVMRustMetadataTypeInContext with LLVMMetadataTypeInContext
2023-04-04replace LLVMRustMetadataAsValue with LLVMMetadataAsValueklensy-4/+0
2023-04-04add bunch of fixmes: currently there exist some functions that accept ↵klensy-0/+2
LLVMValueRef, some that accept LLVMMetadataRef, and replacing one with another not always possible without explicit convertion
2023-04-04Enable loongarch64 LLVM targetzhaixiaojuan-0/+7
2023-03-31Preserve, clarify, and extend debug informationJulia Tatz-0/+3
`-Cdebuginfo=1` was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for line tables only was added. Additionally an option for line info directives only was added, which is well needed for some targets. The debug info options should now behave the same as clang's debug info options.
2023-03-29Auto merge of #109720 - Dylan-DPC:rollup-u564m8s, r=Dylan-DPCbors-7/+10
Rollup of 7 pull requests Successful merges: - #108335 (rustdoc + rustdoc-json support for `feature(non_lifetime_binders)`) - #109534 (rustdoc: Unsupport importing `doc(primitive)` and `doc(keyword)` modules) - #109659 (llvm-wrapper: adapt for LLVM API change) - #109664 (Use span of placeholders in format_args!() expansion.) - #109683 (Check for overflow in `assemble_candidates_after_normalizing_self_ty`) - #109713 (Fix mismatched punctuation in Debug impl of AttrId) - #109718 (Rename `IndexVec::last` → `last_index`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-28Add OpenHarmony targetsAmanieu d'Antras-1/+6
- `aarch64-unknown-linux-ohos` - `armv7-unknown-linux-ohos`
2023-03-27llvm-wrapper: adapt for LLVM API changeKrasimir Georgiev-7/+10
Adapts the wrapper for the LLVM commit https://github.com/llvm/llvm-project/commit/377e1311d50c7e5b5aab3db081938e0d0ceebdfc.
2023-03-07Remove an extraneous includeKazu Hirata-1/+0
SymbolWrapper.cpp doesn't use std::optional or llvm::Optional, so this patch removes the extraneous include. Note that llvm/ADT/Optional.h has been deprecated upstream. This patch ensures that SymbolWrapper.cpp continues to compile even after the upcoming removal of Optional.h.
2023-03-06Remove references to PassManagerBuilderNikita Popov-2/+0
This is a legacy PM concept that we no longer use.
2023-03-03Rollup merge of #108599 - nikic:drop-init, r=cuviperMatthias Krüger-34/+2
Remove legacy PM leftovers This drops two leftovers of legacy PM usage: * We don't need to initialize passes anymore. * The pass listing was still using legacy PM passes. Replace it with the corresponding new PM listing.
2023-03-01Print NewPM passesNikita Popov-16/+2
-C passes=list was printing passes for the legacy pass manager. Use PassBuilder::printPassNames() to print NewPM passes instead.
2023-03-01Remove pass initialization codeNikita Popov-18/+0
This is no longer necessary with the new pass manager.
2023-02-25record llvm cgu instruction statscsmoe-0/+14
2023-02-14Add `kernel-address` sanitizer support for freestanding targetsWesley Norris-3/+7
2023-02-10Update the minimum external LLVM to 14Josh Stone-54/+4
2023-02-07llvm-16: Use Triple.h from new header location.Matthew Maurer-1/+6
LLVM 16 has moved Triple.h from ADT and into TargetParser
2023-02-02llvm-wrapper: adapt for LLVM API changesKrasimir Georgiev-8/+30
Adapts the wrapper for https://github.com/llvm/llvm-project/commit/516e301752560311d2cd8c2b549493eb0f98d01b, where the constructor of PGOOptions gained a new FileSystem argument. Adapted to use the real file system, similarly to the changes inside of LLVM: https://github.com/llvm/llvm-project/commit/516e301752560311d2cd8c2b549493eb0f98d01b#diff-f409934ba27ad86494f3012324e9a3995b56e0743609ded7a387ba62bbf5edb0R236
2023-01-21Rollup merge of #106113 - krasimirgg:llvm-16-ext-tyid, r=nikicMichael Goulet-11/+9
llvm-wrapper: adapt for LLVM API change No functional changes intended. The LLVM commit https://github.com/llvm/llvm-project/commit/e6b02214c68df2c9f826e02310c9352ac652e456 added `TargetExtTyID` to the `TypeID` enum. This adapts `RustWrapper` accordingly.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-2/+2
2023-01-11rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.Dmitri Gribenko-12/+13
LLVM upstream has deprecated llvm::makeArrayRef and will remove it.
2023-01-02llvm-wrapper: adapt for LLVM API changeKrasimir Georgiev-11/+9
No functional changes intended. The LLVM commit https://github.com/llvm/llvm-project/commit/e6b02214c68df2c9f826e02310c9352ac652e456 added `TargetExtTyID` to the `TypeID` enum. This adapts `RustWrapper` accordingly.
2022-12-11llvm-wrapper: adapt for LLVM API changesKrasimir Georgiev-1/+15
This is a follow-up of https://github.com/rust-lang/rust/commit/75aec4703dea7ef8e13924ccfa3a3d2e8c5c7cff. There, I updated the wrapper to only include llvm/ADT/Optional.h for LLVM version below 16. But I missed updating some of the None references. Found by our experimental rust + llvm at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
2022-12-10Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3Matthias Krüger-8/+8
Add LLVM KCFI support to the Rust compiler This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-08Add LLVM KCFI support to the Rust compilerRamon de C Valle-8/+8
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-12-06Rollup merge of #105298 - krasimirgg:llvm-16-dec-1, r=cuviperMatthias Krüger-1/+26
llvm-wrapper: adapt for an LLVM API change Adapts llvm-wrapper for https://github.com/llvm/llvm-project/commit/8c7c20f033c7036a8bf231ca6f9e02172cb581f0. No functional changes intended. Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15404#0184d95d-5a68-4db6-ad32-51ddbc3ab543/202-571
2022-12-06llvm-wrapper: adapt for and LLVM API changeKrasimir Georgiev-1/+26