LLVM  7.0.0svn
llvm::lto::LTO Class Reference

This class implements a resolution-based interface to LLVM's LTO functionality. More...

#include "llvm/LTO/LTO.h"

## Public Member Functions

LTO (Config Conf, ThinBackend Backend=nullptr, unsigned ParallelCodeGenParallelismLevel=1)
Create an LTO object. More...

~LTO ()

Error add (std::unique_ptr< InputFile > Obj, ArrayRef< SymbolResolution > Res)
Add an input file to the LTO link, using the provided symbol resolutions. More...

Returns an upper bound on the number of tasks that the client may expect. More...

Runs the LTO pipeline. More...

## Detailed 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.

Definition at line 238 of file LTO.h.

## ◆ LTO()

 LTO::LTO ( Config Conf, ThinBackend Backend = nullptr, unsigned ParallelCodeGenParallelismLevel = 1 )

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 407 of file LTO.cpp.

## ◆ ~LTO()

 LTO::~LTO ( )
default

Referenced by LTO().

## Member Function Documentation

 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 488 of file LTO.cpp.

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 759 of file LTO.cpp.

## ◆ run()

 Error LTO::run ( AddStreamFn AddStream, NativeObjectCache Cache = nullptr )

Runs the LTO pipeline.