Go to the documentation of this file.
9 #ifndef LLVM_TRANSFORMS_IPO_FUNCTIONIMPORT_H
10 #define LLVM_TRANSFORMS_IPO_FUNCTIONIMPORT_H
23 #include <system_error>
24 #include <unordered_set>
93 std::unique_ptr<ImportFailureInfo>>>;
105 std::function<Expected<std::unique_ptr<Module>>(
StringRef Identifier)>;
109 bool ClearDSOLocalOnDeclarations)
110 : Index(Index), ModuleLoader(
std::
move(ModuleLoader)),
111 ClearDSOLocalOnDeclarations(ClearDSOLocalOnDeclarations) {}
125 bool ClearDSOLocalOnDeclarations;
188 ModuleSummaryIndex &Index,
189 const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,
195 ModuleSummaryIndex &Index,
196 const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,
215 StringRef ModulePath,
216 const StringMap<GVSummaryMapTy> &ModuleToDefinedGVSummaries,
218 std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);
223 const std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);
242 #endif // LLVM_TRANSFORMS_IPO_FUNCTIONIMPORT_H
uint64_t GUID
Declare a type to represent a global unique identifier for a global value.
A set of analyses that are preserved following a run of a transformation pass.
std::unordered_set< GlobalValue::GUID > FunctionsToImportTy
Set of functions to import from a source module.
FunctionImporter(const ModuleSummaryIndex &Index, ModuleLoaderTy ModuleLoader, bool ClearDSOLocalOnDeclarations)
Create a Function Importer.
This is an optimization pass for GlobalISel generic memory operations.
DenseMap< GlobalValue::GUID, std::tuple< unsigned, const GlobalValueSummary *, std::unique_ptr< ImportFailureInfo > >> ImportThresholdsTy
Map of callee GUID considered for import into a given module to a pair consisting of the largest thre...
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
void thinLTOInternalizeModule(Module &TheModule, const GVSummaryMapTy &DefinedGlobals)
Internalize TheModule based on the information recorded in the summaries during global summary-based ...
A CRTP mix-in to automatically provide informational APIs needed for passes.
@ LocalLinkageNotInModule
static cl::opt< bool > PropagateAttrs("propagate-attrs", cl::init(true), cl::Hidden, cl::desc("Propagate attributes in index"))
The function importer is automatically importing function from other modules based on the provided su...
Tagged union holding either a T or a Error.
Information optionally tracked for candidates the importer decided not to import.
void gatherImportedSummariesForModule(StringRef ModulePath, const StringMap< GVSummaryMapTy > &ModuleToDefinedGVSummaries, const FunctionImporter::ImportMapTy &ImportList, std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex)
Compute the set of summaries needed for a ThinLTO backend compilation of ModulePath.
std::error_code EmitImportsFiles(StringRef ModulePath, StringRef OutputFilename, const std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex)
Emit into OutputFilename the files module ModulePath will import from.
void updateIndirectCalls(ModuleSummaryIndex &Index)
Update call edges for indirect calls to local functions added from SamplePGO when needed.
Expected< bool > importFunctions(Module &M, const ImportMapTy &ImportList)
Import functions in Module M based on the supplied import list.
Function and variable summary information to aid decisions and implementation of importing.
PrevailingType
PrevailingType enum used as a return type of callback passed to computeDeadSymbolsAndUpdateIndirectCa...
void thinLTOFinalizeInModule(Module &TheModule, const GVSummaryMapTy &DefinedGlobals, bool PropagateAttrs)
Based on the information recorded in the summaries during global summary-based analysis:
void ComputeCrossModuleImportForModule(StringRef ModulePath, const ModuleSummaryIndex &Index, FunctionImporter::ImportMapTy &ImportList)
Compute all the imports for the given module using the Index.
ImportFailureReason Reason
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Struct that holds a reference to a particular GUID in a global value summary.
bool convertToDeclaration(GlobalValue &GV)
Converts value GV to declaration, or replaces with a declaration if it is an alias.
Implements a dense probed hash-table based set.
CalleeInfo::HotnessType MaxHotness
void computeDeadSymbolsWithConstProp(ModuleSummaryIndex &Index, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols, function_ref< PrevailingType(GlobalValue::GUID)> isPrevailing, bool ImportEnabled)
Compute dead symbols and run constant propagation in combined index after that.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
DenseMap< GlobalValue::GUID, GlobalValueSummary * > GVSummaryMapTy
Map of global value GUID to its summary, used to identify values defined in a particular module,...
StringMap< FunctionsToImportTy > ImportMapTy
The map contains an entry for every module to import from, the key being the module identifier to pas...
Machine Check Debug Module
void ComputeCrossModuleImportForModuleFromIndex(StringRef ModulePath, const ModuleSummaryIndex &Index, FunctionImporter::ImportMapTy &ImportList)
Mark all external summaries in Index for import into the given module.
ImportFailureReason
The different reasons selectCallee will chose not to import a candidate.
ImportFailureInfo(ValueInfo VI, CalleeInfo::HotnessType MaxHotness, ImportFailureReason Reason, unsigned Attempts)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
void computeDeadSymbolsAndUpdateIndirectCalls(ModuleSummaryIndex &Index, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols, function_ref< PrevailingType(GlobalValue::GUID)> isPrevailing)
Compute all the symbols that are "dead": i.e these that can't be reached in the graph from any of the...
static cl::opt< std::string > OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::init("-"))
Class to hold module path string table and global value map, and encapsulate methods for operating on...
std::function< Expected< std::unique_ptr< Module > >(StringRef Identifier)> ModuleLoaderTy
A function of this type is used to load modules referenced by the index.
void ComputeCrossModuleImport(const ModuleSummaryIndex &Index, const StringMap< GVSummaryMapTy > &ModuleToDefinedGVSummaries, StringMap< FunctionImporter::ImportMapTy > &ImportLists, StringMap< FunctionImporter::ExportSetTy > &ExportLists)
Compute all the imports and exports for every module in the Index.
A container for analyses that lazily runs them and caches their results.
The function importing pass.