LLVM: llvm::ModuleSummaryIndex Class Reference (original) (raw)

Class to hold module path string table and global value map, and encapsulate methods for operating on them. More...

#include "[llvm/IR/ModuleSummaryIndex.h](ModuleSummaryIndex%5F8h%5Fsource.html)"

Public Member Functions
ModuleSummaryIndex (bool HaveGVs, bool EnableSplitLTOUnit=false, bool UnifiedLTO=false)
bool haveGVs () const
LLVM_ABI uint64_t getFlags () const
LLVM_ABI void setFlags (uint64_t Flags)
uint64_t getBlockCount () const
void addBlockCount (uint64_t C)
void setBlockCount (uint64_t C)
gvsummary_iterator begin ()
const_gvsummary_iterator begin () const
gvsummary_iterator end ()
const_gvsummary_iterator end () const
size_t size () const
const std::vector< uint64_t > & stackIds () const
unsigned addOrGetStackIdIndex (uint64_t StackId)
uint64_t getStackIdAtIndex (unsigned Index) const
void releaseTemporaryMemory ()
FunctionSummary calculateCallGraphRoot ()
bool withGlobalValueDeadStripping () const
void setWithGlobalValueDeadStripping ()
bool withAttributePropagation () const
void setWithAttributePropagation ()
bool withDSOLocalPropagation () const
void setWithDSOLocalPropagation ()
bool withInternalizeAndPromote () const
void setWithInternalizeAndPromote ()
bool withWholeProgramVisibility () const
void setWithWholeProgramVisibility ()
bool isReadOnly (const GlobalVarSummary *GVS) const
bool isWriteOnly (const GlobalVarSummary *GVS) const
bool withSupportsHotColdNew () const
void setWithSupportsHotColdNew ()
bool skipModuleByDistributedBackend () const
void setSkipModuleByDistributedBackend ()
bool enableSplitLTOUnit () const
void setEnableSplitLTOUnit ()
bool hasUnifiedLTO () const
void setUnifiedLTO ()
bool partiallySplitLTOUnits () const
void setPartiallySplitLTOUnits ()
bool hasParamAccess () const
bool isGlobalValueLive (const GlobalValueSummary *GVS) const
LLVM_ABI bool isGUIDLive (GlobalValue::GUID GUID) const
ValueInfo getValueInfo (const GlobalValueSummaryMapTy::value_type &R) const
Return a ValueInfo for the index value_type (convenient when iterating index).
ValueInfo getValueInfo (GlobalValue::GUID GUID) const
Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().
ValueInfo getOrInsertValueInfo (GlobalValue::GUID GUID)
Return a ValueInfo for GUID.
StringRef saveString (StringRef String)
ValueInfo getOrInsertValueInfo (GlobalValue::GUID GUID, StringRef Name)
Return a ValueInfo for GUID setting value Name.
ValueInfo getOrInsertValueInfo (const GlobalValue *GV)
Return a ValueInfo for GV and mark it as belonging to GV.
GlobalValue::GUID getGUIDFromOriginalID (GlobalValue::GUID OriginalID) const
Return the GUID for OriginalId in the OidGuidMap.
CfiFunctionIndex & cfiFunctionDefs ()
const CfiFunctionIndex & cfiFunctionDefs () const
CfiFunctionIndex & cfiFunctionDecls ()
const CfiFunctionIndex & cfiFunctionDecls () const
void addGlobalValueSummary (const GlobalValue &GV, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value.
void addGlobalValueSummary (StringRef ValueName, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for a value of the given name.
void addGlobalValueSummary (ValueInfo VI, std::unique_ptr< GlobalValueSummary > Summary)
Add a global value summary for the given ValueInfo.
void addOriginalName (GlobalValue::GUID ValueGUID, GlobalValue::GUID OrigGUID)
Add an original name for the value of the given GUID.
GlobalValueSummary * findSummaryInModule (ValueInfo VI, StringRef ModuleId) const
Find the summary for ValueInfo VI in module ModuleId, or nullptr if not found.
GlobalValueSummary * findSummaryInModule (GlobalValue::GUID ValueGUID, StringRef ModuleId) const
Find the summary for global GUID in module ModuleId, or nullptr if not found.
GlobalValueSummary * getGlobalValueSummary (const GlobalValue &GV, bool PerModuleIndex=true) const
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
LLVM_ABI GlobalValueSummary * getGlobalValueSummary (GlobalValue::GUID ValueGUID, bool PerModuleIndex=true) const
Returns the first GlobalValueSummary for ValueGUID, asserting that there is only one if PerModuleIndex.
const StringMap< ModuleHash > & modulePaths () const
Table of modules, containing module hash and id.
StringMap< ModuleHash > & modulePaths ()
Table of modules, containing hash and id.
const ModuleHash & getModuleHash (const StringRef ModPath) const
Get the module SHA1 hash recorded for the given module path.
ModuleInfo * addModule (StringRef ModPath, ModuleHash Hash=ModuleHash{{0}})
Add a new module with the given Hash, mapped to the given ModID, and return a reference to the module.
ModuleInfo * getModule (StringRef ModPath)
Return module entry for module with the given ModPath.
const ModuleInfo * getModule (StringRef ModPath) const
Return module entry for module with the given ModPath.
bool hasExportedFunctions (const Module &M) const
Check if the given Module has any functions available for exporting in the index.
const TypeIdSummaryMapTy & typeIds () const
TypeIdSummary & getOrInsertTypeIdSummary (StringRef TypeId)
Return an existing or new TypeIdSummary entry for TypeId.
const TypeIdSummary * getTypeIdSummary (StringRef TypeId) const
This returns either a pointer to the type id summary (if present in the summary map) or null (if not present).
TypeIdSummary * getTypeIdSummary (StringRef TypeId)
const auto & typeIdCompatibleVtableMap () const
TypeIdCompatibleVtableInfo & getOrInsertTypeIdCompatibleVtableSummary (StringRef TypeId)
Return an existing or new TypeIdCompatibleVtableMap entry for TypeId.
std::optional< TypeIdCompatibleVtableInfo > getTypeIdCompatibleVtableSummary (StringRef TypeId) const
For the given TypeId, this returns the TypeIdCompatibleVtableMap entry if present in the summary map.
LLVM_ABI void collectDefinedFunctionsForModule (StringRef ModulePath, GVSummaryMapTy &GVSummaryMap) const
Collect for the given module the list of functions it defines (GUID -> Summary).
template
void collectDefinedGVSummariesPerModule (Map &ModuleToDefinedGVSummaries) const
Collect for each module the list of Summaries it defines (GUID -> Summary).
LLVM_ABI void print (raw_ostream &OS, bool IsForDebug=false) const
Print to an output stream.
LLVM_ABI void dump () const
Dump to stderr (for debugging).
LLVM_ABI void exportToDot (raw_ostream &OS, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols) const
Export summary to dot file for GraphViz.
LLVM_ABI void dumpSCCs (raw_ostream &OS)
Print out strongly connected components for debugging.
LLVM_ABI void propagateAttributes (const DenseSet< GlobalValue::GUID > &PreservedSymbols)
Do the access attribute and DSOLocal propagation in combined index.
LLVM_ABI bool canImportGlobalVar (const GlobalValueSummary *S, bool AnalyzeRefs) const
Checks if we can import global variable from another module.
LLVM_ABI bool canImportGlobalVar (const GlobalValueSummary *S, bool AnalyzeRefs, bool &CanImportDecl) const
Same as above but checks whether the global var is importable as a declaration.
Static Public Member Functions
static constexpr const char * getRegularLTOModuleName ()
static void discoverNodes (ValueInfo V, std::map< ValueInfo, bool > &FunctionHasParent)
Convenience function for doing a DFS on a ValueInfo.
static std::string getGlobalNameForLocal (StringRef Name, ModuleHash ModHash)
Convenience method for creating a promoted global name for the given value name of a local, and its original module's ID.
static std::string getGlobalNameForLocal (StringRef Name, StringRef Suffix)
static StringRef getOriginalNameBeforePromote (StringRef Name)
Helper to obtain the unpromoted name for a global value (or the original name if not promoted).
Static Public Attributes
static constexpr uint64_t BitcodeSummaryVersion = 12

Class to hold module path string table and global value map, and encapsulate methods for operating on them.

Definition at line 1451 of file ModuleSummaryIndex.h.

ModuleInfo

llvm::ModuleSummaryIndex::ModuleSummaryIndex ( bool HaveGVs, bool EnableSplitLTOUnit = false, bool UnifiedLTO = false ) inline

addBlockCount()

void llvm::ModuleSummaryIndex::addBlockCount ( uint64_t C) inline

addGlobalValueSummary() [1/3]

addGlobalValueSummary() [2/3]

addGlobalValueSummary() [3/3]

addModule()

Add a new module with the given Hash, mapped to the given ModID, and return a reference to the module.

Definition at line 1907 of file ModuleSummaryIndex.h.

addOrGetStackIdIndex()

unsigned llvm::ModuleSummaryIndex::addOrGetStackIdIndex ( uint64_t StackId) inline

addOriginalName()

begin() [1/2]

begin() [2/2]

calculateCallGraphRoot()

FunctionSummary llvm::ModuleSummaryIndex::calculateCallGraphRoot ( ) inline

canImportGlobalVar() [1/2]

canImportGlobalVar() [2/2]

cfiFunctionDecls() [1/2]

cfiFunctionDecls() [2/2]

cfiFunctionDefs() [1/2]

cfiFunctionDefs() [2/2]

collectDefinedFunctionsForModule()

void ModuleSummaryIndex::collectDefinedFunctionsForModule ( StringRef ModulePath,
GVSummaryMapTy & GVSummaryMap ) const

collectDefinedGVSummariesPerModule()

template

void llvm::ModuleSummaryIndex::collectDefinedGVSummariesPerModule ( Map & ModuleToDefinedGVSummaries) const inline

discoverNodes()

dump()

dumpSCCs()

enableSplitLTOUnit()

bool llvm::ModuleSummaryIndex::enableSplitLTOUnit ( ) const inline

end() [1/2]

end() [2/2]

exportToDot()

Export summary to dot file for GraphViz.

Definition at line 561 of file ModuleSummaryIndex.cpp.

References _, A(), assert(), collectDefinedGVSummariesPerModule(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::GlobalValueSummary::Declaration, defineExternalNode(), llvm::GlobalValueSummary::Definition, llvm::dyn_cast_or_null(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::sys::path::filename(), getNodeLabel(), getValueInfo(), hasConstantFlag(), hasReadOnlyFlag(), hasWriteOnlyFlag(), llvm::isa(), modulePaths(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::sort(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace().

findSummaryInModule() [1/2]

findSummaryInModule() [2/2]

getBlockCount()

uint64_t llvm::ModuleSummaryIndex::getBlockCount ( ) const inline

getFlags()

uint64_t ModuleSummaryIndex::getFlags ( ) const

getGlobalNameForLocal() [1/2]

std::string llvm::ModuleSummaryIndex::getGlobalNameForLocal ( StringRef Name, ModuleHash ModHash ) inlinestatic

getGlobalNameForLocal() [2/2]

std::string llvm::ModuleSummaryIndex::getGlobalNameForLocal ( StringRef Name, StringRef Suffix ) inlinestatic

getGlobalValueSummary() [1/2]

getGlobalValueSummary() [2/2]

getGUIDFromOriginalID()

getModule() [1/2]

ModuleInfo * llvm::ModuleSummaryIndex::getModule ( StringRef ModPath) inline

getModule() [2/2]

const ModuleInfo * llvm::ModuleSummaryIndex::getModule ( StringRef ModPath) const inline

getModuleHash()

getOriginalNameBeforePromote()

StringRef llvm::ModuleSummaryIndex::getOriginalNameBeforePromote ( StringRef Name) inlinestatic

Helper to obtain the unpromoted name for a global value (or the original name if not promoted).

Split off the rightmost ".llvm.${hash}" suffix, because it is possible in certain clients (not clang at the moment) for two rounds of ThinLTO optimization and therefore promotion to occur.

Definition at line 1898 of file ModuleSummaryIndex.h.

Referenced by findValueInfoForFunc(), and llvm::thinLTOInternalizeModule().

getOrInsertTypeIdCompatibleVtableSummary()

Return an existing or new TypeIdCompatibleVtableMap entry for TypeId.

This accessor can mutate the map and therefore should not be used in the ThinLTO backends.

Definition at line 1974 of file ModuleSummaryIndex.h.

getOrInsertTypeIdSummary()

getOrInsertValueInfo() [1/3]

getOrInsertValueInfo() [2/3]

getOrInsertValueInfo() [3/3]

getRegularLTOModuleName()

constexpr const char * llvm::ModuleSummaryIndex::getRegularLTOModuleName ( ) inlinestaticconstexpr

getStackIdAtIndex()

uint64_t llvm::ModuleSummaryIndex::getStackIdAtIndex ( unsigned Index) const inline

getTypeIdCompatibleVtableSummary()

For the given TypeId, this returns the TypeIdCompatibleVtableMap entry if present in the summary map.

This may be used when importing.

Definition at line 1981 of file ModuleSummaryIndex.h.

References I.

getTypeIdSummary() [1/2]

getTypeIdSummary() [2/2]

getValueInfo() [1/2]

ValueInfo llvm::ModuleSummaryIndex::getValueInfo ( const GlobalValueSummaryMapTy::value_type & R) const inline

getValueInfo() [2/2]

hasExportedFunctions()

bool llvm::ModuleSummaryIndex::hasExportedFunctions ( const Module & M) const inline

Check if the given Module has any functions available for exporting in the index.

We consider any module present in the ModulePathStringTable to have exported functions.

Definition at line 1928 of file ModuleSummaryIndex.h.

hasParamAccess()

bool llvm::ModuleSummaryIndex::hasParamAccess ( ) const inline

hasUnifiedLTO()

bool llvm::ModuleSummaryIndex::hasUnifiedLTO ( ) const inline

haveGVs()

bool llvm::ModuleSummaryIndex::haveGVs ( ) const inline

isGlobalValueLive()

isGUIDLive()

isReadOnly()

isWriteOnly()

modulePaths() [1/2]

modulePaths() [2/2]

partiallySplitLTOUnits()

bool llvm::ModuleSummaryIndex::partiallySplitLTOUnits ( ) const inline

print()

void ModuleSummaryIndex::print ( raw_ostream & OS,
bool IsForDebug = false ) const

propagateAttributes()

Do the access attribute and DSOLocal propagation in combined index.

Definition at line 261 of file ModuleSummaryIndex.cpp.

References llvm::AreStatisticsEnabled(), assert(), canImportGlobalVar(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::dyn_cast(), isGlobalValueLive(), llvm::none_of(), P, propagateAttributesToRefs(), PropagateAttrs, setWithAttributePropagation(), and setWithDSOLocalPropagation().

releaseTemporaryMemory()

void llvm::ModuleSummaryIndex::releaseTemporaryMemory ( ) inline

saveString()

setBlockCount()

void llvm::ModuleSummaryIndex::setBlockCount ( uint64_t C) inline

setEnableSplitLTOUnit()

void llvm::ModuleSummaryIndex::setEnableSplitLTOUnit ( ) inline

setFlags()

void ModuleSummaryIndex::setFlags ( uint64_t Flags )

Definition at line 115 of file ModuleSummaryIndex.cpp.

References assert(), setEnableSplitLTOUnit(), setPartiallySplitLTOUnits(), setSkipModuleByDistributedBackend(), setUnifiedLTO(), setWithAttributePropagation(), setWithDSOLocalPropagation(), setWithGlobalValueDeadStripping(), setWithInternalizeAndPromote(), setWithSupportsHotColdNew(), and setWithWholeProgramVisibility().

setPartiallySplitLTOUnits()

void llvm::ModuleSummaryIndex::setPartiallySplitLTOUnits ( ) inline

setSkipModuleByDistributedBackend()

void llvm::ModuleSummaryIndex::setSkipModuleByDistributedBackend ( ) inline

setUnifiedLTO()

void llvm::ModuleSummaryIndex::setUnifiedLTO ( ) inline

setWithAttributePropagation()

void llvm::ModuleSummaryIndex::setWithAttributePropagation ( ) inline

setWithDSOLocalPropagation()

void llvm::ModuleSummaryIndex::setWithDSOLocalPropagation ( ) inline

setWithGlobalValueDeadStripping()

void llvm::ModuleSummaryIndex::setWithGlobalValueDeadStripping ( ) inline

setWithInternalizeAndPromote()

void llvm::ModuleSummaryIndex::setWithInternalizeAndPromote ( ) inline

setWithSupportsHotColdNew()

void llvm::ModuleSummaryIndex::setWithSupportsHotColdNew ( ) inline

setWithWholeProgramVisibility()

void llvm::ModuleSummaryIndex::setWithWholeProgramVisibility ( ) inline

size()

size_t llvm::ModuleSummaryIndex::size ( ) const inline

skipModuleByDistributedBackend()

bool llvm::ModuleSummaryIndex::skipModuleByDistributedBackend ( ) const inline

stackIds()

const std::vector< uint64_t > & llvm::ModuleSummaryIndex::stackIds ( ) const inline

typeIdCompatibleVtableMap()

const auto & llvm::ModuleSummaryIndex::typeIdCompatibleVtableMap ( ) const inline

typeIds()

withAttributePropagation()

bool llvm::ModuleSummaryIndex::withAttributePropagation ( ) const inline

withDSOLocalPropagation()

bool llvm::ModuleSummaryIndex::withDSOLocalPropagation ( ) const inline

withGlobalValueDeadStripping()

bool llvm::ModuleSummaryIndex::withGlobalValueDeadStripping ( ) const inline

withInternalizeAndPromote()

bool llvm::ModuleSummaryIndex::withInternalizeAndPromote ( ) const inline

withSupportsHotColdNew()

bool llvm::ModuleSummaryIndex::withSupportsHotColdNew ( ) const inline

withWholeProgramVisibility()

bool llvm::ModuleSummaryIndex::withWholeProgramVisibility ( ) const inline

BitcodeSummaryVersion

uint64_t llvm::ModuleSummaryIndex::BitcodeSummaryVersion = 12 staticconstexpr

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