LLVM 24.0.0git
ModuleImportsManager Class Reference

Determine the list of imports and exports for each module. More...

Inheritance diagram for ModuleImportsManager:
[legend]

Public Member Functions

virtual ~ModuleImportsManager ()=default
DenseMap< StringRef, FunctionImporter::ExportSetTy > & requiredDeclExports ()
 Values that must be exported from their defining modules because declarations of them are required in importing modules.
virtual void computeImportForModule (const GVSummaryMapTy &DefinedGVSummaries, StringRef ModName, FunctionImporter::ImportMapTy &ImportList)
 Given the list of globals defined in a module, compute the list of imports as well as the list of "exports", i.e.

Static Public Member Functions

static std::unique_ptr< ModuleImportsManager > create (function_ref< bool(GlobalValue::GUID, const GlobalValueSummary *)> IsPrevailing, const ModuleSummaryIndex &Index, DenseMap< StringRef, FunctionImporter::ExportSetTy > *ExportLists=nullptr)

Protected Member Functions

 ModuleImportsManager (function_ref< bool(GlobalValue::GUID, const GlobalValueSummary *)> IsPrevailing, const ModuleSummaryIndex &Index, DenseMap< StringRef, FunctionImporter::ExportSetTy > *ExportLists=nullptr)
virtual bool canImport (ValueInfo VI)
void importRequiredDeclaration (ValueInfo VI, StringRef CallerModulePath, FunctionImporter::ImportMapTy &ImportList)
 Import a declaration of the callee VI of a call edge requiring a declaration import (see RequiresDeclImport in computeImportForFunction), from a function in CallerModulePath that is defined in or being imported into the current module, and isn't already defined in the current module.
void addRequiredDeclaration (ValueInfo VI, const GlobalValueSummary *DeclSummary, FunctionImporter::ImportMapTy &ImportList)
 Import a declaration of the callee VI from the module containing DeclSummary, which must be a candidate that is legal to import (i.e.

Protected Attributes

function_ref< bool(GlobalValue::GUID, const GlobalValueSummary *)> IsPrevailing
const ModuleSummaryIndex & Index
DenseMap< StringRef, FunctionImporter::ExportSetTy > *const ExportLists
DenseMap< StringRef, FunctionImporter::ExportSetTy > RequiredDeclExports

Detailed Description

Determine the list of imports and exports for each module.

Definition at line 529 of file FunctionImport.cpp.

Constructor & Destructor Documentation

◆ ModuleImportsManager()

ModuleImportsManager::ModuleImportsManager ( function_ref< bool(GlobalValue::GUID, const GlobalValueSummary *)> IsPrevailing,
const ModuleSummaryIndex & Index,
DenseMap< StringRef, FunctionImporter::ExportSetTy > * ExportLists = nullptr )
inlineprotected

Definition at line 549 of file FunctionImport.cpp.

References ExportLists, Index, and IsPrevailing.

Referenced by create(), and WorkloadImportsManager::WorkloadImportsManager().

◆ ~ModuleImportsManager()

virtual ModuleImportsManager::~ModuleImportsManager ( )
virtualdefault

Member Function Documentation

◆ addRequiredDeclaration()

void ModuleImportsManager::addRequiredDeclaration ( ValueInfo VI,
const GlobalValueSummary * DeclSummary,
FunctionImporter::ImportMapTy & ImportList )
protected

Import a declaration of the callee VI from the module containing DeclSummary, which must be a candidate that is legal to import (i.e.

for which qualifyCalleeCandidates returned ImportFailureReason::None, as is the case for the SummaryForDeclImport returned by selectCallee), and mark it exported from that module. Does nothing if the callee definition was already imported.

Definition at line 1238 of file FunctionImport.cpp.

References llvm::GlobalValueSummary::Definition, ExportLists, llvm::FunctionImporter::ImportMapTy::getImportType(), llvm::FunctionImporter::ImportMapTy::maybeAddDeclaration(), llvm::GlobalValueSummary::modulePath(), and RequiredDeclExports.

Referenced by importRequiredDeclaration().

◆ canImport()

virtual bool ModuleImportsManager::canImport ( ValueInfo VI)
inlineprotectedvirtual

Definition at line 555 of file FunctionImport.cpp.

◆ computeImportForModule()

void ModuleImportsManager::computeImportForModule ( const GVSummaryMapTy & DefinedGVSummaries,
StringRef ModName,
FunctionImporter::ImportMapTy & ImportList )
virtual

Given the list of globals defined in a module, compute the list of imports as well as the list of "exports", i.e.

the list of symbols referenced from another module (that may require promotion).

Definition at line 1150 of file FunctionImport.cpp.

References assert(), llvm::dbgs(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), ExportLists, getFailureName(), llvm::getHotnessName(), I, llvm::ImportInstrLimit, Index, IsPrevailing, LLVM_DEBUG, llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::PrintImportFailures.

◆ create()

◆ importRequiredDeclaration()

void ModuleImportsManager::importRequiredDeclaration ( ValueInfo VI,
StringRef CallerModulePath,
FunctionImporter::ImportMapTy & ImportList )
protected

Import a declaration of the callee VI of a call edge requiring a declaration import (see RequiresDeclImport in computeImportForFunction), from a function in CallerModulePath that is defined in or being imported into the current module, and isn't already defined in the current module.

This is called when the callee definition is not being imported via that edge, and the callee summaries have not already been qualified by selectCallee (see addRequiredDeclaration). If the definition is (or is subsequently) imported via another edge, it takes precedence over the declaration.

Definition at line 1217 of file FunctionImport.cpp.

References addRequiredDeclaration(), assert(), Index, llvm::FunctionImporter::NoInline, llvm::FunctionImporter::None, qualifyCalleeCandidates(), and llvm::FunctionImporter::TooLarge.

◆ requiredDeclExports()

DenseMap< StringRef, FunctionImporter::ExportSetTy > & ModuleImportsManager::requiredDeclExports ( )
inline

Values that must be exported from their defining modules because declarations of them are required in importing modules.

Definition at line 584 of file FunctionImport.cpp.

References RequiredDeclExports.

Member Data Documentation

◆ ExportLists

◆ Index

◆ IsPrevailing

◆ RequiredDeclExports

DenseMap<StringRef, FunctionImporter::ExportSetTy> ModuleImportsManager::RequiredDeclExports
protected

Definition at line 547 of file FunctionImport.cpp.

Referenced by addRequiredDeclaration(), and requiredDeclExports().


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