diff options
| author | bors <bors@rust-lang.org> | 2019-11-27 17:44:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-11-27 17:44:49 +0000 |
| commit | e87a205c2e117d9fb57f6cdeac0a7f6e95c88316 (patch) | |
| tree | e7ff8266ac3aa0df65e2039bea740c09cc01ca0b /src/rustllvm/PassWrapper.cpp | |
| parent | 04e69e4f4234beb4f12cc76dcc53e2cc4247a9be (diff) | |
| parent | 563ed27c01c204d734355709c905f9a14246d4ff (diff) | |
| download | rust-e87a205c2e117d9fb57f6cdeac0a7f6e95c88316.tar.gz rust-e87a205c2e117d9fb57f6cdeac0a7f6e95c88316.zip | |
Auto merge of #56231 - eddyb:mir-debuginfo, r=oli-obk
rustc: move debug info from LocalDecl and UpvarDecl into a dedicated VarDebugInfo.
This PR introduces a MIR "user variable" debuginfo system, which amounts to mapping a variable name, in some `SourceScope`, to a `Place`, so that:
* each name can appear multiple times (e.g. due to macro hygiene), even in the same scope
* each `Place` can appear multiple times (e.g. in the future from optimizations like NRVO, which collapse multiple MIR locals into one)
* the `Place`s aren't limited to just locals, so they can describe the (right now quite ad-hoc) closure upvars and generator saved state fields, and can be properly transformed by optimizations (e.g. inlining - see `src/test/mir-opt/inline-closure-captures.rs`)
The main motivation for this was that #48300 and further optimizations were blocked on being able to describe complex debuginfo transformations (see https://github.com/rust-lang/rust/pull/48300#discussion_r170020762).
<hr/>
In the textual representation, the "user variable" debuginfo can be found in each scope, and consists of `debug NAME => PLACE;` "declarations", e.g. the MIR for `let x = ...; let y = ...; ...` is now:
```rust
let _1: T; // in scope 0 at ...
scope 1 {
debug x => _1; // in scope 1 at ...
let _2: T; // in scope 1 at ...
scope 2 {
debug y => _2; // in scope 2 at ...
}
}
```
For reference, this is how the information was represented before this PR:
(notably, the scopes in which the variables are visible for debuginfo weren't even shown anywhere, making `scope 2` look pointless, and user variable names were part of MIR locals)
```rust
let _1: T; // "x" in scope 0 at ...
scope 1 {
let _2: T; // "y" in scope 1 at ...
scope 2 {
}
}
```
cc @nikomatsakis @michaelwoerister
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
