summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
Commit message (Collapse)AuthorAgeFilesLines
...
* [codeview] Finish support for reading and writing S_ANNOTATION recordsReid Kleckner2019-05-151-0/+6
| | | | | | Implement dumping via llvm-pdbutil and llvm-readobj. llvm-svn: 360813
* [COFF] Fix .bss section size bug in obj2yaml / yaml2objReid Kleckner2019-05-101-0/+6
| | | | | | | | | We need to serialize SizeOfRawData through even when there is no data, as in a .bss section. Fixes PR41836 llvm-svn: 360473
* MinidumpYAML: add support for the ThreadList streamPavel Labath2019-05-091-30/+96
| | | | | | | | | | | | | | | | | | | Summary: The implementation is a pretty straightforward extension of the pattern used for (de)serializing the ModuleList stream. Since there are other streams which use the same format (MemoryList and MemoryList64, at least). I tried to generalize the code a bit so that adding future streams of this type can be done with less code. Reviewers: amccarth, jhenderson, clayborg Subscribers: markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61423 llvm-svn: 360350
* [yaml2obj] - Allow setting st_value explicitly for Symbol.George Rimar2019-05-071-4/+5
| | | | | | | | | | In some cases it is useful to explicitly set symbol's st_name value. For example, I am using it in a patch for LLD to remove the broken binary from a test case and replace it with a YAML test. Differential revision: https://reviews.llvm.org/D61180 llvm-svn: 360137
* [WebAssembly] Add more test coverage for reloctions against section symbolsSam Clegg2019-05-071-1/+2
| | | | | | | | | | | | | The only known user of this relocation type and symbol type is the debug info sections, but we were not testing the `--relocatable` output path. This change adds a minimal test case to cover relocations against section symbols includes `--relocatable` output. Differential Revision: https://reviews.llvm.org/D61623 llvm-svn: 360110
* [WebAssembly] Support EXPLICIT_NAME symbols in llvm-readobjDan Gohman2019-04-301-0/+1
| | | | | | | | | Teach llvm-readobj about WASM_SYMBOL_EXPLICIT_NAME. Differential Revision: https://reviews.llvm.org/D61323 Reviewer: sbc100 llvm-svn: 359602
* [yaml2obj] - Don't crash on invalid inputs.George Rimar2019-04-251-7/+5
| | | | | | | | | | | | | | yaml2obj might crash on invalid input when unable to parse the YAML. Recently a crash with a very similar nature was fixed for an empty files. This patch revisits the fix and does it in yaml::Input instead. It seems to be more correct way to handle such situation. With that crash for invalid inputs is also fixed now. Differential revision: https://reviews.llvm.org/D61059 llvm-svn: 359178
* [AMDGPU] Add gfx1010 target definitionsStanislav Mekhanoshin2019-04-241-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D61041 llvm-svn: 359113
* MinidumpYAML: Fix ambiguity between std::make_unique and llvm::make_uniqueBenjamin Kramer2019-04-181-1/+1
| | | | llvm-svn: 358673
* MinidumpYAML: Add support for ModuleList streamPavel Labath2019-04-181-12/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support for yaml (de)serialization of the minidump ModuleList stream. It's a fairly straight forward-application of the existing patterns to the ModuleList structures defined in previous patches. One thing, which may be interesting to call out explicitly is the addition of "new" allocation functions to the helper BlobAllocator class. The reason for this was, that there was an emerging pattern of a need to allocate space for entities, which do not have a suitable lifetime for use with the existing allocation functions. A typical example of that was the "size" of various lists, which is only available as a temporary returned by the .size() method of some container. For these cases, one can use the new set of allocation functions, which will take a temporary object, and store it in an allocator-managed buffer until it is written to disk. Reviewers: amccarth, jhenderson, clayborg, zturner Subscribers: lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60405 llvm-svn: 358672
* [WebAssembly] Add DataCount section to object filesThomas Lively2019-04-121-0/+11
| | | | | | | | | | | | | | | | | | | Summary: This ensures that object files will continue to validate as WebAssembly modules in the presence of bulk memory operations. Engines that don't support bulk memory operations will not recognize the DataCount section and will report validation errors, but that's ok because object files aren't supposed to be run directly anyway. Reviewers: aheejin, dschuff, sbc100 Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60623 llvm-svn: 358315
* Fix MSVC build for r357749Pavel Labath2019-04-051-5/+5
| | | | | | | | MSVC found the bare "make_unique" invocation ambiguous (between std:: and llvm:: versions). Explicitly qualifying the call with llvm:: should hopefully fix it. llvm-svn: 357750
* Minidump: Add support for reading/writing stringsPavel Labath2019-04-051-5/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Strings in minidump files are stored as a 32-bit length field, giving the length of the string in *bytes*, which is followed by the appropriate number of UTF16 code units. The string is also supposed to be null-terminated, and the null-terminator is not a part of the length field. This patch: - adds support for reading these strings out of the minidump file (this implementation does not depend on proper null-termination) - adds support for writing them to a minidump file - using the previous two pieces implements proper (de)serialization of the CSDVersion field of the SystemInfo stream. Previously, this was only read/written as hex, and no attempt was made to access the referenced string -- now this string is read and written correctly. The changes are tested via yaml2obj|obj2yaml round-trip as well as a unit test which checks the corner cases of the string deserialization logic. Reviewers: jhenderson, zturner, clayborg Subscribers: llvm-commits, aprantl, markmentovai, amccarth, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59775 llvm-svn: 357749
* [XCOFF] Add functionality for parsing AIX XCOFF object file headersHubert Tong2019-04-042-0/+43
| | | | | | | | | | | | | | | | | | | | | Summary: 1. Add functionality for parsing AIX XCOFF object files headers. 2. Only support 32-bit AIX XCOFF object files in this patch. 3. Print out the AIX XCOFF object file header in YAML format. Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk Reviewed By: sfertile, hubert.reinterpretcast Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59419 Patch by Digger Lin llvm-svn: 357663
* [codeview] Remove Type member from CVRecordReid Kleckner2019-04-042-3/+3
| | | | | | | | | | | | | | | | | Summary: Now CVType and CVSymbol are effectively type-safe wrappers around ArrayRef<uint8_t>. Make the kind() accessor load it from the RecordPrefix, which is the same for types and symbols. Reviewers: zturner, aganea Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60018 llvm-svn: 357658
* [yaml2obj][obj2yaml] - Change how symbol's binding is descibed when ↵George Rimar2019-04-031-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parsing/dumping. Currently, YAML has the following syntax for describing the symbols: Symbols: Local: LocalSymbol1: ... LocalSymbol2: ... ... Global: GlobalSymbol1: ... Weak: ... GNUUnique: I.e. symbols are grouped by their bindings. That is not very convenient, because: It does not allow to set a custom binding, what can be useful for producing broken/special outputs for test cases. Adding a new binding would require to change a syntax (what we observed when added GNUUnique recently). It does not allow to change the order of the symbols in .symtab/.dynsym, i.e. currently all Local symbols are placed first, then Global, Weak and GNUUnique are following, but we are not able to change the order. It is not consistent. Binding is just one of the properties of the symbol, we do not group them by other properties. It makes the code more complex that it can be. This patch shows it can be simplified with the change performed. The patch changes the syntax to just: Symbols: Symbol1: ... Symbol2: ... ... With that, we are able to work with the binding field just like with any other symbol property. Differential revision: https://reviews.llvm.org/D60122 llvm-svn: 357595
* [ObjectYAML] Fix build issueMichael Liao2019-04-021-1/+1
| | | | | | | - ObjectYAML depends on Object as minidump support adds additional dependency. llvm-svn: 357471
* Add minidump support to obj2yamlPavel Labath2019-04-021-0/+32
| | | | | | | | | | | | | | | | | Summary: This patch adds the code needed to parse a minidump file into the MinidumpYAML model, and the necessary glue code so that obj2yaml can recognise the minidump files and process them. Reviewers: jhenderson, zturner, clayborg Subscribers: mgorny, lldb-commits, amccarth, markmentovai, aprantl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59634 llvm-svn: 357469
* [yaml2obj][obj2yaml] - Teach yaml2obj/obj2yaml tools about STB_GNU_UNIQUE ↵George Rimar2019-03-281-2/+3
| | | | | | | | | | | | | symbols. yaml2obj/obj2yaml does not support the symbols with STB_GNU_UNIQUE yet. Currently, obj2yaml fails with llvm_unreachable when met such a symbol. I faced it when investigated the https://bugs.llvm.org/show_bug.cgi?id=41196. Differential revision: https://reviews.llvm.org/D59875 llvm-svn: 357158
* MinidumpYAML.cpp: Fix some code standard violations missed during reviewPavel Labath2019-03-251-12/+12
| | | | | | functions should begin with lower case letters. NFC. llvm-svn: 356901
* [ObjectYAML] Add basic minidump generation supportPavel Labath2019-03-223-0/+389
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the ability to read a yaml form of a minidump file and write it out as binary. Apart from the minidump header and the stream directory, only three basic stream kinds are supported: - Text: This kind is used for streams which contain textual data. This is typically the contents of a /proc file on linux (e.g. /proc/PID/maps). In this case, we just put the raw stream contents into the yaml. - SystemInfo: This stream contains various bits of information about the host system in binary form. We expose the data in a structured form. - Raw: This kind is used as a fallback when we don't have any special knowledge about the stream. In this case, we just print the stream contents in hex. For this code to be really useful, more stream kinds will need to be added (particularly for things like lists of memory regions and loaded modules). However, these can be added incrementally. Reviewers: jhenderson, zturner, clayborg, aprantl Subscribers: mgorny, lemo, llvm-commits, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59482 llvm-svn: 356753
* [WebAssembly] Target features sectionThomas Lively2019-03-201-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Implements a new target features section in assembly and object files that records what features are used, required, and disallowed in WebAssembly objects. The linker uses this information to ensure that all objects participating in a link are feature-compatible and records the set of used features in the output binary for use by optimizers and other tools later in the toolchain. The "atomics" feature is always required or disallowed to prevent linking code with stripped atomics into multithreaded binaries. Other features are marked used if they are enabled globally or on any function in a module. Future CLs will add linker flags for ignoring feature compatibility checks and for specifying the set of allowed features, implement using the presence of the "atomics" feature to control the type of memory and segments in the linked binary, and add front-end flags for relaxing the linkage policy for atomics. Reviewers: aheejin, sbc100, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, mgrang, jfb, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59173 llvm-svn: 356610
* [yaml2obj]Allow explicit setting of p_filesz, p_memsz, and p_offsetJames Henderson2019-03-151-0/+3
| | | | | | | | | | | | | | yaml2obj currently derives the p_filesz, p_memsz, and p_offset values of program headers from their sections. This makes writing tests for certain formats more complex, and sometimes impossible. This patch allows setting these fields explicitly, overriding the default value, when relevant. Reviewed by: jakehehrlich, Higuoxing Differential Revision: https://reviews.llvm.org/D59372 llvm-svn: 356247
* [yaml2obj] - Allow producing ELFDATANONE ELFsGeorge Rimar2019-03-071-2/+3
| | | | | | | | | I need this to remove a binary from LLD test suite. The patch also simplifies the code a bit. Differential revision: https://reviews.llvm.org/D59082 llvm-svn: 355591
* [yaml2obj] - Allow setting custom sh_info for RawContentSection sections.George Rimar2019-03-011-0/+1
| | | | | | | | | | | This is for tweaking SHT_SYMTAB sections. Their sh_info contains the (number of symbols + 1) usually. But for creating invalid inputs for test cases it would be convenient to allow explicitly override this field from YAML. Differential revision: https://reviews.llvm.org/D58779 llvm-svn: 355193
* [yaml2obj][obj2yaml] - Add support for the architecture specific dynamic tags.George Rimar2019-02-261-4/+29
| | | | | | | | | | | This allows tools to parse/dump the architecture specific tags like DT_MIPS_*, DT_PPC64_* and DT_HEXAGON_* Also fixes a bug in DynamicTags.def which was revealed in this patch. Differential revision: https://reviews.llvm.org/D58667 llvm-svn: 354876
* [yaml2obj]Re-allow dynamic sections to have raw contentJames Henderson2019-02-251-0/+1
| | | | | | | | | | | | | | | | Recently, support was added to yaml2obj to allow dynamic sections to have a list of entries, to make it easier to write tests with dynamic sections. However, this change also removed the ability to provide custom contents to the dynamic section, making it hard to test malformed contents (e.g. because the section is not a valid size to contain an array of entries). This change reinstates this. An error is emitted if raw content and dynamic entries are both specified. Reviewed by: grimar, ruiu Differential Review: https://reviews.llvm.org/D58543 llvm-svn: 354770
* [yaml2obj][obj2yaml] - Support SHT_GNU_verdef (.gnu.version_d) section.George Rimar2019-02-211-0/+22
| | | | | | | | | | This patch adds support for parsing/dumping the .gnu.version section. Description of the section is: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symverdefs.html Differential revision: https://reviews.llvm.org/D58437 llvm-svn: 354574
* [yaml2obj]Allow symbol Index field to take values lower than SHN_LORESERVEJames Henderson2019-02-211-3/+0
| | | | | | | | | | | | | | | | | | | | In order to test tool handling of invalid section indexes, I need to create an object containing such an invalid section index. I could create a hex-edited binary, but having the ability to use yaml2obj is preferable. Prior to this change, yaml2obj would reject any explicit section indexes less than SHN_LORESERVE. This patch changes it to allow any value. I had to change the test to use llvm-readelf instead of llvm-readobj, because llvm-readobj does not like invalid section indexes. I've also expanded the test to show that the most common SHN_* values are accepted (SHN_UNDEF, SHN_ABS, SHN_COMMON). Reviewed by: grimar, jakehehrlich Differential Revision: https://reviews.llvm.org/D58445 llvm-svn: 354566
* [ObjectYAML] Support SHT_MIPS_DWARF section type flagFangrui Song2019-02-211-0/+1
| | | | | | | Also reorder SHT_MIPS_DWARF and SHT_MIPS_ABIFLAGS in Object/ELF.cpp. The test will be added by D58457. llvm-svn: 354563
* [WebAssembly] Update MC for bulk memoryThomas Lively2019-02-191-2/+12
| | | | | | | | | | | | | | | | | | Summary: Rename MemoryIndex to InitFlags and implement logic for determining data segment layout in ObjectYAML and MC. Also adds a "passive" flag for the .section assembler directive although this cannot be assembled yet because the assembler does not support data sections. Reviewers: sbc100, aardappel, aheejin, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57938 llvm-svn: 354397
* [yaml2obj][obj2yaml] Remove section type range markers from allowed mappings ↵James Henderson2019-02-191-3/+1
| | | | | | | | | | | | | | | | | | | | | and support hex values yaml2obj/obj2yaml previously supported SHT_LOOS, SHT_HIOS, and SHT_LOPROC for section types. These are simply values that delineate a range and don't really make sense as valid values. For example if a section has type value 0x70000000, obj2yaml shouldn't print this value as SHT_LOPROC. Additionally, this was missing the three other range markers (SHT_HIPROC, SHT_LOUSER and SHT_HIUSER). This change removes these three range markers. It also adds support for specifying the type as an integer, to allow section types that LLVM doesn't know about. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D58383 llvm-svn: 354344
* [yaml2obj][obj2yaml] - Support SHT_GNU_versym (.gnu.version) section.George Rimar2019-02-191-0/+10
| | | | | | | | | This patch adds support for parsing dumping the .gnu.version section. Description of the section is: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symversion.html#SYMVERTBL Differential revision: https://reviews.llvm.org/D58280 llvm-svn: 354338
* Recommit r354328, r354329 "[obj2yaml][yaml2obj] - Add support of ↵George Rimar2019-02-191-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parsing/dumping of the .gnu.version_r section." Fix: Replace assert(!IO.getContext() && "The IO context is initialized already"); with assert(IO.getContext() && "The IO context is not initialized"); (this was introduced in r354329, where I tried to quickfix the darwin BB and seems copypasted the assert from the wrong place). Original commit message: The section is described here: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symverrqmts.html Patch just teaches obj2yaml/yaml2obj to dump and parse such sections. We did the finalization of string tables very late, and I had to move the logic to make it a bit earlier. That was needed in this patch since .gnu.version_r adds strings to .dynstr. This might also be useful for implementing other special sections. Everything else changed in this patch seems to be straightforward. Differential revision: https://reviews.llvm.org/D58119 llvm-svn: 354335
* Revert r354328, r354329 "[obj2yaml][yaml2obj] - Add support of ↵George Rimar2019-02-191-30/+0
| | | | | | | | | parsing/dumping of the .gnu.version_r section." Something went wrong. Bots are unhappy: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/44113/steps/test/logs/stdio llvm-svn: 354332
* Fix BB after r354328.George Rimar2019-02-191-4/+2
| | | | | | | | | | | | | | | | | | | | | Bot: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/30188/steps/build_Lld/logs/stdio Error: /Users/buildslave/as-bldslv9_new/lld-x86_64-darwin13/llvm.src/lib/ObjectYAML/ELFYAML.cpp:1013:15: error: unused variable 'Object' [-Werror,-Wunused-variable] const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext()); ^ /Users/buildslave/as-bldslv9_new/lld-x86_64-darwin13/llvm.src/lib/ObjectYAML/ELFYAML.cpp:1023:15: error: unused variable 'Object' [-Werror,-Wunused-variable] const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext()); Fix: change const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext()); assert(Object && "The IO context is not initialized"); to assert(!IO.getContext() && "The IO context is initialized already"); llvm-svn: 354329
* [obj2yaml][yaml2obj] - Add support of parsing/dumping of the .gnu.version_r ↵George Rimar2019-02-191-0/+32
| | | | | | | | | | | | | | | | | | | | section. The section is described here: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symverrqmts.html Patch just teaches obj2yaml/yaml2obj to dump and parse such sections. We did the finalization of string tables very late, and I had to move the logic to make it a bit earlier. That was needed in this patch since .gnu.version_r adds strings to .dynstr. This might also be useful for implementing other special sections. Everything else changed in this patch seems to be straightforward. Differential revision: https://reviews.llvm.org/D58119 llvm-svn: 354328
* [yaml2obj/obj2yaml] - Move `Info` field out from `Section` class.George Rimar2019-02-121-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ELFYAML.h contains a `Section` class which is a base for a few other sections classes that are used for mapping different section types. `Section` has a `StringRef Info` field used for storing sh_info. At the same time, sh_info has very different meanings for sections and cannot be processed in a similar way generally, for example ELFDumper does not handle it in `dumpCommonSection` but do that in `dumpGroup` and `dumpCommonRelocationSection` respectively. At this moment, we have and handle it as a string, because that was possible for the current use case. But also it can simply be a number: For SHT_GNU_verdef is "The number of version definitions within the section." The patch moves `Info` field out to be able to have it as a number. With that change, each class will be able to decide what type and purpose of the sh_info field it wants to use. I also had to edit 2 test cases. This is because patch fixes a bug. Previously we accepted yaml files with Info fields for all sections (for example, for SHT_DYNSYM too). But we do not handle it and the resulting objects had zero sh_info fields set for such sections. Now it is accepted only for sections that supports it. Differential revision: https://reviews.llvm.org/D58054 llvm-svn: 353810
* [lib/ObjectYAML] - Fix BB after r353607 [2]. NFC.George Rimar2019-02-091-2/+1
| | | | | | | | | | | The second and the last place it seems. Error was: [ 4%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Error.cpp.o /Users/buildslave/as-bldslv9_new/lld-x86_64-darwin13/llvm.src/lib/ObjectYAML/ELFYAML.cpp:993:15: error: unused variable 'Object' [-Werror,-Wunused-variable] const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext()); llvm-svn: 353609
* [lib/ObjectYAML] - Fix BB after r353607. NFC.George Rimar2019-02-091-2/+1
| | | | | | | | | | Error was: [ 4%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/DAGDeltaAlgorithm.cpp.o /Users/buildslave/as-bldslv9_new/lld-x86_64-darwin13/llvm.src/lib/ObjectYAML/ELFYAML.cpp:666:15: error: unused variable 'Object' [-Werror,-Wunused-variable] const auto *Object = static_cast<ELFYAML::Object *>(IO.getContext()); (http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/29920) llvm-svn: 353608
* [yaml2obj][obj2yaml] - Add support for dumping/parsing .dynamic sections.George Rimar2019-02-091-0/+46
| | | | | | | | | This teaches the tools to parse and dump the .dynamic section and its dynamic tags. Differential revision: https://reviews.llvm.org/D57691 llvm-svn: 353606
* [WebAssembly] Add symbol flag to the binary format llvm.usedSam Clegg2019-02-071-0/+1
| | | | | | | | | | | | | | Summary: Rather than add a new attribute See https://github.com/WebAssembly/tool-conventions/issues/64 Subscribers: dschuff, jgravelle-google, aheejin, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57864 llvm-svn: 353360
* [yaml2obj]Allow number for ELF symbol typeJames Henderson2019-02-061-0/+1
| | | | | | | | | | | | | yaml2obj previously only recognised standard STT_* names, and didn't allow arbitrary numbers. This change allows the user to specify a number for the type instead. It also adds a test to verify the existing behaviour for obj2yaml for unkown symbol types. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D57822 llvm-svn: 353315
* [yaml::BinaryRef] Slight perf tuning (for llvm-exegesis analysis mode)Roman Lebedev2019-02-061-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-exegesis uses this functionality to read it's benchmark dumps. This reading of `.yaml`s takes ~60% of runtime for 14656 benchmark points (i.e. one sweep over all x86 instructions), but only 30% of time for 3x as much benchmark points. In particular, this `BinaryRef` appears to be an obvious pain point. Without patch: ``` $ perf stat -r 25 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-orig.html no exegesis target for x86_64-unknown-linux-gnu, using default Parsed 14656 benchmark points Printing sched class consistency analysis results to file '/tmp/clusters-orig.html' ... no exegesis target for x86_64-unknown-linux-gnu, using default Parsed 14656 benchmark points Printing sched class consistency analysis results to file '/tmp/clusters-orig.html' Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-orig.html' (25 runs): 972.86 msec task-clock # 0.994 CPUs utilized ( +- 0.25% ) 30 context-switches # 30.774 M/sec ( +- 21.74% ) 0 cpu-migrations # 0.370 M/sec ( +- 67.81% ) 11873 page-faults # 12211.512 M/sec ( +- 0.00% ) 3898373408 cycles # 4009682.186 GHz ( +- 0.25% ) (83.12%) 360399748 stalled-cycles-frontend # 9.24% frontend cycles idle ( +- 0.54% ) (83.24%) 1099450483 stalled-cycles-backend # 28.20% backend cycles idle ( +- 0.59% ) (33.63%) 4910528820 instructions # 1.26 insn per cycle # 0.22 stalled cycles per insn ( +- 0.13% ) (50.21%) 1111976775 branches # 1143726625.854 M/sec ( +- 0.10% ) (66.77%) 23248474 branch-misses # 2.09% of all branches ( +- 0.19% ) (83.29%) 0.97850 +- 0.00647 seconds time elapsed ( +- 0.66% ) ``` With the patch: ``` $ perf stat -r 25 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file="" -analysis-inconsistencies-output-file=/tmp/clusters-new.html no exegesis target for x86_64-unknown-linux-gnu, using default Parsed 14656 benchmark points Printing sched class consistency analysis results to file '/tmp/clusters-new.html' ... no exegesis target for x86_64-unknown-linux-gnu, using default Parsed 14656 benchmark points Printing sched class consistency analysis results to file '/tmp/clusters-new.html' Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=1.0 -benchmarks-file=/tmp/benchmarks-inverse_throughput-onefull.yaml -analysis-clusters-output-file= -analysis-inconsistencies-output-file=/tmp/clusters-new.html' (25 runs): 905.29 msec task-clock # 0.999 CPUs utilized ( +- 0.11% ) 15 context-switches # 16.533 M/sec ( +- 32.27% ) 0 cpu-migrations # 0.000 K/sec 11873 page-faults # 13121.789 M/sec ( +- 0.00% ) 3627759720 cycles # 4009283.100 GHz ( +- 0.11% ) (83.19%) 370401480 stalled-cycles-frontend # 10.21% frontend cycles idle ( +- 0.22% ) (83.19%) 1007114438 stalled-cycles-backend # 27.76% backend cycles idle ( +- 0.34% ) (33.62%) 4414014304 instructions # 1.22 insn per cycle # 0.23 stalled cycles per insn ( +- 0.08% ) (50.36%) 1003751700 branches # 1109314021.971 M/sec ( +- 0.07% ) (66.97%) 24611010 branch-misses # 2.45% of all branches ( +- 0.10% ) (83.41%) 0.90593 +- 0.00105 seconds time elapsed ( +- 0.12% ) ``` So this decreases the overall run time of llvm-exegesis analysis mode (on one sweep) by roughly -7%. To be noted, `BinaryRef::writeAsBinary()` change is the reason for the perf changes, usage of `llvm::isHexDigit()` instead of `isxdigit()` does not appear to have any perf impact, i have only changed it "for symmetry". `writeAsBinary()` change is correct, it produces identical de-hex-ified buffer, and the final output is thus identical: ``` $ sha512sum /tmp/clusters-* db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf /tmp/clusters-new.html db4bbd904fe8840853b589b032c5041bc060b91bcd9c27b914b56581fbc473550eea74b852238c79963b5adf2419f379e9f5db76784048b48e3937f9f3e732bf /tmp/clusters-orig.html ``` Reviewers: silvas, espindola, sbc100, zturner, courbet, gchatelet Reviewed By: gchatelet Subscribers: tschuett, RKSimon, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57699 llvm-svn: 353282
* [COFF] Add new relocation types.Martin Storsjo2019-01-271-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D57291 llvm-svn: 352324
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1915-60/+45
| | | | | | | | | | | | | | | | | 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
* [WebAssembly] Parse llvm.ident into producers sectionThomas Lively2019-01-171-0/+18
| | | | llvm-svn: 351413
* Revert "[WebAssembly] Parse llvm.ident into producers section"Thomas Lively2019-01-171-18/+0
| | | | | | This reverts commit eccdbba3a02a33e13b5262e92200a33e2ead873d. llvm-svn: 351410
* [WebAssembly] Parse llvm.ident into producers sectionThomas Lively2019-01-161-0/+18
| | | | | | | | | | | | | | Summary: Everything before the word "version" is the tool, and everything after the word "version" is the version. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56742 llvm-svn: 351399
* [WebAssembly] Massive instruction renamingThomas Lively2019-01-081-4/+4
| | | | | | | | | | | | | | | Summary: An automated renaming of all the instructions listed at https://github.com/WebAssembly/spec/issues/884#issuecomment-426433329 as well as some similarly-named identifiers. Reviewers: aheejin, dschuff, aardappel Subscribers: sbc100, jgravelle-google, eraman, sunfish, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D56338 llvm-svn: 350609
OpenPOWER on IntegriCloud