about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/debuginfo
AgeCommit message (Collapse)AuthorLines
2024-07-09Auto merge of #127001 - beetrees:f16-debuginfo, r=michaelwoeristerbors-3/+40
Add Natvis visualiser and debuginfo tests for `f16` To render `f16`s in debuggers on MSVC targets, this PR changes the compiler to output `f16`s as `struct f16 { bits: u16 }`, and includes a Natvis visualiser that manually converts the `f16`'s bits to a `float` which is can then be displayed by debuggers. `gdb`, `lldb` and `cdb` tests are also included for `f16` . `f16`/`f128` MSVC debug info issue: #121837 Tracking issue: #116909
2024-07-09Add Natvis visualiser and debuginfo tests for `f16`beetrees-3/+40
2024-06-21Move vcall_visibility_metadata optimization hint out of a debuginfo ↵bjorn3-7/+7
generation method
2024-06-13Honor collapse_debuginfo for statics.Dario Nieuwenhuis-2/+2
fixes #126363
2024-06-01Uplift TypeRelation and RelateMichael Goulet-3/+4
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_codegen_llvm`.Nicholas Nethercote-1/+3
2024-05-10Rollup merge of #124797 - beetrees:primitive-float, r=davidtwcoMatthias Krüger-4/+1
Refactor float `Primitive`s to a separate `Float` type Now there are 4 of them, it makes sense to refactor `F16`, `F32`, `F64` and `F128` out of `Primitive` and into a separate `Float` type (like integers already are). This allows patterns like `F16 | F32 | F64 | F128` to be simplified into `Float(_)`, and is consistent with `ty::FloatTy`. As a side effect, this PR also makes the `Ty::primitive_size` method work with `f16` and `f128`. Tracking issue: #116909 `@rustbot` label +F-f16_and_f128
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-2/+2
2024-05-06Refactor float `Primitive`s to a separate `Float` typebeetrees-4/+1
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-0/+3
2024-04-09Set target-abi module flag for RISC-V targetskxxt-3/+3
Fixes cross-language LTO on RISC-V targets (Fixes #121924)
2024-03-28Replace Session should_remap_filepaths with filename_display_preferenceUrgau-9/+6
2024-03-28Introduce `FileNameMapping::to_real_filename` and use it everywhereUrgau-18/+13
2024-03-28Make local_crate_source_file return a RealFileNameUrgau-1/+2
so it can be remapped (or not) by callers
2024-03-28Replace `RemapFileNameExt::for_codegen` with explicit callsUrgau-6/+17
2024-03-28Simplify trim-paths feature by merging all debuginfo options togetherUrgau-1/+1
2024-03-24Require coroutine kind type to be passed to TyCtxt::coroutine_layoutMichael Goulet-3/+7
2024-03-24Always use tcx.coroutine_layout over calling optimized_mir directlyMichael Goulet-3/+2
2024-03-22Programmatically convert some of the pat ctorsMichael Goulet-1/+1
2024-03-12Ensure nested allocations in statics do not get deduplicatedOli Scherer-0/+6
2024-03-05only set noalias on Box with the global allocatorRalf Jung-3/+7
2024-03-01Add `f16` and `f128` LLVM intrinsicsTrevor Gross-1/+1
2024-02-28Add `f16` and `f128` to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`Trevor Gross-0/+6
Make changes necessary to support these types in the compiler.
2024-02-09Build DebugInfo for coroutine-closureMichael Goulet-1/+4
2023-12-28Remove movability from TyKind::CoroutineMichael Goulet-4/+4
2023-12-19Unify SourceFile::name_hash and StableSourceFileIdMichael Woerister-5/+6
2023-12-15NFC don't convert types to identical typesMatthias Krüger-2/+2
2023-12-15codegen_llvm: set DW_AT_accessibilityDavid Wood-15/+47
Sets the accessibility of types and fields in DWARF using `DW_AT_accessibility` attribute. `DW_AT_accessibility` (public/protected/private) isn't exactly right for Rust, but neither is `DW_AT_visibility` (local/exported/qualified), and there's no way to set `DW_AT_visbility` in LLVM's API. Signed-off-by: David Wood <david@davidtw.co>
2023-12-14Auto merge of #118566 - klensy:cstr-new, r=WaffleLapkinbors-13/+8
use c literals in compiler and library Relands refreshed https://github.com/rust-lang/rust/pull/111647
2023-12-11refactor: only check dwarf version when emitting dwarfWeihang Lo-2/+8
2023-12-11fix: stop emitting `.debug_pubnames` and `.debug_pubtypes`Weihang Lo-0/+8
`.debug_pubnames` and `.debug_pubtypes` are poorly designed and people seldom use them. However, they take a considerable portion of size in the final binary. This tells LLVM stop emitting those sections on DWARFv4 or lower. DWARFv5 use `.debug_names` which is more concise in size and performant for name lookup.
2023-12-10remove redundant importssurechen-2/+2
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-03compiler: replace cstr macro with c str literals in compiler and few other c ↵klensy-13/+8
str replacements
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-3/+3
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-22use visibility to check unused imports and delete some stmtsbohan-1/+0
2023-10-20s/generator/coroutine/Oli Scherer-112/+112
2023-10-20s/Generator/Coroutine/Oli Scherer-14/+14
2023-10-17[RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopesUrgau-36/+72
2023-10-13Format all the let chains in compilerMichael Goulet-2/+7
2023-10-08Make FnDef 1-ZST in LLVM debuginfo.Camille GILLOT-2/+10
2023-09-26subst -> instantiatelcnr-2/+2
2023-09-14treat host effect params as erased generics in codegenDeadbeef-0/+1
This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`.
2023-09-08Auto merge of #115417 - dpaoliello:fixdi, r=wesleywiserbors-17/+23
Use the same DISubprogram for each instance of the same inlined function within a caller # Issue Details: The call to `panic` within a function like `Option::unwrap` is translated to LLVM as a `tail call` (as it will never return), when multiple calls to the same function like this are inlined LLVM will notice the common `tail call` block (i.e., loading the same panic string + location info and then calling `panic`) and merge them together. When merging these instructions together, LLVM will also attempt to merge the debug locations as well, but this fails (i.e., debug info is dropped) as Rust emits a new `DISubprogram` at each inline site thus LLVM doesn't recognize that these are actually the same function and so thinks that there isn't a common debug location. As an example of this, consider the following program: ```rust #[no_mangle] fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 { let x1 = x.unwrap(); let y1 = y.unwrap(); x1 + y1 } ``` When building for x86_64 Windows using 1.72 it generates (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction): ```llvm .cv_loc 0 1 3 0 # src\lib.rs:3:0 addq $40, %rsp retq leaq .Lalloc_f570dea0a53168780ce9a91e67646421(%rip), %rcx leaq .Lalloc_629ace53b7e5b76aaa810d549cc84ea3(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17h12e60b9063f6dee8E int3 ``` # Fix Details: Cache the `DISubprogram` emitted for each inlined function instance within a caller so that this can be reused if that instance is encountered again. Ideally, we would also deduplicate child scopes and variables, however my attempt to do that with #114643 resulted in asserts when building for Linux (#115156) which would require some deep changes to Rust to fix (#115455). Instead, when using an inlined function as a debug scope, we will also create a new child scope such that subsequent child scopes and variables do not collide (from LLVM's perspective). After this change the above assembly now (with <https://reviews.llvm.org/D159226> as well) shows the `panic!` was inlined from `unwrap` in `option.rs` at line 935 into the current function in `lib.rs` at line 0 (line 0 is emitted since it is ambiguous which line to use as there were two inline sites that lead to this same code): ```llvm .cv_loc 0 1 3 0 # src\lib.rs:3:0 addq $40, %rsp retq .cv_inline_site_id 6 within 0 inlined_at 1 0 0 .cv_loc 6 2 935 0 # library\core\src\option.rs:935:0 leaq .Lalloc_5f55955de67e57c79064b537689facea(%rip), %rcx leaq .Lalloc_e741d4de8cb5801e1fd7a6c6795c1559(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17hde1558f32d5b1c04E int3 ```
2023-09-07Use `Freeze` for `SourceFile.lines`John Kåre Alsaker-1/+1
2023-09-03Use relative positions inside a SourceFile.Camille GILLOT-3/+3
2023-09-01Deduplicate inlined function debug info, but create a new lexical scope to ↵Daniel Paoliello-17/+23
child subsequent scopes and variables from colliding
2023-08-29const_eval and codegen: audit uses of is_zstRalf Jung-2/+2
2023-08-25Revert "Use the same DISubprogram for each instance of the same inlined ↵Wesley Wiser-65/+46
function within the caller" This reverts commit 687bffa49375aa00bacc51f5d9adfb84a9453e17. Reverting to resolve ICEs reported on nightly.
2023-08-22Auto merge of #114643 - dpaoliello:inlinedebuginfo, r=wesleywiserbors-46/+65
Use the same DISubprogram for each instance of the same inlined function within a caller # Issue Details: The call to `panic` within a function like `Option::unwrap` is translated to LLVM as a `tail call` (as it will never return), when multiple calls to the same function like this is inlined LLVM will notice the common `tail call` block (i.e., loading the same panic string + location info and then calling `panic`) and merge them together. When merging these instructions together, LLVM will also attempt to merge the debug locations as well, but this fails (i.e., debug info is dropped) as Rust emits a new `DISubprogram` at each inline site thus LLVM doesn't recognize that these are actually the same function and so thinks that there isn't a common debug location. As an example of this when building for x86_64 Windows (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction): ``` .cv_loc 0 1 23 0 # src\lib.rs:23:0 addq $40, %rsp retq leaq .Lalloc_f570dea0a53168780ce9a91e67646421(%rip), %rcx leaq .Lalloc_629ace53b7e5b76aaa810d549cc84ea3(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17h12e60b9063f6dee8E int3 ``` # Fix Details: Cache the `DISubprogram` emitted for each inlined function instance within a caller so that this can be reused if that instance is encountered again, this also requires caching the `DILexicalBlock` and `DIVariable` objects to avoid creating duplicates. After this change the above assembly now looks like: ``` .cv_loc 0 1 23 0 # src\lib.rs:23:0 addq $40, %rsp retq .cv_inline_site_id 5 within 0 inlined_at 1 0 0 .cv_inline_site_id 6 within 5 inlined_at 1 12 0 .cv_loc 6 2 935 0 # library\core\src\option.rs:935:0 leaq .Lalloc_5f55955de67e57c79064b537689facea(%rip), %rcx leaq .Lalloc_e741d4de8cb5801e1fd7a6c6795c1559(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17hde1558f32d5b1c04E int3 ```
2023-08-22Fix spelling mistakeWesley Wiser-1/+1