summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* LTO type uniquing: store the Decl field of a DIImportedEntity as a DIRef.Adrian Prantl2014-04-011-1/+1
| | | | | | | | | | No other functionality changes, DIBuilder testcase is included in a paired CFE commit. This relaxes the assertion in isScopeRef to also accept subclasses of DIScope. llvm-svn: 205279
* DebugInfo: Add GNU_addr_base and GNU_ranges_base only when there are ↵David Blaikie2014-03-251-13/+11
| | | | | | | | addresses or ranges Based on code review feedback from Eric in r204672. llvm-svn: 204702
* DebugInfo: Support debug_loc under fissionDavid Blaikie2014-03-251-10/+24
| | | | | | | | | | | | | | | | | | | | | | Implement debug_loc.dwo, as well as llvm-dwarfdump support for dumping this section. Outlined in the DWARF5 spec and http://gcc.gnu.org/wiki/DebugFission the debug_loc.dwo section has more variation than the standard debug_loc, allowing 3 different forms of entry (plus the end of list entry). GCC seems to, and Clang certainly, only use one form, so I've just implemented dumping support for that for now. It wasn't immediately obvious that there was a good refactoring to share the implementation of dumping support between debug_loc and debug_loc.dwo, so they're separate for now - ideas welcome or I may come back to it at some point. As per a comment in the code, we could choose different forms that may reduce the number of debug_addr entries we emit, but that will require further study. llvm-svn: 204697
* DebugInfo: Remove unnecessary zero-size checkDavid Blaikie2014-03-251-3/+0
| | | | | | | | | This seems excessive - switching section isn't expensive (or if it is we're already being wasteful, since we emitted the debug_loc section symbol earlier anyway) and otherwise there's no work that happens in this function when the list is empty. llvm-svn: 204696
* DebugInfo: Simplify debug loc list handling by keeping separate listsDavid Blaikie2014-03-241-16/+11
| | | | | | | Rather than using a flat list with "empty" entries (ala the actual on-disk format), keep separate lists for each variable. llvm-svn: 204680
* DwarfDebug: Simplify debug_loc mergingDavid Blaikie2014-03-241-13/+3
| | | | | | | | | | No functional change intended. Merging up-front rather than delaying this task until later. This just seems simpler and more efficient (avoiding growing the debug loc list only to have to skip over those post-merged entries, etc). llvm-svn: 204679
* DebugInfo: Add DW_AT_GNU_ranges_base to skeleton CUsDavid Blaikie2014-03-241-4/+9
| | | | | | | | | This is used to avoid relocations in the dwo file by allowing DW_AT_ranges specified in debug_info.dwo to be relative to this base address. (r204667 implements the base-relative DW_AT_ranges side of this) llvm-svn: 204672
* DebugInfo: Implement relative addressing for DW_AT_ranges under fissionDavid Blaikie2014-03-241-2/+9
| | | | | | | | This removes the debug_ranges relocations from debug_info.dwo (but doesn't implement the DW_AT_GNU_ranges_base which is also necessary for correct functioning) llvm-svn: 204668
* DebugInfo: Don't emit relocations to abbreviations in debug_info.dwoDavid Blaikie2014-03-241-1/+1
| | | | llvm-svn: 204667
* DwarfDebug: Remove an unused parameterDavid Blaikie2014-03-241-7/+3
| | | | llvm-svn: 204665
* Remove unused parameterDavid Blaikie2014-03-241-1/+1
| | | | llvm-svn: 204663
* Delete stale comment. Thanks, Eric!Adrian Prantl2014-03-211-1/+0
| | | | llvm-svn: 204530
* Dwarf Debug: Remove some cargo-cult type uniquing. Scopes do not haveAdrian Prantl2014-03-211-1/+1
| | | | | | | an ID, so this is a noop. Thanks Manman for catching this! llvm-svn: 204528
* DebugInfo: Omit DW_AT_addr_base from skeletal type units.David Blaikie2014-03-211-7/+7
| | | | | | | | | | | | | Type units have no addresses, so there's no need for DW_AT_addr_base. This removes another relocation from every skeletal type unit and brings LLVM's skeletal type units in line with GCC's (containing only GNU_dwo_name (strp), comp_dir (strp), and GNU_pubnames (flag_present)). Cary's got some ideas about using str_index in the .o file to reduce those last two relocations (well, replace two relocations with one relocation (pointing to the string index) and two indicies) llvm-svn: 204506
* Reapply DW_AT_low/high_pc patch:Eric Christopher2014-03-201-51/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc. This commit moves us from a single range per subprogram to extending ranges if we are: a) In the same section, and b) In the same enclosing CU. This means we have more fine grained ranges for compile units, and fewer ranges overall when we have multiple functions in the same CU adjacent to each other in the object file. Also remove all of the earlier hacks around this functionality for function sections etc. Also update all of the testcases to take into account the merging functionality. with a fix for location entries in the debug_loc section: Make sure that debug loc entries are relative to the low_pc of the compile unit. This means that when we only have a single range that the offset should be just relative to the low_pc of the unit, for multiple ranges for a CU this means that we'll be relative to 0 which we emit along with DW_AT_ranges. This mostly shows up with linked binaries, so add a testcase with multiple CUs so that our location is going to be offset of a CU with a non-zero low_pc. llvm-svn: 204377
* Add comments from Eric's review of r204094.David Blaikie2014-03-201-0/+5
| | | | llvm-svn: 204358
* Revert "Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc."Eric Christopher2014-03-201-37/+40
| | | | | | | | This appears to trigger failures with optimization and function arguments somehow. This reverts commit r204277. llvm-svn: 204286
* Use the range machinery for DW_AT_ranges and DW_AT_high/lo_pc.Eric Christopher2014-03-191-40/+37
| | | | | | | | | | | | | | | | | | This commit moves us from a single range per subprogram to extending ranges if we are: a) In the same section, and b) In the same enclosing CU. This means we have more fine grained ranges for compile units, and fewer ranges overall when we have multiple functions in the same CU adjacent to each other in the object file. Also remove all of the earlier hacks around this functionality for function sections etc. Also update all of the testcases to take into account the merging functionality. llvm-svn: 204277
* DebugInfo: Use the comp_dir of the referencing type units when building ↵David Blaikie2014-03-191-11/+16
| | | | | | | | | | | | debug_line.dwo This isn't a complete fix - it falls back to non-comp_dir when multiple compile units are in play. Adding a map of comp_dir to table is part of the more general solution, but I gave up (in the short term) when I realized I'd also have to calculate the size of each type unit so as to produce correct DW_AT_stmt_list attributes. llvm-svn: 204202
* Debug info: Remove OdrMemberMap from DwarfDebug, it's not necessary.Adrian Prantl2014-03-181-2/+2
| | | | | | Follow-up to r203982. llvm-svn: 204162
* DwarfDebug: Only unique retained types instead of all types.Adrian Prantl2014-03-181-2/+7
| | | | | | | This is a follow-up to r203983 based on feedback from dblaikie and mren (Thanks!) No functionality change. llvm-svn: 204107
* Switch the type field in DIVariable and DIGlobalVariable over to DITypeRefs.Adrian Prantl2014-03-181-3/+9
| | | | | | | | | This allows us to catch more opportunities for ODR-based type uniquing during LTO. Paired commit with CFE which updates some testcases to verify the new DIBuilder behavior. llvm-svn: 204106
* Add explanatory comment.Eric Christopher2014-03-181-0/+2
| | | | llvm-svn: 204103
* Shorten DotDebugLocEntry to just DebugLocEntry and reformat.Eric Christopher2014-03-181-11/+11
| | | | | | No functional change. llvm-svn: 204102
* DebugInfo: Avoid emitting standard opcode lengths in debug_line.dwo headers ↵David Blaikie2014-03-181-1/+1
| | | | | | | | | where opcodes are never used anyway Introduce a slightly tighter wrapper around the header structure that handles this use case. (MCDwarfDwoLineTable) llvm-svn: 204101
* DebugInfo: Implement debug_line.dwo for file names used in type units during ↵David Blaikie2014-03-181-3/+11
| | | | | | | | | | | | | | | | | | | | -gsplit-dwarf This removes an attribute (and more importantly, a relocation) from skeleton type units and removes some unnecessary file names from the debug_line section that remains in the .o (and linked executable) file. There's still a few places we could shave off some more space here: * use compilation dir of the underlying compilation unit (since all the type units share that compilation dir - though this would be more complicated in LTO cases where they don't (keep a map of compilation dir->line table header?)) * Remove some of the unnecessary header fields from the line table since they're not needed in this situation (about 12 bytes per table). llvm-svn: 204099
* DebugInfo: Do not rely on the compilation dir (index 0) for files in line ↵David Blaikie2014-03-181-5/+11
| | | | | | | | | | | | | | | | | | | | | | tables shared between compilation units When emitting assembly there's no support for emitting separate line tables for each compilation unit - so LLVM emits .loc directives producing a single line table. Line tables have an implicit directory (index 0) equal to the compilation directory (DW_AT_comp_dir) of the compilation unit that references them. If multiple compilation units (with possibly disparate compilation directories) reference the same line table, we must avoid relying on this ambiguous directory. Achieve this my simply not setting the compilation directory on the line table when we're in this situation (multiple units while emitting assembly). llvm-svn: 204094
* DebugInfo: Move getOrCreateSourceID from DwarfDebug to DwarfCompileUnitDavid Blaikie2014-03-171-23/+6
| | | | | | | | | | | We still do a few lookups into the line table mapping in MCContext that could be factored out into a single lookup (rather than looking it up once for the table label, once to set the compilation unit, once for each time we need a file ID, etc... ) but assembly output complicates that somewhat as we still need a virtual dispatch back to the MCAsmStreamer in that case. llvm-svn: 204092
* DebugInfo: Move line table zero-directory-index (compilation dir) handling ↵David Blaikie2014-03-171-4/+2
| | | | | | | | | | | | into MCDwarf Our handling of compilation directory in DwarfDebug was broken (incorrectly using the 'last' compilation directory (that of the last CU in the metadata list) for all function emission in any CU). By moving this handling down into MCDwarf the issue is fixed as the compilation dir is tracked correctly per line table. llvm-svn: 204089
* DebugInfo: Use MC line table file entry uniquing for non-asm input as well.David Blaikie2014-03-171-29/+2
| | | | | | | | | | | | | See r204027 for the precursor to this that applied to asm debug info. This required some non-obvious API changes to handle the case of asm output (we never go asm->asm so this didn't come up in r204027): the modification of the file/directory name by MCDwarfLineTableHeader needed to be reflected in the MCAsmStreamer caller so it could print the appropriate .file directive, so those StringRef parameters are now non-const ref (in/out) parameters rather than just const. llvm-svn: 204069
* Debug Info: Fix LTO type uniquing for C++ member declarationsAdrian Prantl2014-03-141-0/+1
| | | | | | | | | | | | | | | | based on the ODR. This adds an OdrMemberMap to DwarfDebug which is used to unique C++ member function declarations based on the unique identifier of their containing class and their mangled name. We can't use the usual DIRef mechanism here because DIScopes are indexed using their entire MDNode, including decl_file and decl_line, which need not be unique (see testcase). Prior to this change multiple redundant member function declarations would end up in the same uniqued DW_TAG_class_type. llvm-svn: 203982
* Remove command line option for CU hashing. This is on by default now.Eric Christopher2014-03-141-10/+2
| | | | | | Fix up testcases and use of flag. llvm-svn: 203973
* If we see that we're emitting code for a function that doesn't haveEric Christopher2014-03-141-1/+3
| | | | | | | | any lexical scopes then go ahead and turn on DW_AT_ranges for the compile unit since we would be claiming to describe in the CU a range for which we don't have information in the CU otherwise. llvm-svn: 203969
* Remove the -generate-dwarf-cu-ranges flag.Eric Christopher2014-03-141-12/+6
| | | | | | | Rewrite a couple of testcases to cover areas that would be normally by turning it on into testcases that will follow the logic. llvm-svn: 203968
* DwarfDebug: Remove some needless recursion.David Blaikie2014-03-141-2/+4
| | | | llvm-svn: 203946
* Turn on hashing by default for split dwarf compile units.Eric Christopher2014-03-121-1/+1
| | | | llvm-svn: 203680
* DebugInfo: Use common line/file attribute construction codeDavid Blaikie2014-03-121-5/+3
| | | | llvm-svn: 203676
* DebugInfo: Do not emit pubnames/pubtypes sections if they are emptyDavid Blaikie2014-03-111-0/+3
| | | | llvm-svn: 203622
* DebugInfo: Avoid re-looking up the DwarfUnit when emitting pubnames/pubtypesDavid Blaikie2014-03-111-1/+4
| | | | llvm-svn: 203620
* DebugInfo: Refactor emitDebugPubNames/Types into a common implementationDavid Blaikie2014-03-111-56/+11
| | | | | | | | | | I could fold the callers into their one call site, but the indirection (given how verbose choosing the section is) seemed helpful. The use of a member function pointer's a bit "tricky", but seems limited enough, the call sites are simple/clean/clear, and there's only one use. llvm-svn: 203619
* DebugInfo: Remove unused labels now that we just emit DW_AT_gnu_pubnames as ↵David Blaikie2014-03-111-8/+0
| | | | | | a flag (as of r203082) llvm-svn: 203612
* MachineModuleInfo: Turn nested std::pairs into a proper struct.Benjamin Kramer2014-03-091-10/+7
| | | | llvm-svn: 203414
* DebugInfo: Use DW_FORM_data4 for DW_AT_high_pc in DW_TAG_lexical_blocksDavid Blaikie2014-03-081-2/+1
| | | | | | Suggested by Adrian Prantl in code review for r203187 llvm-svn: 203323
* Remove unnecessary test for Darwin and update testcase to be a little lessAdrian Prantl2014-03-071-1/+1
| | | | | | | horrible/fragile. rdar://problem/16264854 llvm-svn: 203309
* Two part patch:Eric Christopher2014-03-071-58/+66
| | | | | | | | | | | | | | | First: refactor out the emission of entries into the .debug_loc section into its own routine. Second: add a new class ByteStreamer that can be used to either emit using an AsmPrinter or hash using DIEHash the series of bytes that would be emitted. Use this in all of the location emission routines for the .debug_loc section. No functional change intended outside of a few additional comments in verbose assembly. llvm-svn: 203304
* Revert "Remove unnecessary check for Darwin. rdar://problem/16264854"Adrian Prantl2014-03-071-1/+1
| | | | | | This breaks linux buildbots. Go figure. llvm-svn: 203300
* Remove unnecessary check for Darwin. rdar://problem/16264854Adrian Prantl2014-03-071-1/+1
| | | | llvm-svn: 203297
* DebugInfo: Use DW_FORM_data4 for DW_AT_high_pc in inlined functionsDavid Blaikie2014-03-071-2/+1
| | | | | | Suggested by Adrian Prantl in code review for r203187. llvm-svn: 203296
* [C++11] DwarfDebug: Turn single-use functors into lambdas.Benjamin Kramer2014-03-071-25/+16
| | | | | | No functionality change. llvm-svn: 203276
* [C++11] DwarfDebug: Use range-based for loops.Benjamin Kramer2014-03-071-245/+116
| | | | | | It has a lot of them with complex types. C++11 really shines here. llvm-svn: 203270
OpenPOWER on IntegriCloud