[PATCH] D69886: [DebugInfo] Support for DW_OP_implicit_pointer (Post IR transformation phase)

Alok Kumar Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 03:44:29 PST 2019


alok created this revision.
alok added reviewers: aprantl, probinson, dblaikie, jini.susan.george, SouraVX, jmorse.
alok added projects: LLVM, debug-info.
Herald added subscribers: llvm-commits, ormris, hiraditya.

This patch stems from D69787 <https://reviews.llvm.org/D69787> as suggested by reviewers.

The original patch is being divided as described below.

First phase of the implementation deals with preserving debug info while instruction is being erased (optimized out) in IR transformation phase. In this phase all the opportunities to generate DW_OP_implicit_pointer operation in IR, are found and handled appropriately. For this phase two patches will be submitted.

  PATCH A) All the opportunities to preserve debug info are dealt with
  PATCH B) Enhance salvaging implementation to generate DW_OP_implicit_pointer operation

PATCH A and B are stand alone but for test cases to work both are needed.

Second phase of the implementation works on IR with DW_OP_implicit_pointer operation to emit debug info. this will have single patch (PATCH C). This patch will be stand alone and self sufficient. It also contains test cases.

The current PATCH is "PATCH C". (Other patches will also be submitted separately.)

  Summary:

Class DwarfCompileUnit has been modified to add member ImplicitVars of vector type. Below is the usage of it.

First operand of DW_OP_implicit_pointer operation is a reference to a debugging information entry that describes the dereferenced object’s value. when this operation is created, the debugging information entry is not yet formed. To solve this problem, we maintain a vector of dereferenced objects. We keep index of dereferenced object's at first operand of DW_OP_implicit_pointer operation temporarily. This temporary value is later replaced by actual value when available.

If a variable has only single DBG_VALUE then currently location list is not created instead value is used to initialized the var. In case of DW_OP_implicit_pointer, now location list will still be created.

  Testing:
   
     - Added unit tests for validation thru llvm-dwarfdump
     - check-llvm, and an end-to-end test using gnu GDB to debug an optimized
         program (LLDB need to be enhanced to support).
     - check-debuginfo (the debug info integration tests)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69886

Files:
  llvm/include/llvm/CodeGen/MachineInstr.h
  llvm/include/llvm/CodeGen/MachineInstrBuilder.h
  llvm/include/llvm/CodeGen/SelectionDAG.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
  llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/lib/IR/IntrinsicInst.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/test/DebugInfo/dwarfdump-implicit_pointer_instcomb.ll
  llvm/test/DebugInfo/dwarfdump-implicit_pointer_mem2reg.ll
  llvm/test/DebugInfo/dwarfdump-implicit_pointer_sroa.ll
  llvm/test/DebugInfo/dwarfdump-implicit_pointer_sroa_inline.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69886.228022.patch
Type: text/x-patch
Size: 50816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191106/73f65714/attachment-0001.bin>


More information about the llvm-commits mailing list