[PATCH] D83560: [DebugInfo] Added support for DW_OP_implicit_value in llvm

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 23:50:51 PDT 2020


dblaikie added a comment.

Not sure it's worth committing such a narrow implementation - might be worth a bit of generalization even in this first patch? Or do you have specific/near-term plans to generalize this further (both the addImplicitValue itself, which looks to be very specific to long double right now (but without any assertions, API features, or comments to enforce that restriction) - and in the DwarfDebug.cpp caller, which could presumably be used for all constant values, maybe (not sure if that would be a good thing or not - haven't looked at the alternatives, etc))

@aprantl @probinson will probably want to weigh in on getting support from their debuggers before this is committed, or having this under a flag, etc.



================
Comment at: llvm/test/DebugInfo/X86/DW_OP_implicit_value.ll:13-18
+;;int main() {
+;;        long double ld = 3.14;
+;;        printf("dummy\n");
+;;        ld *= ld;
+;;        return 0;
+;;}
----------------
I'd probably write this as:
```
long double src();
void f1() {
  long double ld = 3.14;
  ld = src();
}
```
That should be enough to use the implicit_value to represent the value of 'ld' during the call to src, and to use a location list to do it (since the assignment to 'ld' is shortening the lifetime -  using function calls at least I find are clearer opaque clobbers/sinks - rather than the complexity of printf, or wondering whether the use of multiplication is significant, whether this has to be main, has to have an integer return value for some reason, etc.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83560/new/

https://reviews.llvm.org/D83560





More information about the llvm-commits mailing list