LLVM 20.0.0git
|
This class implements a resolution-based interface to LLVM's LTO functionality. More...
#include "llvm/LTO/LTO.h"
Public Types | |
enum | LTOKind { LTOK_Default , LTOK_UnifiedRegular , LTOK_UnifiedThin } |
Unified LTO modes. More... | |
Public Member Functions | |
LTO (Config Conf, ThinBackend Backend=nullptr, unsigned ParallelCodeGenParallelismLevel=1, LTOKind LTOMode=LTOK_Default) | |
Create an LTO object. | |
~LTO () | |
Error | add (std::unique_ptr< InputFile > Obj, ArrayRef< SymbolResolution > Res) |
Add an input file to the LTO link, using the provided symbol resolutions. | |
unsigned | getMaxTasks () const |
Returns an upper bound on the number of tasks that the client may expect. | |
Error | run (AddStreamFn AddStream, FileCache Cache=nullptr) |
Runs the LTO pipeline. | |
Static Public Member Functions | |
static 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. | |
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:
LTO::LTO | ( | Config | Conf, |
ThinBackend | Backend = nullptr , |
||
unsigned | ParallelCodeGenParallelismLevel = 1 , |
||
LTOKind | LTOMode = LTOK_Default |
||
) |
|
default |
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 707 of file LTO.cpp.
References assert(), llvm::ArrayRef< T >::begin(), llvm::lto::Config::ELF, llvm::ArrayRef< T >::end(), I, llvm::Triple::isOSBinFormatELF(), llvm::lto::Config::ResolutionFile, llvm::Error::success(), llvm::lto::Config::VisibilityScheme, and writeToResolutionFile().
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.
|
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 1361 of file LTO.cpp.
References llvm::copy_if(), llvm::RTLIB::RuntimeLibcallsInfo::getLibcallNames(), and Name.
Error LTO::run | ( | AddStreamFn | AddStream, |
FileCache | Cache = nullptr |
||
) |
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.
Definition at line 1140 of file LTO.cpp.
References llvm::computeDeadSymbolsWithConstProp(), llvm::GlobalValue::dropLLVMManglingEscape(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::lto::SymbolResolution::ExportDynamic, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), G, llvm::GlobalValue::getGUID(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::No, llvm::lto::Config::OptLevel, llvm::lto::SymbolResolution::Prevailing, llvm::PrintStatisticsJSON(), llvm::lto::setupStatsFile(), llvm::lto::Config::StatsFile, llvm::SupportsHotColdNew, llvm::Unknown, and llvm::Yes.