[PATCH] D20147: [WIP] DebugInfo: New metadata representation for global variables.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 18:34:42 PDT 2016


pcc created this revision.
pcc added reviewers: dexonsmith, dblaikie, aprantl.
pcc added a subscriber: llvm-commits.
pcc added a dependency: D20074: Add support for metadata attachments for global variables..
Herald added a reviewer: tstellarAMD.
Herald added subscribers: joker.eph, dsanders, jyknight, sanjoy, jholewinski.

This patch reverses the edge from DIGlobalVariable to GlobalVariable. In
order to make this work I also needed to implement the following extensions
for global attached metadata:

- I implemented a capability for globals to hold multiple metadata nodes
  with the same kind.
- I added a byte offset field to the global attached metadata list entries.
  The byte offset can be used to describe the position in the global that the
  metadata pertains to. Passes such as merge globals can copy metadata from
  one global to another, adjusting the offset if necessary. This field is
  intended to be generically useful, for example I plan to use it to hold the
  offsets currently used by "bitset" metadata in the vtable opt and CFI passes.

This isn't fully ready yet, but I wanted to gauge support for the new
representation before implementing the remaining pieces.

TODO:
- Add bitcode read/write and upgrade support for the new constructs
- Use a DIExpression to represent constants
- Update ASan to copy metadata in the same way as I updated merge globals
- Update clang

Depends on D20074

http://reviews.llvm.org/D20147

