<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 8, 2013, at 12:44 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Shouldn't be much if any due to the reduction in output, but also why I asked for a SmallVector to keep memory usage down. I'll let Manman get you numbers though :)</div></blockquote><div><br></div>In r176893 to replace std::vector with SmallVector.</div><div><br></div><div>-Manman<br><blockquote type="cite"><div dir="ltr"><div><br></div><div style="">-eric</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 8, 2013 at 12:12 PM, Evan Cheng <span dir="ltr"><<a href="mailto:evan.cheng@apple.com" target="_blank">evan.cheng@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is there any compile time impact? I always worry when I see data structure like map of vectors.<br>
<span class="HOEnZb"><font color="#888888"><br>
Evan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mar 6, 2013, at 5:42 PM, Manman Ren <<a href="mailto:mren@apple.com">mren@apple.com</a>> wrote:<br>
<br>
> Author: mren<br>
> Date: Wed Mar  6 19:42:00 2013<br>
> New Revision: 176605<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=176605&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=176605&view=rev</a><br>
> Log:<br>
> Debug Info: store the files and directories for each compile unit.<br>
><br>
> We now emit a line table for each compile unit. To reduce the prologue size<br>
> of each line table, the files and directories used by each compile unit are<br>
> stored in std::map<unsigned, std::vector< > > instead of std::vector< >.<br>
><br>
> The prologue for a lto'ed image can be as big as 93K. Duplicating 93K for each<br>
> compile unit causes a huge increase of debug info. With this patch, each<br>
> prologue will only emit the files required by the compile unit.<br>
><br>
> <a href="rdar://problem/13342023">rdar://problem/13342023</a><br>
><br>
> Modified:<br>
>    llvm/trunk/include/llvm/MC/MCContext.h<br>
>    llvm/trunk/include/llvm/MC/MCStreamer.h<br>
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
>    llvm/trunk/lib/MC/MCAsmStreamer.cpp<br>
>    llvm/trunk/lib/MC/MCContext.cpp<br>
>    llvm/trunk/lib/MC/MCDwarf.cpp<br>
>    llvm/trunk/lib/MC/MCNullStreamer.cpp<br>
>    llvm/trunk/lib/MC/MCPureStreamer.cpp<br>
>    llvm/trunk/lib/MC/MCStreamer.cpp<br>
>    llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
><br>
> Modified: llvm/trunk/include/llvm/MC/MCContext.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/MC/MCContext.h (original)<br>
> +++ llvm/trunk/include/llvm/MC/MCContext.h Wed Mar  6 19:42:00 2013<br>
> @@ -17,6 +17,7 @@<br>
> #include "llvm/Support/Allocator.h"<br>
> #include "llvm/Support/Compiler.h"<br>
> #include "llvm/Support/raw_ostream.h"<br>
> +#include <map><br>
> #include <vector> // FIXME: Shouldn't be needed.<br>
><br>
> namespace llvm {<br>
> @@ -101,8 +102,12 @@ namespace llvm {<br>
>     std::string MainFileName;<br>
><br>
>     /// The dwarf file and directory tables from the dwarf .file directive.<br>
> -    std::vector<MCDwarfFile *> MCDwarfFiles;<br>
> -    std::vector<StringRef> MCDwarfDirs;<br>
> +    /// We now emit a line table for each compile unit. To reduce the prologue<br>
> +    /// size of each line table, the files and directories used by each compile<br>
> +    /// unit are separated.<br>
> +    typedef std::map<unsigned, std::vector<MCDwarfFile *> > MCDwarfFilesMap;<br>
> +    MCDwarfFilesMap MCDwarfFilesCUMap;<br>
> +    std::map<unsigned, std::vector<StringRef> > MCDwarfDirsCUMap;<br>
><br>
>     /// The current dwarf line information from the last dwarf .loc directive.<br>
>     MCDwarfLoc CurrentDwarfLoc;<br>
> @@ -282,19 +287,25 @@ namespace llvm {<br>
><br>
>     /// GetDwarfFile - creates an entry in the dwarf file and directory tables.<br>
>     unsigned GetDwarfFile(StringRef Directory, StringRef FileName,<br>
> -                          unsigned FileNumber);<br>
> +                          unsigned FileNumber, unsigned CUID);<br>
><br>
> -    bool isValidDwarfFileNumber(unsigned FileNumber);<br>
> +    bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);<br>
><br>
>     bool hasDwarfFiles() const {<br>
> -      return !MCDwarfFiles.empty();<br>
> +      // Traverse MCDwarfFilesCUMap and check whether each entry is empty.<br>
> +      MCDwarfFilesMap::const_iterator MapB, MapE;<br>
> +      for (MapB = MCDwarfFilesCUMap.begin(), MapE = MCDwarfFilesCUMap.end();<br>
> +           MapB != MapE; MapB++)<br>
> +        if (!MapB->second.empty())<br>
> +           return true;<br>
> +      return false;<br>
>     }<br>
><br>
> -    const std::vector<MCDwarfFile *> &getMCDwarfFiles() {<br>
> -      return MCDwarfFiles;<br>
> +    const std::vector<MCDwarfFile *> &getMCDwarfFiles(unsigned CUID = 0) {<br>
> +      return MCDwarfFilesCUMap[CUID];<br>
>     }<br>
> -    const std::vector<StringRef> &getMCDwarfDirs() {<br>
> -      return MCDwarfDirs;<br>
> +    const std::vector<StringRef> &getMCDwarfDirs(unsigned CUID = 0) {<br>
> +      return MCDwarfDirsCUMap[CUID];<br>
>     }<br>
><br>
>     const DenseMap<const MCSection *, MCLineSection *><br>
><br>
> Modified: llvm/trunk/include/llvm/MC/MCStreamer.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/MC/MCStreamer.h (original)<br>
> +++ llvm/trunk/include/llvm/MC/MCStreamer.h Wed Mar  6 19:42:00 2013<br>
> @@ -525,7 +525,7 @@ namespace llvm {<br>
>     /// file number.  This implements the DWARF2 '.file 4 "foo.c"' assembler<br>
>     /// directive.<br>
>     virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,<br>
> -                                        StringRef Filename);<br>
> +                                        StringRef Filename, unsigned CUID = 0);<br>
><br>
>     /// EmitDwarfLocDirective - This implements the DWARF2<br>
>     // '.loc fileno lineno ...' assembler directive.<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -241,7 +241,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
>   if (Line == 0)<br>
>     return;<br>
>   unsigned FileID = DD->getOrCreateSourceID(V.getContext().getFilename(),<br>
> -                                            V.getContext().getDirectory());<br>
> +                                            V.getContext().getDirectory(),<br>
> +                                            getUniqueID());<br>
>   assert(FileID && "Invalid file id");<br>
>   addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
>   addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
> @@ -257,7 +258,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
>   unsigned Line = G.getLineNumber();<br>
>   if (Line == 0)<br>
>     return;<br>
> -  unsigned FileID = DD->getOrCreateSourceID(G.getFilename(), G.getDirectory());<br>
> +  unsigned FileID = DD->getOrCreateSourceID(G.getFilename(), G.getDirectory(),<br>
> +                                            getUniqueID());<br>
>   assert(FileID && "Invalid file id");<br>
>   addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
>   addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
> @@ -276,7 +278,7 @@ void CompileUnit::addSourceLine(DIE *Die<br>
>     return;<br>
><br>
>   unsigned FileID = DD->getOrCreateSourceID(SP.getFilename(),<br>
> -                                            SP.getDirectory());<br>
> +                                            SP.getDirectory(), getUniqueID());<br>
>   assert(FileID && "Invalid file id");<br>
>   addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
>   addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
> @@ -293,7 +295,7 @@ void CompileUnit::addSourceLine(DIE *Die<br>
>   if (Line == 0)<br>
>     return;<br>
>   unsigned FileID = DD->getOrCreateSourceID(Ty.getFilename(),<br>
> -                                            Ty.getDirectory());<br>
> +                                            Ty.getDirectory(), getUniqueID());<br>
>   assert(FileID && "Invalid file id");<br>
>   addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
>   addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
> @@ -311,7 +313,7 @@ void CompileUnit::addSourceLine(DIE *Die<br>
>     return;<br>
>   DIFile File = Ty.getFile();<br>
>   unsigned FileID = DD->getOrCreateSourceID(File.getFilename(),<br>
> -                                            File.getDirectory());<br>
> +                                            File.getDirectory(), getUniqueID());<br>
>   assert(FileID && "Invalid file id");<br>
>   addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
>   addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
> @@ -329,7 +331,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
>     return;<br>
>   StringRef FN = NS.getFilename();<br>
><br>
> -  unsigned FileID = DD->getOrCreateSourceID(FN, NS.getDirectory());<br>
> +  unsigned FileID = DD->getOrCreateSourceID(FN, NS.getDirectory(),<br>
> +                                            getUniqueID());<br>
>   assert(FileID && "Invalid file id");<br>
>   addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
>   addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -528,7 +528,8 @@ DIE *DwarfDebug::constructInlinedScopeDI<br>
><br>
>   DILocation DL(Scope->getInlinedAt());<br>
>   TheCU->addUInt(ScopeDIE, dwarf::DW_AT_call_file, 0,<br>
> -                 getOrCreateSourceID(DL.getFilename(), DL.getDirectory()));<br>
> +                 getOrCreateSourceID(DL.getFilename(), DL.getDirectory(),<br>
> +                                     TheCU->getUniqueID()));<br>
>   TheCU->addUInt(ScopeDIE, dwarf::DW_AT_call_line, 0, DL.getLineNumber());<br>
><br>
>   // Add name to the name table, we do this here because we're guaranteed<br>
> @@ -617,19 +618,28 @@ DIE *DwarfDebug::constructScopeDIE(Compi<br>
> // SourceIds map. This can update DirectoryNames and SourceFileNames maps<br>
> // as well.<br>
> unsigned DwarfDebug::getOrCreateSourceID(StringRef FileName,<br>
> -                                         StringRef DirName) {<br>
> +                                         StringRef DirName, unsigned CUID) {<br>
> +  // If we use .loc in assembly, we can't separate .file entries according to<br>
> +  // compile units. Thus all files will belong to the default compile unit.<br>
> +  if (Asm->TM.hasMCUseLoc() &&<br>
> +      Asm->OutStreamer.getKind() == MCStreamer::SK_AsmStreamer)<br>
> +    CUID = 0;<br>
> +<br>
>   // If FE did not provide a file name, then assume stdin.<br>
>   if (FileName.empty())<br>
> -    return getOrCreateSourceID("<stdin>", StringRef());<br>
> +    return getOrCreateSourceID("<stdin>", StringRef(), CUID);<br>
><br>
>   // TODO: this might not belong here. See if we can factor this better.<br>
>   if (DirName == CompilationDir)<br>
>     DirName = "";<br>
><br>
> -  unsigned SrcId = SourceIdMap.size()+1;<br>
> +  // FileIDCUMap stores the current ID for the given compile unit.<br>
> +  unsigned SrcId = FileIDCUMap[CUID] + 1;<br>
><br>
> -  // We look up the file/dir pair by concatenating them with a zero byte.<br>
> +  // We look up the CUID/file/dir by concatenating them with a zero byte.<br>
>   SmallString<128> NamePair;<br>
> +  NamePair += CUID;<br>
> +  NamePair += '\0';<br>
>   NamePair += DirName;<br>
>   NamePair += '\0'; // Zero bytes are not allowed in paths.<br>
>   NamePair += FileName;<br>
> @@ -638,8 +648,9 @@ unsigned DwarfDebug::getOrCreateSourceID<br>
>   if (Ent.getValue() != SrcId)<br>
>     return Ent.getValue();<br>
><br>
> +  FileIDCUMap[CUID] = SrcId;<br>
>   // Print out a .file directive to specify files for .loc directives.<br>
> -  Asm->OutStreamer.EmitDwarfFileDirective(SrcId, DirName, FileName);<br>
> +  Asm->OutStreamer.EmitDwarfFileDirective(SrcId, DirName, FileName, CUID);<br>
><br>
>   return SrcId;<br>
> }<br>
> @@ -650,14 +661,17 @@ CompileUnit *DwarfDebug::constructCompil<br>
>   DICompileUnit DIUnit(N);<br>
>   StringRef FN = DIUnit.getFilename();<br>
>   CompilationDir = DIUnit.getDirectory();<br>
> -  // Call this to emit a .file directive if it wasn't emitted for the source<br>
> -  // file this CU comes from yet.<br>
> -  getOrCreateSourceID(FN, CompilationDir);<br>
><br>
>   DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);<br>
>   CompileUnit *NewCU = new CompileUnit(GlobalCUIndexCount++,<br>
>                                        DIUnit.getLanguage(), Die, Asm,<br>
>                                        this, &InfoHolder);<br>
> +<br>
> +  FileIDCUMap[NewCU->getUniqueID()] = 0;<br>
> +  // Call this to emit a .file directive if it wasn't emitted for the source<br>
> +  // file this CU comes from yet.<br>
> +  getOrCreateSourceID(FN, CompilationDir, NewCU->getUniqueID());<br>
> +<br>
>   NewCU->addString(Die, dwarf::DW_AT_producer, DIUnit.getProducer());<br>
>   NewCU->addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,<br>
>                  DIUnit.getLanguage());<br>
> @@ -1707,7 +1721,8 @@ void DwarfDebug::recordSourceLine(unsign<br>
>     } else<br>
>       llvm_unreachable("Unexpected scope info");<br>
><br>
> -    Src = getOrCreateSourceID(Fn, Dir);<br>
> +    Src = getOrCreateSourceID(Fn, Dir,<br>
> +            Asm->OutStreamer.getContext().getDwarfCompileUnitID());<br>
>   }<br>
>   Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, Flags, 0, 0, Fn);<br>
> }<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Mar  6 19:42:00 2013<br>
> @@ -305,7 +305,9 @@ class DwarfDebug {<br>
>   // A list of all the unique abbreviations in use.<br>
>   std::vector<DIEAbbrev *> Abbreviations;<br>
><br>
> -  // Source id map, i.e. pair of source filename and directory,<br>
> +  // Stores the current file ID for a given compile unit.<br>
> +  DenseMap <unsigned, unsigned> FileIDCUMap;<br>
> +  // Source id map, i.e. CUID, source filename and directory,<br>
>   // separated by a zero byte, mapped to a unique id.<br>
>   StringMap<unsigned, BumpPtrAllocator&> SourceIdMap;<br>
><br>
> @@ -626,7 +628,8 @@ public:<br>
>   /// \brief Look up the source id with the given directory and source file<br>
>   /// names. If none currently exists, create a new id and insert it in the<br>
>   /// SourceIds map.<br>
> -  unsigned getOrCreateSourceID(StringRef DirName, StringRef FullName);<br>
> +  unsigned getOrCreateSourceID(StringRef DirName, StringRef FullName,<br>
> +                               unsigned CUID);<br>
><br>
>   /// \brief Recursively Emits a debug information entry.<br>
>   void emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs);<br>
><br>
> Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -215,7 +215,7 @@ public:<br>
><br>
>   virtual void EmitFileDirective(StringRef Filename);<br>
>   virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,<br>
> -                                      StringRef Filename);<br>
> +                                      StringRef Filename, unsigned CUID = 0);<br>
>   virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,<br>
>                                      unsigned Column, unsigned Flags,<br>
>                                      unsigned Isa, unsigned Discriminator,<br>
> @@ -828,14 +828,14 @@ void MCAsmStreamer::EmitFileDirective(St<br>
> }<br>
><br>
> bool MCAsmStreamer::EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,<br>
> -                                           StringRef Filename) {<br>
> +                                           StringRef Filename, unsigned CUID) {<br>
>   if (!UseDwarfDirectory && !Directory.empty()) {<br>
>     if (sys::path::is_absolute(Filename))<br>
> -      return EmitDwarfFileDirective(FileNo, "", Filename);<br>
> +      return EmitDwarfFileDirective(FileNo, "", Filename, CUID);<br>
><br>
>     SmallString<128> FullPathName = Directory;<br>
>     sys::path::append(FullPathName, Filename);<br>
> -    return EmitDwarfFileDirective(FileNo, "", FullPathName);<br>
> +    return EmitDwarfFileDirective(FileNo, "", FullPathName, CUID);<br>
>   }<br>
><br>
>   if (UseLoc) {<br>
> @@ -846,8 +846,11 @@ bool MCAsmStreamer::EmitDwarfFileDirecti<br>
>     }<br>
>     PrintQuotedString(Filename, OS);<br>
>     EmitEOL();<br>
> +    // All .file will belong to a single CUID.<br>
> +    CUID = 0;<br>
>   }<br>
> -  return this->MCStreamer::EmitDwarfFileDirective(FileNo, Directory, Filename);<br>
> +  return this->MCStreamer::EmitDwarfFileDirective(FileNo, Directory, Filename,<br>
> +                                                  CUID);<br>
> }<br>
><br>
> void MCAsmStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,<br>
><br>
> Modified: llvm/trunk/lib/MC/MCContext.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCContext.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCContext.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -77,8 +77,8 @@ void MCContext::reset() {<br>
>   Symbols.clear();<br>
>   Allocator.Reset();<br>
>   Instances.clear();<br>
> -  MCDwarfFiles.clear();<br>
> -  MCDwarfDirs.clear();<br>
> +  MCDwarfFilesCUMap.clear();<br>
> +  MCDwarfDirsCUMap.clear();<br>
>   MCGenDwarfLabelEntries.clear();<br>
>   DwarfDebugFlags = StringRef();<br>
>   MCLineSections.clear();<br>
> @@ -299,11 +299,13 @@ const MCSection *MCContext::getCOFFSecti<br>
> /// error and zero is returned and the client reports the error, else the<br>
> /// allocated file number is returned.  The file numbers may be in any order.<br>
> unsigned MCContext::GetDwarfFile(StringRef Directory, StringRef FileName,<br>
> -                                 unsigned FileNumber) {<br>
> +                                 unsigned FileNumber, unsigned CUID) {<br>
>   // TODO: a FileNumber of zero says to use the next available file number.<br>
>   // Note: in GenericAsmParser::ParseDirectiveFile() FileNumber was checked<br>
>   // to not be less than one.  This needs to be change to be not less than zero.<br>
><br>
> +  std::vector<MCDwarfFile *>& MCDwarfFiles = MCDwarfFilesCUMap[CUID];<br>
> +  std::vector<StringRef>& MCDwarfDirs = MCDwarfDirsCUMap[CUID];<br>
>   // Make space for this FileNumber in the MCDwarfFiles vector if needed.<br>
>   if (FileNumber >= MCDwarfFiles.size()) {<br>
>     MCDwarfFiles.resize(FileNumber + 1);<br>
> @@ -363,7 +365,8 @@ unsigned MCContext::GetDwarfFile(StringR<br>
><br>
> /// isValidDwarfFileNumber - takes a dwarf file number and returns true if it<br>
> /// currently is assigned and false otherwise.<br>
> -bool MCContext::isValidDwarfFileNumber(unsigned FileNumber) {<br>
> +bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {<br>
> +  std::vector<MCDwarfFile *>& MCDwarfFiles = MCDwarfFilesCUMap[CUID];<br>
>   if(FileNumber == 0 || FileNumber >= MCDwarfFiles.size())<br>
>     return false;<br>
><br>
><br>
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -299,7 +299,7 @@ const MCSymbol *MCDwarfFileTable::EmitCU<br>
><br>
>   // First the directory table.<br>
>   const std::vector<StringRef> &MCDwarfDirs =<br>
> -    context.getMCDwarfDirs();<br>
> +    context.getMCDwarfDirs(CUID);<br>
>   for (unsigned i = 0; i < MCDwarfDirs.size(); i++) {<br>
>     MCOS->EmitBytes(MCDwarfDirs[i]); // the DirectoryName<br>
>     MCOS->EmitBytes(StringRef("\0", 1)); // the null term. of the string<br>
> @@ -308,7 +308,7 @@ const MCSymbol *MCDwarfFileTable::EmitCU<br>
><br>
>   // Second the file table.<br>
>   const std::vector<MCDwarfFile *> &MCDwarfFiles =<br>
> -    MCOS->getContext().getMCDwarfFiles();<br>
> +    MCOS->getContext().getMCDwarfFiles(CUID);<br>
>   for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {<br>
>     MCOS->EmitBytes(MCDwarfFiles[i]->getName()); // FileName<br>
>     MCOS->EmitBytes(StringRef("\0", 1)); // the null term. of the string<br>
><br>
> Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCNullStreamer.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCNullStreamer.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -89,7 +89,7 @@ namespace {<br>
><br>
>     virtual void EmitFileDirective(StringRef Filename) {}<br>
>     virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,<br>
> -                                        StringRef Filename) {<br>
> +                                        StringRef Filename, unsigned CUID = 0) {<br>
>       return false;<br>
>     }<br>
>     virtual void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,<br>
><br>
> Modified: llvm/trunk/lib/MC/MCPureStreamer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCPureStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCPureStreamer.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCPureStreamer.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -95,7 +95,7 @@ public:<br>
>     report_fatal_error("unsupported directive in pure streamer");<br>
>   }<br>
>   virtual bool EmitDwarfFileDirective(unsigned FileNo, StringRef Directory,<br>
> -                                      StringRef Filename) {<br>
> +                                      StringRef Filename, unsigned CUID = 0) {<br>
>     report_fatal_error("unsupported directive in pure streamer");<br>
>   }<br>
><br>
><br>
> Modified: llvm/trunk/lib/MC/MCStreamer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/MC/MCStreamer.cpp (original)<br>
> +++ llvm/trunk/lib/MC/MCStreamer.cpp Wed Mar  6 19:42:00 2013<br>
> @@ -157,8 +157,8 @@ void MCStreamer::EmitFill(uint64_t NumBy<br>
><br>
> bool MCStreamer::EmitDwarfFileDirective(unsigned FileNo,<br>
>                                         StringRef Directory,<br>
> -                                        StringRef Filename) {<br>
> -  return getContext().GetDwarfFile(Directory, Filename, FileNo) == 0;<br>
> +                                        StringRef Filename, unsigned CUID) {<br>
> +  return getContext().GetDwarfFile(Directory, Filename, FileNo, CUID) == 0;<br>
> }<br>
><br>
> void MCStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line,<br>
><br>
> Modified: llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=176605&r1=176604&r2=176605&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=176605&r1=176604&r2=176605&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll (original)<br>
> +++ llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll Wed Mar  6 19:42:00 2013<br>
> @@ -9,13 +9,16 @@<br>
><br>
> ; CHECK: DW_TAG_compile_unit<br>
> ; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
> -; CHECK: DW_AT_stmt_list [DW_FORM_data4]   (0x00000049)<br>
> +; CHECK: DW_AT_stmt_list [DW_FORM_data4]   (0x0000003c)<br>
><br>
> ; CHECK: .debug_line contents:<br>
> ; CHECK-NEXT: Line table prologue:<br>
> -; CHECK-NEXT: total_length: 0x00000045<br>
> +; CHECK-NEXT: total_length: 0x00000038<br>
> +; CHECK: file_names[  1]    0 0x00000000 0x00000000 simple.c<br>
> ; CHECK: Line table prologue:<br>
> -; CHECK: total_length: 0x00000047<br>
> +; CHECK-NEXT: total_length: 0x00000039<br>
> +; CHECK: file_names[  1]    0 0x00000000 0x00000000 simple2.c<br>
> +; CHECK-NOT: file_names<br>
><br>
> define i32 @test(i32 %a) nounwind uwtable ssp {<br>
> entry:<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></body></html>