about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/debuginfo
AgeCommit message (Collapse)AuthorLines
2023-07-06Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errorsbors-7/+10
Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Part of rust-lang/compiler-team#616 turns out there's a lot of places we construct `Ty` this is a ridiculously huge PR :S r? `@oli-obk`
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-7/+10
2023-07-05Revert "use new c literals instead of cstr! macro"León Orell Valerian Liehr-7/+12
This reverts commit a17561ffc90c900cb7d0e96b00c6381244764ef7.
2023-06-29Set capacity of the string passed to `push_item_name`.Nicholas Nethercote-2/+2
Other callsites already do this, but these two were missed. This avoids some allocations.
2023-06-29Replace a `lookup_debug_loc` call.Nicholas Nethercote-3/+3
`lookup_debug_loc` finds a file, line, and column, which requires two binary searches. But this call site only needs the file. This commit replaces the call with `lookup_source_file`, which does a single binary search.
2023-06-29Avoid unnecessary line lookup.Nicholas Nethercote-1/+1
`lookup_debug_loc` calls `SourceMap::lookup_line`, which does a binary search over the files, and then a binary search over the lines within the found file. It then calls `SourceFile::line_begin_pos`, which redoes the binary search over the lines within the found file. This commit removes the second binary search over the lines, instead getting the line starting pos directly using the result of the first binary search over the lines. (And likewise for `get_span_loc`, in the cranelift backend.)
2023-06-19Store generator field names in GeneratorLayout.Camille GILLOT-9/+5
2023-06-19Make closure_saved_names_of_captured_variables a query.Camille GILLOT-4/+5
2023-06-16Rollup merge of #112474 - ldm0:ldm_enum_debuginfo_128_support, r=compiler-errorsMichael Goulet-8/+2
Support 128-bit enum variant in debuginfo codegen fixes #111600
2023-06-14Introduce a minimum CGU size in non-incremental builds.Nicholas Nethercote-1/+1
Because tiny CGUs make compilation less efficient *and* result in worse generated code. We don't do this when the number of CGUs is explicitly given, because there are times when the requested number is very important, as described in some comments within the commit. So the commit also introduces a `CodegenUnits` type that distinguishes between default values and user-specified values. This change has a roughly neutral effect on walltimes across the rustc-perf benchmarks; there are some speedups and some slowdowns. But it has significant wins for most other metrics on numerous benchmarks, including instruction counts, cycles, binary size, and max-rss. It also reduces parallelism, which is good for reducing jobserver competition when multiple rustc processes are running at the same time. It's smaller benchmarks that benefit the most; larger benchmarks already have CGUs that are all larger than the minimum size. Here are some example before/after CGU sizes for opt builds. - html5ever - CGUs: 16, mean size: 1196.1, sizes: [3908, 2992, 1706, 1652, 1572, 1136, 1045, 948, 946, 938, 579, 471, 443, 327, 286, 189] - CGUs: 4, mean size: 4396.0, sizes: [6706, 3908, 3490, 3480] - libc - CGUs: 12, mean size: 35.3, sizes: [163, 93, 58, 53, 37, 8, 2 (x6)] - CGUs: 1, mean size: 424.0, sizes: [424] - tt-muncher - CGUs: 5, mean size: 1819.4, sizes: [8508, 350, 198, 34, 7] - CGUs: 1, mean size: 9075.0, sizes: [9075] Note that CGUs of size 100,000+ aren't unusual in larger programs.
2023-06-10Support 128-bit enum variant in debuginfo codegenDonoughLiu-8/+2
2023-05-31use new c literals instead of cstr! macroklensy-12/+7
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-1/+1
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-1/+1
2023-05-19Auto merge of #111641 - michaelwoerister:debugger-visualizer-fixes, r=cjgillotbors-2/+1
Fix dependency tracking for debugger visualizers This PR fixes dependency tracking for debugger visualizer files by changing the `debugger_visualizers` query to an `eval_always` query that scans the AST while it is still available. This way the set of visualizer files is already available when dep-info is emitted. Since the query is turned into an `eval_always` query, dependency tracking will now reliably detect changes to the visualizer script files themselves. TODO: - [x] perf.rlo - [x] Needs a bit more documentation in some places - [x] Needs regression test for the incr. comp. case Fixes https://github.com/rust-lang/rust/issues/111226 Fixes https://github.com/rust-lang/rust/issues/111227 Fixes https://github.com/rust-lang/rust/issues/111295 r? `@wesleywiser` cc `@gibbyfree`
2023-05-18Auto merge of #111345 - jyn514:cfg-release-caching, r=cjgillot,est31bors-2/+1
Only depend on CFG_VERSION in rustc_interface This avoids having to rebuild the whole compiler on each commit when `omit-git-hash = false`. cc https://github.com/rust-lang/rust/issues/76720 - this won't fix it, and I'm not suggesting we turn this on by default, but it will make it less painful for people who do have `omit-git-hash` on as a workaround.
2023-05-17Only depend on CFG_VERSION in rustc_interfacejyn-2/+1
this avoids having to rebuild the whole compiler on each commit when `omit-git-hash = false`.
2023-05-16Move DebuggerVisualizerFile types from rustc_span to rustc_middleMichael Woerister-2/+1
2023-05-06make (try_)subst_and_normalize_erasing_regions take EarlyBinderKyle Matsuda-2/+2
2023-05-03debuginfo: split method declaration and definitionJosh Stone-34/+51
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-27rename `needs_subst` to `has_param`Boxy-1/+1
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-4/+4
2023-04-19Move `GenericArgKind::as_{type,const,region}` to `GenericArg`Maybe Waffle-2/+2
2023-04-19Add `GenericArgKind::as_{type,const,region}`Maybe Waffle-14/+9
2023-04-18Auto merge of #110083 - saethlin:encode-hashes-as-bytes, r=cjgillotbors-1/+2
Encode hashes as bytes, not varint In a few places, we store hashes as `u64` or `u128` and then apply `derive(Decodable, Encodable)` to the enclosing struct/enum. It is more efficient to encode hashes directly than try to apply some varint encoding. This PR adds two new types `Hash64` and `Hash128` which are produced by `StableHasher` and replace every use of storing a `u64` or `u128` that represents a hash. Distribution of the byte lengths of leb128 encodings, from `x build --stage 2` with `incremental = true` Before: ``` ( 1) 373418203 (53.7%, 53.7%): 1 ( 2) 196240113 (28.2%, 81.9%): 3 ( 3) 108157958 (15.6%, 97.5%): 2 ( 4) 17213120 ( 2.5%, 99.9%): 4 ( 5) 223614 ( 0.0%,100.0%): 9 ( 6) 216262 ( 0.0%,100.0%): 10 ( 7) 15447 ( 0.0%,100.0%): 5 ( 8) 3633 ( 0.0%,100.0%): 19 ( 9) 3030 ( 0.0%,100.0%): 8 ( 10) 1167 ( 0.0%,100.0%): 18 ( 11) 1032 ( 0.0%,100.0%): 7 ( 12) 1003 ( 0.0%,100.0%): 6 ( 13) 10 ( 0.0%,100.0%): 16 ( 14) 10 ( 0.0%,100.0%): 17 ( 15) 5 ( 0.0%,100.0%): 12 ( 16) 4 ( 0.0%,100.0%): 14 ``` After: ``` ( 1) 372939136 (53.7%, 53.7%): 1 ( 2) 196240140 (28.3%, 82.0%): 3 ( 3) 108014969 (15.6%, 97.5%): 2 ( 4) 17192375 ( 2.5%,100.0%): 4 ( 5) 435 ( 0.0%,100.0%): 5 ( 6) 83 ( 0.0%,100.0%): 18 ( 7) 79 ( 0.0%,100.0%): 10 ( 8) 50 ( 0.0%,100.0%): 9 ( 9) 6 ( 0.0%,100.0%): 19 ``` The remaining 9 or 10 and 18 or 19 are `u64` and `u128` respectively that have the high bits set. As far as I can tell these are coming primarily from `SwitchTargets`.
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-1/+2
2023-04-17Spelling - compilerJosh Soref-3/+3
* 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-08Auto merge of #109862 - klensy:llvm-dd, r=nikicbors-20/+8
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-18/+7
2023-04-04Auto merge of #109808 - jyn514:debuginfo-options, r=michaelwoeristerbors-19/+2
Extend -Cdebuginfo with new options and named aliases This is a rebase of https://github.com/rust-lang/rust/pull/83947, along with my best guess at what the new options mean. I tried to follow the LLVM source code to get a better idea but ran into quite a lot of trouble (https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/go-to-definition.20in.20src.2Fllvm-project.3F). The description for the original PR follows below. Note that the changes in this PR have already been through FCP: https://github.com/rust-lang/rust/pull/83947#issuecomment-878384979 Closes https://github.com/rust-lang/rust/pull/109311. Helps with https://github.com/rust-lang/rust/pull/104968. r? `@michaelwoerister` cc `@cuviper` --- The -Cdebuginfo=1 option was never line tables only and can't be due to backwards compatibility issues. This was clarified and an option for emitting line tables only was added. Additionally an option for emitting line info directives only was added, which is needed for some targets, i.e. nvptx. The debug info options should now behave similarly to clang's debug info options. Fix https://github.com/rust-lang/rust/issues/60020 Fix https://github.com/rust-lang/rust/issues/64405
2023-04-04replace LLVMRustMetadataAsValue with LLVMMetadataAsValueklensy-1/+1
2023-04-04replace deprecated LLVMSetCurrentDebugLocation with LLVMSetCurrentDebugLocation2klensy-2/+1
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+2
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-03-31Preserve, clarify, and extend debug informationJulia Tatz-19/+2
`-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-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-1/+2
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-28Move `mir::Field` → `abi::FieldIdx`Scott McMurray-3/+5
The first PR for https://github.com/rust-lang/compiler-team/issues/606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
2023-03-27Rollup merge of #109635 - Nilstrieb:debrrruginfo, r=compiler=errorsMatthias Krüger-5/+4
debuginfo: Get pointer size/align from tcx.data_layout instead of layout_of This avoids some type interning and a query execution. It also just makes the code simpler.
2023-03-26debuginfo: Get pointer size/align from tcx.data_layout instead of layout_ofNilstrieb-5/+4
This avoids some type interning and a query execution. It also just makes the code simpler.
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-2/+2
2023-03-11Address the new odd backticks tidy lint in compiler/est31-0/+1
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+1
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-1/+1
2023-01-27Don't merge vtables when full debuginfo is enabled.Michael Woerister-0/+5
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-1/+2
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2023-01-16Move compiler input and ouput paths into sessionOli Scherer-4/+4
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-1/+1
2022-12-07Move closure/generator type info methods to TyCtxtMichael Goulet-75/+8