summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
* BPF: Use official ELF e_machine valueAlexei Starovoitov2016-07-152-0/+2
| | | | | | | | | The same value for EM_BPF is being propagated to glibc, elfutils, and binutils. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 275633
* [pdb] Teach MsfBuilder and other classes about the Free Page Map.Zachary Turner2016-07-153-3/+3
| | | | | | | | | | | | | | Block 1 and 2 of an MSF file are bit vectors that represent the list of blocks allocated and free in the file. We had been using these blocks to write stream data and other data, so we mark them as the free page map now. We don't yet serialize these pages to the disk, but at least we make a note of what it is, and avoid writing random data to them. Doing this also necessitated cleaning up some of the tests to be more general and hardcode fewer values, which is nice. llvm-svn: 275629
* [pdb] Round trip the NameMap data structure to YAML.Zachary Turner2016-07-154-0/+27
| | | | llvm-svn: 275628
* [pdb] Use MsfBuilder to handle the writing PDBs.Zachary Turner2016-07-155-35/+47
| | | | | | | | | | | | | | | Previously we would read a PDB, then write some of it back out, but write the directory, super block, and other pertinent metadata back out unchanged. This generates incorrect PDBs since the amount of data written was not always the same as the amount of data read. This patch changes things to use the newly introduced `MsfBuilder` class to write out a correct and accurate set of Msf metadata for the data *actually* written, which opens up the door for adding and removing type records, symbol records, and other types of data to an existing PDB. llvm-svn: 275627
* [OptRemark,LDist] RFC: Add hotness attributeAdam Nemet2016-07-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first set of changes implementing the RFC from http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 This is a cross-sectional patch; rather than implementing the hotness attribute for all optimization remarks and all passes in a patch set, it implements it for the 'missed-optimization' remark for Loop Distribution. My goal is to shake out the design issues before scaling it up to other types and passes. Hotness is computed as an integer as the multiplication of the block frequency with the function entry count. It's only printed in opt currently since clang prints the diagnostic fields directly. E.g.: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info (hotness: 300) A new API added is similar to emitOptimizationRemarkMissed. The difference is that it additionally takes a code region that the diagnostic corresponds to. From this, hotness is computed using BFI. The new API is exposed via an analysis pass so that it can be made dependent on LazyBFI. (Thanks to Hal for the analysis pass idea.) This feature can all be enabled by setDiagnosticHotnessRequested in the LLVM context. If this is off, LazyBFI is not calculated (D22141) so there should be no overhead. A new command-line option is added to turn this on in opt. My plan is to switch all user of emitOptimizationRemark* to use this module instead. Reviewers: hfinkel Subscribers: rcox2, mzolotukhin, llvm-commits Differential Revision: http://reviews.llvm.org/D21771 llvm-svn: 275583
* [llvm-cov] Improve error messagesVedant Kumar2016-07-151-4/+4
| | | | | | | While we're at it, extend an existing test to make sure that error messages look reasonable. llvm-svn: 275520
* [llvm-cov] Fix a use-after-freeVedant Kumar2016-07-151-1/+1
| | | | | | | | | | | Taking a lock before appending to a vector does no good unless threads reading from the vector also take the lock, because the vector could be re-sized. I don't have a good isolated test for this. I found the issue with ASan while testing a large project. I'm working on a bot that does this. llvm-svn: 275516
* [llvm-cov] Clean up an awkward capture-by-reference (NFC)Vedant Kumar2016-07-151-2/+2
| | | | | | | | Writing `for (StringRef &SourceFile : ...)` is strange to begin with. Subsequently capturing "SourceFile" by reference is even stranger. Just copy the StringRef, since that's cheap to do. llvm-svn: 275515
* [Coverage] Mark a few more methods const (NFC)Vedant Kumar2016-07-151-11/+11
| | | | llvm-svn: 275514
* llvm-objdump: extend __mh_execute_header handling to other special symsTim Northover2016-07-141-5/+7
| | | | | | | | | | We don't need to print any of the special __mh_*_header symbols when disassembling. Since they point at the beginning of the segment (not where the actual code is) they're pretty misleading. Should also fix lld bots. llvm-svn: 275498
* llvm-objdump: handle stubbed and malformed dylibs betterTim Northover2016-07-141-2/+12
| | | | | | | | We were quite happy to read past the end of the valid section data when disassembling. Instead we entirely skip stub dylibs, and tell the user what's happened if their section only has partial data. llvm-svn: 275487
* Move legacy LTO interface headers to legacy/ directory.Peter Collingbourne2016-07-142-6/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D22173 llvm-svn: 275476
* [ThinLTO/gold] Perform index-based weak/linkonce resolutionTeresa Johnson2016-07-141-17/+33
| | | | | | | | | | | | | | | | | | | | Summary: Invoke the weak/linkonce symbol resolution support (already used by libLTO) that operates via the summary index. This ensures prevailing linkonce are kept, by making them weak, and marks preempted copies as available_externally when possible. With this change, the older support for keeping the prevailing linkonce (by changing their symbol resolution) is removed. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D22302 llvm-svn: 275474
* [Object] Re-apply r275316 now that I have the corresponding LLD patch ready.Lang Hames2016-07-149-150/+160
| | | | llvm-svn: 275361
* [Object] Revert r275316, Archive::child_iterator changes, while I update lld.Lang Hames2016-07-149-160/+150
| | | | | | Should fix the bots broken by r275316. llvm-svn: 275353
* [llvm-cov] Use a thread pool to speed up report generation (NFC)Vedant Kumar2016-07-131-24/+75
| | | | | | | | | | | | | | It's safe to print out source coverage views using multiple threads when using the -output-dir mode of the `llvm-cov show` sub-command. While testing this on my development machine, I observed that the speed up is roughly linear with the number of available cores. Avg. time for `llvm-cov show ./llvm-as -show-line-counts-or-regions`: 1 thread: 7.79s user 0.33s system 98% cpu 8.228 total 4 threads: 7.82s user 0.34s system 283% cpu 2.880 total llvm-svn: 275321
* [Object] Change Archive::child_iterator for better interop with Error/Expected.Lang Hames2016-07-139-150/+160
| | | | | | | | | | | | | | | | | | | | | | | See http://reviews.llvm.org/D22079 Changes the Archive::child_begin and Archive::children to require a reference to an Error. If iterator increment fails (because the archive header is damaged) the iterator will be set to 'end()', and the error stored in the given Error&. The Error value should be checked by the user immediately after the loop. E.g.: Error Err; for (auto &C : A->children(Err)) { // Do something with archive child C. } // Check the error immediately after the loop. if (Err) return Err; Failure to check the Error will result in an abort() when the Error goes out of scope (as guaranteed by the Error class). llvm-svn: 275316
* [MIR] Print on the given output instead of stderr.Quentin Colombet2016-07-131-1/+1
| | | | | | | | | | | | Currently the MIR framework prints all its outputs (errors and actual representation) on stderr. This patch fixes that by printing the regular output in the output specified with -o. Differential Revision: http://reviews.llvm.org/D22251 llvm-svn: 275314
* [ThinLTO/gold] Enable symbol resolution in distributed backend caseTeresa Johnson2016-07-131-5/+0
| | | | | | | | | | | | | | | | While testing a follow-on change to enable index-based symbol resolution and internalization in the distributed backends, I realized that a test case change I made in r275247 was only required because we were not analyzing symbols in the claimed files in thinlto-index-only mode. In the fixed test case there should be no internalization because we are linking in -shared mode, so f() is in fact exported, which is detected properly when we analyze symbols in thinlto-index-only mode. Note that this is not (yet) a correctness issue (because we are not yet performing the index-based linkage optimizations in the distributed backends - that's coming in a follow-on patch). llvm-svn: 275277
* Rename llc's -fpreserve-as-comments flag -preserve-as-comments.Nirav Dave2016-07-131-1/+1
| | | | llvm-svn: 275266
* [ThinLTO/gold] ThinLTO internalization fixesTeresa Johnson2016-07-131-16/+9
| | | | | | | | | | | Internalization was missing cases where we originally had a local symbol that was promoted eagerly but not actually exported. This is because we were only internalizing the set of global (non-local) symbols that were PREVAILAING_DEF_IRONLY. Instead, collect the set of global symbols that are referenced outside of a single IR file, and skip internalization for those. llvm-svn: 275247
* [MC] Flip llc's assembly comment preservation flag to have consistentNirav Dave2016-07-121-3/+4
| | | | | | orientation with llvm-mc. llvm-svn: 275179
* Fix libdeps in r275125. LTO tools require BitReader.NAKAMURA Takumi2016-07-122-0/+2
| | | | llvm-svn: 275148
* Add a libLTO API to query a memory buffer and check if it contains ObjC ↵Mehdi Amini2016-07-113-0/+29
| | | | | | | | | | | categories The linker supports a feature to force load an object from a static archive if it defines an Objective-C category. This API supports this feature by looking at every section in the module to find if a category is defined in the module. llvm-svn: 275125
* Refactor the PDB writing to use a builder approachZachary Turner2016-07-116-41/+164
| | | | llvm-svn: 275110
* [pdb] Add a pdb2yaml option to not dump file headers.Zachary Turner2016-07-114-18/+32
| | | | | | | | | This will be useful once we start adding the ability to dump type records and symbol records, since it will allow us to generate mergeable information instead of information that specifies an entire file. llvm-svn: 275109
* Provide support for preserving assembly commentsNirav Dave2016-07-112-0/+10
| | | | | | | | | | | | | | | | | Preserve assembly comments from input in output assembly and flags to toggle property. This is on by default for inline assembly and off in llvm-mc. Parsed comments are emitted immediately before an EOL which generally places them on the expected line. Reviewers: rtrieu, dwmw2, rnk, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20020 llvm-svn: 275058
* [codeview] Drop unused private inheritance.Benjamin Kramer2016-07-101-1/+0
| | | | | | | | There is no polymorphism here, and StreamRef already contains a StreamInterface pointer. Dropping the base class makes StreamRef more transparent to the compiler, for example it can find unused variables. llvm-svn: 275013
* [cmake] Change lli-child-target to use add_llvm_utility instead of ↵Michael Gottesman2016-07-102-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | add_llvm_executable. We are currently using add_llvm_utility for executable targets that: 1. Are built by default. 2. Used for testing. 3. Are not installed by default. Originally, lli-child-target used add_llvm_tool instead of add_llvm_executable directly. This was changed so that lli-child-target would not be installed. This was good since this is only used for testing and should never be installed for users. This also had the unfortunate side effect that one can never turn off the building of lli-child-target by default, a regression for projects that by default do not want to compile any LLVM tools beyond tablegen/llvm-config. This patch changes lli-child-target to use add_llvm_utility. This makes sense since: 1. lli-child-target matches the semantics of executables created with add_llvm_utility. 2. We fix the regression since now one can use the flag LLVM_BUILD_UTILS to eliminate default compilation. llvm-svn: 275008
* [PM] Port UnreachableBlockElim to the new Pass ManagerWei Mi2016-07-082-1/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D22124 llvm-svn: 274824
* Minor formatting change, NFCVedant Kumar2016-07-061-7/+3
| | | | | | | The rest of llvm-cov does not use LLVM_ATTRIBUTE_UNUSED. Leave unused params unnamed to be consistent. llvm-svn: 274694
* [llvm-cov] Add support for creating html reportsVedant Kumar2016-07-066-1/+538
| | | | | | | | Based on a patch by Harlan Haskins! Differential Revision: http://reviews.llvm.org/D18278 llvm-svn: 274688
* [pdb] Round trip the PDB stream between YAML and binary PDB.Zachary Turner2016-07-066-9/+125
| | | | | | This gets writing of the PDB stream working. llvm-svn: 274647
* [pdb] Re-add code to write PDB files.Zachary Turner2016-06-303-26/+36
| | | | | | | | | Somehow all the functionality to write PDB files got removed, probably accidentally when uploading the patch perhaps the wrong one got uploaded. This re-adds all the code, as well as the corresponding test. llvm-svn: 274248
* Update llvm-pdbdump to use subcommands.Zachary Turner2016-06-3012-447/+383
| | | | llvm-svn: 274247
* Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI.Peter Collingbourne2016-06-291-67/+54
| | | | | | | | | | | | | | | | The NewArchiveIterator class has a problem: it requires too much context. Any memory buffers added to the archive must be stored within an Archive::Member, which must have an associated Archive. This makes it harder than necessary to create new archive members (or new archives entirely) from scratch using memory buffers. This patch replaces NewArchiveIterator with a NewArchiveMember class that stores just the memory buffer and the information that goes into the archive member header. Differential Revision: http://reviews.llvm.org/D21721 llvm-svn: 274183
* [llvm-cov] Use relative paths to file reports in -output-dir modeVedant Kumar2016-06-292-5/+11
| | | | | | This makes it possible to e.g copy a report to another filesystem. llvm-svn: 274173
* Change Archive::create() from ErrorOr<...> to Expected<...> and updateKevin Enderby2016-06-293-7/+14
| | | | | | | | | its clients. This commit will break the next lld builds. I’ll be committing the matching change for lld next. llvm-svn: 274160
* Don't verify inputs to the Linker if ODR merging.Rafael Espindola2016-06-291-1/+4
| | | | | | | | | | | | | | | | | | This fixes pr28072. The point, as Duncan pointed out, is that the file is already partially linked by just reading it. Long term I think the solution is to make metadata owned by the module and then the linker will lazily read it and be in charge of all the linking. Running a verifier in each input will defeat the lazy loading, but will be legal. Right now we are at the unfortunate position that to support odr merging we cannot verify the inputs, which mildly annoying (see test update). llvm-svn: 274148
* Use LLVM_ATTRIBUTE_UNUSED instead of void casts; NFCVedant Kumar2016-06-291-7/+7
| | | | llvm-svn: 274139
* [llvm-cov] Do not allow ".." to escape the coverage sub-directoryVedant Kumar2016-06-291-2/+3
| | | | | | | | | | | In -output-dir mode, file reports are placed into a "coverage" directory. If filenames in the coverage mapping contain "..", they might escape out of this directory. Fix the problem by removing ".." from source filenames (expand the path component). llvm-svn: 274135
* [bugpoint] Delete a stale comment.Philip Reames2016-06-291-3/+0
| | | | llvm-svn: 274093
* [bugpoint] Unwrap one level of wrapper functions [NFC]Philip Reames2016-06-292-18/+11
| | | | llvm-svn: 274092
* [bugpoint] Extract helper functions for readability [NFCI]Philip Reames2016-06-291-51/+64
| | | | | | And remove the use of a label(!) in the process. llvm-svn: 274087
* [llvm-cov] Minor cleanups to prepare for the html format patchVedant Kumar2016-06-295-31/+77
| | | | | | | | | | | | - Add renderView{Header,Footer}, renderLineSuffix, and hasSubViews to support creating tables with nested views. - Move the 'Format' cl::opt to make it easier to extend. - Just create one function view file, instead of overwriting the same file for every new function. Add a regression test for this. llvm-svn: 274086
* [bugpoint] Simplify code by moving exception to only callerPhilip Reames2016-06-294-12/+10
| | | | llvm-svn: 274083
* [bugpoint] Treat token type the same as ehpad w.r.t deletionPhilip Reames2016-06-291-4/+4
| | | | llvm-svn: 274082
* [bugpoint] Disabling one transform shouldn't prevent reporting the progress ↵Philip Reames2016-06-291-2/+2
| | | | | | of the former llvm-svn: 274081
* Finish cleaning up most of the error handling in libObject’s ↵Kevin Enderby2016-06-286-10/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MachOUniversalBinary and its clients to use the new llvm::Error model for error handling. Changed getAsArchive() from ErrorOr<...> to Expected<...> so now all interfaces there use the new llvm::Error model for return values. In the two places it had if (!Parent) this is actually a program error so changed from returning errorCodeToError(object_error::parse_failed) to calling report_fatal_error() with a message. In getObjectForArch() added error messages to its two llvm::Error return values instead of returning errorCodeToError(object_error::arch_not_found) with no error message. For the llvm-obdump, llvm-nm and llvm-size clients since the only binary files in Mach-O Universal Binaries that are supported are Mach-O files or archives with Mach-O objects, updated their logic to generate an error when a slice contains something like an ELF binary instead of ignoring it. And added a test case for that. The last error stuff to be cleaned up for libObject’s MachOUniversalBinary is the use of errorOrToExpected(Archive::create(ObjBuffer)) which needs Archive::create() to be changed from ErrorOr<...> to Expected<...> first, which I’ll work on next. llvm-svn: 274079
* Fix "not all control paths return a value" warning on MSVCSimon Pilgrim2016-06-281-0/+1
| | | | llvm-svn: 274065
OpenPOWER on IntegriCloud