This apparently leads to clang segfaults in our internal builds...<br><br><div class="gmail_quote">On Wed Oct 01 2014 at 9:11:14 PM Adrian Prantl <<a href="mailto:aprantl@apple.com">aprantl@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br>
Date: Wed Oct 1 13:55:02 2014<br>
New Revision: 218787<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218787&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=218787&view=rev</a><br>
Log:<br>
Move the complex address expression out of DIVariable and into an extra<br>
argument of the llvm.dbg.declare/llvm.dbg.<u></u>value intrinsics.<br>
<br>
Previously, DIVariable was a variable-length field that has an optional<br>
reference to a Metadata array consisting of a variable number of<br>
complex address expressions. In the case of OpPiece expressions this is<br>
wasting a lot of storage in IR, because when an aggregate type is, e.g.,<br>
SROA'd into all of its n individual members, the IR will contain n copies<br>
of the DIVariable, all alike, only differing in the complex address<br>
reference at the end.<br>
<br>
By making the complex address into an extra argument of the<br>
dbg.value/dbg.declare intrinsics, all of the pieces can reference the<br>
same variable and the complex address expressions can be uniqued across<br>
the CU, too.<br>
Down the road, this will allow us to move other flags, such as<br>
"indirection" out of the DIVariable, too.<br>
<br>
The new intrinsics look like this:<br>
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)<br>
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)<br>
<br>
This patch adds a new LLVM-local tag to DIExpressions, so we can detect<br>
and pretty-print DIExpression metadata nodes.<br>
<br>
What this patch doesn't do:<br>
<br>
This patch does not touch the "Indirect" field in DIVariable; but moving<br>
that into the expression would be a natural next step.<br>
<br>
<a href="http://reviews.llvm.org/D4919" target="_blank">http://reviews.llvm.org/D4919</a><br>
rdar://problem/17994491<br>
<br>
Thanks to dblaikie and dexonsmith for reviewing this patch!<br>
<br>
Note: I accidentally committed a bogus older version of this patch previously.<br>
<br>
Modified:<br>
llvm/trunk/docs/<u></u>SourceLevelDebugging.rst<br>
llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstr.h<br>
llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstrBuilder.h<br>
llvm/trunk/include/llvm/<u></u>CodeGen/MachineModuleInfo.h<br>
llvm/trunk/include/llvm/<u></u>CodeGen/SelectionDAG.h<br>
llvm/trunk/include/llvm/IR/<u></u>DIBuilder.h<br>
llvm/trunk/include/llvm/IR/<u></u>DebugInfo.h<br>
llvm/trunk/include/llvm/IR/<u></u>IntrinsicInst.h<br>
llvm/trunk/include/llvm/IR/<u></u>Intrinsics.td<br>
llvm/trunk/include/llvm/<u></u>Support/Dwarf.h<br>
llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/AsmPrinter.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/<u></u>DbgValueHistoryCalculator.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DebugLocEntry.h<br>
llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.h<br>
llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfUnit.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>InlineSpiller.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>LiveDebugVariables.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>MachineInstr.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>RegAllocFast.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/FastISel.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/<u></u>FunctionLoweringInfo.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/InstrEmitter.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/SDNodeDbgValue.h<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/SelectionDAG.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/<u></u>SelectionDAGBuilder.cpp<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/<u></u>SelectionDAGBuilder.h<br>
llvm/trunk/lib/CodeGen/<u></u>SelectionDAG/SelectionDAGISel.<u></u>cpp<br>
llvm/trunk/lib/IR/AutoUpgrade.<u></u>cpp<br>
llvm/trunk/lib/IR/DIBuilder.<u></u>cpp<br>
llvm/trunk/lib/IR/DebugInfo.<u></u>cpp<br>
llvm/trunk/lib/Support/Dwarf.<u></u>cpp<br>
llvm/trunk/lib/Target/AArch64/<u></u>AArch64InstrInfo.cpp<br>
llvm/trunk/lib/Target/AArch64/<u></u>AArch64InstrInfo.h<br>
llvm/trunk/lib/Target/X86/<u></u>X86FastISel.cpp<br>
llvm/trunk/lib/Transforms/<u></u>Scalar/SROA.cpp<br>
llvm/trunk/lib/Transforms/<u></u>Scalar/ScalarReplAggregates.<u></u>cpp<br>
llvm/trunk/lib/Transforms/<u></u>Utils/Local.cpp<br>
llvm/trunk/test/Analysis/<u></u>GlobalsModRef/pr12351.ll<br>
llvm/trunk/test/Assembler/<u></u>2010-02-05-<u></u>FunctionLocalMetadataBecomesNu<u></u>ll.ll<br>
llvm/trunk/test/Assembler/<u></u>functionlocal-metadata.ll<br>
llvm/trunk/test/CodeGen/<u></u>AArch64/aarch64-2014-08-11-<u></u>MachineCombinerCrash.ll<br>
llvm/trunk/test/CodeGen/<u></u>AArch64/arm64-2011-03-17-<u></u>AsmPrinterCrash.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>2009-10-16-Scope.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>2010-04-15-<u></u>ScavengerDebugValue.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>2010-06-25-<u></u>Thumb2ITInvalidIterator.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>2010-08-04-StackVariable.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>2011-01-19-MergedGlobalDbg.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>2011-08-02-MergedGlobalDbg.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>coalesce-dbgvalue.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>debug-info-arg.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>debug-info-blocks.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>debug-info-branch-folding.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>debug-info-d16-reg.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>debug-info-qreg.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>debug-info-s16-reg.ll<br>
llvm/trunk/test/CodeGen/ARM/<u></u>debug-info-sreg2.ll<br>
llvm/trunk/test/CodeGen/<u></u>Generic/dbg_value.ll<br>
llvm/trunk/test/CodeGen/<u></u>Hexagon/hwloop-dbg.ll<br>
llvm/trunk/test/CodeGen/<u></u>Inputs/DbgValueOtherTargets.ll<br>
llvm/trunk/test/CodeGen/<u></u>PowerPC/dbg.ll<br>
llvm/trunk/test/CodeGen/<u></u>PowerPC/pr17168.ll<br>
llvm/trunk/test/CodeGen/Thumb/<u></u>2010-07-15-debugOrdering.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2009-02-12-DebugInfoVLA.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2009-10-16-Scope.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-01-18-DbgValue.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-02-01-DbgValueCrash.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-05-25-DotDebugLoc.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-05-26-DotDebugLoc.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-05-28-Crash.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-06-01-DeadArg-DbgInfo.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-07-06-DbgCrash.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-08-04-StackVariable.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2010-11-02-DbgParameter.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2011-01-24-DbgValue-Before-<u></u>Use.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2012-11-30-handlemove-dbg.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2012-11-30-misched-dbg.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>2012-11-30-regpres-dbg.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>MachineSink-DbgValue.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>StackColoring-dbg.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>dbg-changes-codegen-branch-<u></u>folding.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>dbg-changes-codegen.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>fpstack-debuginstr-kill.ll<br>
llvm/trunk/test/CodeGen/X86/<u></u>stack-protector-dbginfo.ll<br>
llvm/trunk/test/CodeGen/XCore/<u></u>dwarf_debug.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2009-11-10-CurrentFn.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-03-12-llc-crash.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-03-19-DbgDeclare.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-03-24-MemberFn.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-03-30-<u></u>InvalidDbgInfoCrash.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-04-06-NestedFnDbgInfo.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-05-03-DisableFramePtr.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-05-03-OriginDIE.ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-06-29-InlinedFnLocalVar.<u></u>ll<br>
llvm/trunk/test/DebugInfo/<u></u>2010-10-01-crash.ll<br>
llvm/trunk/test/DebugInfo/<u></u>AArch64/struct_by_value.ll<br>
llvm/trunk/test/DebugInfo/ARM/<u></u>PR16736.ll<br>
llvm/trunk/test/DebugInfo/ARM/<u></u>lowerbdgdeclare_vla.ll<br>
llvm/trunk/test/DebugInfo/ARM/<u></u>s-super-register.ll<br>
llvm/trunk/test/DebugInfo/ARM/<u></u>selectiondag-deadcode.ll<br>
llvm/trunk/test/DebugInfo/<u></u>Mips/delay-slot.ll<br>
llvm/trunk/test/DebugInfo/<u></u>PR20038.ll<br>
llvm/trunk/test/DebugInfo/<u></u>SystemZ/variable-loc.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>2010-04-13-PubType.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>2011-09-26-GlobalVarContext.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>2011-12-16-BadStructRef.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>DW_AT_byte_size.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>DW_AT_linkage_name.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>DW_AT_location-reference.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>DW_AT_object_pointer.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>aligned_stack_var.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>arguments.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>array.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>array2.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>block-capture.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>byvalstruct.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>cu-ranges-odr.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>cu-ranges.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-byval-parameter.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-const-int.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-const.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-declare-arg.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-declare.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-i128-const.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-merge-loc-entry.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-prolog-end.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-value-const-byref.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-value-dag-combine.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-value-inlined-parameter.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-value-isel.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-value-location.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-value-range.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg-value-terminator.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dbg_value_direct.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>debug-info-block-captured-<u></u>self.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>debug-info-blocks.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>debug-info-static-member.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>debug-loc-asan.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>debug-loc-offset.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>debug-ranges-offset.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>decl-derived-member.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dwarf-aranges-no-dwarf-labels.<u></u>ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>dwarf-public-names.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>earlydup-crash.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>elf-names.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>empty-and-one-elem-array.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>ending-run.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>fission-ranges.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>formal_parameter.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>generate-odr-hash.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>gnu-public-names.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>inline-member-function.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>inline-seldag-test.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>instcombine-instrinsics.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>lexical_block.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>line-info.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>linkage-name.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>misched-dbg-value.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>multiple-at-const-val.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>nodebug_with_debug_loc.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>objc-property-void.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>op_deref.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>parameters.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>pieces-1.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>pieces-2.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>pieces-3.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>pr11300.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>pr12831.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>pr19307.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>recursive_inlining.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>reference-argument.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>rvalue-ref.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>sret.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>stmt-list-multiple-compile-<u></u>units.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>subrange-type.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>subreg.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>subregisters.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>union-template.ll<br>
llvm/trunk/test/DebugInfo/X86/<u></u>vla.ll<br>
llvm/trunk/test/DebugInfo/<u></u>array.ll<br>
llvm/trunk/test/DebugInfo/<u></u>cross-cu-inlining.ll<br>
llvm/trunk/test/DebugInfo/<u></u>cross-cu-linkonce-distinct.ll<br>
llvm/trunk/test/DebugInfo/<u></u>cross-cu-linkonce.ll<br>
llvm/trunk/test/DebugInfo/cu-<u></u>range-hole.ll<br>
llvm/trunk/test/DebugInfo/cu-<u></u>ranges.ll<br>
llvm/trunk/test/DebugInfo/<u></u>dead-argument-order.ll<br>
llvm/trunk/test/DebugInfo/<u></u>debug-info-qualifiers.ll<br>
llvm/trunk/test/DebugInfo/<u></u>dwarf-public-names.ll<br>
llvm/trunk/test/DebugInfo/<u></u>enum-types.ll<br>
llvm/trunk/test/DebugInfo/<u></u>enum.ll<br>
llvm/trunk/test/DebugInfo/<u></u>incorrect-variable-debugloc.ll<br>
llvm/trunk/test/DebugInfo/<u></u>inheritance.ll<br>
llvm/trunk/test/DebugInfo/<u></u>inline-debug-info-multiret.ll<br>
llvm/trunk/test/DebugInfo/<u></u>inline-debug-info.ll<br>
llvm/trunk/test/DebugInfo/<u></u>inline-scopes.ll<br>
llvm/trunk/test/DebugInfo/<u></u>inlined-arguments.ll<br>
llvm/trunk/test/DebugInfo/<u></u>inlined-vars.ll<br>
llvm/trunk/test/DebugInfo/<u></u>member-order.ll<br>
llvm/trunk/test/DebugInfo/<u></u>missing-abstract-variable.ll<br>
llvm/trunk/test/DebugInfo/<u></u>namespace.ll<br>
llvm/trunk/test/DebugInfo/<u></u>namespace_inline_function_<u></u>definition.ll<br>
llvm/trunk/test/DebugInfo/<u></u>restrict.ll<br>
llvm/trunk/test/DebugInfo/<u></u>sugared-constants.ll<br>
llvm/trunk/test/DebugInfo/tu-<u></u>composite.ll<br>
llvm/trunk/test/DebugInfo/two-<u></u>cus-from-same-file.ll<br>
llvm/trunk/test/DebugInfo/<u></u>unconditional-branch.ll<br>
llvm/trunk/test/DebugInfo/<u></u>varargs.ll<br>
llvm/trunk/test/<u></u>Instrumentation/<u></u>AddressSanitizer/coverage-dbg.<u></u>ll<br>
llvm/trunk/test/<u></u>Instrumentation/<u></u>AddressSanitizer/coverage2-<u></u>dbg.ll<br>
llvm/trunk/test/<u></u>Instrumentation/<u></u>AddressSanitizer/debug_info.ll<br>
llvm/trunk/test/<u></u>Instrumentation/<u></u>MemorySanitizer/store-origin.<u></u>ll<br>
llvm/trunk/test/JitListener/<u></u>test-common-symbols.ll<br>
llvm/trunk/test/JitListener/<u></u>test-inline.ll<br>
llvm/trunk/test/JitListener/<u></u>test-parameters.ll<br>
llvm/trunk/test/Linker/2011-<u></u>08-18-unique-class-type.ll<br>
llvm/trunk/test/Linker/2011-<u></u>08-18-unique-class-type2.ll<br>
llvm/trunk/test/Linker/<u></u>DbgDeclare.ll<br>
llvm/trunk/test/Linker/<u></u>DbgDeclare2.ll<br>
llvm/trunk/test/Linker/Inputs/<u></u>type-unique-inheritance-a.ll<br>
llvm/trunk/test/Linker/Inputs/<u></u>type-unique-inheritance-b.ll<br>
llvm/trunk/test/Linker/Inputs/<u></u>type-unique-simple2-a.ll<br>
llvm/trunk/test/Linker/Inputs/<u></u>type-unique-simple2-b.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-odr-a.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-odr-b.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-simple-a.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-simple-b.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-simple2-a.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-simple2-b.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-type-array-a.ll<br>
llvm/trunk/test/Linker/type-<u></u>unique-type-array-b.ll<br>
llvm/trunk/test/Transforms/<u></u>AddDiscriminators/no-<u></u>discriminators.ll<br>
llvm/trunk/test/Transforms/<u></u>DeadArgElim/2010-04-30-<u></u>DbgInfo.ll<br>
llvm/trunk/test/Transforms/<u></u>DeadStoreElimination/inst-<u></u>limits.ll<br>
llvm/trunk/test/Transforms/<u></u>GCOVProfiling/linezero.ll<br>
llvm/trunk/test/Transforms/<u></u>GlobalOpt/2009-03-05-dbg.ll<br>
llvm/trunk/test/Transforms/<u></u>Inline/ignore-debug-info.ll<br>
llvm/trunk/test/Transforms/<u></u>InstCombine/debuginfo.ll<br>
llvm/trunk/test/Transforms/<u></u>LICM/debug-value.ll<br>
llvm/trunk/test/Transforms/<u></u>LoopIdiom/debug-line.ll<br>
llvm/trunk/test/Transforms/<u></u>LoopRotate/dbgvalue.ll<br>
llvm/trunk/test/Transforms/<u></u>LoopStrengthReduce/pr12018.ll<br>
llvm/trunk/test/Transforms/<u></u>LoopVectorize/dbg.value.ll<br>
llvm/trunk/test/Transforms/<u></u>LoopVectorize/debugloc.ll<br>
llvm/trunk/test/Transforms/<u></u>Mem2Reg/ConvertDebugInfo.ll<br>
llvm/trunk/test/Transforms/<u></u>Mem2Reg/ConvertDebugInfo2.ll<br>
llvm/trunk/test/Transforms/<u></u>ObjCARC/allocas.ll<br>
llvm/trunk/test/Transforms/<u></u>ObjCARC/basic.ll<br>
llvm/trunk/test/Transforms/<u></u>ObjCARC/ensure-that-exception-<u></u>unwind-path-is-visited.ll<br>
llvm/trunk/test/Transforms/<u></u>SLPVectorizer/X86/debug_info.<u></u>ll<br>
llvm/trunk/test/Transforms/<u></u>SampleProfile/branch.ll<br>
llvm/trunk/test/Transforms/<u></u>ScalarRepl/debuginfo-<u></u>preserved.ll<br>
llvm/trunk/test/Transforms/<u></u>Scalarizer/dbginfo.ll<br>
llvm/trunk/test/Transforms/<u></u>SimplifyCFG/branch-fold-dbg.ll<br>
llvm/trunk/test/Transforms/<u></u>SimplifyCFG/hoist-dbgvalue.ll<br>
llvm/trunk/test/Transforms/<u></u>StripSymbols/2010-06-30-<u></u>StripDebug.ll<br>
llvm/trunk/test/Transforms/<u></u>StripSymbols/strip-dead-debug-<u></u>info.ll<br>
llvm/trunk/unittests/<u></u>Transforms/Utils/Cloning.cpp<br>
<br>
Modified: llvm/trunk/docs/<u></u>SourceLevelDebugging.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/SourceLevelDebugging.rst?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/docs/<u></u>SourceLevelDebugging.rst?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/docs/<u></u>SourceLevelDebugging.rst (original)<br>
+++ llvm/trunk/docs/<u></u>SourceLevelDebugging.rst Wed Oct 1 13:55:02 2014<br>
@@ -571,7 +571,7 @@ Local variables<br>
metadata, ;; Reference to the type descriptor<br>
i32, ;; flags<br>
metadata ;; (optional) Reference to inline location<br>
- metadata ;; (optional) Reference to a complex expression (see below)<br>
+ metadata ;; (optional) Reference to a complex expression.<br>
}<br>
<br>
These descriptors are used to define variables local to a sub program. The<br>
@@ -590,7 +590,20 @@ The context is either the subprogram or<br>
Name the source variable name. Context and line indicate where the variable<br>
was defined. Type descriptor defines the declared type of the variable.<br>
<br>
-The ``OpPiece`` operator is used for (typically larger aggregate)<br>
+Complex Expressions<br>
+^^^^^^^^^^^^^^^^^^^<br>
+.. code-block:: llvm<br>
+<br>
+ !8 = metadata !{<br>
+ i32, ;; DW_TAG_expression<br>
+ ...<br>
+ }<br>
+<br>
+Complex expressions describe variable storage locations in terms of<br>
+prefix-notated DWARF expressions. Currently the only supported<br>
+operators are ``DW_OP_plus``, ``DW_OP_deref``, and ``DW_OP_piece``.<br>
+<br>
+The ``DW_OP_piece`` operator is used for (typically larger aggregate)<br>
variables that are fragmented across several locations. It takes two<br>
i32 arguments, an offset and a size in bytes to describe which piece<br>
of the variable is at this location.<br>
<br>
Modified: llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstr.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/CodeGen/MachineInstr.h?<u></u>rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstr.h (original)<br>
+++ llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstr.h Wed Oct 1 13:55:02 2014<br>
@@ -244,12 +244,22 @@ public:<br>
///<br>
DebugLoc getDebugLoc() const { return debugLoc; }<br>
<br>
- /// getDebugVariable() - Return the debug variable referenced by<br>
+ /// \brief Return the debug variable referenced by<br>
/// this DBG_VALUE instruction.<br>
DIVariable getDebugVariable() const {<br>
assert(isDebugValue() && "not a DBG_VALUE");<br>
- const MDNode *Var = getOperand(getNumOperands() - 1).getMetadata();<br>
- return DIVariable(Var);<br>
+ DIVariable Var(getOperand(2).getMetadata(<u></u>));<br>
+ assert(Var.Verify() && "not a DIVariable");<br>
+ return Var;<br>
+ }<br>
+<br>
+ /// \brief Return the complex address expression referenced by<br>
+ /// this DBG_VALUE instruction.<br>
+ DIExpression getDebugExpression() const {<br>
+ assert(isDebugValue() && "not a DBG_VALUE");<br>
+ DIExpression Expr(getOperand(3).<u></u>getMetadata());<br>
+ assert(Expr.Verify() && "not a DIExpression");<br>
+ return Expr;<br>
}<br>
<br>
/// emitError - Emit an error referring to the source location of this<br>
<br>
Modified: llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstrBuilder.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/CodeGen/<u></u>MachineInstrBuilder.h?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstrBuilder.h (original)<br>
+++ llvm/trunk/include/llvm/<u></u>CodeGen/MachineInstrBuilder.h Wed Oct 1 13:55:02 2014<br>
@@ -170,6 +170,8 @@ public:<br>
<br>
const MachineInstrBuilder &addMetadata(const MDNode *MD) const {<br>
MI->addOperand(*MF, MachineOperand::<u></u>CreateMetadata(MD));<br>
+ assert((MI->isDebugValue() ? MI->getDebugVariable().Verify(<u></u>) : true) &&<br>
+ "first MDNode argument of a DBG_VALUE not a DIVariable");<br>
return *this;<br>
}<br>
<br>
@@ -345,24 +347,25 @@ inline MachineInstrBuilder BuildMI(Machi<br>
/// address. The convention is that a DBG_VALUE is indirect iff the<br>
/// second operand is an immediate.<br>
///<br>
-inline MachineInstrBuilder BuildMI(MachineFunction &MF,<br>
- DebugLoc DL,<br>
- const MCInstrDesc &MCID,<br>
- bool IsIndirect,<br>
- unsigned Reg,<br>
- unsigned Offset,<br>
- const MDNode *MD) {<br>
+inline MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL,<br>
+ const MCInstrDesc &MCID, bool IsIndirect,<br>
+ unsigned Reg, unsigned Offset,<br>
+ const MDNode *Variable, const MDNode *Expr) {<br>
+ assert(DIVariable(Variable).<u></u>Verify() && "not a DIVariable");<br>
+ assert(DIExpression(Expr).<u></u>Verify() && "not a DIExpression");<br>
if (IsIndirect)<br>
return BuildMI(MF, DL, MCID)<br>
- .addReg(Reg, RegState::Debug)<br>
- .addImm(Offset)<br>
- .addMetadata(MD);<br>
+ .addReg(Reg, RegState::Debug)<br>
+ .addImm(Offset)<br>
+ .addMetadata(Variable)<br>
+ .addMetadata(Expr);<br>
else {<br>
assert(Offset == 0 && "A direct address cannot have an offset.");<br>
return BuildMI(MF, DL, MCID)<br>
- .addReg(Reg, RegState::Debug)<br>
- .addReg(0U, RegState::Debug)<br>
- .addMetadata(MD);<br>
+ .addReg(Reg, RegState::Debug)<br>
+ .addReg(0U, RegState::Debug)<br>
+ .addMetadata(Variable)<br>
+ .addMetadata(Expr);<br>
}<br>
}<br>
<br>
@@ -371,15 +374,15 @@ inline MachineInstrBuilder BuildMI(Machi<br>
/// address and inserts it at position I.<br>
///<br>
inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,<br>
- MachineBasicBlock::iterator I,<br>
- DebugLoc DL,<br>
- const MCInstrDesc &MCID,<br>
- bool IsIndirect,<br>
- unsigned Reg,<br>
- unsigned Offset,<br>
- const MDNode *MD) {<br>
+ MachineBasicBlock::iterator I, DebugLoc DL,<br>
+ const MCInstrDesc &MCID, bool IsIndirect,<br>
+ unsigned Reg, unsigned Offset,<br>
+ const MDNode *Variable, const MDNode *Expr) {<br>
+ assert(DIVariable(Variable).<u></u>Verify() && "not a DIVariable");<br>
+ assert(DIExpression(Expr).<u></u>Verify() && "not a DIExpression");<br>
MachineFunction &MF = *BB.getParent();<br>
- MachineInstr *MI = BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, MD);<br>
+ MachineInstr *MI =<br>
+ BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);<br>
BB.insert(I, MI);<br>
return MachineInstrBuilder(MF, MI);<br>
}<br>
<br>
Modified: llvm/trunk/include/llvm/<u></u>CodeGen/MachineModuleInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/CodeGen/<u></u>MachineModuleInfo.h?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/<u></u>CodeGen/MachineModuleInfo.h (original)<br>
+++ llvm/trunk/include/llvm/<u></u>CodeGen/MachineModuleInfo.h Wed Oct 1 13:55:02 2014<br>
@@ -166,6 +166,7 @@ public:<br>
<br>
struct VariableDbgInfo {<br>
TrackingVH<MDNode> Var;<br>
+ TrackingVH<MDNode> Expr;<br>
unsigned Slot;<br>
DebugLoc Loc;<br>
};<br>
@@ -390,8 +391,9 @@ public:<br>
<br>
/// setVariableDbgInfo - Collect information used to emit debugging<br>
/// information of a variable.<br>
- void setVariableDbgInfo(MDNode *N, unsigned Slot, DebugLoc Loc) {<br>
- VariableDbgInfo Info = { N, Slot, Loc };<br>
+ void setVariableDbgInfo(MDNode *Var, MDNode *Expr, unsigned Slot,<br>
+ DebugLoc Loc) {<br>
+ VariableDbgInfo Info = {Var, Expr, Slot, Loc};<br>
VariableDbgInfos.push_back(<u></u>std::move(Info));<br>
}<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/<u></u>CodeGen/SelectionDAG.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/CodeGen/SelectionDAG.h?<u></u>rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/<u></u>CodeGen/SelectionDAG.h (original)<br>
+++ llvm/trunk/include/llvm/<u></u>CodeGen/SelectionDAG.h Wed Oct 1 13:55:02 2014<br>
@@ -984,15 +984,18 @@ public:<br>
<br>
/// getDbgValue - Creates a SDDbgValue node.<br>
///<br>
- SDDbgValue *getDbgValue(MDNode *MDPtr, SDNode *N, unsigned R,<br>
- bool IsIndirect, uint64_t Off,<br>
- DebugLoc DL, unsigned O);<br>
- /// Constant.<br>
- SDDbgValue *getConstantDbgValue(MDNode *MDPtr, const Value *C, uint64_t Off,<br>
- DebugLoc DL, unsigned O);<br>
- /// Frame index.<br>
- SDDbgValue *getFrameIndexDbgValue(MDNode *MDPtr, unsigned FI, uint64_t Off,<br>
- DebugLoc DL, unsigned O);<br>
+ /// SDNode<br>
+ SDDbgValue *getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R,<br>
+ bool IsIndirect, uint64_t Off, DebugLoc DL,<br>
+ unsigned O);<br>
+<br>
+ /// Constant<br>
+ SDDbgValue *getConstantDbgValue(MDNode *Var, MDNode *Expr, const Value *C,<br>
+ uint64_t Off, DebugLoc DL, unsigned O);<br>
+<br>
+ /// FrameIndex<br>
+ SDDbgValue *getFrameIndexDbgValue(MDNode *Var, MDNode *Expr, unsigned FI,<br>
+ uint64_t Off, DebugLoc DL, unsigned O);<br>
<br>
/// RemoveDeadNode - Remove the specified node from the system. If any of its<br>
/// operands then becomes dead, remove them as well. Inform UpdateListener<br>
<br>
Modified: llvm/trunk/include/llvm/IR/<u></u>DIBuilder.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DIBuilder.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/IR/DIBuilder.h?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/IR/<u></u>DIBuilder.h (original)<br>
+++ llvm/trunk/include/llvm/IR/<u></u>DIBuilder.h Wed Oct 1 13:55:02 2014<br>
@@ -85,7 +85,6 @@ namespace llvm {<br>
<br>
public:<br>
explicit DIBuilder(Module &M);<br>
- enum ComplexAddrKind { OpPlus=1, OpDeref, OpPiece };<br>
enum DebugEmissionKind { FullDebug=1, LineTablesOnly };<br>
<br>
/// finalize - Construct any deferred debug info descriptors.<br>
@@ -501,33 +500,18 @@ namespace llvm {<br>
unsigned Flags = 0,<br>
unsigned ArgNo = 0);<br>
<br>
-<br>
- /// createComplexVariable - Create a new descriptor for the specified<br>
+ /// createExpression - Create a new descriptor for the specified<br>
/// variable which has a complex address expression for its address.<br>
- /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or<br>
- /// DW_TAG_arg_variable.<br>
- /// @param Scope Variable scope.<br>
- /// @param Name Variable name.<br>
- /// @param F File where this variable is defined.<br>
- /// @param LineNo Line number.<br>
- /// @param Ty Variable Type<br>
/// @param Addr An array of complex address operations.<br>
- /// @param ArgNo If this variable is an argument then this argument's<br>
- /// number. 1 indicates 1st argument.<br>
- DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,<br>
- StringRef Name, DIFile F, unsigned LineNo,<br>
- DITypeRef Ty, ArrayRef<Value *> Addr,<br>
- unsigned ArgNo = 0);<br>
+ DIExpression createExpression(ArrayRef<<u></u>Value *> Addr = None);<br>
<br>
- /// createVariablePiece - Create a descriptor to describe one part<br>
+ /// createPieceExpression - Create a descriptor to describe one part<br>
/// of aggregate variable that is fragmented across multiple Values.<br>
///<br>
- /// @param Variable Variable that is partially represented by this.<br>
/// @param OffsetInBytes Offset of the piece in bytes.<br>
/// @param SizeInBytes Size of the piece in bytes.<br>
- DIVariable createVariablePiece(DIVariable Variable,<br>
- unsigned OffsetInBytes,<br>
- unsigned SizeInBytes);<br>
+ DIExpression createPieceExpression(unsigned OffsetInBytes,<br>
+ unsigned SizeInBytes);<br>
<br>
/// createFunction - Create a new descriptor for the specified subprogram.<br>
/// See comments in DISubprogram for descriptions of these fields.<br>
@@ -675,34 +659,37 @@ namespace llvm {<br>
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.<br>
/// @param Storage llvm::Value of the variable<br>
/// @param VarInfo Variable's debug info descriptor.<br>
+ /// @param Expr A complex location expression.<br>
/// @param InsertAtEnd Location for the new intrinsic.<br>
Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,<br>
- BasicBlock *InsertAtEnd);<br>
+ DIExpression Expr, BasicBlock *InsertAtEnd);<br>
<br>
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.<br>
/// @param Storage llvm::Value of the variable<br>
/// @param VarInfo Variable's debug info descriptor.<br>
+ /// @param Expr A complex location expression.<br>
/// @param InsertBefore Location for the new intrinsic.<br>
Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,<br>
- Instruction *InsertBefore);<br>
-<br>
+ DIExpression Expr, Instruction *InsertBefore);<br>
<br>
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.<br>
/// @param Val llvm::Value of the variable<br>
/// @param Offset Offset<br>
/// @param VarInfo Variable's debug info descriptor.<br>
+ /// @param Expr A complex location expression.<br>
/// @param InsertAtEnd Location for the new intrinsic.<br>
Instruction *insertDbgValueIntrinsic(llvm:<u></u>:Value *Val, uint64_t Offset,<br>
- DIVariable VarInfo,<br>
+ DIVariable VarInfo, DIExpression Expr,<br>
BasicBlock *InsertAtEnd);<br>
<br>
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.<br>
/// @param Val llvm::Value of the variable<br>
/// @param Offset Offset<br>
/// @param VarInfo Variable's debug info descriptor.<br>
+ /// @param Expr A complex location expression.<br>
/// @param InsertBefore Location for the new intrinsic.<br>
Instruction *insertDbgValueIntrinsic(llvm:<u></u>:Value *Val, uint64_t Offset,<br>
- DIVariable VarInfo,<br>
+ DIVariable VarInfo, DIExpression Expr,<br>
Instruction *InsertBefore);<br>
};<br>
} // end namespace llvm<br>
<br>
Modified: llvm/trunk/include/llvm/IR/<u></u>DebugInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/IR/DebugInfo.h?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/IR/<u></u>DebugInfo.h (original)<br>
+++ llvm/trunk/include/llvm/IR/<u></u>DebugInfo.h Wed Oct 1 13:55:02 2014<br>
@@ -150,6 +150,7 @@ public:<br>
bool isTemplateValueParameter() const;<br>
bool isObjCProperty() const;<br>
bool isImportedEntity() const;<br>
+ bool isExpression() const;<br>
<br>
/// print - print descriptor.<br>
void print(raw_ostream &OS) const;<br>
@@ -720,20 +721,6 @@ public:<br>
/// Verify - Verify that a variable descriptor is well formed.<br>
bool Verify() const;<br>
<br>
- /// HasComplexAddr - Return true if the variable has a complex address.<br>
- bool hasComplexAddress() const { return getNumAddrElements() > 0; }<br>
-<br>
- /// \brief Return the size of this variable's complex address or<br>
- /// zero if there is none.<br>
- unsigned getNumAddrElements() const {<br>
- if (DbgNode->getNumOperands() < 9)<br>
- return 0;<br>
- return getDescriptorField(8)-><u></u>getNumOperands();<br>
- }<br>
-<br>
- /// \brief return the Idx'th complex address element.<br>
- uint64_t getAddrElement(unsigned Idx) const;<br>
-<br>
/// isBlockByrefVariable - Return true if the variable was declared as<br>
/// a "__block" variable (Apple Blocks).<br>
bool isBlockByrefVariable(const DITypeIdentifierMap &Map) const {<br>
@@ -744,6 +731,35 @@ public:<br>
/// information for an inlined function arguments.<br>
bool isInlinedFnArgument(const Function *CurFn);<br>
<br>
+ /// Return the size reported by the variable's type.<br>
+ unsigned getSizeInBits(const DITypeIdentifierMap &Map);<br>
+<br>
+ void printExtendedName(raw_ostream &OS) const;<br>
+};<br>
+<br>
+/// DIExpression - A complex location expression.<br>
+class DIExpression : public DIDescriptor {<br>
+ friend class DIDescriptor;<br>
+ void printInternal(raw_ostream &OS) const;<br>
+<br>
+public:<br>
+ explicit DIExpression(const MDNode *N = nullptr) : DIDescriptor(N) {}<br>
+<br>
+ /// Verify - Verify that a variable descriptor is well formed.<br>
+ bool Verify() const;<br>
+<br>
+ /// \brief Return the number of elements in the complex expression.<br>
+ unsigned getNumElements() const {<br>
+ if (!DbgNode)<br>
+ return 0;<br>
+ unsigned N = DbgNode->getNumOperands();<br>
+ assert(N > 0 && "missing tag");<br>
+ return N - 1;<br>
+ }<br>
+<br>
+ /// \brief return the Idx'th complex address element.<br>
+ uint64_t getElement(unsigned Idx) const;<br>
+<br>
/// isVariablePiece - Return whether this is a piece of an aggregate<br>
/// variable.<br>
bool isVariablePiece() const;<br>
@@ -751,11 +767,6 @@ public:<br>
uint64_t getPieceOffset() const;<br>
/// getPieceSize - Return the size of this piece in bytes.<br>
uint64_t getPieceSize() const;<br>
-<br>
- /// Return the size reported by the variable's type.<br>
- unsigned getSizeInBits(const DITypeIdentifierMap &Map);<br>
-<br>
- void printExtendedName(raw_ostream &OS) const;<br>
};<br>
<br>
/// DILocation - This object holds location information. This object<br>
@@ -872,9 +883,6 @@ DIVariable createInlinedVariable(MDNode<br>
/// cleanseInlinedVariable - Remove inlined scope from the variable.<br>
DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);<br>
<br>
-/// getEntireVariable - Remove OpPiece exprs from the variable.<br>
-DIVariable getEntireVariable(DIVariable DV);<br>
-<br>
/// Construct DITypeIdentifierMap by going through retained types of each CU.<br>
DITypeIdentifierMap generateDITypeIdentifierMap(<u></u>const NamedMDNode *CU_Nodes);<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/IR/<u></u>IntrinsicInst.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/IR/IntrinsicInst.h?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/IR/<u></u>IntrinsicInst.h (original)<br>
+++ llvm/trunk/include/llvm/IR/<u></u>IntrinsicInst.h Wed Oct 1 13:55:02 2014<br>
@@ -82,6 +82,7 @@ namespace llvm {<br>
public:<br>
Value *getAddress() const;<br>
MDNode *getVariable() const { return cast<MDNode>(getArgOperand(1))<u></u>; }<br>
+ MDNode *getExpression() const { return cast<MDNode>(getArgOperand(2))<u></u>; }<br>
<br>
// Methods for support type inquiry through isa, cast, and dyn_cast:<br>
static inline bool classof(const IntrinsicInst *I) {<br>
@@ -103,6 +104,7 @@ namespace llvm {<br>
const_cast<Value*>(<u></u>getArgOperand(1)))-><u></u>getZExtValue();<br>
}<br>
MDNode *getVariable() const { return cast<MDNode>(getArgOperand(2))<u></u>; }<br>
+ MDNode *getExpression() const { return cast<MDNode>(getArgOperand(3))<u></u>; }<br>
<br>
// Methods for support type inquiry through isa, cast, and dyn_cast:<br>
static inline bool classof(const IntrinsicInst *I) {<br>
<br>
Modified: llvm/trunk/include/llvm/IR/<u></u>Intrinsics.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Intrinsics.td?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/IR/Intrinsics.td?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/IR/<u></u>Intrinsics.td (original)<br>
+++ llvm/trunk/include/llvm/IR/<u></u>Intrinsics.td Wed Oct 1 13:55:02 2014<br>
@@ -373,9 +373,12 @@ let Properties = [IntrNoMem] in {<br>
// places.<br>
let Properties = [IntrNoMem] in {<br>
def int_dbg_declare : Intrinsic<[],<br>
- [llvm_metadata_ty, llvm_metadata_ty]>;<br>
+ [llvm_metadata_ty,<br>
+ llvm_metadata_ty,<br>
+ llvm_metadata_ty]>;<br>
def int_dbg_value : Intrinsic<[],<br>
[llvm_metadata_ty, llvm_i64_ty,<br>
+ llvm_metadata_ty,<br>
llvm_metadata_ty]>;<br>
}<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/<u></u>Support/Dwarf.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm/Support/Dwarf.h?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm/<u></u>Support/Dwarf.h (original)<br>
+++ llvm/trunk/include/llvm/<u></u>Support/Dwarf.h Wed Oct 1 13:55:02 2014<br>
@@ -53,6 +53,7 @@ enum LLVMConstants : uint32_t {<br>
<br>
DW_TAG_auto_variable = 0x100, // Tag for local (auto) variables.<br>
DW_TAG_arg_variable = 0x101, // Tag for argument variables.<br>
+ DW_TAG_expression = 0x102, // Tag for complex address expressions.<br>
<br>
DW_TAG_user_base = 0x1000, // Recommended base for user tags.<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/AsmPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/AsmPrinter/AsmPrinter.<u></u>cpp?rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/AsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/AsmPrinter.cpp Wed Oct 1 13:55:02 2014<br>
@@ -614,8 +614,8 @@ static void emitKill(const MachineInstr<br>
/// of DBG_VALUE, returning true if it was able to do so. A false return<br>
/// means the target will need to handle MI in EmitInstruction.<br>
static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {<br>
- // This code handles only the 3-operand target-independent form.<br>
- if (MI->getNumOperands() != 3)<br>
+ // This code handles only the 4-operand target-independent form.<br>
+ if (MI->getNumOperands() != 4)<br>
return false;<br>
<br>
SmallString<128> Str;<br>
@@ -629,9 +629,11 @@ static bool emitDebugValueComment(const<br>
OS << Name << ":";<br>
}<br>
OS << V.getName();<br>
- if (V.isVariablePiece())<br>
- OS << " [piece offset=" << V.getPieceOffset()<br>
- << " size="<<V.getPieceSize()<<"]";<br>
+<br>
+ DIExpression Expr = MI->getDebugExpression();<br>
+ if (Expr.isVariablePiece())<br>
+ OS << " [piece offset=" << Expr.getPieceOffset()<br>
+ << " size=" << Expr.getPieceSize() << "]";<br>
OS << " <- ";<br>
<br>
// The second operand is only an offset if it's an immediate.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/<u></u>DbgValueHistoryCalculator.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/AsmPrinter/<u></u>DbgValueHistoryCalculator.cpp?<u></u>rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/<u></u>DbgValueHistoryCalculator.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/<u></u>DbgValueHistoryCalculator.cpp Wed Oct 1 13:55:02 2014<br>
@@ -27,7 +27,7 @@ namespace llvm {<br>
// In the other case, returns 0.<br>
static unsigned isDescribedByReg(const MachineInstr &MI) {<br>
assert(MI.isDebugValue());<br>
- assert(MI.getNumOperands() == 3);<br>
+ assert(MI.getNumOperands() == 4);<br>
// If location of variable is described using a register (directly or<br>
// indirecltly), this register is always a first operand.<br>
return MI.getOperand(0).isReg() ? MI.getOperand(0).getReg() : 0;<br>
@@ -37,7 +37,7 @@ void DbgValueHistoryMap::<u></u>startInstrRange<br>
const MachineInstr &MI) {<br>
// Instruction range should start with a DBG_VALUE instruction for the<br>
// variable.<br>
- assert(MI.isDebugValue() && getEntireVariable(MI.<u></u>getDebugVariable()) == Var);<br>
+ assert(MI.isDebugValue() && "not a DBG_VALUE");<br>
auto &Ranges = VarInstrRanges[Var];<br>
if (!Ranges.empty() && Ranges.back().second == nullptr &&<br>
Ranges.back().first-><u></u>isIdenticalTo(&MI)) {<br>
@@ -193,7 +193,7 @@ void calculateDbgValueHistory(const Mach<br>
// Use the base variable (without any DW_OP_piece expressions)<br>
// as index into History. The full variables including the<br>
// piece expressions are attached to the MI.<br>
- DIVariable Var = getEntireVariable(MI.<u></u>getDebugVariable());<br>
+ DIVariable Var = MI.getDebugVariable();<br>
<br>
if (unsigned PrevReg = Result.getRegisterForVar(Var))<br>
dropRegDescribedVar(RegVars, PrevReg, Var);<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DebugLocEntry.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/AsmPrinter/<u></u>DebugLocEntry.h?rev=218787&r1=<u></u>218786&r2=218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DebugLocEntry.h (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DebugLocEntry.h Wed Oct 1 13:55:02 2014<br>
@@ -26,25 +26,30 @@ class DebugLocEntry {<br>
public:<br>
/// A single location or constant.<br>
struct Value {<br>
- Value(const MDNode *Var, int64_t i)<br>
- : Variable(Var), EntryKind(E_Integer) {<br>
+ Value(const MDNode *Var, const MDNode *Expr, int64_t i)<br>
+ : Variable(Var), Expression(Expr), EntryKind(E_Integer) {<br>
Constant.Int = i;<br>
}<br>
- Value(const MDNode *Var, const ConstantFP *CFP)<br>
- : Variable(Var), EntryKind(E_ConstantFP) {<br>
+ Value(const MDNode *Var, const MDNode *Expr, const ConstantFP *CFP)<br>
+ : Variable(Var), Expression(Expr), EntryKind(E_ConstantFP) {<br>
Constant.CFP = CFP;<br>
}<br>
- Value(const MDNode *Var, const ConstantInt *CIP)<br>
- : Variable(Var), EntryKind(E_ConstantInt) {<br>
+ Value(const MDNode *Var, const MDNode *Expr, const ConstantInt *CIP)<br>
+ : Variable(Var), Expression(Expr), EntryKind(E_ConstantInt) {<br>
Constant.CIP = CIP;<br>
}<br>
- Value(const MDNode *Var, MachineLocation Loc)<br>
- : Variable(Var), EntryKind(E_Location), Loc(Loc) {<br>
+ Value(const MDNode *Var, const MDNode *Expr, MachineLocation Loc)<br>
+ : Variable(Var), Expression(Expr), EntryKind(E_Location), Loc(Loc) {<br>
+ assert(DIVariable(Var).Verify(<u></u>));<br>
+ assert(DIExpression(Expr).<u></u>Verify());<br>
}<br>
<br>
// The variable to which this location entry corresponds.<br>
const MDNode *Variable;<br>
<br>
+ // Any complex address location expression for this Value.<br>
+ const MDNode *Expression;<br>
+<br>
// Type of entry that this represents.<br>
enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt };<br>
enum EntryType EntryKind;<br>
@@ -69,7 +74,8 @@ public:<br>
MachineLocation getLoc() const { return Loc; }<br>
const MDNode *getVariableNode() const { return Variable; }<br>
DIVariable getVariable() const { return DIVariable(Variable); }<br>
- bool isVariablePiece() const { return getVariable().isVariablePiece(<u></u>); }<br>
+ bool isVariablePiece() const { return getExpression().<u></u>isVariablePiece(); }<br>
+ DIExpression getExpression() const { return DIExpression(Expression); }<br>
friend bool operator==(const Value &, const Value &);<br>
friend bool operator<(const Value &, const Value &);<br>
};<br>
@@ -90,11 +96,13 @@ public:<br>
// list of values.<br>
// Return true if the merge was successful.<br>
bool MergeValues(const DebugLocEntry &Next) {<br>
- if (Begin == Next.Begin && Values.size() > 0 && Next.Values.size() > 0) {<br>
+ if (Begin == Next.Begin) {<br>
+ DIExpression Expr(Values[0].Expression);<br>
DIVariable Var(Values[0].Variable);<br>
+ DIExpression NextExpr(Next.Values[0].<u></u>Expression);<br>
DIVariable NextVar(Next.Values[0].<u></u>Variable);<br>
- if (Var.getName() == NextVar.getName() &&<br>
- Var.isVariablePiece() && NextVar.isVariablePiece()) {<br>
+ if (Var == NextVar && Expr.isVariablePiece() &&<br>
+ NextExpr.isVariablePiece()) {<br>
addValues(Next.Values);<br>
End = Next.End;<br>
return true;<br>
@@ -133,8 +141,10 @@ public:<br>
std::sort(Values.begin(), Values.end());<br>
Values.erase(std::unique(<u></u>Values.begin(), Values.end(),<br>
[](const Value &A, const Value &B) {<br>
- return A.getVariable() == B.getVariable();<br>
- }), Values.end());<br>
+ return A.getVariable() == B.getVariable() &&<br>
+ A.getExpression() == B.getExpression();<br>
+ }),<br>
+ Values.end());<br>
}<br>
};<br>
<br>
@@ -144,7 +154,10 @@ inline bool operator==(const DebugLocEnt<br>
if (A.EntryKind != B.EntryKind)<br>
return false;<br>
<br>
- if (A.getVariable() != B.getVariable())<br>
+ if (A.Expression != B.Expression)<br>
+ return false;<br>
+<br>
+ if (A.Variable != B.Variable)<br>
return false;<br>
<br>
switch (A.EntryKind) {<br>
@@ -163,7 +176,8 @@ inline bool operator==(const DebugLocEnt<br>
/// Compare two pieces based on their offset.<br>
inline bool operator<(const DebugLocEntry::Value &A,<br>
const DebugLocEntry::Value &B) {<br>
- return A.getVariable().<u></u>getPieceOffset() < B.getVariable().<u></u>getPieceOffset();<br>
+ return A.getExpression().<u></u>getPieceOffset() <<br>
+ B.getExpression().<u></u>getPieceOffset();<br>
}<br>
<br>
}<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/AsmPrinter/DwarfDebug.<u></u>cpp?rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.cpp Wed Oct 1 13:55:02 2014<br>
@@ -901,7 +901,7 @@ void DwarfDebug::<u></u>collectDeadVariables()<br>
for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {<br>
DIVariable DV(Variables.getElement(vi));<br>
assert(DV.isVariable());<br>
- DbgVariable NewVar(DV, this);<br>
+ DbgVariable NewVar(DV, DIExpression(nullptr), this);<br>
auto VariableDie = SPCU->constructVariableDIE(<u></u>NewVar);<br>
SPCU->applyVariableAttributes(<u></u>NewVar, *VariableDie);<br>
SPDIE->addChild(std::move(<u></u>VariableDie));<br>
@@ -1121,7 +1121,7 @@ DbgVariable *DwarfDebug::getExistingAbst<br>
<br>
void DwarfDebug::<u></u>createAbstractVariable(const DIVariable &Var,<br>
LexicalScope *Scope) {<br>
- auto AbsDbgVariable = make_unique<DbgVariable>(Var, this);<br>
+ auto AbsDbgVariable = make_unique<DbgVariable>(Var, DIExpression(), this);<br>
addScopeVariable(Scope, AbsDbgVariable.get());<br>
AbstractVariables[Var] = std::move(AbsDbgVariable);<br>
}<br>
@@ -1177,6 +1177,7 @@ void DwarfDebug::<u></u>collectVariableInfoFrom<br>
continue;<br>
Processed.insert(VI.Var);<br>
DIVariable DV(VI.Var);<br>
+ DIExpression Expr(VI.Expr);<br>
LexicalScope *Scope = LScopes.findLexicalScope(VI.<u></u>Loc);<br>
<br>
// If variable scope is not found then skip this variable.<br>
@@ -1184,7 +1185,7 @@ void DwarfDebug::<u></u>collectVariableInfoFrom<br>
continue;<br>
<br>
ensureAbstractVariableIsCreate<u></u>dIfScoped(DV, Scope->getScopeNode());<br>
- ConcreteVariables.push_back(<u></u>make_unique<DbgVariable>(DV, this));<br>
+ ConcreteVariables.push_back(<u></u>make_unique<DbgVariable>(DV, Expr, this));<br>
DbgVariable *RegVar = ConcreteVariables.back().get()<u></u>;<br>
RegVar->setFrameIndex(VI.Slot)<u></u>;<br>
addScopeVariable(Scope, RegVar);<br>
@@ -1193,9 +1194,10 @@ void DwarfDebug::<u></u>collectVariableInfoFrom<br>
<br>
// Get .debug_loc entry for the instruction range starting at MI.<br>
static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {<br>
+ const MDNode *Expr = MI->getDebugExpression();<br>
const MDNode *Var = MI->getDebugVariable();<br>
<br>
- assert(MI->getNumOperands() == 3);<br>
+ assert(MI->getNumOperands() == 4);<br>
if (MI->getOperand(0).isReg()) {<br>
MachineLocation MLoc;<br>
// If the second operand is an immediate, this is a<br>
@@ -1204,20 +1206,20 @@ static DebugLocEntry::Value getDebugLocV<br>
MLoc.set(MI->getOperand(0).<u></u>getReg());<br>
else<br>
MLoc.set(MI->getOperand(0).<u></u>getReg(), MI->getOperand(1).getImm());<br>
- return DebugLocEntry::Value(Var, MLoc);<br>
+ return DebugLocEntry::Value(Var, Expr, MLoc);<br>
}<br>
if (MI->getOperand(0).isImm())<br>
- return DebugLocEntry::Value(Var, MI->getOperand(0).getImm());<br>
+ return DebugLocEntry::Value(Var, Expr, MI->getOperand(0).getImm());<br>
if (MI->getOperand(0).isFPImm())<br>
- return DebugLocEntry::Value(Var, MI->getOperand(0).getFPImm());<br>
+ return DebugLocEntry::Value(Var, Expr, MI->getOperand(0).getFPImm());<br>
if (MI->getOperand(0).isCImm())<br>
- return DebugLocEntry::Value(Var, MI->getOperand(0).getCImm());<br>
+ return DebugLocEntry::Value(Var, Expr, MI->getOperand(0).getCImm());<br>
<br>
- llvm_unreachable("Unexpected 3 operand DBG_VALUE instruction!");<br>
+ llvm_unreachable("Unexpected 4-operand DBG_VALUE instruction!");<br>
}<br>
<br>
/// Determine whether two variable pieces overlap.<br>
-static bool piecesOverlap(DIVariable P1, DIVariable P2) {<br>
+static bool piecesOverlap(DIExpression P1, DIExpression P2) {<br>
if (!P1.isVariablePiece() || !P2.isVariablePiece())<br>
return true;<br>
unsigned l1 = P1.getPieceOffset();<br>
@@ -1268,11 +1270,11 @@ DwarfDebug::buildLocationList(<u></u>SmallVecto<br>
}<br>
<br>
// If this piece overlaps with any open ranges, truncate them.<br>
- DIVariable DIVar = Begin->getDebugVariable();<br>
+ DIExpression DIExpr = Begin->getDebugExpression();<br>
auto Last = std::remove_if(OpenRanges.<u></u>begin(), OpenRanges.end(),<br>
[&](DebugLocEntry::Value R) {<br>
- return piecesOverlap(DIVar, R.getVariable());<br>
- });<br>
+ return piecesOverlap(DIExpr, R.getExpression());<br>
+ });<br>
OpenRanges.erase(Last, OpenRanges.end());<br>
<br>
const MCSymbol *StartLabel = getLabelBeforeInsn(Begin);<br>
@@ -1294,7 +1296,7 @@ DwarfDebug::buildLocationList(<u></u>SmallVecto<br>
bool couldMerge = false;<br>
<br>
// If this is a piece, it may belong to the current DebugLocEntry.<br>
- if (DIVar.isVariablePiece()) {<br>
+ if (DIExpr.isVariablePiece()) {<br>
// Add this value to the list of open ranges.<br>
OpenRanges.push_back(Value);<br>
<br>
@@ -1320,10 +1322,14 @@ DwarfDebug::buildLocationList(<u></u>SmallVecto<br>
if (PrevEntry != DebugLoc.rend() && PrevEntry->MergeRanges(*<u></u>CurEntry))<br>
DebugLoc.pop_back();<br>
<br>
- DEBUG(dbgs() << "Values:\n";<br>
- for (auto Value : CurEntry->getValues())<br>
- Value.getVariable()->dump();<br>
- dbgs() << "-----\n");<br>
+ DEBUG({<br>
+ dbgs() << CurEntry->getValues().size() << " Values:\n";<br>
+ for (auto Value : CurEntry->getValues()) {<br>
+ Value.getVariable()->dump();<br>
+ Value.getExpression()->dump();<br>
+ }<br>
+ dbgs() << "-----\n";<br>
+ });<br>
}<br>
}<br>
<br>
@@ -1358,7 +1364,7 @@ DwarfDebug::<u></u>collectVariableInfo(SmallPtr<br>
if (!Scope)<br>
continue;<br>
<br>
- Processed.insert(<u></u>getEntireVariable(DV));<br>
+ Processed.insert(DV);<br>
const MachineInstr *MInsn = Ranges.front().first;<br>
assert(MInsn->isDebugValue() && "History must begin with debug value");<br>
ensureAbstractVariableIsCreate<u></u>dIfScoped(DV, Scope->getScopeNode());<br>
@@ -1392,7 +1398,8 @@ DwarfDebug::<u></u>collectVariableInfo(SmallPtr<br>
continue;<br>
if (LexicalScope *Scope = LScopes.findLexicalScope(DV.<u></u>getContext())) {<br>
ensureAbstractVariableIsCreate<u></u>dIfScoped(DV, Scope->getScopeNode());<br>
- ConcreteVariables.push_back(<u></u>make_unique<DbgVariable>(DV, this));<br>
+ DIExpression NoExpr;<br>
+ ConcreteVariables.push_back(<u></u>make_unique<DbgVariable>(DV, NoExpr, this));<br>
addScopeVariable(Scope, ConcreteVariables.back().get()<u></u>);<br>
}<br>
}<br>
@@ -1580,18 +1587,17 @@ void DwarfDebug::beginFunction(<u></u>const Mac<br>
<br>
// The first mention of a function argument gets the FunctionBeginSym<br>
// label, so arguments are visible when breaking at function entry.<br>
- DIVariable DV(Ranges.front().first-><u></u>getDebugVariable());<br>
- if (DV.isVariable() && DV.getTag() == dwarf::DW_TAG_arg_variable &&<br>
- getDISubprogram(DV.getContext(<u></u>)).describes(MF->getFunction()<u></u>)) {<br>
- if (!DV.isVariablePiece())<br>
- LabelsBeforeInsn[Ranges.front(<u></u>).first] = FunctionBeginSym;<br>
- else {<br>
+ DIVariable DIVar(Ranges.front().first-><u></u>getDebugVariable());<br>
+ if (DIVar.isVariable() && DIVar.getTag() == dwarf::DW_TAG_arg_variable &&<br>
+ getDISubprogram(DIVar.<u></u>getContext()).describes(MF-><u></u>getFunction())) {<br>
+ LabelsBeforeInsn[Ranges.front(<u></u>).first] = FunctionBeginSym;<br>
+ if (Ranges.front().first-><u></u>getDebugExpression().<u></u>isVariablePiece()) {<br>
// Mark all non-overlapping initial pieces.<br>
for (auto I = Ranges.begin(); I != Ranges.end(); ++I) {<br>
- DIVariable Piece = I->first->getDebugVariable();<br>
+ DIExpression Piece = I->first->getDebugExpression()<u></u>;<br>
if (std::all_of(Ranges.begin(), I,<br>
- [&](DbgValueHistoryMap::<u></u>InstrRange Pred){<br>
- return !piecesOverlap(Piece, Pred.first->getDebugVariable()<u></u>);<br>
+ [&](DbgValueHistoryMap::<u></u>InstrRange Pred) {<br>
+ return !piecesOverlap(Piece, Pred.first-><u></u>getDebugExpression());<br>
}))<br>
LabelsBeforeInsn[I->first] = FunctionBeginSym;<br>
else<br>
@@ -2089,9 +2095,9 @@ void DwarfDebug::emitLocPieces(<u></u>ByteStrea<br>
<br>
unsigned Offset = 0;<br>
for (auto Piece : Values) {<br>
- DIVariable Var = Piece.getVariable();<br>
- unsigned PieceOffset = Var.getPieceOffset();<br>
- unsigned PieceSize = Var.getPieceSize();<br>
+ DIExpression Expr = Piece.getExpression();<br>
+ unsigned PieceOffset = Expr.getPieceOffset();<br>
+ unsigned PieceSize = Expr.getPieceSize();<br>
assert(Offset <= PieceOffset && "overlapping or duplicate pieces");<br>
if (Offset < PieceOffset) {<br>
// The DWARF spec seriously mandates pieces with no locations for gaps.<br>
@@ -2102,8 +2108,9 @@ void DwarfDebug::emitLocPieces(<u></u>ByteStrea<br>
Offset += PieceSize;<br>
<br>
const unsigned SizeOfByte = 8;<br>
- assert(!Var.isIndirect() && "indirect address for piece");<br>
#ifndef NDEBUG<br>
+ DIVariable Var = Piece.getVariable();<br>
+ assert(!Var.isIndirect() && "indirect address for piece");<br>
unsigned VarSize = Var.getSizeInBits(Map);<br>
assert(PieceSize+PieceOffset <= VarSize/SizeOfByte<br>
&& "piece is larger than or outside of variable");<br>
@@ -2149,24 +2156,25 @@ void DwarfDebug::emitDebugLocValue(<u></u>ByteS<br>
}<br>
} else if (Value.isLocation()) {<br>
MachineLocation Loc = Value.getLoc();<br>
- if (!DV.hasComplexAddress())<br>
+ DIExpression Expr = Value.getExpression();<br>
+ if (!Expr)<br>
// Regular entry.<br>
Asm->EmitDwarfRegOp(Streamer, Loc, DV.isIndirect());<br>
else {<br>
// Complex address entry.<br>
- unsigned N = DV.getNumAddrElements();<br>
+ unsigned N = Expr.getNumElements();<br>
unsigned i = 0;<br>
- if (N >= 2 && DV.getAddrElement(0) == DIBuilder::OpPlus) {<br>
+ if (N >= 2 && Expr.getElement(0) == dwarf::DW_OP_plus) {<br>
if (Loc.getOffset()) {<br>
i = 2;<br>
Asm->EmitDwarfRegOp(Streamer, Loc, DV.isIndirect());<br>
Streamer.EmitInt8(dwarf::DW_<u></u>OP_deref, "DW_OP_deref");<br>
Streamer.EmitInt8(dwarf::DW_<u></u>OP_plus_uconst, "DW_OP_plus_uconst");<br>
- Streamer.EmitSLEB128(DV.<u></u>getAddrElement(1));<br>
+ Streamer.EmitSLEB128(Expr.<u></u>getElement(1));<br>
} else {<br>
// If first address element is OpPlus then emit<br>
// DW_OP_breg + Offset instead of DW_OP_reg + Offset.<br>
- MachineLocation TLoc(Loc.getReg(), DV.getAddrElement(1));<br>
+ MachineLocation TLoc(Loc.getReg(), Expr.getElement(1));<br>
Asm->EmitDwarfRegOp(Streamer, TLoc, DV.isIndirect());<br>
i = 2;<br>
}<br>
@@ -2176,14 +2184,14 @@ void DwarfDebug::emitDebugLocValue(<u></u>ByteS<br>
<br>
// Emit remaining complex address elements.<br>
for (; i < N; ++i) {<br>
- uint64_t Element = DV.getAddrElement(i);<br>
- if (Element == DIBuilder::OpPlus) {<br>
+ uint64_t Element = Expr.getElement(i);<br>
+ if (Element == dwarf::DW_OP_plus) {<br>
Streamer.EmitInt8(dwarf::DW_<u></u>OP_plus_uconst, "DW_OP_plus_uconst");<br>
- Streamer.EmitULEB128(DV.<u></u>getAddrElement(++i));<br>
- } else if (Element == DIBuilder::OpDeref) {<br>
+ Streamer.EmitULEB128(Expr.<u></u>getElement(++i));<br>
+ } else if (Element == dwarf::DW_OP_deref) {<br>
if (!Loc.isReg())<br>
Streamer.EmitInt8(dwarf::DW_<u></u>OP_deref, "DW_OP_deref");<br>
- } else if (Element == DIBuilder::OpPiece) {<br>
+ } else if (Element == dwarf::DW_OP_piece) {<br>
i += 3;<br>
// handled in emitDebugLocEntry.<br>
} else<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/AsmPrinter/DwarfDebug.<u></u>h?rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.h (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfDebug.h Wed Oct 1 13:55:02 2014<br>
@@ -70,6 +70,7 @@ public:<br>
/// \brief This class is used to track local variable information.<br>
class DbgVariable {<br>
DIVariable Var; // Variable Descriptor.<br>
+ DIExpression Expr; // Complex address location expression.<br>
DIE *TheDIE; // Variable DIE.<br>
unsigned DotDebugLocOffset; // Offset in DotDebugLocEntries.<br>
const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.<br>
@@ -78,18 +79,22 @@ class DbgVariable {<br>
<br>
public:<br>
/// Construct a DbgVariable from a DIVariable.<br>
- DbgVariable(DIVariable V, DwarfDebug *DD)<br>
- : Var(V), TheDIE(nullptr), DotDebugLocOffset(~0U), MInsn(nullptr),<br>
- FrameIndex(~0), DD(DD) {}<br>
+ DbgVariable(DIVariable V, DIExpression E, DwarfDebug *DD)<br>
+ : Var(V), Expr(E), TheDIE(nullptr), DotDebugLocOffset(~0U),<br>
+ MInsn(nullptr), FrameIndex(~0), DD(DD) {<br>
+ assert(Var.Verify() && Expr.Verify());<br>
+ }<br>
<br>
/// Construct a DbgVariable from a DEBUG_VALUE.<br>
/// AbstractVar may be NULL.<br>
DbgVariable(const MachineInstr *DbgValue, DwarfDebug *DD)<br>
- : Var(DbgValue-><u></u>getDebugVariable()), TheDIE(nullptr),<br>
- DotDebugLocOffset(~0U), MInsn(DbgValue), FrameIndex(~0), DD(DD) {}<br>
+ : Var(DbgValue-><u></u>getDebugVariable()), Expr(DbgValue-><u></u>getDebugExpression()),<br>
+ TheDIE(nullptr), DotDebugLocOffset(~0U), MInsn(DbgValue),<br>
+ FrameIndex(~0), DD(DD) {}<br>
<br>
// Accessors.<br>
DIVariable getVariable() const { return Var; }<br>
+ DIExpression getExpression() const { return Expr; }<br>
void setDIE(DIE &D) { TheDIE = &D; }<br>
DIE *getDIE() const { return TheDIE; }<br>
void setDotDebugLocOffset(unsigned O) { DotDebugLocOffset = O; }<br>
@@ -124,14 +129,14 @@ public:<br>
<br>
bool variableHasComplexAddress() const {<br>
assert(Var.isVariable() && "Invalid complex DbgVariable!");<br>
- return Var.hasComplexAddress();<br>
+ return Expr.getNumElements() > 0;<br>
}<br>
bool isBlockByrefVariable() const;<br>
unsigned getNumAddrElements() const {<br>
assert(Var.isVariable() && "Invalid complex DbgVariable!");<br>
- return Var.getNumAddrElements();<br>
+ return Expr.getNumElements();<br>
}<br>
- uint64_t getAddrElement(unsigned i) const { return Var.getAddrElement(i); }<br>
+ uint64_t getAddrElement(unsigned i) const { return Expr.getElement(i); }<br>
DIType getType() const;<br>
<br>
private:<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfUnit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/AsmPrinter/DwarfUnit.<u></u>cpp?rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>AsmPrinter/DwarfUnit.cpp Wed Oct 1 13:55:02 2014<br>
@@ -607,16 +607,20 @@ void DwarfUnit::addComplexAddress(<u></u>const<br>
unsigned N = DV.getNumAddrElements();<br>
unsigned i = 0;<br>
if (Location.isReg()) {<br>
- if (N >= 2 && DV.getAddrElement(0) == DIBuilder::OpPlus) {<br>
+ if (N >= 2 && DV.getAddrElement(0) == dwarf::DW_OP_plus) {<br>
+ assert(!DV.getVariable().<u></u>isIndirect() &&<br>
+ "double indirection not handled");<br>
// If first address element is OpPlus then emit<br>
// DW_OP_breg + Offset instead of DW_OP_reg + Offset.<br>
addRegisterOffset(*Loc, Location.getReg(), DV.getAddrElement(1));<br>
i = 2;<br>
- } else if (N >= 2 && DV.getAddrElement(0) == DIBuilder::OpDeref) {<br>
- addRegisterOpPiece(*Loc, Location.getReg(),<br>
- DV.getVariable().getPieceSize(<u></u>),<br>
- DV.getVariable().<u></u>getPieceOffset());<br>
- i = 3;<br>
+ } else if (N >= 2 && DV.getAddrElement(0) == dwarf::DW_OP_deref) {<br>
+ assert(!DV.getVariable().<u></u>isIndirect() &&<br>
+ "double indirection not handled");<br>
+ addRegisterOpPiece(*Loc, Location.getReg(),<br>
+ DV.getExpression().<u></u>getPieceSize(),<br>
+ DV.getExpression().<u></u>getPieceOffset());<br>
+ i = 3;<br>
} else<br>
addRegisterOpPiece(*Loc, Location.getReg());<br>
} else<br>
@@ -624,15 +628,15 @@ void DwarfUnit::addComplexAddress(<u></u>const<br>
<br>
for (; i < N; ++i) {<br>
uint64_t Element = DV.getAddrElement(i);<br>
- if (Element == DIBuilder::OpPlus) {<br>
+ if (Element == dwarf::DW_OP_plus) {<br>
addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
addUInt(*Loc, dwarf::DW_FORM_udata, DV.getAddrElement(++i));<br>
<br>
- } else if (Element == DIBuilder::OpDeref) {<br>
+ } else if (Element == dwarf::DW_OP_deref) {<br>
if (!Location.isReg())<br>
addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
<br>
- } else if (Element == DIBuilder::OpPiece) {<br>
+ } else if (Element == dwarf::DW_OP_piece) {<br>
const unsigned SizeOfByte = 8;<br>
unsigned PieceOffsetInBits = DV.getAddrElement(++i)*<u></u>SizeOfByte;<br>
unsigned PieceSizeInBits = DV.getAddrElement(++i)*<u></u>SizeOfByte;<br>
@@ -1861,7 +1865,7 @@ std::unique_ptr<DIE> DwarfUnit::construc<br>
<br>
// Check if variable is described by a DBG_VALUE instruction.<br>
if (const MachineInstr *DVInsn = DV.getMInsn()) {<br>
- assert(DVInsn->getNumOperands(<u></u>) == 3);<br>
+ assert(DVInsn->getNumOperands(<u></u>) == 4);<br>
if (DVInsn->getOperand(0).isReg()<u></u>) {<br>
const MachineOperand RegOp = DVInsn->getOperand(0);<br>
// If the second operand is an immediate, this is an indirect value.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>InlineSpiller.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/InlineSpiller.cpp?rev=<u></u>218787&r1=218786&r2=218787&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>InlineSpiller.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>InlineSpiller.cpp Wed Oct 1 13:55:02 2014<br>
@@ -1224,12 +1224,16 @@ void InlineSpiller::<u></u>spillAroundUses(unsi<br>
// Modify DBG_VALUE now that the value is in a spill slot.<br>
bool IsIndirect = MI->isIndirectDebugValue();<br>
uint64_t Offset = IsIndirect ? MI->getOperand(1).getImm() : 0;<br>
- const MDNode *MDPtr = MI->getOperand(2).getMetadata(<u></u>);<br>
+ const MDNode *Var = MI->getDebugVariable();<br>
+ const MDNode *Expr = MI->getDebugExpression();<br>
DebugLoc DL = MI->getDebugLoc();<br>
DEBUG(dbgs() << "Modifying debug info due to spill:" << "\t" << *MI);<br>
MachineBasicBlock *MBB = MI->getParent();<br>
BuildMI(*MBB, MBB->erase(MI), DL, TII.get(TargetOpcode::DBG_<u></u>VALUE))<br>
- .addFrameIndex(StackSlot).<u></u>addImm(Offset).addMetadata(<u></u>MDPtr);<br>
+ .addFrameIndex(StackSlot)<br>
+ .addImm(Offset)<br>
+ .addMetadata(Var)<br>
+ .addMetadata(Expr);<br>
continue;<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<u></u>LiveDebugVariables.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=218787&r1=218786&r2=218787&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>CodeGen/LiveDebugVariables.<u></u>cpp?rev=218787&r1=218786&r2=<u></u>218787&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/CodeGen/<u></u>LiveDebugVariables.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<u></u>LiveDebugVariables.cpp Wed Oct 1 13:55:02 2014<br>
@@ -110,7 +110,8 @@ public:<br>
namespace {<br>
class LDVImpl;<br>
class UserValue {<br>
- const MDNode *variable; ///< The debug info variable we are part of.<br>
+ const MDNode *Variable; ///< The debug info variable we are part of.<br>
+ const MDNode *Expression; ///< Any complex address expression.<br>
unsigned offset; ///< Byte offset into variable.<br>
bool IsIndirect; ///< true if this is a register-indirect+offset value.<br>
DebugLoc dl; ///< The debug location for the variable. This is<br>
@@ -140,11 +141,10 @@ class UserValue {<br>
<br>
public:<br>
/// UserValue - Create a new UserValue.<br>
- UserValue(const MDNode *var, unsigned o, bool i, DebugLoc L,<br>
- LocMap::Allocator &alloc)<br>
- : variable(var), offset(o), IsIndirect(i), dl(L), leader(this),<br>
- next(nullptr), locInts(alloc)<br>
- {}<br>
+ UserValue(const MDNode *var, const MDNode *expr, unsigned o, bool i,<br>
+ DebugLoc L, LocMap::Allocator &alloc)<br>
+ : Variable(var), Expression(expr), offset(o), IsIndirect(i), dl(L),<br>
+ leader(this), next(nullptr), locInts(alloc) {}<br>
<br>
/// getLeader - Get the leader of this value's equivalence class.<br>
UserValue *getLeader() {<br>
@@ -158,8 +158,10 @@ public:<br>
UserValue *getNext() const { return next; }<br>
<br>
/// match - Does this UserValue match the parameters?<br>
- bool match(const MDNode *Var, unsigned Offset, bool indirect) const {<br>
- return Var == variable && Offset == offset && indirect == IsIndirect;<br>
+ bool match(const MDNode *Var, const MDNode *Expr, unsigned Offset,<br>
+ bool indirect) const {<br>
+ return Var == Variable && Expr == Expression && Offset == offset &&<br>
+ indirect == IsIndirect;<br>
}<br>
<br>
/// merge - Merge equivalence classes.<br>
@@ -307,8 +309,8 @@ class LDVImpl {<br>
UVMap userVarMap;<br>
<br>
/// getUserValue - Find or create a UserValue.<br>
- UserValue *getUserValue(const MDNode *Var, unsigned Offset,<br>
- bool IsIndirect, DebugLoc DL);<br>
+ UserValue *getUserValue(const MDNode *Var, const MDNode *Expr,<br>
+ unsigned Offset, bool IsIndirect, DebugLoc DL);<br>
<br>
/// lookupVirtReg - Find the EC leader for VirtReg or null.<br>
UserValue *lookupVirtReg(unsigned VirtReg);<br>
@@ -361,7 +363,7 @@ public:<br>
} // namespace<br>
<br>
void UserValue::print(raw_ostream &OS, const TargetMachine *TM) {<br>
- DIVariable DV(variable);<br>
+ DIVariable DV(Variable);<br>
OS << "!\"";<br>
DV.printExtendedName(OS);<br>
OS << "\"\t";<br>
@@ -422,19 +424,20 @@ void UserValue::mapVirtRegs(LDVImpl *LDV<br>
LDV->mapVirtReg(locations[i].<u></u>getReg(), this);<br>
}<br>
<br>
-UserValue *LDVImpl::getUserValue(const MDNode *Var, unsigned Offset,<br>
- </blockquote></div>