summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
* [codeview] Maintain the type enum-to-classname mapping in the .def fileReid Kleckner2016-05-031-23/+5
| | | | | | This way it will be easy to stamp out something like a type visitor. llvm-svn: 268347
* Parse the TPI (type information) stream of PDB files.Zachary Turner2016-05-031-0/+34
| | | | | | | | | | | | | | | This parses the TPI stream (stream 2) from the PDB file. This stream contains some header information followed by a series of codeview records. There is some additional complexity here in that alongside this stream of codeview records is a serialized hash table in order to efficiently query the types. We parse the necessary bookkeeping information to allow us to reconstruct the hash table, but we do not actually construct it yet as there are still a few things that need to be understood first. Differential Revision: http://reviews.llvm.org/D19840 Reviewed By: ruiu, rnk llvm-svn: 268343
* Move llvm-readobj/StreamWriter to Support.Zachary Turner2016-05-0314-485/+55
| | | | | | | | | We wish to re-use this from llvm-pdbdump, and it provides a nice way to print structured data in scoped format that could prove useful for many other dumping tools as well. Moving to support and changing name to ScopedPrinter to better reflect its purpose. llvm-svn: 268342
* NFC: An iterator for stepping through CodeView type stream in llvm-readobjAdrian McCarthy2016-05-021-39/+125
| | | | | | | | | | | | This is a small refactoring step toward moving CodeView type stream logic from llvm-readobj to a library. It abstracts the logic of stepping through the stream into an iterator class and updates llvm-readobj to use that iterator. This has no functional change; llvm-readobj produces identical output. The next step is to abstract the parsing of the different leaf types and then move that and the iterator into a library. Since this is my first contrib outside LLDB, please let me know if I'm messing up on any of the LLVM style guidelines, idioms, or patterns. Differential Revision: http://reviews.llvm.org/D19746 llvm-svn: 268334
* Simplify. NFC.Rafael Espindola2016-05-021-4/+1
| | | | llvm-svn: 268326
* Fix llvm-size to exit with non zero when it can’t open a file.Kevin Enderby2016-05-021-1/+5
| | | | | | rdar://26027819 llvm-svn: 268313
* Don't try to create thin bsd archives.Rafael Espindola2016-05-021-1/+3
| | | | | | Not such variant has been specified yet. llvm-svn: 268305
* [dsymutil] Create the temporary files in the system temp directory.Frederic Riss2016-05-021-3/+6
| | | | | | | | | | llvm-dsymutil used to create the temporary files in the output directory. This works fine except when the output directory contains a '%' char, which is then replaced by llvm::sys::fs::createUniqueFile() generating an invalid path. Just use the default temp dir for those files. llvm-svn: 268304
* [codeview] Isolate type dumping from object file stateReid Kleckner2016-05-021-18/+38
| | | | | | | | | | | | | | This isolates the state we use for type dumping from the knowledge of object files. We can use CVTypeDumper to dump types from anywhere in memory now. NFC Reviewers: zturner Differential Revision: http://reviews.llvm.org/D19824 llvm-svn: 268300
* Thread Expected<...> up from libObject’s getType() for symbols to allow ↵Kevin Enderby2016-05-0210-57/+129
| | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s section index is more than the number of sections. The existing test case in test/Object/macho-invalid.test for macho-invalid-section-index-getSectionRawName now reports the error with the message indicating that a symbol at a specific index has a bad section index and that bad section index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: "// TODO: Actually report errors helpfully" and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. llvm-svn: 268298
* [codeview] Don't dump type stream bytes unless asked toReid Kleckner2016-05-021-1/+2
| | | | llvm-svn: 268271
* Parse PDB Name Hash TableZachary Turner2016-05-021-25/+9
| | | | | | | | | | | | | PDB has a lot of similar data structures. We already have code for parsing a Name Map, but PDB seems to have a different but very similar structure that is a hash table. This is the beginning of code needed in order to parse the name hash table, but it is not yet complete. It parses the basic metadata of the hash table, the bucket array, and the names buffer, but doesn't use any of these fields yet as the data structure requires a non-trivial amount of work to understand. llvm-svn: 268268
* [llvm-readobj] Dump hash as part of -version-info.Davide Italiano2016-05-021-0/+1
| | | | llvm-svn: 268210
* [CMake] [Xcode] Improving Xcode toolchain generation to support distribution ↵Chris Bieneman2016-04-291-0/+20
| | | | | | | | targets This adds a new target `install-distribution-toolchain` which will install an Xcode toolchain featuring just the LLVM components specified in LLVM_DISTRIBUTION_COMPONENTS. llvm-svn: 268125
* Move coverage related code into a separate library.Easwaran Raman2016-04-296-7/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D19333 llvm-svn: 268089
* Put PDB parsing code into a pdb namespace.Zachary Turner2016-04-291-22/+22
| | | | llvm-svn: 268072
* Refactor the PDB Stream reading interface.Zachary Turner2016-04-291-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | The motivation for this change is that PDB has the notion of streams and substreams. Substreams often consist of variable length structures that are convenient to be able to treat as guaranteed, contiguous byte arrays, whereas the streams they are contained in are not necessarily so, as a single stream could be spread across many discontiguous blocks. So, when processing data from a substream, we want to be able to assume that we have a contiguous byte array so that we can cast pointers to variable length arrays and such. This leads to the question of how to be able to read the same data structure from either a stream or a substream using the same interface, which is where this patch comes in. We separate out the stream's read state from the underlying representation, and introduce a `StreamReader` class. Then we change the name of `PDBStream` to `MappedBlockStream`, and introduce a second kind of stream called a `ByteStream` which is simply a sequence of contiguous bytes. Finally, we update all of the std::vectors in `PDBDbiStream` to use `ByteStream` instead as a proof of concept. llvm-svn: 268071
* Remove leftoverTobias Grosser2016-04-291-4/+0
| | | | llvm-svn: 268049
* cmake: Set LINK_POLLY_INTO_TOOLS to ON (v2)Tobias Grosser2016-04-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the second try. This time we disable this feature if no Polly checkout is available. For this to work we need to check if tools/polly is present early enough that our decision is known before cmake generates Config/config.h. With Polly checked into LLVM it was since a long time possible to compile clang/opt/bugpoint with Polly support directly linked in, instead of only providing Polly as a separate loadable module. This commit switches the default from providing Polly as a module to linking Polly into tools, such that it becomes unnecessary to load the Polly module when playing with Polly. Such configuration has shown a lot more convenient for day-to-day Polly use. This change does not impact the default behavior of any tool, if Polly is not explicitly enabled when calling clang/opt/bugpoint Polly does not affect compilation. This change also does not impact normal LLVM/clang checkouts that do not contain Polly. Reviewers: jdoerfert, Meinersbur Subscribers: pollydev, llvm-commits Differential Revision: http://reviews.llvm.org/D19711 llvm-svn: 268048
* [llvm-cov] Don't emit 'nan%' in reportsVedant Kumar2016-04-291-0/+6
| | | | llvm-svn: 267971
* [llvm-pdbdump] Restore error messages, handle bad block sizesDavid Majnemer2016-04-281-14/+23
| | | | | | | We lost the ability to report errors, bring it back. Also, correctly validate the block size. llvm-svn: 267955
* Fix a bug in llvm-objdump for -private-headers printing the ↵Kevin Enderby2016-04-281-1/+1
| | | | | | | | LC_CODE_SIGNATURE Mach-O load command. rdar://25985653 llvm-svn: 267940
* Update llvm-objdump for disassembly of ARM Mach-O files to always include ↵Kevin Enderby2016-04-281-3/+5
| | | | | | | | | | the opcode bytes. As this is the expected behavior of the old darwin otool(1) for ARM Mach-O files. rdar://25896249 llvm-svn: 267929
* Read the rest of the DBI substreams, and parse source info.Zachary Turner2016-04-281-15/+20
| | | | | | | | | | | | | We now read out the rest of the substreams from the DBI streams. One of these substreams, the FileInfo substream, contains information about which source files contribute to each module (aka compiland). This patch additionally parses out the file information from that substream, and dumps it in llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D19634 Reviewed by: ruiu llvm-svn: 267928
* Fix bugs in llvm-objdump printing the last word for -section in non i386 and ↵Kevin Enderby2016-04-271-2/+2
| | | | | | | | | | | x86 files. Two problems, 1) for the last 4 bytes it would print them as separate bytes not a word and 2) it would print the same last byte for those bytes less than a word. rdar://25938224 llvm-svn: 267819
* Parse module information from DBI stream.Zachary Turner2016-04-271-0/+23
| | | | | | | | | | | | This gets more data out of the DBI strema of the PDB. In particular it extracts the metadata for the list of modules (compilands) that this PDB contains info about, and adds support for dumping these fields to llvm-pdbdump. Differential Revision: http://reviews.llvm.org/D19570 Reviewed By: ruiu llvm-svn: 267818
* Fix a bug in llvm-objdump printing of 32-bit addresses for -section in non ↵Kevin Enderby2016-04-271-1/+1
| | | | | | | | i386 and x86 files. rdar://25896202 llvm-svn: 267807
* Add TargetMachine::addEarlyAsPossiblePasses, and call it from opt.Justin Lebar2016-04-271-11/+20
| | | | | | | | | | | | | | Summary: This is a hook to allow TargetMachine to install passes at the EP_EarlyAsPossible PassManagerBuilder extension point. Reviewers: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18614 llvm-svn: 267763
* [ThinLTO] Use valueid instead of bitcode offsets in combined index fileTeresa Johnson2016-04-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With the removal of support for lazy parsing of combined index summary records (e.g. r267344), we no longer need to include the summary record bitcode offset in the VST entries for definitions. Change the combined index format to be similar to the per-module index format in using value ids to cross-reference from the summary record to the VST entry (rather than the summary record bitcode offset to cross-reference in the other direction). The visible changes are: 1) Add the value id to the combined summary records 2) Remove the summary offset from the combined VST records, which has the following effects: - No longer need the VST_CODE_COMBINED_GVDEFENTRY record, as all combined index VST entries now only contain the value id and corresponding GUID. - No longer have duplicate VST entries in the case where there are multiple definitions of a symbol (e.g. weak/linkonce), as they all have the same value id and GUID. An implication of #2 above is that in order to hook up an alias to the correct aliasee based on the value id of the aliasee recorded in the combined index alias record, we need to scan the entries in the index for that GUID to find the one from the same module (i.e. the case where there are multiple entries for the aliasee). But the reader no longer has to maintain a special map to hook up the alias/aliasee. Reviewers: joker.eph Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19481 llvm-svn: 267712
* Parse and dump PDB DBI Stream Header InformationZachary Turner2016-04-261-4/+18
| | | | | | | | | | | | | | | | | | The DBI stream contains a lot of bookkeeping information for other streams. In particular it contains information about section contributions and linked modules. This patch is a first attempt at parsing some of the information out of the DBI stream. It currently only parses and dumps the headers of the DBI stream, so none of the module data or section contribution data is pulled out. This is just a proof of concept that we understand the basic properties of the DBI stream's metadata, and followup patches will try to extract more detailed information out. Differential Revision: http://reviews.llvm.org/D19500 Reviewed By: majnemer, ruiu llvm-svn: 267585
* Reapply: "ARM: put correct symbol index on indirect pointers in __thread_ptr.""Tim Northover2016-04-261-1/+1
| | | | | | | A latent bug in llvm-objdump used the wrong format specifier on 32-bit targets, causing the test to fail. This fixes the issue. llvm-svn: 267582
* Refactor some more PDB reading code into DebugInfoPDB.Zachary Turner2016-04-261-126/+13
| | | | | | | Differential Revision: http://reviews.llvm.org/D19445 Reviewed By: David Majnemer llvm-svn: 267564
* Align case statements (whitespace-only cleanup)Sanjoy Das2016-04-261-15/+15
| | | | llvm-svn: 267525
* Symbolize operand bundle blocks for bcanalyzerSanjoy Das2016-04-261-0/+8
| | | | | | | | | | Reviewers: joker.eph Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D19523 llvm-svn: 267524
* [lli] Fix a sign-compare warning.Lang Hames2016-04-261-2/+2
| | | | llvm-svn: 267512
* [CMake] If set we should pass LLVM_VERSION_INFO into config.hChris Bieneman2016-04-251-2/+0
| | | | | | | | Autoconf used to support setting LLVM_VERSION_INFO and there is some code filtered around llvm in Support/CommandLine.cpp and LTO/LTOCodeGenerator.cpp that uses it if it is set. We also shouldn't be explicitly setting it as a define on llvm-shlib. It is pointless there because there is no code using it in llvm-shlib, and it is better to have it as part of the generated config.h so that it is available everywhere. llvm-svn: 267490
* [ORC] Thread Error/Expected through the RPC library.Lang Hames2016-04-253-41/+51
| | | | | | | | | | This replaces use of std::error_code and ErrorOr in the ORC RPC support library with Error and Expected. This required updating the OrcRemoteTarget API, Client, and server code, as well as updating the Orc C API. This patch also fixes several instances where Errors were dropped. llvm-svn: 267457
* [gold] Fix linkInModule and extend common.ll test.Evgeniy Stepanov2016-04-251-3/+3
| | | | | | | | | | Fix early exit from linkInModule. IRMover::move returns false on success and true on error. Add a few more cases of merged common linkage variables with different sizes and alignments. llvm-svn: 267437
* Resubmit "Refactor raw pdb dumper into library"Zachary Turner2016-04-252-312/+85
| | | | | | | This fixes a number of endianness issues as well as an ODR violation that hopefully causes everything to be happy. llvm-svn: 267431
* [gold-plugin] Remove dead assignment. NFC.Davide Italiano2016-04-251-1/+0
| | | | llvm-svn: 267429
* dsymutil: Only warn about clang module DWO id mismatches in verbose mode.Adrian Prantl2016-04-251-1/+4
| | | | | | | | | | Until PR27449 (https://llvm.org/bugs/show_bug.cgi?id=27449) is fixed in clang this warning is pointless, since ASTFileSignatures will change randomly when a module is rebuilt. rdar://problem/25610919 llvm-svn: 267427
* Add a version field in the bitcode for the summaryMehdi Amini2016-04-241-0/+1
| | | | | | | Differential Revision: http://reviews.llvm.org/D19456 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267318
* Add an internalization step to the ThinLTOCodeGeneratorMehdi Amini2016-04-241-4/+45
| | | | | | | | | | | | | Keeping as much as possible internal/private is known to help the optimizer. Let's try to benefit from this in ThinLTO. Note: this is early work, but is enough to build clang (and all the LLVM tools). I still need to write some lit-tests... Differential Revision: http://reviews.llvm.org/D19103 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267317
* Store and emit original name in combined indexMehdi Amini2016-04-231-0/+1
| | | | | | | | | | | | | | | | | | | Summary: As discussed in D18298, some local globals can't be renamed/promoted (because they have a section, or because they are referenced from inline assembly). To be able to detect naming collision, we need to keep around the "GUID" using their original name without taking the linkage into account. Reviewers: tejohnson Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19454 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267304
* DebugInfo: Remove MDString-based type referencesDuncan P. N. Exon Smith2016-04-231-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | Eliminate DITypeIdentifierMap and make DITypeRef a thin wrapper around DIType*. It is no longer legal to refer to a DICompositeType by its 'identifier:', and DIBuilder no longer retains all types with an 'identifier:' automatically. Aside from the bitcode upgrade, this is mainly removing logic to resolve an MDString-based reference to an actualy DIType. The commits leading up to this have made the implicit type map in DICompileUnit's 'retainedTypes:' field superfluous. This does not remove DITypeRef, DIScopeRef, DINodeRef, and DITypeRefArray, or stop using them in DI-related metadata. Although as of this commit they aren't serving a useful purpose, there are patchces under review to reuse them for CodeView support. The tests in LLVM were updated with deref-typerefs.sh, which is attached to the thread "[RFC] Lazy-loading of debug info metadata": http://lists.llvm.org/pipermail/llvm-dev/2016-April/098318.html llvm-svn: 267296
* [gold] Gate value name discarding under save-tempsTeresa Johnson2016-04-231-8/+4
| | | | | | | | | | | | | | Summary: This removes a couple of flags added to control this behavior, and simply keeps all value names when save-temps is specified. Reviewers: rafael Subscribers: llvm-commits, pcc, davide Differential Revision: http://reviews.llvm.org/D19384 llvm-svn: 267279
* llvm-objdump: deal with invalid ARM encodings slightly better.Tim Northover2016-04-221-7/+17
| | | | | | | | | | | | | | Before we printed a warning to stderr and left the actual output stream in a mess. This tries to print a .long or .short representation of what we saw (as if there was a data-in-code directive). This isn't guaranteed to restore synchronization in Thumb-mode (if the invalid instruction was supposed to be 32-bits, we may be off-by-16 for the rest of the function). But there's no certain way to deal with that, and it's invalid code anyway (if the data really wasn't an instruction, the user can add proper .data_in_code directives if they care) llvm-svn: 267250
* MachO: remove weird ARM/Thumb interface from MachOObjectFileTim Northover2016-04-226-29/+21
| | | | | | | | | | | | | | | | Only one consumer (llvm-objdump) actually cared about the fact that there were two triples. Others were actively working around the fact that the Triple returned by getArch might have been invalid. As for llvm-objdump, it needs to be acutely aware of both Triples anyway, so being generic in the exposed API is no benefit. Also rename the version of getArch returning a Triple. Users were having to pass an unwanted nullptr to disambiguate the two, which was nasty. The only functional change here is that armv7m and armv7em object files no longer crash llvm-objdump. llvm-svn: 267249
* AMDGPU: Fix crash when dumping unknown opcodeMatt Arsenault2016-04-221-0/+5
| | | | | | | | I'm for some reason having a problem producing a test. It should be the same as test/MC/X86/invalid_opcode.s, but llvm-mc seems to ignore random bytes. llvm-svn: 267225
* Introduce llvm.load.relative intrinsic.Peter Collingbourne2016-04-221-0/+1
| | | | | | | | | | | | | | | | | | | This intrinsic takes two arguments, ``%ptr`` and ``%offset``. It loads a 32-bit value from the address ``%ptr + %offset``, adds ``%ptr`` to that value and returns it. The constant folder specifically recognizes the form of this intrinsic and the constant initializers it may load from; if a loaded constant initializer is known to have the form ``i32 trunc(x - %ptr)``, the intrinsic call is folded to ``x``. LLVM provides that the calculation of such a constant initializer will not overflow at link time under the medium code model if ``x`` is an ``unnamed_addr`` function. However, it does not provide this guarantee for a constant initializer folded into a function body. This intrinsic can be used to avoid the possibility of overflows when loading from such a constant. Differential Revision: http://reviews.llvm.org/D18367 llvm-svn: 267223
OpenPOWER on IntegriCloud