summaryrefslogtreecommitdiffstats
path: root/llvm/tools/gold/gold-plugin.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add RAII wrapper for gold plugin file managementTeresa Johnson2015-12-161-23/+31
| | | | | | Suggested in review of r255256. llvm-svn: 255779
* Use diagnostic handler in the LLVMContextRafael Espindola2015-12-141-1/+1
| | | | | | | | | | | | | | | | This patch converts code that has access to a LLVMContext to not take a diagnostic handler. This has a few advantages * It is easier to use a consistent diagnostic handler in a single program. * Less clutter since we are not passing a handler around. It does make it a bit awkward to implement some C APIs that return a diagnostic string. I will propose new versions of these APIs and deprecate the current ones. llvm-svn: 255571
* [ThinLTO] Release files in gold plugin during combined index (take 2)Teresa Johnson2015-12-101-4/+2
| | | | | | | Ensure we release the files even when they don't hold a function index summary section, by restructuring the control flow a little bit. llvm-svn: 255256
* Slit lib/Linker in two.Rafael Espindola2015-12-101-157/+97
| | | | | | | | | | | | | | | | A linker normally has two stages: symbol resolution and "moving stuff". In lib/Linker there is the complication of lazy linking some globals, but it was still far more mixed than it needed to. This splits the linker into a lower level IRMover and the linker proper. The IRMover just takes a list of globals to move and a callback that lets the user control what is lazy linked. The main motivation is that now tools/gold (and soon lld) can use their own symbol resolution to instruct IRMover what to do. llvm-svn: 255254
* [ThinLTO] Release files read when creating combined index in gold pluginTeresa Johnson2015-12-091-0/+3
| | | | | | | This wasn't causing an issue since at HEAD we exit the linker completely after creating the combined index. llvm-svn: 255156
* Delay context construction to when/if it is needed in gold plugin (NFC)Teresa Johnson2015-12-091-3/+3
| | | | llvm-svn: 255146
* clang-format order of gold-plugin includes (NFC)Teresa Johnson2015-12-091-2/+2
| | | | llvm-svn: 255144
* Always pass a diagnostic handler to the linker.Rafael Espindola2015-12-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Before this patch the diagnostic handler was optional. If it was not passed, the one in the LLVMContext was used. That is probably not a pattern we want to follow. If each area has an optional callback, there is a sea of callbacks and it is hard to follow which one is called. Doing this also found cases where the callback is a nice addition, like testing that no errors or warnings are reported. The other option is to always use the diagnostic handler in the LLVMContext. That has a few problems * To implement the C API we would have to set the diag handler and then set it back to the original value. * Code that creates the context might be far away from code that wants the diagnostics. I do have a patch that implements the second option and will send that as an RFC. llvm-svn: 254777
* Use references now that it is natural to do so.Rafael Espindola2015-12-011-3/+3
| | | | | | | The linker never takes ownership of a module or changes which module it is refering to, making it natural to use references. llvm-svn: 254449
* Simplify the linking of recursive data.Rafael Espindola2015-11-271-2/+2
| | | | | | | | Now the ValueMapper has two callbacks. The first one maps the declaration. The ValueMapper records the mapping and then materializes the body/initializer. llvm-svn: 254209
* Don't create implicit comdats.Rafael Espindola2015-11-231-2/+0
| | | | | | comdats are explicitly represented for some time now. llvm-svn: 253924
* [ThinLTO] Handle bitcode without function summary sections gracefullyTeresa Johnson2015-11-211-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Several fixes to the handling of bitcode files without function summary sections so that they are skipped during ThinLTO processing in llvm-lto and the gold plugin when appropriate instead of aborting. 1 Don't assert when trying to add a FunctionInfo that doesn't have a summary attached. 2 Skip FunctionInfo structures that don't have attached function summary sections when trying to create the combined function summary. 3 In both llvm-lto and gold-plugin, check whether a bitcode file has a function summary section before trying to parse the index, and skip the bitcode file if it does not. 4 Fix hasFunctionSummaryInMemBuffer in BitcodeReader, which had a bug where we returned to early while looking for the summary section. Also added llvm-lto and gold-plugin based tests for cases where we don't have function summaries in the bitcode file. I verified that either the first couple fixes described above are enough to avoid the crashes, or fixes 1,3,4. But have combined them all here for added robustness. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D14903 llvm-svn: 253796
* Remove unused function parameter (NFC)Mehdi Amini2015-11-191-3/+2
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 253569
* gold-plugin.cpp: Fix diagnosticHandler corresponding to r253540.NAKAMURA Takumi2015-11-191-4/+9
| | | | llvm-svn: 253553
* Clang format a few prior patches (NFC)Teresa Johnson2015-11-021-3/+5
| | | | | | | I had clang formatted my earlier patches using the wrong style. Reformatted with the LLVM style. llvm-svn: 251812
* Make class final to pacify -Wnon-virtual-dtor.Manuel Klimek2015-10-201-1/+1
| | | | llvm-svn: 250805
* Pass FunctionInfoIndex by reference to WriteFunctionSummaryToFile (NFC)Teresa Johnson2015-10-191-1/+1
| | | | | | Implemented suggestion by dblakie in review for r250704. llvm-svn: 250723
* Convert gold-plugin unnecessary unique_ptr into local (NFC)Teresa Johnson2015-10-191-3/+3
| | | | llvm-svn: 250704
* Support for function summary index bitcode sections and files.Teresa Johnson2015-10-041-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The bitcode format is described in this document: https://drive.google.com/file/d/0B036uwnWM6RWdnBLakxmeDdOeXc/view For more info on ThinLTO see: https://sites.google.com/site/llvmthinlto The first customer is ThinLTO, however the data structures are designed and named more generally based on prior feedback. There are a few comments regarding how certain interfaces are used by ThinLTO, and the options added here to gold currently have ThinLTO-specific names as the behavior they provoke is currently ThinLTO-specific. This patch includes support for generating per-module function indexes, the combined index file via the gold plugin, and several tests (more are included with the associated clang patch D11908). Reviewers: dexonsmith, davidxl, joker.eph Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13107 llvm-svn: 249270
* Disable the second verification run when performing LTO throughTeresa Johnson2015-09-161-1/+10
| | | | | | | | gold in NDEBUG mode. Follow on patch for r247729 - LTO: Disable extra verify runs in release builds. llvm-svn: 247824
* gold-plugin: Implement parallel LTO code generation using llvm::splitCodeGen.Peter Collingbourne2015-09-011-34/+47
| | | | | | | | | Parallelism can be enabled using a new plugin option, jobs=N, where N is the number of code generation threads. Differential Revision: http://reviews.llvm.org/D12308 llvm-svn: 246584
* Replace &vector[0] with vector.data() to avoid invalid dereference caught by ↵Nick Lewycky2015-08-051-4/+5
| | | | | | debug STL. Also move a '*' for consistency and fix an 80-col violation. llvm-svn: 244134
* Update for r243115 which changed the DataLayout API on TargetMachine butChandler Carruth2015-07-241-2/+1
| | | | | | didn't update the gold-plugin. llvm-svn: 243121
* gold-plugin: save the .o when given -save-temps.Rafael Espindola2015-06-151-3/+8
| | | | | | | The plugin now save the bitcode before and after optimizations and the .o that is passed to the linker. llvm-svn: 239726
* Fix build error from r234957Duncan P. N. Exon Smith2015-04-151-2/+1
| | | | llvm-svn: 234958
* uselistorder: Pull the bit through WriteToBitcodFile()Duncan P. N. Exon Smith2015-04-151-2/+3
| | | | | | | | | | | Change the callers of `WriteToBitcodeFile()` to pass `true` or `shouldPreserveBitcodeUseListOrder()` explicitly. I left the callers that want to send `false` alone. I'll keep pushing the bit higher until hopefully I can delete the global `cl::opt` entirely. llvm-svn: 234957
* Simplify use of formatted_raw_ostream.Rafael Espindola2015-04-091-3/+2
| | | | | | | | | | | | | | | formatted_raw_ostream is a wrapper over another stream to add column and line number tracking. It is used only for asm printing. This patch moves the its creation down to where we know we are printing assembly. This has the following advantages: * Simpler lifetime management: std::unique_ptr * We don't compute column and line number of object files :-) llvm-svn: 234535
* This reverts commit r234460 and r234461.Rafael Espindola2015-04-091-2/+3
| | | | | | | | | Revert "Add classof implementations to the raw_ostream classes." Revert "Use the cast machinery to remove dummy uses of formatted_raw_ostream." The underlying issue can be fixed without classof. llvm-svn: 234495
* Use the cast machinery to remove dummy uses of formatted_raw_ostream.Rafael Espindola2015-04-091-3/+2
| | | | | | | If we know we are producing an object, we don't need to wrap the stream in a formatted_raw_ostream anymore. llvm-svn: 234461
* Fix PR23045.Rafael Espindola2015-03-301-5/+3
| | | | | | | | | Keep a note in the materializer that we are stripping debug info so that user doing a lazy read of the module don't hit outdated formats. Thanks to Duncan for suggesting the fix. llvm-svn: 233603
* Work around pr23045 and make it easier to reproduce.Rafael Espindola2015-03-271-3/+5
| | | | | | | | | | | Dropping old debug format requires the entire module to be read upfront. This was failing only with the gold plugin, but that is just because llvm-link was not upgrading metadata. The new testcase using llvm-link shows the problem. llvm-svn: 233381
* libLTO, llvm-lto, gold: Introduce flag for controlling optimization level.Peter Collingbourne2015-03-191-1/+22
| | | | | | | | | | This change also introduces a link-time optimization level of 1. This optimization level runs only the globaldce pass as well as cleanup passes for passes that run at -O0, specifically simplifycfg which cleans up lowerbitsets. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150316/266951.html llvm-svn: 232769
* Be lazy about loading metadata in IRObjectFile.Rafael Espindola2015-03-131-0/+1
| | | | | | | This speeds up llvm-ar building lib64/libclangSema.a with debug IR files from 8.658015807 seconds to just 0.351036519 seconds :-) llvm-svn: 232221
* Fix the build of the gold-plugin and examples.Rafael Espindola2015-03-041-3/+1
| | | | llvm-svn: 231279
* Bring r231132 back with a fix.Rafael Espindola2015-03-041-5/+2
| | | | | | | | | | The issue was that we were always printing the remarks. Fix that and add a test showing that it prints nothing if -pass-remarks is not given. Original message: Correctly handle -pass-remarks in the gold plugin. llvm-svn: 231273
* Revert r231132, "Correctly handle -pass-remarks in the gold plugin.", for ↵NAKAMURA Takumi2015-03-041-2/+5
| | | | | | now, to suppress log floodng in LTO. llvm-svn: 231253
* Correctly handle -pass-remarks in the gold plugin.Rafael Espindola2015-03-031-5/+2
| | | | llvm-svn: 231132
* Add r230655 back with a fix.Rafael Espindola2015-03-021-11/+32
| | | | | | | | | | | | | | | | | | | | The issue is that now we have a diag handler during optimizations and get forward every optimization remark, flooding stdout. The same filtering should probably be done with or without a custom handler, but for now just ignore remarks. Original message: gold-plugin: "Upgrade" debug info and handle its warnings. The gold plugin never calls MaterializeModule, so any old debug info was not deleted and could cause crashes. Now that it is being "upgraded", the plugin also has to handle warnings and create Modules with a nice id (it shows in the warning). llvm-svn: 230991
* Revert r230655, "gold-plugin: "Upgrade" debug info and handle its warnings."NAKAMURA Takumi2015-03-011-29/+11
| | | | | | It emits *millions of warnings* during selfhosting LTO build, to choke the buildbot with gigbytes of log. llvm-svn: 230885
* gold-plugin: "Upgrade" debug info and handle its warnings.Rafael Espindola2015-02-261-11/+29
| | | | | | | | | | The gold plugin never calls MaterializeModule, so any old debug info was not deleted and could cause crashes. Now that it is being "upgraded", the plugin also has to handle warnings and create Modules with a nice id (it shows in the warning). llvm-svn: 230655
* Set the datalayout in the gold plugin.Rafael Espindola2015-02-211-0/+3
| | | | | | This fixes the gold tests after r230054. llvm-svn: 230098
* [PM] Fix a compile error I introduced in r229094 and didn't noticeChandler Carruth2015-02-131-1/+1
| | | | | | | | | | | | because I didn't have binutils set up properly to build the gold plugin. Fixes PR22581 which was filed because this broke the build for folks relying on the plugin. Very sorry! =] I've gotten the plugin stuff building now as well so it shouldn't keep happening. llvm-svn: 229156
* [PM] Remove the old 'PassManager.h' header file at the top level ofChandler Carruth2015-02-131-4/+4
| | | | | | | | | | | | | | | | | | | | LLVM's include tree and the use of using declarations to hide the 'legacy' namespace for the old pass manager. This undoes the primary modules-hostile change I made to keep out-of-tree targets building. I sent an email inquiring about whether this would be reasonable to do at this phase and people seemed fine with it, so making it a reality. This should allow us to start bootstrapping with modules to a certain extent along with making it easier to mix and match headers in general. The updates to any code for users of LLVM are very mechanical. Switch from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h". Qualify the types which now produce compile errors with "legacy::". The most common ones are "PassManager", "PassManagerBase", and "FunctionPassManager". llvm-svn: 229094
* gold-plugin: delete the output file for OT_DISABLEMichael Kuperstein2015-02-121-1/+6
| | | | | | | | bfd creates the output file early, so calling exit(0) is not enough, the file needs to be explicitly deleted. Patch by: H.J. Lu <hjl.tools@gmail.com> llvm-svn: 228946
* Gold-plugin: Broaden scope of get/release_input_file to scope of Module.Jan Wen Voung2015-02-111-9/+10
| | | | | | | | | | | | | | | | | | | | Summary: Move calls to get_input_file and release_input_file out of getModuleForFile(). Otherwise release_input_file may end up unmapping a view of the file while the view is still being used by the Module (on 32-bit hosts). Fix for PR22482. Test Plan: Add test using --no-map-whole-files. Reviewers: rafael, nlewycky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7539 llvm-svn: 228842
* gold-plugin.cpp: Fixup r227599 corresponding to r227685 and r227731 -- Don't ↵NAKAMURA Takumi2015-02-021-1/+5
| | | | | | lose DataLayoutPass. llvm-svn: 227783
* Fixup gold-plugin after r227576.Alexey Samsonov2015-01-301-2/+2
| | | | llvm-svn: 227599
* Update of the gold-plugin.cpp code to match Chandler's changes (r226981)Sylvestre Ledru2015-01-241-1/+1
| | | | llvm-svn: 227004
* [PM] Move TargetLibraryInfo into the Analysis library.Chandler Carruth2015-01-151-1/+1
| | | | | | | | | | | | | | | | While the term "Target" is in the name, it doesn't really have to do with the LLVM Target library -- this isn't an abstraction which LLVM targets generally need to implement or extend. It has much more to do with modeling the various runtime libraries on different OSes and with different runtime environments. The "target" in this sense is the more general sense of a target of cross compilation. This is in preparation for porting this analysis to the new pass manager. No functionality changed, and updates inbound for Clang and Polly. llvm-svn: 226078
* Fix linking of shared libraries.Rafael Espindola2015-01-141-1/+1
| | | | | | | In shared libraries the plugin can see non-weak declarations that are still undefined. llvm-svn: 226031
OpenPOWER on IntegriCloud