<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 13, 2016, at 3:09 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Thu, Jan 7, 2016 at 6:28 AM, Amjad Aboud via llvm-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: aaboud<br class="">Date: Thu Jan 7 08:28:20 2016<br class="">New Revision: 257060<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=257060&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=257060&view=rev</a><br class="">Log:<br class="">Added support for macro emission in dwarf (supporting DWARF version 4).<br class=""><br class="">Differential Revision:<span class="Apple-converted-space"> </span><a href="http://reviews.llvm.org/D15495" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D15495</a><br class=""><br class="">Added:<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/test/DebugInfo/X86/debug-macro.ll<br class="">Modified:<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/include/llvm/CodeGen/DIE.h<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/include/llvm/MC/MCObjectFileInfo.h<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/lib/IR/Verifier.cpp<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/lib/MC/MCObjectFileInfo.cpp<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp<br class=""> <span class="Apple-converted-space"> </span>llvm/trunk/lib/Target/NVPTX/NVPTXTargetObjectFile.h<br class=""><br class="">Modified: llvm/trunk/include/llvm/CodeGen/DIE.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)<br class="">+++ llvm/trunk/include/llvm/CodeGen/DIE.h Thu Jan 7 08:28:20 2016<br class="">@@ -29,6 +29,48 @@ class MCSymbol;<br class=""> class raw_ostream;<br class=""> class DwarfTypeUnit;<br class=""><br class="">+// AsmStreamerBase - A base abstract interface class defines methods that<br class="">+// can be implemented to stream objects or can be implemented to<br class="">+// calculate the size of the streamed objects.<br class="">+// The derived classes will use an AsmPrinter to implement the methods.<br class="">+//<br class="">+// TODO: complete this interface and use it to merge EmitValue and SizeOf<br class="">+// methods in the DIE classes below.<br class=""></blockquote><div class=""><br class=""></div><div class="">Adrian do you really reckon we need/want this abstraction?<br class=""><br class="">I think this is a bit of a divergence from the way the rest of the DWARF emission is done, where we rely on relocations (most of which are resolved at object emission time - they aren't actually dynamic relocs) to compute the size/offsets of section contributions of DWARF to the CU, etc. Is there a reason that doesn't work/is worse/different in this case?<br class=""></div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+class AsmStreamerBase {<br class="">+protected:<br class="">+ const AsmPrinter *AP;<br class="">+ AsmStreamerBase(const AsmPrinter *AP) : AP(AP) {}<br class="">+<br class="">+public:<br class="">+ virtual ~AsmStreamerBase() {}<br class="">+ virtual unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr,<br class="">+ unsigned PadTo = 0) = 0;<br class="">+ virtual unsigned emitInt8(unsigned char Value) = 0;<br class="">+ virtual unsigned emitBytes(StringRef Data) = 0;<br class="">+};<br class="">+<br class="">+/// EmittingAsmStreamer - Implements AbstractAsmStreamer to stream objects.<br class="">+/// Notice that the return value is not the actual size of the streamed object.<br class="">+/// For size calculation use SizeReporterAsmStreamer.<br class="">+class EmittingAsmStreamer : public AsmStreamerBase {<br class="">+public:<br class="">+ EmittingAsmStreamer(const AsmPrinter *AP) : AsmStreamerBase(AP) {}<br class="">+ unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr,<br class="">+ unsigned PadTo = 0) override;<br class="">+ unsigned emitInt8(unsigned char Value) override;<br class="">+ unsigned emitBytes(StringRef Data) override;<br class="">+};<br class="">+<br class="">+/// SizeReporterAsmStreamer - Only reports the size of the streamed objects.<br class="">+class SizeReporterAsmStreamer : public AsmStreamerBase {<br class="">+public:<br class="">+ SizeReporterAsmStreamer(const AsmPrinter *AP) : AsmStreamerBase(AP) {}<br class="">+ unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr,<br class="">+ unsigned PadTo = 0) override;<br class="">+ unsigned emitInt8(unsigned char Value) override;<br class="">+ unsigned emitBytes(StringRef Data) override;<br class="">+};<br class="">+<br class=""> //===--------------------------------------------------------------------===//<br class=""> /// DIEAbbrevData - Dwarf abbreviation data, describes one attribute of a<br class=""> /// Dwarf abbreviation.<br class=""><br class="">Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)<br class="">+++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Thu Jan 7 08:28:20 2016<br class="">@@ -92,6 +92,7 @@ protected:<br class=""> MCSection *DwarfLocSection;<br class=""> MCSection *DwarfARangesSection;<br class=""> MCSection *DwarfRangesSection;<br class="">+ MCSection *DwarfMacinfoSection;<br class=""> // The pubnames section is no longer generated by default. The generation<br class=""> // can be enabled by a compiler flag.<br class=""> MCSection *DwarfPubNamesSection;<br class="">@@ -245,6 +246,7 @@ public:<br class=""> MCSection *getDwarfLocSection() const { return DwarfLocSection; }<br class=""> MCSection *getDwarfARangesSection() const { return DwarfARangesSection; }<br class=""> MCSection *getDwarfRangesSection() const { return DwarfRangesSection; }<br class="">+ MCSection *getDwarfMacinfoSection() const { return DwarfMacinfoSection; }<br class=""><br class=""> // DWARF5 Experimental Debug Info Sections<br class=""> MCSection *getDwarfAccelNamesSection() const {<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Thu Jan 7 08:28:20 2016<br class="">@@ -32,6 +32,39 @@<br class=""> using namespace llvm;<br class=""><br class=""> //===----------------------------------------------------------------------===//<br class="">+// EmittingAsmStreamer Implementation<br class="">+//===----------------------------------------------------------------------===//<br class="">+unsigned EmittingAsmStreamer::emitULEB128(uint64_t Value, const char *Desc,<br class="">+ unsigned PadTo) {<br class="">+ AP->EmitULEB128(Value, Desc, PadTo);<br class="">+ return 0;</blockquote><div class=""><br class=""></div><div class="">This is a slightly quirky API - isn't it problematic for a caller, if they don't know which kind of AsmStreamer they're interacting with - and one produces sizes, the other produces zeros. That seems... not good?</div><div class=""> </div></div></div></blockquote><div><br class=""></div><div>Yeah I think you’re right. Using compile-time-resolved labels to compute the sizes is superior to this.</div><div><br class=""></div><div>-- adrian</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">+}<br class="">+<br class="">+unsigned EmittingAsmStreamer::emitInt8(unsigned char Value) {<br class="">+ AP->EmitInt8(Value);<br class="">+ return 0;<br class="">+}<br class="">+<br class="">+unsigned EmittingAsmStreamer::emitBytes(StringRef Data) {<br class="">+ AP->OutStreamer->EmitBytes(Data);<br class="">+ return 0;<br class="">+}<br class="">+<br class="">+//===----------------------------------------------------------------------===//<br class="">+// SizeReporterAsmStreamer Implementation<br class="">+//===----------------------------------------------------------------------===//<br class="">+unsigned SizeReporterAsmStreamer::emitULEB128(uint64_t Value, const char *Desc,<br class="">+ unsigned PadTo) {<br class="">+ return getULEB128Size(Value);<br class="">+}<br class="">+<br class="">+unsigned SizeReporterAsmStreamer::emitInt8(unsigned char Value) { return 1; }<br class="">+<br class="">+unsigned SizeReporterAsmStreamer::emitBytes(StringRef Data) {<br class="">+ return Data.size();<br class="">+}<br class="">+<br class="">+//===----------------------------------------------------------------------===//<br class=""> // DIEAbbrevData Implementation<br class=""> //===----------------------------------------------------------------------===//<br class=""><br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Jan 7 08:28:20 2016<br class="">@@ -561,6 +561,8 @@ void DwarfDebug::finalizeModuleInfo() {<br class=""> // Collect info for variables that were optimized out.<br class=""> collectDeadVariables();<br class=""><br class="">+ unsigned MacroOffset = 0;<br class="">+ std::unique_ptr<AsmStreamerBase> AS(new SizeReporterAsmStreamer(Asm));<br class=""> // Handle anything that needs to be done on a per-unit basis after<br class=""> // all other generation.<br class=""> for (const auto &P : CUMap) {<br class="">@@ -613,6 +615,15 @@ void DwarfDebug::finalizeModuleInfo() {<br class=""> U.setBaseAddress(TheCU.getRanges().front().getStart());<br class=""> U.attachRangesOrLowHighPC(U.getUnitDie(), TheCU.takeRanges());<br class=""> }<br class="">+<br class="">+ auto *CUNode = cast<DICompileUnit>(P.first);<br class="">+ if (CUNode->getMacros()) {<br class="">+ // Compile Unit has macros, emit "DW_AT_macro_info" attribute.<br class="">+ U.addUInt(U.getUnitDie(), dwarf::DW_AT_macro_info,<br class="">+ dwarf::DW_FORM_sec_offset, MacroOffset);<br class="">+ // Update macro section offset<br class="">+ MacroOffset += handleMacroNodes(AS.get(), CUNode->getMacros(), U);<br class="">+ }<br class=""> }<br class=""><br class=""> // Compute DIE offsets and sizes.<br class="">@@ -656,6 +667,9 @@ void DwarfDebug::endModule() {<br class=""> // Emit info into a debug ranges section.<br class=""> emitDebugRanges();<br class=""><br class="">+ // Emit info into a debug macinfo section.<br class="">+ emitDebugMacinfo();<br class="">+<br class=""> if (useSplitDwarf()) {<br class=""> emitDebugStrDWO();<br class=""> emitDebugInfoDWO();<br class="">@@ -1833,6 +1847,70 @@ void DwarfDebug::emitDebugRanges() {<br class=""> }<br class=""> }<br class=""><br class="">+unsigned DwarfDebug::handleMacroNodes(AsmStreamerBase *AS,<br class="">+ DIMacroNodeArray Nodes,<br class="">+ DwarfCompileUnit &U) {<br class="">+ unsigned Size = 0;<br class="">+ for (auto *MN : Nodes) {<br class="">+ if (auto *M = dyn_cast<DIMacro>(MN))<br class="">+ Size += emitMacro(AS, *M);<br class="">+ else if (auto *F = dyn_cast<DIMacroFile>(MN))<br class="">+ Size += emitMacroFile(AS, *F, U);<br class="">+ else<br class="">+ llvm_unreachable("Unexpected DI type!");<br class="">+ }<br class="">+ return Size;<br class="">+}<br class="">+<br class="">+unsigned DwarfDebug::emitMacro(AsmStreamerBase *AS, DIMacro &M) {<br class="">+ int Size = 0;<br class="">+ Size += AS->emitULEB128(M.getMacinfoType());<br class="">+ Size += AS->emitULEB128(M.getLine());<br class="">+ StringRef Name = M.getName();<br class="">+ StringRef Value = M.getValue();<br class="">+ Size += AS->emitBytes(Name);<br class="">+ if (!Value.empty()) {<br class="">+ // There should be one space between macro name and macro value.<br class="">+ Size += AS->emitInt8(' ');<br class="">+ Size += AS->emitBytes(Value);<br class="">+ }<br class="">+ Size += AS->emitInt8('\0');<br class="">+ return Size;<br class="">+}<br class="">+<br class="">+unsigned DwarfDebug::emitMacroFile(AsmStreamerBase *AS, DIMacroFile &F,<br class="">+ DwarfCompileUnit &U) {<br class="">+ int Size = 0;<br class="">+ assert(F.getMacinfoType() == dwarf::DW_MACINFO_start_file);<br class="">+ Size += AS->emitULEB128(dwarf::DW_MACINFO_start_file);<br class="">+ Size += AS->emitULEB128(F.getLine());<br class="">+ DIFile *File = F.getFile();<br class="">+ unsigned FID =<br class="">+ U.getOrCreateSourceID(File->getFilename(), File->getDirectory());<br class="">+ Size += AS->emitULEB128(FID);<br class="">+ Size += handleMacroNodes(AS, F.getElements(), U);<br class="">+ Size += AS->emitULEB128(dwarf::DW_MACINFO_end_file);<br class="">+ return Size;<br class="">+}<br class="">+<br class="">+// Emit visible names into a debug macinfo section.<br class="">+void DwarfDebug::emitDebugMacinfo() {<br class="">+ if (MCSection *Macinfo = Asm->getObjFileLowering().getDwarfMacinfoSection()) {<br class="">+ // Start the dwarf macinfo section.<br class="">+ Asm->OutStreamer->SwitchSection(Macinfo);<br class="">+ }<br class="">+ std::unique_ptr<AsmStreamerBase> AS(new EmittingAsmStreamer(Asm));<br class="">+ for (const auto &P : CUMap) {<br class="">+ auto &TheCU = *P.second;<br class="">+ auto *SkCU = TheCU.getSkeleton();<br class="">+ DwarfCompileUnit &U = SkCU ? *SkCU : TheCU;<br class="">+ auto *CUNode = cast<DICompileUnit>(P.first);<br class="">+ handleMacroNodes(AS.get(), CUNode->getMacros(), U);<br class="">+ }<br class="">+ Asm->OutStreamer->AddComment("End Of Macro List Mark");<br class="">+ Asm->EmitInt8(0);<br class="">+}<br class="">+<br class=""> // DWARF5 Experimental Separate Dwarf emitters.<br class=""><br class=""> void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Jan 7 08:28:20 2016<br class="">@@ -400,18 +400,26 @@ class DwarfDebug : public AsmPrinterHand<br class=""> /// Emit visible names into a debug str section.<br class=""> void emitDebugStr();<br class=""><br class="">- /// Emit visible names into a debug loc section.<br class="">+ /// Emit variable locations into a debug loc section.<br class=""> void emitDebugLoc();<br class=""><br class="">- /// Emit visible names into a debug loc dwo section.<br class="">+ /// Emit variable locations into a debug loc dwo section.<br class=""> void emitDebugLocDWO();<br class=""><br class="">- /// Emit visible names into a debug aranges section.<br class="">+ /// Emit address ranges into a debug aranges section.<br class=""> void emitDebugARanges();<br class=""><br class="">- /// Emit visible names into a debug ranges section.<br class="">+ /// Emit address ranges into a debug ranges section.<br class=""> void emitDebugRanges();<br class=""><br class="">+ /// Emit macros into a debug macinfo section.<br class="">+ void emitDebugMacinfo();<br class="">+ unsigned emitMacro(AsmStreamerBase *AS, DIMacro &M);<br class="">+ unsigned emitMacroFile(AsmStreamerBase *AS, DIMacroFile &F,<br class="">+ DwarfCompileUnit &U);<br class="">+ unsigned handleMacroNodes(AsmStreamerBase *AS, DIMacroNodeArray Nodes,<br class="">+ DwarfCompileUnit &U);<br class="">+<br class=""> /// DWARF 5 Experimental Split Dwarf Emitters<br class=""><br class=""> /// Initialize common features of skeleton units.<br class=""><br class="">Modified: llvm/trunk/lib/IR/Verifier.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/IR/Verifier.cpp (original)<br class="">+++ llvm/trunk/lib/IR/Verifier.cpp Thu Jan 7 08:28:20 2016<br class="">@@ -984,6 +984,9 @@ void Verifier::visitDIMacro(const DIMacr<br class=""> <span class="Apple-converted-space"> </span>N.getMacinfoType() == dwarf::DW_MACINFO_undef,<br class=""> <span class="Apple-converted-space"> </span>"invalid macinfo type", &N);<br class=""> Assert(!N.getName().empty(), "anonymous macro", &N);<br class="">+ if (!N.getValue().empty()) {<br class="">+ assert(N.getValue().data()[0] != ' ' && "Macro value has a space prefix");<br class="">+ }<br class=""> }<br class=""><br class=""> void Verifier::visitDIMacroFile(const DIMacroFile &N) {<br class=""><br class="">Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)<br class="">+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Thu Jan 7 08:28:20 2016<br class="">@@ -256,6 +256,9 @@ void MCObjectFileInfo::initMachOMCObject<br class=""> DwarfRangesSection =<br class=""> Ctx->getMachOSection("__DWARF", "__debug_ranges", MachO::S_ATTR_DEBUG,<br class=""> <span class="Apple-converted-space"> </span>SectionKind::getMetadata(), "debug_range");<br class="">+ DwarfMacinfoSection =<br class="">+ Ctx->getMachOSection("__DWARF", "__debug_macinfo", MachO::S_ATTR_DEBUG,<br class="">+ SectionKind::getMetadata());<br class=""> DwarfDebugInlineSection =<br class=""> Ctx->getMachOSection("__DWARF", "__debug_inlined", MachO::S_ATTR_DEBUG,<br class=""> <span class="Apple-converted-space"> </span>SectionKind::getMetadata());<br class="">@@ -505,6 +508,8 @@ void MCObjectFileInfo::initELFMCObjectFi<br class=""> Ctx->getELFSection(".debug_aranges", ELF::SHT_PROGBITS, 0);<br class=""> DwarfRangesSection =<br class=""> Ctx->getELFSection(".debug_ranges", ELF::SHT_PROGBITS, 0, "debug_range");<br class="">+ DwarfMacinfoSection =<br class="">+ Ctx->getELFSection(".debug_macinfo", ELF::SHT_PROGBITS, 0);<br class=""><br class=""> // DWARF5 Experimental Debug Info<br class=""><br class="">@@ -684,6 +689,11 @@ void MCObjectFileInfo::initCOFFMCObjectF<br class=""> COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |<br class=""> COFF::IMAGE_SCN_MEM_READ,<br class=""> SectionKind::getMetadata(), "debug_range");<br class="">+ DwarfMacinfoSection = Ctx->getCOFFSection(<br class="">+ ".debug_macinfo",<br class="">+ COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |<br class="">+ COFF::IMAGE_SCN_MEM_READ,<br class="">+ SectionKind::getMetadata());<br class=""> DwarfInfoDWOSection = Ctx->getCOFFSection(<br class=""> ".debug_info.dwo",<br class=""> COFF::IMAGE_SCN_MEM_DISCARDABLE | COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |<br class=""><br class="">Modified: llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp (original)<br class="">+++ llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp Thu Jan 7 08:28:20 2016<br class="">@@ -4549,6 +4549,7 @@ NVPTXTargetObjectFile::~NVPTXTargetObjec<br class=""> delete static_cast<NVPTXSection *>(DwarfLocSection);<br class=""> delete static_cast<NVPTXSection *>(DwarfARangesSection);<br class=""> delete static_cast<NVPTXSection *>(DwarfRangesSection);<br class="">+ delete static_cast<NVPTXSection *>(DwarfMacinfoSection);<br class=""> }<br class=""><br class=""> MCSection *<br class=""><br class="">Modified: llvm/trunk/lib/Target/NVPTX/NVPTXTargetObjectFile.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXTargetObjectFile.h?rev=257060&r1=257059&r2=257060&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXTargetObjectFile.h?rev=257060&r1=257059&r2=257060&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/NVPTX/NVPTXTargetObjectFile.h (original)<br class="">+++ llvm/trunk/lib/Target/NVPTX/NVPTXTargetObjectFile.h Thu Jan 7 08:28:20 2016<br class="">@@ -41,6 +41,7 @@ public:<br class=""> DwarfLocSection = nullptr;<br class=""> DwarfARangesSection = nullptr;<br class=""> DwarfRangesSection = nullptr;<br class="">+ DwarfMacinfoSection = nullptr;<br class=""> }<br class=""><br class=""> virtual ~NVPTXTargetObjectFile();<br class="">@@ -81,6 +82,8 @@ public:<br class=""> new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());<br class=""> DwarfRangesSection =<br class=""> new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());<br class="">+ DwarfMacinfoSection =<br class="">+ new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());<br class=""> }<br class=""><br class=""> MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,<br class=""><br class="">Added: llvm/trunk/test/DebugInfo/X86/debug-macro.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-macro.ll?rev=257060&view=auto" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-macro.ll?rev=257060&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/DebugInfo/X86/debug-macro.ll (added)<br class="">+++ llvm/trunk/test/DebugInfo/X86/debug-macro.ll Thu Jan 7 08:28:20 2016<br class="">@@ -0,0 +1,67 @@<br class="">+; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=CHECK-INFO %s<br class="">+; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=macro - | FileCheck --check-prefix=CHECK-MACRO %s<br class="">+; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=line - | FileCheck --check-prefix=CHECK-LINE %s<br class="">+<br class="">+<br class="">+; CHECK-INFO: .debug_info contents:<br class="">+; CHECK-INFO: DW_TAG_compile_unit<br class="">+; CHECK-INFO-NOT: DW_TAG<br class="">+; CHECK-INFO: DW_AT_name {{.*}}"debug-macro.cpp")<br class="">+; CHECK-INFO: DW_AT_macro_info {{.*}}(0x00000000)<br class="">+; CHECK-INFO: DW_TAG_compile_unit<br class="">+; CHECK-INFO-NOT: DW_TAG<br class="">+; CHECK-INFO: DW_AT_name {{.*}}"debug-macro1.cpp")<br class="">+; CHECK-INFO: DW_AT_macro_info {{.*}}(0x00000044)<br class="">+; CHECK-INFO: DW_TAG_compile_unit<br class="">+; CHECK-INFO-NOT: DW_TAG<br class="">+; CHECK-INFO: DW_AT_name {{.*}}"debug-macro2.cpp")<br class="">+; CHECK-INFO-NOT: DW_AT_macro_info<br class="">+<br class="">+; CHECK-MACRO: .debug_macinfo contents:<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_define - lineno: 0 macro: NameCMD ValueCMD<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_start_file - lineno: 9 filenum: 2<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_define - lineno: 1 macro: NameDef Value<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_undef - lineno: 11 macro: NameUndef<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_end_file<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_undef - lineno: 10 macro: NameUndef2<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_end_file<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1<br class="">+; CHECK-MACRO-NEXT: DW_MACINFO_end_file<br class="">+<br class="">+; CHECK-LINE: .debug_line contents:<br class="">+; CHECK-LINE: Dir Mod Time File Len File Name<br class="">+; CHECK-LINE: file_names[ 1] {{.*}}debug-macro.cpp<br class="">+; CHECK-LINE: file_names[ 2] {{.*}}debug-macro.h<br class="">+; CHECK-LINE: Dir Mod Time File Len File Name<br class="">+; CHECK-LINE: file_names[ 1] {{.*}}debug-macro1.cpp<br class="">+<br class="">+!<a href="http://llvm.dbg.cu/" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0, !16, !20}<br class="">+!llvm.module.flags = !{!13, !14}<br class="">+!llvm.ident = !{!15}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2, imports: !2, macros: !3)<br class="">+!1 = !DIFile(filename: "debug-macro.cpp", directory: "/")<br class="">+!2 = !{}<br class="">+!3 = !{!4, !5}<br class="">+!4 = !DIMacro(type: DW_MACINFO_define, line: 0, name: "NameCMD", value: "ValueCMD")<br class="">+!5 = !DIMacroFile(line: 0, file: !1, nodes: !6)<br class="">+!6 = !{!7, !12}<br class="">+!7 = !DIMacroFile(line: 9, file: !8, nodes: !9)<br class="">+!8 = !DIFile(filename: "debug-macro.h", directory: "/")<br class="">+!9 = !{!10, !11}<br class="">+!10 = !DIMacro(type: DW_MACINFO_define, line: 1, name: "NameDef", value: "Value")<br class="">+!11 = !DIMacro(type: DW_MACINFO_undef, line: 11, name: "NameUndef")<br class="">+!12 = !DIMacro(type: DW_MACINFO_undef, line: 10, name: "NameUndef2")<br class="">+<br class="">+!13 = !{i32 2, !"Dwarf Version", i32 4}<br class="">+!14 = !{i32 1, !"Debug Info Version", i32 3}<br class="">+!15 = !{!"clang version 3.5.0 "}<br class="">+<br class="">+!16 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !17, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2, imports: !2, macros: !18)<br class="">+!17 = !DIFile(filename: "debug-macro1.cpp", directory: "/")<br class="">+!18 = !{!19}<br class="">+!19 = !DIMacroFile(line: 0, file: !17, nodes: !2)<br class="">+<br class="">+!20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !21, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2, imports: !2)<br class="">+!21 = !DIFile(filename: "debug-macro2.cpp", directory: "/")<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></blockquote></div></div></blockquote></div><br class=""></body></html>