LLVM 17.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
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.
 
 ~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 ArrayRef< const char * > getRuntimeLibcallSymbols ()
 Static method that returns a list of libcall symbols that can be generated by LTO but might not be visible from bitcode symbol table.
 

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:

Definition at line 254 of file LTO.h.

Constructor & Destructor Documentation

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

◆ ~LTO()

LTO::~LTO ( )
default

Member Function Documentation

◆ add()

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 670 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().

◆ getMaxTasks()

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.

Definition at line 1032 of file LTO.cpp.

◆ getRuntimeLibcallSymbols()

ArrayRef< const char * > LTO::getRuntimeLibcallSymbols ( )
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 1275 of file LTO.cpp.

References libcallRoutineNames.

◆ run()

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 1078 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, SupportsHotColdNew, llvm::Unknown, and llvm::Yes.


The documentation for this class was generated from the following files: