|
LLVM 23.0.0git
|
This class implements a resolution-based interface to LLVM's LTO functionality. More...
#include "llvm/LTO/LTO.h"
Classes | |
| struct | RegularLTOState |
| struct | ThinLTOState |
Public Types | |
| enum | LTOKind { LTOK_Default , LTOK_UnifiedRegular , LTOK_UnifiedThin } |
| Unified LTO modes. More... | |
Public Member Functions | |
| LLVM_ABI | LTO (Config Conf, ThinBackend Backend={}, unsigned ParallelCodeGenParallelismLevel=1, LTOKind LTOMode=LTOK_Default) |
| Create an LTO object. | |
| virtual LLVM_ABI | ~LTO () |
| LLVM_ABI Error | add (std::unique_ptr< InputFile > Obj, ArrayRef< SymbolResolution > Res) |
| Add an input file to the LTO link, using the provided symbol resolutions. | |
| LLVM_ABI void | setBitcodeLibFuncs (ArrayRef< StringRef > BitcodeLibFuncs) |
| Set the list of functions implemented in bitcode that were not extracted from an archive. | |
| LLVM_ABI unsigned | getMaxTasks () const |
| Returns an upper bound on the number of tasks that the client may expect. | |
| virtual LLVM_ABI Error | run (AddStreamFn AddStream, FileCache Cache={}) |
| Runs the LTO pipeline. | |
| void | emitRemark (OptimizationRemark &Remark) |
| Helper to emit an optimization remark during the LTO link when outside of the standard optimization pass pipeline. | |
| virtual Expected< std::shared_ptr< lto::InputFile > > | addInput (std::unique_ptr< lto::InputFile > InputPtr) |
Static Public Member Functions | |
| static LLVM_ABI SmallVector< const char * > | getRuntimeLibcallSymbols (const Triple &TT) |
| Static method that returns a list of libcall symbols that can be generated by LTO but might not be visible from bitcode symbol table. | |
| static LLVM_ABI SmallVector< StringRef > | getLibFuncSymbols (const Triple &TT, llvm::StringSaver &Saver) |
| Static method that returns a list of library function symbols that can be generated by LTO but might not be visible from bitcode symbol table. | |
Protected Types | |
| using | ModuleMapType = MapVector<StringRef, BitcodeModule> |
Protected Member Functions | |
| virtual void | cleanup () |
Protected Attributes | |
| Config | Conf |
| struct llvm::lto::LTO::RegularLTOState | RegularLTO |
| struct llvm::lto::LTO::ThinLTOState | ThinLTO |
| LTOKind | LTOMode |
This class implements a resolution-based interface to LLVM's LTO functionality.
It supports regular LTO, parallel LTO code generation and ThinLTO. You can use it from a linker in the following way:
|
protected |
| LTO::LTO | ( | Config | Conf, |
| ThinBackend | Backend = {}, | ||
| unsigned | ParallelCodeGenParallelismLevel = 1, | ||
| LTOKind | LTOMode = LTOK_Default ) |
Create an LTO object.
A default constructed LTO object has a reasonable production configuration, but you can customize it by passing arguments to this constructor. FIXME: We do currently require the DiagHandler field to be set in Conf. Until that is fixed, a Config argument is required.
Definition at line 688 of file LTO.cpp.
References Conf, llvm::LTOKeepSymbolCopies, LTOMode, llvm::move(), RegularLTO, and ThinLTO.
|
virtualdefault |
References LLVM_ABI.
| Error LTO::add | ( | std::unique_ptr< InputFile > | Obj, |
| ArrayRef< SymbolResolution > | Res ) |
Add an input file to the LTO link, using the provided symbol resolutions.
The symbol resolutions must appear in the enumeration order given by InputFile::symbols().
Definition at line 822 of file LTO.cpp.
References addInput(), assert(), Conf, llvm::lto::Config::ELF, llvm::ArrayRef< T >::empty(), I, llvm::Triple::isOSBinFormatELF(), RegularLTO, llvm::Error::success(), llvm::Expected< T >::takeError(), and writeToResolutionFile().
|
inlinevirtual |
|
protectedvirtual |
Definition at line 705 of file LTO.cpp.
References llvm::consumeError(), and llvm::lto::finalizeOptimizationRemarks().
Referenced by run().
| void LTO::emitRemark | ( | OptimizationRemark & | Remark | ) |
Helper to emit an optimization remark during the LTO link when outside of the standard optimization pass pipeline.
Definition at line 101 of file LTO.cpp.
References llvm::OptimizationRemarkEmitter::emit(), F, and llvm::Remark.
|
static |
Static method that returns a list of library function symbols that can be generated by LTO but might not be visible from bitcode symbol table.
Unlike the runtime libcalls, the linker can report to the code generator which of these are actually available in the link, and the code generator can then only reference that set of symbols.
Definition at line 1505 of file LTO.cpp.
References llvm::StringRef::data(), F, llvm::TargetLibraryInfo::getName(), llvm::TargetLibraryInfo::has(), I, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), and llvm::StringSaver::save().
| unsigned LTO::getMaxTasks | ( | ) | const |
Returns an upper bound on the number of tasks that the client may expect.
This may only be called after all IR object files have been added. For a full description of tasks see LTOBackend.h.
Definition at line 1250 of file LTO.cpp.
References RegularLTO, and ThinLTO.
|
static |
Static method that returns a list of libcall symbols that can be generated by LTO but might not be visible from bitcode symbol table.
Definition at line 1492 of file LTO.cpp.
References llvm::StringRef::data(), llvm::RTLIB::RuntimeLibcallsInfo::getLibcallImplName(), llvm::RTLIB::RuntimeLibcallsInfo::getNumAvailableLibcallImpls(), llvm::RTLIB::RuntimeLibcallsInfo::isAvailable(), llvm::RTLIB::libcall_impls(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorImpl< T >::reserve().
|
virtual |
Runs the LTO pipeline.
This function calls the supplied AddStream function to add native object files to the link.
The Cache parameter is optional. If supplied, it will be used to cache native object files and add them to the link.
The client will receive at most one callback (via either AddStream or Cache) for each task identifier.
Reimplemented in llvm::lto::DTLTO.
Definition at line 1301 of file LTO.cpp.
References cleanup(), llvm::computeDeadSymbolsWithConstProp(), Conf, llvm::GlobalValue::dropLLVMManglingEscape(), llvm::ArrayRef< T >::empty(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), G, llvm::GlobalValue::getGUIDAssumingExternalLinkage(), llvm::No, llvm::PrintStatisticsJSON(), llvm::lto::setupStatsFile(), llvm::SupportsHotColdNew, ThinLTO, llvm::Unknown, and llvm::Yes.
Set the list of functions implemented in bitcode that were not extracted from an archive.
Such functions may not be referenced, as they have lost their opportunity to be defined.
Definition at line 853 of file LTO.cpp.
References assert(), and llvm::ArrayRef< T >::empty().
|
protected |
Definition at line 459 of file LTO.h.
Referenced by add(), llvm::lto::DTLTO::DTLTO(), llvm::lto::DTLTO::getConfig(), llvm::lto::DTLTO::getConfig(), LTO(), llvm::lto::LTO::RegularLTOState::RegularLTOState(), llvm::lto::DTLTO::run(), and run().
|
protected |
Definition at line 620 of file LTO.h.
Referenced by llvm::lto::DTLTO::DTLTO(), and LTO().
|
protected |
Referenced by add(), getMaxTasks(), LTO(), and llvm::lto::DTLTO::run().
|
protected |
Referenced by getMaxTasks(), LTO(), and run().