summaryrefslogtreecommitdiffstats
path: root/llvm/tools/lto
Commit message (Collapse)AuthorAgeFilesLines
* s/LLVM_ON_WIN32/_WIN32/, llvmNico Weber2018-04-291-1/+1
| | | | | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. This moves over all uses of the macro, but doesn't remove the definition of it in (llvm-)config.h yet. llvm-svn: 331127
* Rename *CommandFlags.def to *CommandFlags.incDavid Blaikie2018-04-111-1/+1
| | | | | | | | These aren't the .def style files used in LLVM that require a macro defined before their inclusion - they're just basic non-modular includes to stamp out command line flag variables. llvm-svn: 329840
* [ThinLTO] Added a couple of C LTO API interfaces to control the cache policy.Ekaterina Romanova2018-03-022-2/+14
| | | | | | | | | | - thinlto_codegen_set_cache_size_bytes to control the absolute size of cache directory. - thinlto_codegen_set_cache_size_files the size and amount of files in cache directory. These functions have been supported in C++ LTO API for a long time, but were absent in C LTO API. Differential Revision: https://reviews.llvm.org/D42446 llvm-svn: 326537
* Rename CommandFlags.h -> CommandFlags.defDavid Blaikie2017-11-271-1/+1
| | | | | | | | | Since this isn't a real header - it includes static functions and had external linkage variables (though this change makes them static, since that's what they should be) so can't be included more than once in a program. llvm-svn: 319082
* This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352 Vivek Pandya2017-09-151-15/+20
| | | | | | | | | | | It enables OptimizationRemarkEmitter::allowExtraAnalysis and MachineOptimizationRemarkEmitter::allowExtraAnalysis to return true not only for -fsave-optimization-record but when specific remarks are requested with command line options. The diagnostic handler used to be callback now this patch adds a class DiagnosticHandler. It has virtual method to provide custom diagnostic handler and methods to control which particular remarks are enabled. However LLVM-C API users can still provide callback function for diagnostic handler. llvm-svn: 313390
* This reverts r313381Vivek Pandya2017-09-151-20/+15
| | | | llvm-svn: 313387
* This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352 Vivek Pandya2017-09-151-15/+20
| | | | | | | | | | | It enables OptimizationRemarkEmitter::allowExtraAnalysis and MachineOptimizationRemarkEmitter::allowExtraAnalysis to return true not only for -fsave-optimization-record but when specific remarks are requested with command line options. The diagnostic handler used to be callback now this patch adds a class DiagnosticHandler. It has virtual method to provide custom diagnostic handler and methods to control which particular remarks are enabled. However LLVM-C API users can still provide callback function for diagnostic handler. llvm-svn: 313382
* Spelling mistakes in comments. NFCI.Simon Pilgrim2017-03-301-1/+1
| | | | | | Based on corrections mentioned in patch for clang for PR27635 llvm-svn: 299072
* Add support for -fno-builtin to LTO and ThinLTO to libLTOMehdi Amini2017-03-281-3/+9
| | | | | | | | | | Reviewers: tejohnson, pcc Subscribers: Prazek, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D30791 llvm-svn: 298936
* [ThinLTO] Honor -O{0,1,2,4} passed through the libLTO interface for ThinLTOMehdi Amini2016-12-281-0/+19
| | | | | | | This was hardcoded to be O3 till now, without any way to change it without changing the code. llvm-svn: 290682
* [ThinLTO] Add an API to trigger file-based API for returning objects to the ↵Mehdi Amini2016-12-142-1/+19
| | | | | | | | | | | | | | | | | | | | linker Summary: The motivation is to support better the -object_path_lto option on Darwin. The linker needs to write down the generate object files on disk for later use by lldb or dsymutil (debug info are not present in the final binary). We're moving this into libLTO so that we can be smarter when a cache is enabled and hard-link when possible instead of duplicating the files. Reviewers: tejohnson, deadalnix, pcc Subscribers: dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D27507 llvm-svn: 289631
* [CMake] LTO depends on intrinsics_genChris Bieneman2016-11-181-1/+1
| | | | | | | | | | | | | | | | lto.cpp has the following include chain: llvm/Bitcode/BitcodeReader.h llvm/IR/ModuleSummaryIndex.h llvm/IR/Module.h llvm/IR/Function.h llvm/IR/Argument.h llvm/IR/Attributes.h llvm/IR/Attributes.gen This means LTO needs to depend on intrinsics_gen. llvm-svn: 287393
* Bitcode: Clean up error handling for certain bitcode query functions.Peter Collingbourne2016-11-111-1/+3
| | | | | | | | | | | | | The functions getBitcodeTargetTriple(), isBitcodeContainingObjCCategory(), getBitcodeProducerString() and hasGlobalValueSummary() now return errors via their return value rather than via the diagnostic handler. To make this work, re-implement these functions using non-member functions so that they can be used without the LLVMContext required by BitcodeReader. Differential Revision: https://reviews.llvm.org/D26532 llvm-svn: 286623
* Split Bitcode/ReaderWriter.h into separate reader and writer headersTeresa Johnson2016-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Split ReaderWriter.h which contains the APIs into both the BitReader and BitWriter libraries into BitcodeReader.h and BitcodeWriter.h. This is to address Chandler's concern about sharing the same API header between multiple libraries (BitReader and BitWriter). That concern is why we create a single bitcode library in our downstream build of clang, which led to r286297 being reverted as it added a dependency that created a cycle only when there is a single bitcode library (not two as in upstream). Reviewers: mehdi_amini Subscribers: dlj, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D26502 llvm-svn: 286566
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-1/+1
| | | | | | | | | | Reviewers: beanz, lattner, jlebar Subscribers: jholewinski, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26235 llvm-svn: 285832
* Recommit "Use StringRef in LTOModule implementation (NFC)""Mehdi Amini2016-10-071-16/+17
| | | | | | | | This reverts commit r283456 and reapply r282997, with explicitly zeroing the struct member to workaround a bug in MSVC2013 with zero-initialization: https://connect.microsoft.com/VisualStudio/feedback/details/802160 llvm-svn: 283581
* Revert "Use StringRef in LTOModule implementation (NFC)"Mehdi Amini2016-10-061-17/+16
| | | | | | | This reverts commit r282997, a windows bot is asserting in one test apparently. llvm-svn: 283456
* Use StringRef in LTOModule implementation (NFC)Mehdi Amini2016-10-011-16/+17
| | | | llvm-svn: 282997
* Move legacy LTO interface headers to legacy/ directory.Peter Collingbourne2016-07-141-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D22173 llvm-svn: 275476
* Fix libdeps in r275125. LTO tools require BitReader.NAKAMURA Takumi2016-07-121-0/+1
| | | | llvm-svn: 275148
* Add a libLTO API to query a memory buffer and check if it contains ObjC ↵Mehdi Amini2016-07-112-0/+10
| | | | | | | | | | | 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
* Delete Reloc::Default.Rafael Espindola2016-05-181-2/+2
| | | | | | | | | | | | Having an enum member named Default is quite confusing: Is it distinct from the others? This patch removes that member and instead uses Optional<Reloc> in places where we have a user input that still hasn't been maped to the default value, which is now clear has no be one of the remaining 3 options. llvm-svn: 269988
* LTO: Use a common LibLTOCodeGenerator::init, NFCDuncan P. N. Exon Smith2016-04-161-3/+5
| | | | llvm-svn: 266538
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-1/+2
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
* Add a libLTO API to stop/restart ThinLTO between optimizations and CodeGenMehdi Amini2016-04-012-2/+14
| | | | | | | | This allows the linker to instruct ThinLTO to perform only the optimization part or only the codegen part of the process. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265113
* Const-correctness in libLTOMehdi Amini2016-03-191-1/+1
| | | | | | | | Looks like I was sloppy when bridging to C. Thanks D. Blaikie for noticing! From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 263885
* Fix a const_cast related warning in GCC in the C API for libLTOMehdi Amini2016-03-191-1/+1
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 263870
* void foo() is not a valid C prototype, one has to write void foo(void)Mehdi Amini2016-03-091-1/+1
| | | | | | | Remove a warning introduced in r262977 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 262990
* libLTO: add a ThinLTOCodeGenerator on the model of LTOCodeGenerator.Mehdi Amini2016-03-092-0/+122
| | | | | | | | | | | | | | | | | This is intended to provide a parallel (threaded) ThinLTO scheme for linker plugin use through the libLTO C API. The intent of this patch is to provide a first implementation as a proof-of-concept and allows linker to start supporting ThinLTO by definiing the libLTO C API. Some part of the libLTO API are left unimplemented yet. Following patches will add support for these. The current implementation can link all clang/llvm binaries. Differential Revision: http://reviews.llvm.org/D17066 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 262977
* [LTO] Fix error reporting from lto_module_create_in_local_context()Petr Pavlu2016-03-011-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Function lto_module_create_in_local_context() would previously rely on the default LLVMContext being created for it by LTOModule::makeLTOModule(). This context exits the program on error and is not arranged to update sLastStringError in tools/lto/lto.cpp. Function lto_module_create_in_local_context() now creates an LLVMContext by itself, sets it up correctly to its needs and then passes it to LTOModule::createInLocalContext() which takes ownership of the context and keeps it present for the lifetime of the returned LTOModule. Function LTOModule::makeLTOModule() is modified to take a reference to LLVMContext (instead of a pointer) and no longer creates a default context when nullptr is passed to it. Method LTOModule::createInContext() that takes a pointer to LLVMContext is removed because it allows to pass a nullptr to it. Instead LTOModule::createFromBuffer() (that takes a reference to LLVMContext) should be used. Differential Revision: http://reviews.llvm.org/D17715 llvm-svn: 262330
* [CMake] Assigning the LTO component to lto.hChris Bieneman2016-02-261-1/+2
| | | | | | This makes it so lto.h is installed when you run the install-LTO target. llvm-svn: 262066
* Add missing raw_ostream includeReid Kleckner2016-01-291-0/+1
| | | | | | | | Prior to r259115 this was coming via LTOModule.h and MCContext.h. Apparently this target is not built by 'check'. =( llvm-svn: 259124
* Remove autoconf supportChris Bieneman2016-01-261-42/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* [LTO] Fix error reporting when a file passed to libLTO is invalid or ↵Petr Pavlu2016-01-201-2/+0
| | | | | | | | | | | | | | | | | | non-existent This addresses PR26060 where function lto_module_create() could return nullptr but lto_get_error_message() returned an empty string. The error() call after LTOModule::createFromFile() in llvm-lto is then removed because any error from this function should go through the diagnostic handler in llvm-lto which will exit the program. The error() call was added because this previously did not happen when the file was non-existent. This is fixed by the patch. (The situation that llvm-lto reports an error when the input file does not exist is tested by llvm/tools/llvm-lto/error.ll). Differential Revision: http://reviews.llvm.org/D16106 llvm-svn: 258298
* Fix the order of destructors in LibLTOCodeGeneratorSteven Wu2015-12-091-0/+4
| | | | | | | | | | | | | | | | Summary: The order of destructors in LTOCodeGenerator gets changed in r254696. It is possible for LTOCodeGenerator to have a MergedModule created in the OwnedContext, in which case the module must be destructed before the context. Reviewers: rafael, dexonsmith Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D15346 llvm-svn: 255092
* Modernize the C++ APIs for creating LTO modules.Rafael Espindola2015-12-041-13/+57
| | | | | | | | | | | | | | | | This is a continuation of r253367. These functions return is owned by the caller, so they return std::unique_ptr now. The call can fail, so the return is wrapped in ErrorOr. They have a context where to report diagnostics, so they don't need to take a string out parameter. With this there are no call to getGlobalContext in lib/LTO. llvm-svn: 254721
* Move a call to getGlobalContext out of lib/LTO.Rafael Espindola2015-12-041-2/+3
| | | | llvm-svn: 254696
* Switch lto codegen to using diagnostic handlers.Yunzhong Gao2015-11-171-5/+5
| | | | | | | | | | | This patch removes the std::string& argument from a number of C++ LTO API calls and instead makes them use the installed diagnostic handler. This would also improve consistency of diagnostic handling infrastructure: if an LTO client used lto_codegen_set_diagnostic_handler() to install a custom error handler, we do not want some error messages to go through the custom error handler, and some other error messages to go into sLastErrorString. llvm-svn: 253367
* Add a libLTO diagnostic handler that supports lto_get_error_message APIYunzhong Gao2015-11-111-2/+10
| | | | | | | | | | | | | | This is a follow-up from the previous discussion on the thread: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151019/307763.html The LibLTO lto_get_error_message() API reads error messages from a std::string sLastErrorString. Instead of passing this string around as an argument, this patch creates a diagnostic handler and then sends this handler to the constructor of LTOCodeGenerator. Differential Revision: http://reviews.llvm.org/D14313 llvm-svn: 252791
* [CMake] Add LLVM_VERSION_PATCH to the -current_version flag for libLTO and ↵Chris Bieneman2015-10-141-1/+1
| | | | | | | | libLLVM. This is to match autoconf where LLVM_SUBMIT_SUBVERSION is usually set to ${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}. llvm-svn: 250277
* [CMake] Add compatibility and current versioning to libLTO to match autoconf ↵Chris Bieneman2015-10-131-0/+10
| | | | | | | | support. This also adds LLVM_LTO_VERSION_OFFSET to support functional equivalence to autoconf. llvm-svn: 250245
* Reapply "LTO: Disable extra verify runs in release builds"Duncan P. N. Exon Smith2015-09-151-6/+16
| | | | | | | This reverts commit r247730, effectively reapplying r247729. This time I have an lld commit ready to follow. llvm-svn: 247735
* Revert "LTO: Disable extra verify runs in release builds"Duncan P. N. Exon Smith2015-09-151-16/+6
| | | | | | | This temporarily reverts commit r247729, as it caused lld build failures. I'll recommit once I have an lld patch ready-to-go. llvm-svn: 247730
* LTO: Disable extra verify runs in release buildsDuncan P. N. Exon Smith2015-09-151-6/+16
| | | | | | | | | | | | | | | | | | | | | | The verifier currently runs three times in LTO: (1) after parsing, (2) at the beginning of the optimization pipeline, and (3) at the end of it. The first run is important, since we're not sure where the bitcode comes from and it's nice to validate it, but in release builds the extra runs aren't appropriate. This commit: - Allows these runs to be disabled in LTOCodeGenerator. - Adds command-line options to llvm-lto. - Adds command-line options to libLTO.dylib, and disables the verifier by default in release builds (based on NDEBUG). This shaves about 3.5% off the runtime of ld64 when linking verify-uselistorder with -flto -g. rdar://22509081 llvm-svn: 247729
* LTO: Simplify merged module ownership.Peter Collingbourne2015-08-241-1/+1
| | | | | | | | | | | This change moves LTOCodeGenerator's ownership of the merged module to a field of type std::unique_ptr<Module>. This helps simplify parts of the code and clears the way for the module to be consumed by LLVM CodeGen (see D12132 review comments). Differential Revision: http://reviews.llvm.org/D12205 llvm-svn: 245891
* LTO: Change signature of LTOCodeGenerator::setCodePICModel() to take a ↵Peter Collingbourne2015-08-211-2/+16
| | | | | | | | | Reloc::Model. This allows us to remove a bunch of code in LTOCodeGenerator and llvm-lto and has the side effect of improving error handling in the libLTO C API. llvm-svn: 245756
* lto: Clean up C libLTO interfaces pertaining to linker flags.Peter Collingbourne2015-06-292-19/+2
| | | | | | | | | Specifically, remove the dependent library interface and replace the existing linker option interface with a new one that returns a single list of flags. Differential Revision: http://reviews.llvm.org/D10820 llvm-svn: 241018
* Teach LTOModule to emit linker flags for dllexported symbols, plus interface ↵Peter Collingbourne2015-06-291-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cleanup. This change unifies how LTOModule and the backend obtain linker flags for globals: via a new TargetLoweringObjectFile member function named emitLinkerFlagsForGlobal. A new function LTOModule::getLinkerOpts() returns the list of linker flags as a single concatenated string. This change affects the C libLTO API: the function lto_module_get_*deplibs now exposes an empty list, and lto_module_get_*linkeropts exposes a single element which combines the contents of all observed flags. libLTO should never have tried to parse the linker flags; it is the linker's job to do so. Because linkers will need to be able to parse flags in regular object files, it makes little sense for libLTO to have a redundant mechanism for doing so. The new API is compatible with the old one. It is valid for a user to specify multiple linker flags in a single pragma directive like this: #pragma comment(linker, "/defaultlib:foo /defaultlib:bar") The previous implementation would not have exposed either flag via lto_module_get_*deplibs (as the test in TargetLoweringObjectFileCOFF::getDepLibFromLinkerOpt was case sensitive) and would have exposed "/defaultlib:foo /defaultlib:bar" as a single flag via lto_module_get_*linkeropts. This may have been a bug in the implementation, but it does give us a chance to fix the interface. Differential Revision: http://reviews.llvm.org/D10548 llvm-svn: 241010
* Adding the missing LTO API to lto.exportsSteven Wu2015-06-231-0/+1
| | | | | | | | | | | | | | Summary: lto_codegen_set_should_embed_uselists is introduced in r235943 but not added to lto.exports. Add to export list to expose the API. Reviewers: dexonsmith Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D10658 llvm-svn: 240442
* add missing dependency on Target lib for toolsSanjay Patel2015-06-031-0/+1
| | | | | | | This was exposed by r238842 (which was reverted by r238900) when doing a CMake build with -DBUILD_SHARED_LIBS=ON. llvm-svn: 238953
OpenPOWER on IntegriCloud