LLVM: llvm::lto::LTO Class Reference (original) (raw)
This class implements a resolution-based interface to LLVM's LTO functionality. More...
#include "[llvm/LTO/LTO.h](LTO%5F8h%5Fsource.html)"
| 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. | |
| 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 unsigned | getMaxTasks () const |
| Returns an upper bound on the number of tasks that the client may expect. | |
| LLVM_ABI Error | run (AddStreamFn AddStream, FileCache Cache={}) |
| Runs the LTO pipeline. |
| 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. |
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:
- Set hooks and code generation options (see lto::Config struct defined in Config.h), and use the lto::Config object to create an lto::LTO object.
- Create lto::InputFile objects using lto::InputFile::create(), then use the symbols() function to enumerate its symbols and compute a resolution for each symbol (see SymbolResolution below).
- After the linker has visited each input file (and each regular object file) and computed a resolution for each symbol, take each lto::InputFile and pass it and an array of symbol resolutions to the add() function.
- Call the getMaxTasks() function to get an upper bound on the number of native object files that LTO may add to the link.
- Call the run() function. This function will use the supplied AddStream and Cache functions to add up to getMaxTasks() native object files to the link.
Definition at line 371 of file LTO.h.
◆ LTOKind
Unified LTO modes.
| Enumerator | |
|---|---|
| LTOK_Default | Any LTO mode without Unified LTO. The default mode. |
| LTOK_UnifiedRegular | Regular LTO, with Unified LTO enabled. |
| LTOK_UnifiedThin | ThinLTO, with Unified LTO enabled. |
Definition at line 376 of file LTO.h.
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 619 of file LTO.cpp.
References llvm::LTOKeepSymbolCopies, and llvm::move().
◆ ~LTO()
◆ add()
◆ getMaxTasks()
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 1153 of file LTO.cpp.
◆ getRuntimeLibcallSymbols()
◆ run()
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 1204 of file LTO.cpp.
References llvm::computeDeadSymbolsWithConstProp(), 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::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::No, llvm::PrintStatisticsJSON(), llvm::lto::setupStatsFile(), llvm::SupportsHotColdNew, llvm::Unknown, and llvm::Yes.
The documentation for this class was generated from the following files: