[PATCH] [RFC] Rewrite the way we generate debug locations for variables.

Alexey Samsonov samsonov at google.com
Thu Jan 30 08:20:11 PST 2014


Hi dblaikie,

Completely change the way we turn DBG_VALUE machine instructions
into location information for local variables. This is inspired by discussion
in r128327 review thread.

We used to terminate location range for each variable at the end of the basic
block with DBG_VALUE for it. This is incorrect, e.g. the register used to hold
the variable location may be never clobbered in the entire function, so one
DBG_VALUE is enough to define the location of a variable in the whole function.

Now we actually analyze the control flow: calculate the presumed location of
a variable at the end and the beginning of each basic block. For example,
if the location of a variable is the same at the end of all predecessors of
basic block B, we may assume that we know the location of a variable in B,
and avoid terminating the location range too early.

I think it's pretty much all we can do w/o actually changing the CodeGen for
DBG_VALUE instructions.

If you agree with the direction of this patch, I should probably test it
extensively. There are many concerns:
0) Correctness. LLVM/Clang regression tests don't really check anything -
   we should run it on gdb test-suite or smth. comprehensive.
1) Debug info size. We should verify that .debug_loc section wouldn't explode.
2) Compilation time - in the worst case we smth. like
   O(NumVars * NumInstructions), which can be a lot for large functions.

http://llvm-reviews.chandlerc.com/D2658

Files:
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2658.1.patch
Type: text/x-patch
Size: 20074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140130/332d8c26/attachment.bin>


More information about the llvm-commits mailing list