LLVM 19.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::FunctionImporter Class Reference

The function importer is automatically importing function from other modules based on the provided summary informations. More...

#include "llvm/Transforms/IPO/FunctionImport.h"

Classes

struct  ImportFailureInfo
 Information optionally tracked for candidates the importer decided not to import. More...
 

Public Types

enum  ImportFailureReason {
  None , GlobalVar , NotLive , TooLarge ,
  InterposableLinkage , LocalLinkageNotInModule , NotEligible , NoInline
}
 The different reasons selectCallee will chose not to import a candidate. More...
 
using FunctionsToImportTy = DenseMap< GlobalValue::GUID, GlobalValueSummary::ImportKind >
 The functions to import from a source module and their import type.
 
using ImportThresholdsTy = DenseMap< GlobalValue::GUID, std::tuple< unsigned, const GlobalValueSummary *, std::unique_ptr< ImportFailureInfo > > >
 Map of callee GUID considered for import into a given module to a pair consisting of the largest threshold applied when deciding whether to import it and, if we decided to import, a pointer to the summary instance imported.
 
using ImportMapTy = DenseMap< StringRef, FunctionsToImportTy >
 The map contains an entry for every module to import from, the key being the module identifier to pass to the ModuleLoader.
 
using ExportSetTy = DenseMap< ValueInfo, GlobalValueSummary::ImportKind >
 The map contains an entry for every global value the module exports.
 
using ModuleLoaderTy = std::function< Expected< std::unique_ptr< Module > >(StringRef Identifier)>
 A function of this type is used to load modules referenced by the index.
 

Public Member Functions

 FunctionImporter (const ModuleSummaryIndex &Index, ModuleLoaderTy ModuleLoader, bool ClearDSOLocalOnDeclarations)
 Create a Function Importer.
 
Expected< boolimportFunctions (Module &M, const ImportMapTy &ImportList)
 Import functions in Module M based on the supplied import list.
 

Detailed Description

The function importer is automatically importing function from other modules based on the provided summary informations.

Definition at line 32 of file FunctionImport.h.

Member Typedef Documentation

◆ ExportSetTy

The map contains an entry for every global value the module exports.

The key is ValueInfo, and the value indicates whether the definition or declaration is visible to another module. If a function's definition is visible to other modules, the global values this function referenced are visible and shouldn't be internalized. TODO: Rename to ExportMapTy.

Definition at line 108 of file FunctionImport.h.

◆ FunctionsToImportTy

The functions to import from a source module and their import type.

Definition at line 35 of file FunctionImport.h.

◆ ImportMapTy

The map contains an entry for every module to import from, the key being the module identifier to pass to the ModuleLoader.

The value is the set of functions to import. The module identifier strings must be owned elsewhere, typically by the in-memory ModuleSummaryIndex the importing decisions are made from (the module path for each summary is owned by the index's module path string table).

Definition at line 100 of file FunctionImport.h.

◆ ImportThresholdsTy

Map of callee GUID considered for import into a given module to a pair consisting of the largest threshold applied when deciding whether to import it and, if we decided to import, a pointer to the summary instance imported.

If we decided not to import, the summary will be nullptr.

Definition at line 89 of file FunctionImport.h.

◆ ModuleLoaderTy

using llvm::FunctionImporter::ModuleLoaderTy = std::function<Expected<std::unique_ptr<Module> >(StringRef Identifier)>

A function of this type is used to load modules referenced by the index.

Definition at line 111 of file FunctionImport.h.

Member Enumeration Documentation

◆ ImportFailureReason

The different reasons selectCallee will chose not to import a candidate.

Enumerator
None 
GlobalVar 
NotLive 
TooLarge 
InterposableLinkage 
LocalLinkageNotInModule 
NotEligible 
NoInline 

Definition at line 40 of file FunctionImport.h.

Constructor & Destructor Documentation

◆ FunctionImporter()

llvm::FunctionImporter::FunctionImporter ( const ModuleSummaryIndex Index,
ModuleLoaderTy  ModuleLoader,
bool  ClearDSOLocalOnDeclarations 
)
inline

Create a Function Importer.

Definition at line 115 of file FunctionImport.h.

Member Function Documentation

◆ importFunctions()

Expected< bool > FunctionImporter::importFunctions ( Module M,
const ImportMapTy ImportList 
)

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