summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
AgeCommit message (Collapse)Author
2025-05-21[llvm] Use *Map::try_emplace (NFC) (#140843)Kazu Hirata
try_emplace can default-construct values, so we do not need to do so on our own. Plus, try_emplace(Key) is much shorter than insert(std::make_pair(Key, Value()).
2025-04-19[llvm] Construct SmallVector with iterator ranges (NFC) (#136460)Kazu Hirata
2023-01-16This patch allows llvm-dwarfutil to utilize accelerator tablesAlexey Lapshin
generation code from DWARFLinker. It adds command line option: --build-accelerator [none,DWARF] Build accelerator tables(default: none) =none - Do not build accelerators =DWARF - Build accelerator tables according to the resulting DWARF version DWARFv4: .debug_pubnames and .debug_pubtypes DWARFv5: .debug_names Differential Revision: https://reviews.llvm.org/D139638
2022-06-10[MC] De-capitalize SwitchSection. NFCFangrui Song
Add SwitchSection to return switchSection. The API will be removed soon.
2022-06-05[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().Alexey Lapshin
This patch is extraction from the https://reviews.llvm.org/D126883. It removes DwarfStringPoolEntryRef::isIndexed() and isIndexed bit since they are not used. Differential Revision: https://reviews.llvm.org/D126958
2020-09-17DwarfStringPool.cpp - remove unnecessary StringRef include. NFCI.Simon Pilgrim
Already included in DwarfStringPool.h
2020-09-15[DebugInfo] Make the offset of string pool entries 64-bit (18/19).Igor Kudrin
The string pool is shared among several units in the case of LTO, and it potentially can exceed the limit of 4GiB for an extremely large application. As it is now possible to emit 64-bit debugging info, the limitation can be removed. Differential Revision: https://reviews.llvm.org/D87025
2020-09-15[DebugInfo] Fix emitting DWARF64 DWO compilation units and string offset ↵Igor Kudrin
tables (9/19). These two fixes are better to go together because llvm-dwarfdump is unable to dump a table when another one is malformed. Differential Revision: https://reviews.llvm.org/D87018
2020-09-15[DebugInfo] Fix emitting DWARF64 .debug_str_offsets sections (8/19).Igor Kudrin
The patch fixes calculating the size of the table and emitting the unit length field. Differential Revision: https://reviews.llvm.org/D87017
2020-02-14[MCStreamer] De-capitalize EmitValue EmitIntValue{,InHex}Fangrui Song
2020-02-14[MC] De-capitalize another set of MCStreamer::Emit* functionsFangrui Song
Emit{ValueTo,Code}Alignment Emit{DTP,TP,GP}* EmitSymbolValue etc
2020-02-14[MC] De-capitalize some MCStreamer::Emit* functionsFangrui Song
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-09-30Use the container form llvm::sort(C, ...)Fangrui Song
There are a few leftovers in rL343163 which span two lines. This commit changes these llvm::sort(C.begin(), C.end, ...) to llvm::sort(C, ...) llvm-svn: 343426
2018-08-07[DebugInfo] Reduce debug_str_offsets section sizePavel Labath
Summary: The accelerator tables use the debug_str section to store their strings. However, they do not support the indirect method of access that is available for the debug_info section (DW_FORM_strx et al.). Currently our code is assuming that all strings can/will be referenced indirectly, and puts all of them into the debug_str_offsets section. This is generally true for regular (unsplit) dwarf, but in the DWO case, most of the strings in the debug_str section will only be used from the accelerator tables. Therefore the contents of the debug_str_offsets section will be largely unused and bloating the main executable. This patch rectifies this by teaching the DwarfStringPool to differentiate between strings accessed directly and indirectly. When a user inserts a string into the pool it has to declare whether that string will be referenced directly or not. If at least one user requsts indirect access, that string will be assigned an index ID and put into debug_str_offsets table. Otherwise, the offset table is skipped. This approach reduces the overall binary size (when compiled with -gdwarf-5 -gsplit-dwarf) in my tests by about 2% (debug_str_offsets is shrunk by 99%). Reviewers: probinson, dblaikie, JDevlieghere Subscribers: aprantl, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D49493 llvm-svn: 339122
2018-07-26dwarfgen: Add support for generating the debug_str_offsets section, take 3Pavel Labath
Previous version of this patch failed on darwin targets because of different handling of cross-debug-section relocations. This fixes the tests to emit the DW_AT_str_offsets_base attribute correctly in both cases. Since doing this is a non-trivial amount of code, and I'm going to need it in more than one test, I've added a helper function to the dwarfgen DIE class to do it. Original commit message follows: The motivation for this is D49493, where we'd like to test details of debug_str_offsets behavior which is difficult to trigger from a traditional test. This adds the plubming necessary for dwarfgen to generate this section. The more interesting changes are: - I've moved emitStringOffsetsTableHeader function from DwarfFile to DwarfStringPool, so I can generate the section header more easily from the unit test. - added a new addAttribute overload taking an MCExpr*. This is used to generate the DW_AT_str_offsets_base, which links a compile unit to the offset table. I've also added a basic test for reading and writing DW_form_strx forms. Reviewers: dblaikie, JDevlieghere, probinson Subscribers: llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D49670 llvm-svn: 338031
2018-07-25Revert "dwarfgen: Add support for generating the debug_str_offsets section, ↵Pavel Labath
take 2" This reverts commit r337933. The build error is fixed but the test now fails on the darwin buildbots. Investigating... llvm-svn: 337935
2018-07-25dwarfgen: Add support for generating the debug_str_offsets section, take 2Pavel Labath
This recommits r337910 after fixing an "ambiguous call to addAttribute" error with some compilers (gcc circa 4.9 and MSVC). It seems that these compilers will consider a "false -> pointer" conversion during overload resolution. This creates ambiguity because one I added an overload which takes a MCExpr * as an argument. I fix this by making the new overload take MCExpr&, which avoids the conversion. It also documents the fact that we expect a valid MCExpr object. Original commit message follows: The motivation for this is D49493, where we'd like to test details of debug_str_offsets behavior which is difficult to trigger from a traditional test. This adds the plubming necessary for dwarfgen to generate this section. The more interesting changes are: - I've moved emitStringOffsetsTableHeader function from DwarfFile to DwarfStringPool, so I can generate the section header more easily from the unit test. - added a new addAttribute overload taking an MCExpr*. This is used to generate the DW_AT_str_offsets_base, which links a compile unit to the offset table. I've also added a basic test for reading and writing DW_form_strx forms. Reviewers: dblaikie, JDevlieghere, probinson Subscribers: llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D49670 llvm-svn: 337933
2018-07-25Revert "dwarfgen: Add support for generating the debug_str_offsets section"Pavel Labath
This reverts commit r337910 as it's generating "ambiguous call to addAttribute" errors on some bots. Will resubmit once I get a chance to look into the problem. llvm-svn: 337924
2018-07-25dwarfgen: Add support for generating the debug_str_offsets sectionPavel Labath
Summary: The motivation for this is D49493, where we'd like to test details of debug_str_offsets behavior which is difficult to trigger from a traditional test. This adds the plubming necessary for dwarfgen to generate this section. The more interesting changes are: - I've moved emitStringOffsetsTableHeader function from DwarfFile to DwarfStringPool, so I can generate the section header more easily from the unit test. - added a new addAttribute overload taking an MCExpr*. This is used to generate the DW_AT_str_offsets_base, which links a compile unit to the offset table. I've also added a basic test for reading and writing DW_form_strx forms. Reviewers: dblaikie, JDevlieghere, probinson Subscribers: llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D49670 llvm-svn: 337910
2018-01-26[DWARF] Generate DWARF v5 string offsets tables along with strx* index forms.Wolfgang Pieb
Summary: This is the producer side for DWARF v5 string offsets tables. The reader/consumer side was committed with r321295. All compile and type units in a module share a contribution to the string offsets table. Indirect strings use the strx{1,2,3,4} index forms. Reviewers: dblaikie, aprantl, JDevliegehere Differential Revision: https://reviews.llvm.org/D42021 llvm-svn: 323546
2017-08-17[CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko
other minor fixes (NFC). llvm-svn: 311124
2015-05-24AsmPrinter: Avoid creating symbols in DwarfStringPoolDuncan P. N. Exon Smith
Stop creating symbols we don't need in `DwarfStringPool`. The consumers only call `DwarfStringPoolEntryRef::getSymbol()` when DWARF is relocatable, so this just stops creating the unused symbols when it's not. This drops memory usage from 851 MB to 845 MB, around 0.7%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238122
2015-05-24AsmPrinter: Prune an include, NFCDuncan P. N. Exon Smith
llvm-svn: 238121
2015-05-24AsmPrinter: Extract DwarfStringPoolEntry from DwarfStringPool, NFCDuncan P. N. Exon Smith
Extract out `DwarfStringPoolEntry` and `DwarfStringPoolRef` from `DwarfStringPool` so that downstream users can start using `DwarfStringPool::getEntry()` directly. This will allow users to delay the decision between emitting a symbol or an offset until later. llvm-svn: 238116
2015-05-24AsmPrinter: Emit the DwarfStringPool offset directly when possibleDuncan P. N. Exon Smith
Change `DwarfStringPool` to calculate byte offsets on-the-fly, and update `DwarfUnit::getLocalString()` to use a `DIEInteger` instead of a `DIEDelta` when Dwarf doesn't use relocations (i.e., Mach-O). This eliminates another call to `EmitLabelDifference()`, and drops memory usage from 865 MB down to 861 MB, around 0.5%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) llvm-svn: 238114
2015-05-24AsmPrinter: Refactor DwarfStringPool::getEntry(), NFCDuncan P. N. Exon Smith
Move `DwarfStringPool`'s `getEntry()` to the header (and make it a member function) in preparation for calculating symbol offsets on-the-fly. llvm-svn: 238112
2015-05-21Move alignment from MCSectionData to MCSection.Rafael Espindola
This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
2015-04-24[AsmPrinter] Make AsmPrinter's OutStreamer member a unique_ptr.Lang Hames
AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a reference for this is crufty. llvm-svn: 235752
2015-03-17Centralize the handling of unique ids for temporary labels.Rafael Espindola
Before this patch code wanting to create temporary labels for a given entity (function, cu, exception range, etc) had to keep its own counter to have stable symbol names. createTempSymbol would still add a suffix to make sure a new symbol was always returned, but it kept a single counter. Because of that, if we were to use just createTempSymbol("cu_begin"), the label could change from cu_begin42 to cu_begin43 because some other code started using temporary labels. Simplify this by just keeping one counter per prefix and removing the various specialized counters. llvm-svn: 232535
2015-03-17Convert the easy cases of GetTempSymbol to createTempSymbol.Rafael Espindola
In these cases no code was depending on GetTempSymbol finding an existing symbol. llvm-svn: 232478
2014-11-19Remove StringMap::GetOrCreateValue in favor of StringMap::insertDavid Blaikie
Having two ways to do this doesn't seem terribly helpful and consistently using the insert version (which we already has) seems like it'll make the code easier to understand to anyone working with standard data structures. (I also updated many references to the Entry's key and value to use first() and second instead of getKey{Data,Length,} and get/setValue - for similar consistency) Also removes the GetOrCreateValue functions so there's less surface area to StringMap to fix/improve/change/accommodate move semantics, etc. llvm-svn: 222319
2014-09-11Remove the unused string section symbol parameter from DwarfFile::emitStringsDavid Blaikie
And since it /looked/ like the DwarfStrSectionSym was unused, I tried removing it - but then it turned out that DwarfStringPool was reconstructing the same label (and expecting it to have already been emitted) and uses that. So I kept it around, but wanted to pass it in to users - since it seemed a bit silly for DwarfStringPool to have it passed in and returned but itself have no use for it. The only two users don't handle strings in both .dwo and .o files so they only ever need the one symbol - no need to keep it (and have an unused symbol) in the DwarfStringPool used for fission/.dwo. Refactor a bunch of accelerator table usage to remove duplication so I didn't have to touch 4-5 callers. llvm-svn: 217628
2014-04-27Make helper functions static.Benjamin Kramer
llvm-svn: 207359
2014-04-25Encapsulate the DWARF string pool in a separate type.David Blaikie
Pulls out some more code from some of the rather monolithic DWARF classes. Unlike the address table, the string table won't move up into DwarfDebug - each DWARF file has its own string table (but there can be only one address table). llvm-svn: 207277