Files:
  include/llvm/IR/DIBuilder.h
  include/llvm/IR/DebugInfoMetadata.h
  include/llvm/IR/GlobalObject.h
  include/llvm/IR/GlobalVariable.h
  lib/AsmParser/LLParser.cpp
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/Bitcode/Writer/ValueEnumerator.cpp
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  lib/CodeGen/GlobalMerge.cpp
  lib/IR/AsmWriter.cpp
  lib/IR/DIBuilder.cpp
  lib/IR/LLVMContextImpl.h
  lib/IR/Metadata.cpp
  lib/IR/Verifier.cpp
  lib/Linker/IRMover.cpp
  lib/Transforms/IPO/StripSymbols.cpp
  lib/Transforms/Utils/CloneFunction.cpp
  lib/Transforms/Utils/ValueMapper.cpp
  test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll
  test/Assembler/diglobalvariable.ll
  test/Assembler/disubprogram.ll
  test/Assembler/drop-debug-info.ll
  test/Assembler/metadata.ll
  test/Bitcode/DISubprogram-distinct-definitions.ll
  test/Bitcode/Inputs/thinlto-function-summary-callgraph-pgo.ll
  test/Bitcode/dityperefs-3.8.ll
  test/Bitcode/metadata-function-blocks.ll
  test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
  test/Bitcode/upgrade-subprogram.ll
  test/CodeGen/AArch64/aarch64-2014-08-11-MachineCombinerCrash.ll
  test/CodeGen/AMDGPU/debugger-insert-nops.ll
  test/CodeGen/AMDGPU/debugger-reserve-regs.ll
  test/CodeGen/AMDGPU/llvm.dbg.value.ll
  test/CodeGen/ARM/2010-06-25-Thumb2ITInvalidIterator.ll
  test/CodeGen/ARM/2010-08-04-StackVariable.ll
  test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
  test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
  test/CodeGen/ARM/coalesce-dbgvalue.ll
  test/CodeGen/ARM/debug-frame-vararg.ll
  test/CodeGen/ARM/debug-info-arg.ll
  test/CodeGen/ARM/debug-info-blocks.ll
  test/CodeGen/ARM/debug-info-branch-folding.ll
  test/CodeGen/ARM/debug-info-d16-reg.ll
  test/CodeGen/ARM/debug-info-no-frame.ll
  test/CodeGen/ARM/debug-info-qreg.ll
  test/CodeGen/ARM/debug-info-s16-reg.ll
  test/CodeGen/ARM/debug-info-sreg2.ll
  test/CodeGen/ARM/debug-segmented-stacks.ll
  test/CodeGen/ARM/vfp-regs-dwarf.ll
  test/CodeGen/Hexagon/cfi-late.ll
  test/CodeGen/Hexagon/hwloop-dbg.ll
  test/CodeGen/Hexagon/misched-top-rptracker-sync.ll
  test/CodeGen/Inputs/DbgValueOtherTargets.ll
  test/CodeGen/MIR/ARM/ARMLoadStoreDBG.mir
  test/CodeGen/MIR/ARM/sched-it-debug-nodes.mir
  test/CodeGen/MIR/X86/expected-metadata-node-after-debug-location.mir
  test/CodeGen/MIR/X86/expected-metadata-node-after-exclaim.mir
  test/CodeGen/MIR/X86/instructions-debug-location.mir
  test/CodeGen/MIR/X86/metadata-operands.mir
  test/CodeGen/MIR/X86/unknown-metadata-node.mir
  test/CodeGen/NVPTX/debug-file-loc.ll
  test/CodeGen/PowerPC/dbg.ll
  test/CodeGen/PowerPC/pr17168.ll
  test/CodeGen/PowerPC/pr24546.ll
  test/CodeGen/PowerPC/unwind-dw2-g.ll
  test/CodeGen/WinEH/wineh-cloning.ll
  test/CodeGen/X86/2010-01-18-DbgValue.ll
  test/CodeGen/X86/2010-05-25-DotDebugLoc.ll
  test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
  test/CodeGen/X86/2010-05-28-Crash.ll
  test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll
  test/CodeGen/X86/2010-08-04-StackVariable.ll
  test/CodeGen/X86/2010-09-16-EmptyFilename.ll
  test/CodeGen/X86/2010-11-02-DbgParameter.ll
  test/CodeGen/X86/2011-01-24-DbgValue-Before-Use.ll
  test/CodeGen/X86/2012-11-30-handlemove-dbg.ll
  test/CodeGen/X86/2012-11-30-misched-dbg.ll
  test/CodeGen/X86/2012-11-30-regpres-dbg.ll
  test/CodeGen/X86/MachineSink-DbgValue.ll
  test/CodeGen/X86/bit-piece-comment.ll
  test/CodeGen/X86/code_placement_cold_loop_blocks.ll
  test/CodeGen/X86/code_placement_loop_rotation.ll
  test/CodeGen/X86/code_placement_loop_rotation2.ll
  test/CodeGen/X86/dbg-changes-codegen-branch-folding.ll
  test/CodeGen/X86/dbg-combine.ll
  test/CodeGen/X86/debugloc-argsize.ll
  test/CodeGen/X86/fpstack-debuginstr-kill.ll
  test/CodeGen/X86/loc-remat.ll
  test/CodeGen/X86/mbp-false-cfg-break.ll
  test/CodeGen/X86/misched-code-difference-with-debug.ll
  test/CodeGen/X86/movpc32-check.ll
  test/CodeGen/X86/partition-sections.ll
  test/CodeGen/X86/push-cfi-debug.ll
  test/CodeGen/X86/stack-protector-dbginfo.ll
  test/CodeGen/X86/unknown-location.ll
  test/CodeGen/XCore/dwarf_debug.ll
  test/DebugInfo/AArch64/big-endian.ll
  test/DebugInfo/AArch64/bitfields.ll
  test/DebugInfo/AArch64/cfi-eof-prologue.ll
  test/DebugInfo/AArch64/coalescing.ll
  test/DebugInfo/AArch64/constant-dbgloc.ll
  test/DebugInfo/AArch64/dwarfdump.ll
  test/DebugInfo/AArch64/frameindices.ll
  test/DebugInfo/AArch64/prologue_end.ll
  test/DebugInfo/AArch64/struct_by_value.ll
  test/DebugInfo/ARM/PR16736.ll
  test/DebugInfo/ARM/PR26163.ll
  test/DebugInfo/ARM/big-endian-bitfield.ll
  test/DebugInfo/ARM/bitfield.ll
  test/DebugInfo/ARM/cfi-eof-prologue.ll
  test/DebugInfo/ARM/constant-dbgloc.ll
  test/DebugInfo/ARM/float-args.ll
  test/DebugInfo/ARM/header.ll
  test/DebugInfo/ARM/lowerbdgdeclare_vla.ll
  test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll
  test/DebugInfo/ARM/prologue_end.ll
  test/DebugInfo/ARM/s-super-register.ll
  test/DebugInfo/ARM/selectiondag-deadcode.ll
  test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll
  test/DebugInfo/ARM/split-complex.ll
  test/DebugInfo/ARM/sroa-complex.ll
  test/DebugInfo/ARM/tls.ll
  test/DebugInfo/COFF/asan-module-ctor.ll
  test/DebugInfo/COFF/asm.ll
  test/DebugInfo/COFF/cpp-mangling.ll
  test/DebugInfo/COFF/fp-stack.ll
  test/DebugInfo/COFF/inlining-files.ll
  test/DebugInfo/COFF/inlining-levels.ll
  test/DebugInfo/COFF/inlining.ll
  test/DebugInfo/COFF/local-constant.ll
  test/DebugInfo/COFF/local-variables.ll
  test/DebugInfo/COFF/multifile.ll
  test/DebugInfo/COFF/multifunction.ll
  test/DebugInfo/COFF/register-variables.ll
  test/DebugInfo/COFF/simple.ll
  test/DebugInfo/COFF/tail-call-without-lexical-scopes.ll
  test/DebugInfo/Generic/2009-11-03-InsertExtractValue.ll
  test/DebugInfo/Generic/2009-11-05-DeadGlobalVariable.ll
  test/DebugInfo/Generic/2009-11-06-NamelessGlobalVariable.ll
  test/DebugInfo/Generic/2009-11-10-CurrentFn.ll
  test/DebugInfo/Generic/2010-03-24-MemberFn.ll
  test/DebugInfo/Generic/2010-04-06-NestedFnDbgInfo.ll
  test/DebugInfo/Generic/2010-04-19-FramePtr.ll
  test/DebugInfo/Generic/2010-05-10-MultipleCU.ll
  test/DebugInfo/Generic/2010-06-29-InlinedFnLocalVar.ll
  test/DebugInfo/Generic/2010-07-19-Crash.ll
  test/DebugInfo/Generic/2010-10-01-crash.ll
  test/DebugInfo/Generic/Inputs/gmlt.ll
  test/DebugInfo/Generic/PR20038.ll
  test/DebugInfo/Generic/accel-table-hash-collisions.ll
  test/DebugInfo/Generic/array.ll
  test/DebugInfo/Generic/block-asan.ll
  test/DebugInfo/Generic/constant-pointers.ll
  test/DebugInfo/Generic/constant-sdnodes-have-dbg-location.ll
  test/DebugInfo/Generic/constantfp-sdnodes-have-dbg-location.ll
  test/DebugInfo/Generic/cross-cu-inlining.ll
  test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
  test/DebugInfo/Generic/cross-cu-linkonce.ll
  test/DebugInfo/Generic/cu-range-hole.ll
  test/DebugInfo/Generic/cu-ranges.ll
  test/DebugInfo/Generic/dbg-at-specficiation.ll
  test/DebugInfo/Generic/dead-argument-order.ll
  test/DebugInfo/Generic/debug-info-qualifiers.ll
  test/DebugInfo/Generic/debuginfofinder-forward-declaration.ll
  test/DebugInfo/Generic/debuginfofinder-multiple-cu.ll
  test/DebugInfo/Generic/def-line.ll
  test/DebugInfo/Generic/discriminator.ll
  test/DebugInfo/Generic/dwarf-public-names.ll
  test/DebugInfo/Generic/enum-types.ll
  test/DebugInfo/Generic/enum.ll
  test/DebugInfo/Generic/global.ll
  test/DebugInfo/Generic/gvn.ll
  test/DebugInfo/Generic/incorrect-variable-debugloc.ll
  test/DebugInfo/Generic/incorrect-variable-debugloc1.ll
  test/DebugInfo/Generic/inline-debug-info-multiret.ll
  test/DebugInfo/Generic/inline-debug-info.ll
  test/DebugInfo/Generic/inline-no-debug-info.ll
  test/DebugInfo/Generic/inline-scopes.ll
  test/DebugInfo/Generic/inlined-arguments.ll
  test/DebugInfo/Generic/inlined-vars.ll
  test/DebugInfo/Generic/linkage-name-abstract.ll
  test/DebugInfo/Generic/location-verifier.ll
  test/DebugInfo/Generic/lto-comp-dir.ll
  test/DebugInfo/Generic/member-order.ll
  test/DebugInfo/Generic/member-pointers.ll
  test/DebugInfo/Generic/missing-abstract-variable.ll
  test/DebugInfo/Generic/multiline.ll
  test/DebugInfo/Generic/namespace.ll
  test/DebugInfo/Generic/namespace_function_definition.ll
  test/DebugInfo/Generic/namespace_inline_function_definition.ll
  test/DebugInfo/Generic/piece-verifier.ll
  test/DebugInfo/Generic/ptrsize.ll
  test/DebugInfo/Generic/recursive_inlining.ll
  test/DebugInfo/Generic/restrict.ll
  test/DebugInfo/Generic/sugared-constants.ll
  test/DebugInfo/Generic/template-recursive-void.ll
  test/DebugInfo/Generic/tu-composite.ll
  test/DebugInfo/Generic/tu-member-pointer.ll
  test/DebugInfo/Generic/two-cus-from-same-file.ll
  test/DebugInfo/Generic/typedef.ll
  test/DebugInfo/Generic/unconditional-branch.ll
  test/DebugInfo/Generic/varargs.ll
  test/DebugInfo/Generic/version.ll
  test/DebugInfo/Generic/virtual-index.ll
  test/DebugInfo/Inputs/gmlt.ll
  test/DebugInfo/Inputs/line.ll
  test/DebugInfo/MIR/X86/live-debug-values-3preds.mir
  test/DebugInfo/MIR/X86/live-debug-values.mir
  test/DebugInfo/Mips/InlinedFnLocalVar.ll
  test/DebugInfo/Mips/delay-slot.ll
  test/DebugInfo/Mips/dsr-fixed-objects.ll
  test/DebugInfo/Mips/dsr-non-fixed-objects.ll
  test/DebugInfo/Mips/fn-call-line.ll
  test/DebugInfo/Mips/prologue_end.ll
  test/DebugInfo/PowerPC/tls-fission.ll
  test/DebugInfo/PowerPC/tls.ll
  test/DebugInfo/Sparc/gnu-window-save.ll
  test/DebugInfo/Sparc/prologue_end.ll
  test/DebugInfo/SystemZ/prologue_end.ll
  test/DebugInfo/SystemZ/variable-loc.ll
  test/DebugInfo/X86/2010-04-13-PubType.ll
  test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
  test/DebugInfo/X86/2011-12-16-BadStructRef.ll
  test/DebugInfo/X86/DIModuleContext.ll
  test/DebugInfo/X86/DW_AT_byte_size.ll
  test/DebugInfo/X86/DW_AT_linkage_name.ll
  test/DebugInfo/X86/DW_AT_location-reference.ll
  test/DebugInfo/X86/DW_AT_object_pointer.ll
  test/DebugInfo/X86/DW_AT_specification.ll
  test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
  test/DebugInfo/X86/DW_TAG_friend.ll
  test/DebugInfo/X86/InlinedFnLocalVar.ll
  test/DebugInfo/X86/PR26148.ll
  test/DebugInfo/X86/abstract_origin.ll
  test/DebugInfo/X86/aligned_stack_var.ll
  test/DebugInfo/X86/arange-and-stub.ll
  test/DebugInfo/X86/arange.ll
  test/DebugInfo/X86/arguments.ll
  test/DebugInfo/X86/array.ll
  test/DebugInfo/X86/array2.ll
  test/DebugInfo/X86/bbjoin.ll
  test/DebugInfo/X86/bitfields-dwarf4.ll
  test/DebugInfo/X86/bitfields.ll
  test/DebugInfo/X86/block-capture.ll
  test/DebugInfo/X86/byvalstruct.ll
  test/DebugInfo/X86/c-type-units.ll
  test/DebugInfo/X86/coff_debug_info_type.ll
  (269 more files...)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20147.56848.patch
Type: text/x-patch
Size: 506725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160511/f70e0640/attachment-0001.bin>


More information about the llvm-commits mailing list