- Jan 10, 2017
-
-
Victor Leschuk authored
Support for DW_FORM_implicit_const DWARFv5 feature. When this form is used attribute value goes to .debug_abbrev section (as SLEB). As this form would break any debug tool which doesn't support DWARFv5 it is guarded by dwarf version check. Attempt to use this form with dwarf version <= 4 is considered a fatal error. Differential Revision: https://reviews.llvm.org/D28456 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291599 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jan 05, 2017
-
-
Greg Clayton authored
Differential Revision: https://reviews.llvm.org/D28303 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291194 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 09, 2016
-
-
Benjamin Kramer authored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289208 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 08, 2016
-
-
Simon Pilgrim authored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289037 91177308-0d34-0410-b5e6-96231b3b80d8
-
Greg Clayton authored
The only tests we have for the DWARF parser are the tests that use llvm-dwarfdump and expect output from textual dumps. More DWARF parser modification are coming in the next few weeks and I wanted to add tests that can verify that we can encode and decode all form types, as well as test some other basic DWARF APIs where we ask DIE objects for their children and siblings. DwarfGenerator.cpp was added in the lib/CodeGen directory. This file contains the code necessary to easily create DWARF for tests: dwarfgen::Generator DG; Triple Triple("x86_64--"); bool success = DG.init(Triple, Version); if (!success) return; dwarfgen::CompileUnit &CU = DG.addCompileUnit(); dwarfgen::DIE CUDie = CU.getUnitDIE(); CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c"); CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C); dwarfgen::DIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram); SubprogramDie.addAttribute(DW_AT_name, DW_FORM_strp, "main"); SubprogramDie.addAttribute(DW_AT_low_pc, DW_FORM_addr, 0x1000U); SubprogramDie.addAttribute(DW_AT_high_pc, DW_FORM_addr, 0x2000U); dwarfgen::DIE IntDie = CUDie.addChild(DW_TAG_base_type); IntDie.addAttribute(DW_AT_name, DW_FORM_strp, "int"); IntDie.addAttribute(DW_AT_encoding, DW_FORM_data1, DW_ATE_signed); IntDie.addAttribute(DW_AT_byte_size, DW_FORM_data1, 4); dwarfgen::DIE ArgcDie = SubprogramDie.addChild(DW_TAG_formal_parameter); ArgcDie.addAttribute(DW_AT_name, DW_FORM_strp, "argc"); // ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref4, IntDie); ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref_addr, IntDie); StringRef FileBytes = DG.generate(); MemoryBufferRef FileBuffer(FileBytes, "dwarf"); auto Obj = object::ObjectFile::createObjectFile(FileBuffer); EXPECT_TRUE((bool)Obj); DWARFContextInMemory DwarfContext(*Obj.get()); This code is backed by the AsmPrinter code that emits DWARF for the actual compiler. While adding unit tests it was discovered that DIEValue that used DIEEntry as their values had bugs where DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref8, and DW_FORM_ref_udata forms were not supported. These are all now supported. Added support for DW_FORM_string so we can emit inlined C strings. Centralized the code to unique abbreviations into a new DIEAbbrevSet class and made both the dwarfgen::Generator and the llvm::DwarfFile classes use the new class. Fixed comments in the llvm::DIE class so that the Offset is known to be the compile/type unit offset. DIEInteger now supports more DW_FORM values. There are also unit tests that cover: Encoding and decoding all form types and values Encoding and decoding all reference types (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata, DW_FORM_ref_addr) including cross compile unit references with that go forward one compile unit and backward on compile unit. Differential Revision: https://reviews.llvm.org/D27326 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289010 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Dec 01, 2016
-
-
David Blaikie authored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288421 91177308-0d34-0410-b5e6-96231b3b80d8
-
Greg Clayton authored
This change removes the dependency on DwarfDebug that was used for DW_FORM_ref_addr by making a new DIEUnit class in DIE.cpp. The DIEUnit class represents a compile or type unit and it owns the unit DIE as an instance variable. This allows anyone with a DIE, to get the unit DIE, and then get back to its DIEUnit without adding any new ivars to the DIE class. Why was this needed? The DIE class has an Offset that is always the CU relative DIE offset, not the "offset in debug info section" as was commented in the header file (the comment has been corrected). This is great for performance because most DIE references are compile unit relative and this means most code that accessed the DIE's offset didn't need to make it into a compile unit relative offset because it already was. When we needed to emit a DW_FORM_ref_addr though, we needed to find the absolute offset of the DIE by finding the DIE's compile/type unit. This class did have the absolute debug info/type offset and could be added to the CU relative offset to compute the absolute offset. With this change we can easily get back to a DIE's DIEUnit which will have this needed offset. Prior to this is required having a DwarfDebug and required calling: DwarfCompileUnit *DwarfDebug::lookupUnit(const DIE *CU) const; Now we can use the DIEUnit class to do so without needing DwarfDebug. All clients now use DIEUnit objects (the DwarfDebug stack and the DwarfLinker). A follow on patch for the DWARF generator will also take advantage of this. Differential Revision: https://reviews.llvm.org/D27170 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288399 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Nov 11, 2016
-
-
Adrian Prantl authored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286610 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Nov 10, 2016
-
-
Eugene Zelenko authored
Fix some Clang-tidy modernize-use-default and readability-redundant-member-init and Include What You Use warnings; other minor fixes. Differential revision: https://reviews.llvm.org/D26087 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286484 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 17, 2016
-
-
Benjamin Kramer authored
Contains some manual fixes. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273047 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Apr 18, 2016
-
-
Mehdi Amini authored
Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266595 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Feb 11, 2016
-
-
Peter Collingbourne authored
Rather than storing type units in a vector and emitting them at the end of code generation, emit them immediately and destroy them, reclaiming the memory we were using for their DIEs. In one benchmark carried out against Chromium's 50 largest (by bitcode file size) translation units, total peak memory consumption with type units decreased by median 17%, or by 7% when compared against disabling type units. Tested using check-{llvm,clang}, the GDB 7.5 test suite (with '-fdebug-types-section') and by eyeballing llvm-dwarfdump output on those Chromium translation units with split DWARF both disabled and enabled, and verifying that the only changes were to addresses and abbreviation ordering. Differential Revision: http://reviews.llvm.org/D17118 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260578 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Feb 01, 2016
-
-
Amjad Aboud authored
Changed emitting offset of macinfo entry into compiler unit DIE to use "addSectionLabel" method rather than explicitly calculating size/offset of macro entry. Differential Revision: http://reviews.llvm.org/D16292 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259358 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jan 07, 2016
-
-
Amjad Aboud authored
Differential Revision: http://reviews.llvm.org/D15495 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257060 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Nov 24, 2015
-
-
Davide Italiano authored
Switch dump()/print() method definitions to LLVM_DUMP_METHOD instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253945 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Aug 02, 2015
-
-
Duncan P. N. Exon Smith authored
Change `DIELoc` and `DIEBlock` to stop inheriting from `DIE`, instead inheriting from `DIEValueList` to share the value storage API. This awkward bit of code-sharing was also fairly confusing: neither `DIELoc` nor `DIEBlock` represents a `DIE`, so why would they inherit from it? Aside from the API cleanup, this should improve debug info memory usage in the backend, since it shaves five pointers off of every `DIELoc` and `DIEBlock`. I haven't bothered to measure the savings, though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243858 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Rewrite `DIEValueList` as a subclass of `DIE`, renaming its API to match `DIE`'s. This is preparation for changing `DIEBlock` and `DIELoc` to stop inheriting from `DIE` and inherit directly from `DIEValueList`. I thought about leaving this as a has-a relationship (and changing `DIELoc` and `DIEBlock` to also have-a `DIEValueList`), but that seemed to require a fair bit more boilerplate and I think it needed more changes to the `DwarfUnit` API than this will. No functionality change intended here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243854 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243853 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 27, 2015
-
-
Duncan P. N. Exon Smith authored
There are two main reasons why a linked-list makes sense for `DIEValueList`. 1. We want `DIE` to be on a `BumpPtrAllocator` to improve teardown efficiency. Making `DIEValueList` array-based would make that much more complicated. 2. The singly-linked list is fairly memory efficient. The histogram [1] shows that most DIEs have relatively few values, so we often pay less than the 2/3-pointer static overhead of a vector. Furthermore, we don't know ahead of time exactly how many values a `DIE` needs, so a vector-like scheme will on average over-allocate by ~50%. As it happens, that's the same memory overhead as the linked list node. [1]: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-May/085910.html The comment I added to the code is a little more succinct, but I think it's enough to give the idea. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240868 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 26, 2015
-
-
Duncan P. N. Exon Smith authored
r240748 seems to be on the right path. Be more explicit. http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/1961/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240750 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Try to placate bots by explicitly scoping a conversion constructor from `iterator` to `const_iterator`. http://lab.llvm.org:8011/builders/sanitizer-windows/builds/5931/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240748 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 25, 2015
-
-
Duncan P. N. Exon Smith authored
Replace the `std::vector<>` for `DIE::Children` with an intrusively linked list. This is a strict memory improvement: it requires no auxiliary storage, and reduces `sizeof(DIE)` by one pointer. It also factors out the DIE-related malloc traffic. This drops llc memory usage from 735 MB down to 718 MB, or ~2.3%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240736 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Change `DIE::Values` to a singly linked list, where each node is allocated on a `BumpPtrAllocator`. In order to support `push_back()`, the list is circular, and points at the tail element instead of the head. I abstracted the core list logic out to `IntrusiveBackList` so that it can be reused for `DIE::Children`, which also cares about `push_back()`. This drops llc memory usage from 799 MB down to 735 MB, about 8%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240733 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 24, 2015
-
-
Duncan P. N. Exon Smith authored
Stop taking a `dwarf::Form` in `DIEValue::EmitValue()` and `DIEValue::SizeOf()`, since they're always passed `DIEValue::getForm()` anyway. This is just left over from when `DIEValue` didn't know its own form. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240566 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 23, 2015
-
-
Alexander Kornienko authored
Apparently, the style needs to be agreed upon first. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240390 91177308-0d34-0410-b5e6-96231b3b80d8
-
- Jun 19, 2015
-
-
Alexander Kornienko authored
The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240137 91177308-0d34-0410-b5e6-96231b3b80d8
-
- May 28, 2015
-
-
Duncan P. N. Exon Smith authored
Update `DIE` API to hide the implementation of `DIE::Children` so we can swap it out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238468 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238456 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
GCC seems to have some overzealous warnings about strict aliasing. Rafael reports that this patch suppresses them on GCC 4.9, and I'm hoping this will work for GCC 4.7 as well. I'll watch [1] and iterate if necessary. [1]: http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/8597 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238447 91177308-0d34-0410-b5e6-96231b3b80d8
-
- May 27, 2015
-
-
Duncan P. N. Exon Smith authored
Change `DIE::addChild()` to return a reference to the just-added node, and update consumers to use it directly. An upcoming commit will abstract away (and eventually change) the underlying storage of `DIE::Children`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238372 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Change the `DIE` API to hide the implementation of the list of `DIEValue`s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238369 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Stop storing a `DIEAbbrev` in `DIE`, since the data fits neatly inside the `DIEValue` list. Besides being a cleaner data structure (avoiding the parallel arrays), this gives us more freedom to rearrange the `DIEValue` list. This fixes the temporary memory regression from 845 MB up to 879 MB, and drops it further to 829 MB for a net memory decrease of around 1.9% (incremental decrease around 5.7%). (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238364 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
This reverts commit r238350, effectively reapplying r238349 after fixing (all?) the problems, all somehow related to how I was using `AlignedArrayCharUnion<>` inside `DIEValue`: - MSVC can only handle `sizeof()` on types, not values. Change the assert. - GCC doesn't know the `is_trivially_copyable` type trait. Instead of asserting it, add destructors. - Call placement new even when constructing POD (i.e., the pointers). - Instead of copying the char buffer, copy the casted classes. I've left in a couple of `static_assert`s that I think both MSVC and GCC know how to handle. If the bots disagree with me, I'll remove them. - Check that the constructed type is either standard layout or a pointer. This protects against a programming error: we really want the "small" `DIEValue`s to be small and simple, so don't accidentally change them not to be. - Similarly, check that the size of the buffer is no bigger than a `uint64_t` or a pointer. (I thought checking against `sizeof(uint64_t)` would be good enough, but Chandler suggested that pointers might sometimes be bigger than that in the context of sanitizers.) I've also committed r238359 in the meantime, which introduces a DIEValue.def to simplify dispatching between the various types (thanks to a review comment by David Blaikie). Without that, this commit would be almost unintelligible. Here's the original commit message: -- Change `DIEValue` to be stored/passed/etc. by value, instead of reference. It's now a discriminated union, with a `Val` field storing the actual type. The classes that used to inherit from `DIEValue` no longer do. There are two categories of these: - Small values fit in a single pointer and are stored by value. - Large values require auxiliary storage, and are stored by reference. The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp. It was relying on `DIEInteger`s being passed around by reference, so I replaced that assumption with a `PatchLocation` type that stores a safe reference to where the `DIEInteger` lives instead. This commit causes a temporary regression in memory usage, since I've left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit. I measured an increase from 845 MB to 879 MB, around 3.9%. The follow-up drops it lower than the starting point, and I've only recently brought the memory this low anyway, so I'm committing these changes separately to keep them incremental. (I also considered swapping the commits, but the other one first would cause a lot more code churn.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) -- git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238362 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Use a .def macro file to iterate through the various subclasses of `DIEValue`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238359 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
This reverts commit r238349, since it caused some errors on bots: - std::is_trivially_copyable isn't available until GCC 5.0. - It was complaining about strict aliasing with my use of ArrayCharUnion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238350 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Change `DIEValue` to be stored/passed/etc. by value, instead of reference. It's now a discriminated union, with a `Val` field storing the actual type. The classes that used to inherit from `DIEValue` no longer do. There are two categories of these: - Small values fit in a single pointer and are stored by value. - Large values require auxiliary storage, and are stored by reference. The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp. It was relying on `DIEInteger`s being passed around by reference, so I replaced that assumption with a `PatchLocation` type that stores a safe reference to where the `DIEInteger` lives instead. This commit causes a temporary regression in memory usage, since I've left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit. I measured an increase from 845 MB to 879 MB, around 3.9%. The follow-up drops it lower than the starting point, and I've only recently brought the memory this low anyway, so I'm committing these changes separately to keep them incremental. (I also considered swapping the commits, but the other one first would cause a lot more code churn.) (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238349 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
An upcoming commit will switch to storing `DIEValue`s by value in a `DIE`, so move the `DIE` down below all the subclasses it can. Two subclasses inherit from `DIE`, so drop those down below `DIE`. `DIEValue` will become a discriminated union, which contains an instance of one of the classes that are currently subclasses. "Big" ones, such as those that inherit from `DIE`, will continue to be stored by pointer. This commit does as much of the code motion ahead of time as possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238346 91177308-0d34-0410-b5e6-96231b3b80d8
-
- May 24, 2015
-
-
Duncan P. N. Exon Smith authored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238123 91177308-0d34-0410-b5e6-96231b3b80d8
-
Duncan P. N. Exon Smith authored
Expose the `DwarfStringPool` entry in a header, and store a pointer to it directly in `DIEString`. Instead of choosing at creation time how to emit it, use the `dwarf::Form` to determine that at emission time. Besides avoiding the other `DIEValue`, this shaves two pointers off of `DIEString`; the data is now a single pointer. This is a nice cleanup on its own -- and drops memory usage from 861 MB down to 853 MB, around 0.9% -- but it's also preparation for passing `DIEValue`s by value. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238117 91177308-0d34-0410-b5e6-96231b3b80d8
-
- May 23, 2015
-
-
Duncan P. N. Exon Smith authored
Remove all virtual functions from `DIEValue`, dropping the vtable pointer from its layout. Instead, create "impl" functions on the subclasses, and use the `DIEValue::Type` to implement the dynamic dispatch. This is necessary -- obviously not sufficient -- for passing `DIEValue`s around by value. However, this change stands on its own: we make tons of these. I measured a drop in memory usage from 888 MB down to 860 MB, or around 3.2%. (I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`; see r236629 for details.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238084 91177308-0d34-0410-b5e6-96231b3b80d8
-