about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
AgeCommit message (Collapse)AuthorLines
2025-02-07fix non-enzyme buildsManuel Drehwald-7/+10
2025-02-07get tests to work without -Z/-C flagsManuel Drehwald-0/+10
2025-02-06Remove dead code from rustc_codegen_llvm and the LLVM wrapperDaniel Paoliello-31/+0
2025-02-01Use `LLVMDIBuilderCreateDebugLocation`Zalathar-10/+0
The LLVM-C binding takes an explicit context, whereas our binding obtained the context from the scope argument.
2025-02-01Use `LLVMDIBuilderCreateLexicalBlockFile`Zalathar-6/+0
2025-02-01Use `LLVMDIBuilderCreateLexicalBlock`Zalathar-8/+0
2025-02-01Use `LLVMDIBuilderCreateNameSpace`Zalathar-8/+0
2025-02-01Use `LLVMDIBuilderFinalize`Zalathar-4/+0
2025-01-31Auto merge of #136350 - matthiaskrgr:rollup-6eqfyvh, r=matthiaskrgrbors-106/+101
Rollup of 9 pull requests Successful merges: - #134531 ([rustdoc] Add `--extract-doctests` command-line flag) - #135860 (Compiler: Finalize dyn compatibility renaming) - #135992 (Improve documentation when adding a new target) - #136194 (Support clobber_abi in BPF inline assembly) - #136325 (Delay a bug when indexing unsized slices) - #136326 (Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef`) - #136330 (Remove unnecessary hooks) - #136336 (Overhaul `rustc_middle::util`) - #136341 (Remove myself from vacation) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-31Rollup merge of #136326 - Zalathar:llvm-di-builder-ref, r=nikicMatthias Krüger-106/+101
Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef` Inspired by trying to split #134009 into smaller steps that are easier to review individually. This makes it possible to start incrementally replacing our debuginfo bindings with the ones in the LLVM-C API, all of which operate on `LLVMDIBuilderRef`. There should be no change to compiler behaviour.
2025-01-31Auto merge of #136332 - jhpratt:rollup-aa69d0e, r=jhprattbors-3/+2
Rollup of 9 pull requests Successful merges: - #132156 (When encountering unexpected closure return type, point at return type/expression) - #133429 (Autodiff Upstreaming - rustc_codegen_ssa, rustc_middle) - #136281 (`rustc_hir_analysis` cleanups) - #136297 (Fix a typo in profile-guided-optimization.md) - #136300 (atomic: extend compare_and_swap migration docs) - #136310 (normalize `*.long-type.txt` paths for compare-mode tests) - #136312 (Disable `overflow_delimited_expr` in edition 2024) - #136313 (Filter out RPITITs when suggesting unconstrained assoc type on too many generics) - #136323 (Fix a typo in conventions.md) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-31Remove the temporary typedef for `LLVMRustDIFlags`Zalathar-16/+10
If we're already churning all of the debuginfo bindings, we might as well fix this at the same time.
2025-01-31Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef`Zalathar-90/+91
This makes it possible to start incrementally replacing our debuginfo bindings with the ones in the LLVM-C API, all of which operate on `LLVMDIBuilderRef`.
2025-01-30use Attribute::getWithCaptureInfoHans Wennborg-2/+1
2025-01-30LLVM changed the nocapture attribute to captures(none)Hans Wennborg-0/+11
This updates RustWrapper.cpp and tests after https://github.com/llvm/llvm-project/pull/123181
2025-01-29upstream rustc_codegen_ssa/rustc_middle changes for enzyme/autodiffManuel Drehwald-3/+2
2025-01-21Make our `DIFlags` match `LLVMDIFlags` in the LLVM-C APIZalathar-114/+68
2025-01-07llvm: Ignore error value that is always falseMatthew Maurer-8/+2
See llvm/llvm-project#121851 For LLVM 20+, this function (`renameModuleForThinLTO`) has no return value. For prior versions of LLVM, this never failed, but had a signature which allowed an error value people were handling.
2025-01-05Use constants for DWARF opcodes, instead of FFI callsZalathar-12/+4
2025-01-04Auto merge of #133990 - Walnut356:static_const, r=workingjubileebors-0/+7
[Debuginfo] Force enum `DISCR_*` to `static const u64` to allow for inspection via LLDB see [here](https://rust-lang.zulipchat.com/#narrow/channel/317568-t-compiler.2Fwg-debugging/topic/Revamping.20Debuginfo/near/486614878) for more info. This change mainly helps `*-msvc` debugged with LLDB. Currently, LLDB cannot inspect `static` struct fields, so the intended visualization for enums is only borderline functional, and niche enums with ranges of discriminant cannot be determined at all . LLDB *can* inspect `static const` values (though for whatever reason, non-enum/non-u64 consts don't work). This change adds the `LLVMRustDIBuilderCreateQualifiedType` to the rust FFI layer to wrap the discr type with a `const` modifier, as well as forcing all generated integer enum `DISCR_*` values to be u64's. Those values will only ever be used by debugger visualizers anyway, so it shouldn't be a huge deal, but I left a fixme comment for it just in case.. The `tag` also still properly reflects the discriminant type, so no information is lost.
2025-01-01upstream rustc_codegen_llvm changes for enzyme/autodiffManuel Drehwald-0/+77
2024-12-30force enum `DISCR_*` to `const u64` to allow for inspection via LLDB's ↵Walnut-3/+3
`SBTypeStaticField::GetConstantValue()`
2024-12-30rustc_llvm: expose FloatABIType target machine parameterRalf Jung-5/+21
2024-12-23add LLVMRustDIBuilderCreateQualifiedType to ffiWalnut-0/+7
2024-12-20Remove some dead code around import library generationbjorn3-50/+0
This was missed when replacing the usage of LLVM for generating import libraries.
2024-12-12Auto merge of #129181 - beetrees:asm-spans, r=pnkfelix,compiler-errorsbors-1/+1
Pass end position of span through inline ASM cookie Before this PR, only the start position of the span was passed though the inline ASM cookie to diagnostics. LLVM 19 has full support for 64-bit inline ASM cookies; this PR uses that to pass the end position of the span in the upper 32 bits, meaning inline ASM diagnostics now point at the entire line the error occurred on, not just the first character of it.
2024-11-26Respect verify-llvm-ir option in the backendNikita Popov-3/+3
We are currently unconditionally verifying the LLVM IR in the backend (twice), ignoring the value of the verify-llvm-ir option.
2024-11-26Pass end position of span through inline ASM cookiebeetrees-1/+1
2024-11-23Rollup merge of #127483 - BertalanD:no_sanitize-global-var, r=rcvalle许杰友 Jieyou Xu (Joe)-0/+19
Allow disabling ASan instrumentation for globals AddressSanitizer adds instrumentation to global variables unless the [`no_sanitize_address`](https://llvm.org/docs/LangRef.html#global-attributes) attribute is set on them. This commit extends the existing `#[no_sanitize(address)]` attribute to set this; previously it only had the desired effect on functions. (cc https://github.com/rust-lang/rust/issues/39699)
2024-11-14PassWrapper: disable UseOdrIndicator for Asan Win32Jakob Koschel-4/+11
As described here UseOdrIndicator should be disabled on Windows since link.exe does not support duplicate weak definitions (https://reviews.llvm.org/D137227). Co-Authored-By: Bastian Kersting <bkersting@google.com>
2024-11-09Add discriminators to DILocations when multiple functions are inlined into a ↵Kyle Huey-0/+8
single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixes #131944
2024-11-09Auto merge of #132584 - Zalathar:includes, r=cuviperbors-163/+144
Trim and tidy includes in `rustc_llvm` These includes tend to accumulate over time, and are usually only removed when something breaks in a new LLVM version, so it's nice to clean them up manually once in a while. General strategy used for this PR: - Remove all includes from `LLVMWrapper.h` that aren't needed by the header itself, transplanting them to individual source files as necessary. - For each source file, temporarily remove each include if doing so doesn't cause a compile error. - If a “required” include looks like it shouldn't be needed, try replacing it with its sub-includes, then trim that list. - After doing all of the above, go back and re-add any removed include if the file does actually use things defined in that header, even if the header happens to also be included by something else.
2024-11-09Make `RustString` an extern type to avoid `improper_ctypes` warningsZalathar-2/+3
2024-11-08Don't use `LLVMRustStringWriteImpl` outside of `RawRustStringOstream`Zalathar-3/+4
2024-11-08Rollup merge of #132590 - Zalathar:z-timings-stats, r=jieyouxuStuart Cook-20/+8
Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats` The existing code for these unstable LLVM-infodump flags was jumping through hoops to pass an allocated C string across the FFI boundary, when it's much simpler to just write to a `&RustString` instead.
2024-11-08Rollup merge of #132452 - Zalathar:llvm-cov-wrappers, r=jieyouxuStuart Cook-26/+28
coverage: Extract safe FFI wrapper functions to `llvm_cov` This PR takes all of the inline `unsafe` calls in coverage codegen, and all the safe wrapper functions in `coverageinfo/mod.rs`, and moves them to a new `llvm_cov` submodule that is dedicated to safe FFI wrapper functions. This reduces the mixing of abstraction levels in the rest of coverage codegen. As a follow-up, this PR also tidies up the names and signatures of several of the coverage FFI functions.
2024-11-05PassWrapper: adapt for new parameter in LLVMAugie Fackler-5/+41
llvm/llvm-project@390300d9f41df6ad71f0f4196ef4885d4bd5dc48 added a new parameter to some callbacks, so we have to handle them. @rustbot label: +llvm-main
2024-11-05coverage: Tidy up coverage-specific FFI functionsZalathar-26/+28
2024-11-04Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats`Zalathar-20/+8
2024-11-04Trim and tidy includes in `rustc_llvm`Zalathar-73/+53
2024-11-04Move `LLVMRustAttribute[Kind]` out of `LLVMWrapper.h`Zalathar-90/+91
2024-11-03Auto merge of #132555 - matthiaskrgr:rollup-2d79661, r=matthiaskrgrbors-7/+6
Rollup of 15 pull requests Successful merges: - #129329 (Implement `From<&mut {slice}>` for `Box/Rc/Arc<{slice}>`) - #131377 (Add LowerExp and UpperExp implementations to NonZero) - #132393 (Docs: added brief colon explanation) - #132437 (coverage: Regression test for inlining into an uninstrumented crate) - #132499 (unicode_data.rs: show command for generating file) - #132503 (better test for const HashMap; remove const_hash leftovers) - #132511 (stabilize const_arguments_as_str) - #132520 (NFC add known bug nr to test) - #132522 (make codegen help output more consistent) - #132523 (Added regression test for generics index out of bounds) - #132528 (Use `*_opt` typeck results fns to not ICE in fallback suggestion) - #132537 (PassWrapper: adapt for llvm/llvm-project@5445edb5d) - #132540 (Do not format generic consts) - #132543 (add and update some crashtests) - #132550 (compiler: Continue introducing rustc_abi to the compiler) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-03Auto merge of #132514 - Zalathar:print-target-cpus, r=jieyouxubors-41/+9
Port most of `--print=target-cpus` to Rust The logic and formatting needed by `--print=target-cpus` has historically been carried out in C++ code. Originally it used `printf` to write directly to the console, but later it switched over to writing to a `std::ostringstream` and then passing its buffer to a callback function pointer. This PR replaces that C++ code with a very simple function that writes a list of CPU names to a `&RustString`, with the rest of the logic and formatting being handled by ordinary safe Rust code.
2024-11-03Rollup merge of #132537 - durin42:llvm-20-prelinklto, r=DianQKMatthias Krüger-7/+6
PassWrapper: adapt for llvm/llvm-project@5445edb5d As with ab5583ed1e75869b765a90386dac9119992f8ed7, we had been explicitly passing defaults whose type have changed. Rather than do an ifdef, we simply rely on the defaults. ````@rustbot```` label: +llvm-main
2024-11-03Auto merge of #132419 - durin42:llvm-20-type-test-thing, r=cuviperbors-3/+3
PassWrapper: adapt for llvm/llvm-project@b01e2a8b5620466c3b A boolean turned into an enum. None matches the old behavior of false, so we pass that. `@rustbot` label: +llvm-main
2024-11-02Allow disabling ASan instrumentation for globalsDaniel Bertalan-0/+19
AddressSanitizer adds instrumentation to global variables unless the [`no_sanitize_address`](https://llvm.org/docs/LangRef.html#global-attributes) attribute is set on them. This commit extends the existing `#[no_sanitize(address)]` attribute to set this; previously it only had the desired effect on functions.
2024-11-02PassWrapper: adapt for llvm/llvm-project@5445edb5dAugie Fackler-7/+6
As with ab5583ed1e75869b765a90386dac9119992f8ed7, we had been explicitly passing defaults whose type have changed. Rather than do an ifdef, we simply rely on the defaults. @rustbot label: +llvm-main
2024-11-02PassWrapper: adapt for ↵Augie Fackler-3/+3
llvm/llvm-project@b01e2a8b5620466c3b80cc6f049efbc90b9d103a We don't see a reason to explicitly pass the default here, so just use the default instead of explicitly passing it and needing an ifdef. @rustbot label: +llvm-main
2024-11-02Port most of `LLVMRustPrintTargetCPUs` to RustZalathar-39/+7
2024-11-02Use a dedicated safe wrapper for `LLVMRustGetHostCPUName`Zalathar-2/+2