LLVM
8.0.1
|
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... | |
unsigned | getMaxTasks () const |
Returns an upper bound on the number of tasks that the client may expect. More... | |
Error | run (AddStreamFn AddStream, NativeObjectCache Cache=nullptr) |
Runs the LTO pipeline. More... | |
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 |
||
) |
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 435 of file LTO.cpp.
References assert(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), llvm::Value::getName(), llvm::lto::SymbolResolution::LinkerRedefined, Name, llvm::lto::SymbolResolution::Prevailing, llvm::StringRef::startswith(), llvm::StringRef::substr(), llvm::Unknown, llvm::lto::SymbolResolution::VisibleToRegularObj, and ~LTO().
|
default |
Referenced by LTO().
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 523 of file LTO.cpp.
References assert(), llvm::ArrayRef< T >::begin(), I, llvm::lto::Config::ResolutionFile, 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.
Error LTO::run | ( | AddStreamFn | AddStream, |
NativeObjectCache | 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 812 of file LTO.cpp.
References llvm::computeDeadSymbolsWithConstProp(), llvm::GlobalValue::dropLLVMManglingEscape(), llvm::ArrayRef< T >::empty(), llvm::EnableStatistics(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::errorCodeToError(), llvm::sys::fs::F_None, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), G, llvm::GlobalValue::getGUID(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::insert(), llvm::No, llvm::lto::Config::OptLevel, llvm::PrintStatisticsJSON(), llvm::lto::Config::StatsFile, llvm::Unknown, and llvm::Yes.