|
LLVM 24.0.0git
|
Class to hold module path string table and global value map, and encapsulate methods for operating on them. More...
#include "llvm/IR/ModuleSummaryIndex.h"
Public Types | |
| typedef ModulePathStringTableTy::value_type | ModuleInfo |
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 = 14 |
Class to hold module path string table and global value map, and encapsulate methods for operating on them.
Definition at line 1539 of file ModuleSummaryIndex.h.
Definition at line 2009 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1659 of file ModuleSummaryIndex.h.
Referenced by getTypeIdSummary().
|
inline |
Definition at line 1683 of file ModuleSummaryIndex.h.
|
inline |
Add a global value summary for a value.
Definition at line 1895 of file ModuleSummaryIndex.h.
References addGlobalValueSummary(), and getOrInsertValueInfo().
Referenced by addGlobalValueSummary(), and addGlobalValueSummary().
|
inline |
Add a global value summary for a value of the given name.
Definition at line 1901 of file ModuleSummaryIndex.h.
References addGlobalValueSummary(), llvm::GlobalValue::getGUIDAssumingExternalLinkage(), and getOrInsertValueInfo().
|
inline |
Add a global value summary for the given ValueInfo.
Definition at line 1910 of file ModuleSummaryIndex.h.
References addOriginalName(), and llvm::dyn_cast().
|
inline |
Add a new module with the given Hash, mapped to the given ModID, and return a reference to the module.
Definition at line 2013 of file ModuleSummaryIndex.h.
Definition at line 1699 of file ModuleSummaryIndex.h.
References uint64_t.
|
inline |
Add an original name for the value of the given GUID.
Definition at line 1922 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary().
|
inline |
Definition at line 1686 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1687 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1756 of file ModuleSummaryIndex.h.
References discoverNodes(), llvm::isa(), llvm::FunctionSummary::makeDummyFunctionSummary(), P, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
| bool ModuleSummaryIndex::canImportGlobalVar | ( | const GlobalValueSummary * | S, |
| bool | AnalyzeRefs ) const |
Checks if we can import global variable from another module.
Definition at line 369 of file ModuleSummaryIndex.cpp.
References canImportGlobalVar().
Referenced by canImportGlobalVar(), and propagateAttributes().
| bool ModuleSummaryIndex::canImportGlobalVar | ( | const GlobalValueSummary * | S, |
| bool | AnalyzeRefs, | ||
| bool & | CanImportDecl ) const |
Same as above but checks whether the global var is importable as a declaration.
Definition at line 375 of file ModuleSummaryIndex.cpp.
References llvm::cast(), llvm::GlobalValueSummary::getBaseObject(), ImportConstantsWithRefs, llvm::GlobalValue::isInterposableLinkage(), isReadOnly(), isWriteOnly(), llvm::GlobalValueSummary::linkage(), and llvm::GlobalValueSummary::notEligibleToImport().
|
inline |
Definition at line 1891 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1892 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1888 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1889 of file ModuleSummaryIndex.h.
| void ModuleSummaryIndex::collectDefinedFunctionsForModule | ( | StringRef | ModulePath, |
| GVSummaryMapTy & | GVSummaryMap ) const |
Collect for the given module the list of functions it defines (GUID -> Summary).
Definition at line 176 of file ModuleSummaryIndex.cpp.
References llvm::dyn_cast_or_null().
|
inline |
Collect for each module the list of Summaries it defines (GUID -> Summary).
Definition at line 2104 of file ModuleSummaryIndex.h.
Referenced by exportToDot().
|
inlinestatic |
Convenience function for doing a DFS on a ValueInfo.
Marks the function in the FunctionHasParent map.
Definition at line 1724 of file ModuleSummaryIndex.h.
References assert(), C(), discoverNodes(), llvm::dyn_cast(), F, and V.
Referenced by calculateCallGraphRoot(), and discoverNodes().
| LLVM_DUMP_METHOD void ModuleSummaryIndex::dump | ( | ) | const |
Dump to stderr (for debugging).
Definition at line 5679 of file AsmWriter.cpp.
References llvm::dbgs(), and print().
| LLVM_DUMP_METHOD void ModuleSummaryIndex::dumpSCCs | ( | raw_ostream & | OS | ) |
Print out strongly connected components for debugging.
Definition at line 418 of file ModuleSummaryIndex.cpp.
References llvm::cast(), F, I, llvm::scc_begin(), and llvm::utostr().
|
inline |
Definition at line 1821 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1688 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1689 of file ModuleSummaryIndex.h.
| void ModuleSummaryIndex::exportToDot | ( | raw_ostream & | OS, |
| const DenseSet< GlobalValue::GUID > & | GUIDPreservedSymbols ) const |
Export summary to dot file for GraphViz.
Definition at line 599 of file ModuleSummaryIndex.cpp.
References _, A(), assert(), collectDefinedGVSummariesPerModule(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::detail::DenseSetImpl< ValueT, MapTy >::count(), llvm::GlobalValueSummary::Declaration, defineExternalNode(), llvm::GlobalValueSummary::Definition, llvm::dyn_cast_or_null(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::sys::path::filename(), getNodeLabel(), getValueInfo(), hasConstantFlag(), hasReadOnlyFlag(), hasWriteOnlyFlag(), llvm::isa(), modulePaths(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::size(), llvm::sort(), and llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace().
|
inline |
Find the summary for global GUID in module ModuleId, or nullptr if not found.
Definition at line 1947 of file ModuleSummaryIndex.h.
References findSummaryInModule(), and getValueInfo().
|
inline |
Find the summary for ValueInfo VI in module ModuleId, or nullptr if not found.
Definition at line 1933 of file ModuleSummaryIndex.h.
References llvm::find_if().
Referenced by findSummaryInModule().
|
inline |
Definition at line 1682 of file ModuleSummaryIndex.h.
References uint64_t.
| uint64_t ModuleSummaryIndex::getFlags | ( | ) | const |
Definition at line 96 of file ModuleSummaryIndex.cpp.
References enableSplitLTOUnit(), hasUnifiedLTO(), partiallySplitLTOUnits(), skipModuleByDistributedBackend(), withAttributePropagation(), withDSOLocalPropagation(), withGlobalValueDeadStripping(), withInternalizeAndPromote(), withSpeculativeDevirt(), withSupportsHotColdNew(), and withWholeProgramVisibility().
|
inlinestatic |
Convenience method for creating a promoted global name for the given value name of a local, and its original module's ID.
Definition at line 1987 of file ModuleSummaryIndex.h.
References getGlobalNameForLocal(), uint64_t, and llvm::utostr().
Referenced by getGlobalNameForLocal(), and llvm::updateIndexWPDForExports().
|
inlinestatic |
Definition at line 1993 of file ModuleSummaryIndex.h.
|
inline |
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
Definition at line 1957 of file ModuleSummaryIndex.h.
References assert(), getGlobalValueSummary(), llvm::GlobalValue::getGUID(), and llvm::Value::hasName().
Referenced by getGlobalValueSummary().
| GlobalValueSummary * ModuleSummaryIndex::getGlobalValueSummary | ( | GlobalValue::GUID | ValueGUID, |
| bool | PerModuleIndex = true ) const |
Returns the first GlobalValueSummary for ValueGUID, asserting that there is only one if PerModuleIndex.
Definition at line 194 of file ModuleSummaryIndex.cpp.
References assert(), and getValueInfo().
|
inline |
Return the GUID for OriginalId in the OidGuidMap.
Definition at line 1883 of file ModuleSummaryIndex.h.
References I.
Referenced by findIndirectTailCallCallsite().
|
inline |
Return module entry for module with the given ModPath.
Definition at line 2018 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Return module entry for module with the given ModPath.
Definition at line 2025 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Get the module SHA1 hash recorded for the given module path.
Definition at line 1979 of file ModuleSummaryIndex.h.
References assert().
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 2004 of file ModuleSummaryIndex.h.
Referenced by findIndirectTailCallCallsite(), findValueInfoForGV(), and llvm::thinLTOInternalizeModule().
|
inline |
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 2080 of file ModuleSummaryIndex.h.
|
inline |
Return an existing or new TypeIdSummary entry for TypeId.
This accessor can mutate the map and therefore should not be used in the ThinLTO backends.
Definition at line 2043 of file ModuleSummaryIndex.h.
References llvm::GlobalValue::getGUIDAssumingExternalLinkage(), and llvm::make_range().
Referenced by parseTypeIdSummaryRecord().
|
inline |
Return a ValueInfo for GV and mark it as belonging to GV.
Definition at line 1878 of file ModuleSummaryIndex.h.
References llvm::GlobalValue::getGUID(), and getOrInsertValueInfo().
|
inline |
Return a ValueInfo for GV with GUID GUID and mark it as belonging to GV.
Definition at line 1869 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Return a ValueInfo for GUID.
Definition at line 1850 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary(), addGlobalValueSummary(), and getOrInsertValueInfo().
|
inline |
Return a ValueInfo for GUID setting value Name.
Definition at line 1860 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1673 of file ModuleSummaryIndex.h.
Referenced by checkCombinedSummaryForTesting().
Definition at line 1706 of file ModuleSummaryIndex.h.
References assert(), and uint64_t.
Referenced by checkAllocContextIds().
|
inline |
For the given TypeId, this returns the TypeIdCompatibleVtableMap entry if present in the summary map.
This may be used when importing.
Definition at line 2087 of file ModuleSummaryIndex.h.
References I.
|
inline |
Definition at line 2066 of file ModuleSummaryIndex.h.
References ModuleSummaryIndex().
|
inline |
This returns either a pointer to the type id summary (if present in the summary map) or null (if not present).
This may be used when importing.
Definition at line 2057 of file ModuleSummaryIndex.h.
References llvm::GlobalValue::getGUIDAssumingExternalLinkage(), and llvm::make_range().
|
inline |
Return a ValueInfo for the index value_type (convenient when iterating index).
Definition at line 1839 of file ModuleSummaryIndex.h.
Referenced by exportToDot(), findIndirectTailCallCallsite(), findSummaryInModule(), findValueInfoForGV(), getGlobalValueSummary(), and isGUIDLive().
|
inline |
Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().
Definition at line 1844 of file ModuleSummaryIndex.h.
References I.
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 2034 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1830 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1824 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1677 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1832 of file ModuleSummaryIndex.h.
References llvm::GlobalValueSummary::isLive().
Referenced by isGUIDLive(), and propagateAttributes().
| bool ModuleSummaryIndex::isGUIDLive | ( | GlobalValue::GUID | GUID | ) | const |
Definition at line 204 of file ModuleSummaryIndex.cpp.
References getValueInfo(), I, and isGlobalValueLive().
|
inline |
Definition at line 1804 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeReadOnly().
Referenced by canImportGlobalVar().
|
inline |
Definition at line 1807 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeWriteOnly().
Referenced by canImportGlobalVar().
|
inline |
Table of modules, containing hash and id.
Definition at line 1976 of file ModuleSummaryIndex.h.
|
inline |
Table of modules, containing module hash and id.
Definition at line 1971 of file ModuleSummaryIndex.h.
Referenced by exportToDot().
|
inline |
Definition at line 1827 of file ModuleSummaryIndex.h.
Referenced by getFlags().
| void ModuleSummaryIndex::print | ( | raw_ostream & | OS, |
| bool | IsForDebug = false ) const |
Print to an output stream.
Definition at line 5608 of file AsmWriter.cpp.
| void ModuleSummaryIndex::propagateAttributes | ( | const DenseSet< GlobalValue::GUID > & | PreservedSymbols | ) |
Do the access attribute and DSOLocal propagation in combined index.
Definition at line 299 of file ModuleSummaryIndex.cpp.
References llvm::AreStatisticsEnabled(), assert(), canImportGlobalVar(), llvm::detail::DenseSetImpl< ValueT, MapTy >::count(), llvm::dyn_cast(), isGlobalValueLive(), llvm::none_of(), P, propagateAttributesToRefs(), PropagateAttrs, setWithAttributePropagation(), and setWithDSOLocalPropagation().
|
inline |
Definition at line 1716 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1857 of file ModuleSummaryIndex.h.
References llvm::String.
|
inline |
Definition at line 1684 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1822 of file ModuleSummaryIndex.h.
Referenced by setFlags().
| void ModuleSummaryIndex::setFlags | ( | uint64_t | Flags | ) |
Definition at line 124 of file ModuleSummaryIndex.cpp.
References assert(), setEnableSplitLTOUnit(), setPartiallySplitLTOUnits(), setSkipModuleByDistributedBackend(), setUnifiedLTO(), setWithAttributePropagation(), setWithDSOLocalPropagation(), setWithGlobalValueDeadStripping(), setWithInternalizeAndPromote(), setWithSpeculativeDevirt(), setWithSupportsHotColdNew(), and setWithWholeProgramVisibility().
|
inline |
Definition at line 1828 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1817 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1825 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1788 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1793 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1783 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1796 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1802 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1812 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1799 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1690 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1814 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1693 of file ModuleSummaryIndex.h.
Definition at line 1697 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2072 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2038 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1787 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1792 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1780 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1795 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1801 of file ModuleSummaryIndex.h.
Referenced by getFlags(), and llvm::lto::thinBackend().
|
inline |
Definition at line 1811 of file ModuleSummaryIndex.h.
Referenced by llvm::PassBuilder::buildLTODefaultPipeline(), llvm::PassBuilder::buildThinLTODefaultPipeline(), and getFlags().
|
inline |
Definition at line 1798 of file ModuleSummaryIndex.h.
Referenced by getFlags(), and llvm::lto::thinBackend().
|
staticconstexpr |
Definition at line 1670 of file ModuleSummaryIndex.h.