class LTO
Declaration
class LTO { /* full declaration omitted */ };
Description
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.
Declared at: llvm/include/llvm/LTO/LTO.h:268
Method Overview
- public LTO(llvm::lto::Config Conf, llvm::lto::ThinBackend Backend = nullptr, unsigned int ParallelCodeGenParallelismLevel = 1)
- public llvm::Error add(std::unique_ptr<InputFile> Obj, ArrayRef<llvm::lto::SymbolResolution> Res)
- public unsigned int getMaxTasks() const
- public static ArrayRef<const char *> getRuntimeLibcallSymbols()
- public llvm::Error run(llvm::lto::AddStreamFn AddStream, llvm::lto::NativeObjectCache Cache = nullptr)
- public ~LTO()
Methods
¶LTO(llvm::lto::Config Conf,
llvm::lto::ThinBackend Backend = nullptr,
unsigned int ParallelCodeGenParallelismLevel =
1)
LTO(llvm::lto::Config Conf,
llvm::lto::ThinBackend Backend = nullptr,
unsigned int ParallelCodeGenParallelismLevel =
1)
Description
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.
Declared at: llvm/include/llvm/LTO/LTO.h:277
Parameters
- llvm::lto::Config Conf
- llvm::lto::ThinBackend Backend = nullptr
- unsigned int ParallelCodeGenParallelismLevel = 1
¶llvm::Error add(
std::unique_ptr<InputFile> Obj,
ArrayRef<llvm::lto::SymbolResolution> Res)
llvm::Error add(
std::unique_ptr<InputFile> Obj,
ArrayRef<llvm::lto::SymbolResolution> Res)
Description
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().
Declared at: llvm/include/llvm/LTO/LTO.h:284
Parameters
- std::unique_ptr<InputFile> Obj
- ArrayRef<llvm::lto::SymbolResolution> Res
¶unsigned int getMaxTasks() const
unsigned int getMaxTasks() const
Description
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.
Declared at: llvm/include/llvm/LTO/LTO.h:289
¶static ArrayRef<const char*>
getRuntimeLibcallSymbols()
static ArrayRef<const char*>
getRuntimeLibcallSymbols()
Description
Static method that returns a list of libcall symbols that can be generated by LTO but might not be visible from bitcode symbol table.
Declared at: llvm/include/llvm/LTO/LTO.h:303
¶llvm::Error run(
llvm::lto::AddStreamFn AddStream,
llvm::lto::NativeObjectCache Cache = nullptr)
llvm::Error run(
llvm::lto::AddStreamFn AddStream,
llvm::lto::NativeObjectCache Cache = nullptr)
Description
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.
Declared at: llvm/include/llvm/LTO/LTO.h:299
Parameters
- llvm::lto::AddStreamFn AddStream
- llvm::lto::NativeObjectCache Cache = nullptr
¶~LTO()
~LTO()
Declared at: llvm/include/llvm/LTO/LTO.h:279