|
LLVM 23.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 1518 of file ModuleSummaryIndex.h.
Definition at line 1975 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1635 of file ModuleSummaryIndex.h.
Referenced by getTypeIdSummary().
|
inline |
Definition at line 1659 of file ModuleSummaryIndex.h.
References llvm::CallingConv::C.
|
inline |
Add a global value summary for a value.
Definition at line 1861 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 1867 of file ModuleSummaryIndex.h.
References addGlobalValueSummary(), llvm::GlobalValue::getGUIDAssumingExternalLinkage(), and getOrInsertValueInfo().
|
inline |
Add a global value summary for the given ValueInfo.
Definition at line 1876 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 1979 of file ModuleSummaryIndex.h.
Definition at line 1675 of file ModuleSummaryIndex.h.
|
inline |
Add an original name for the value of the given GUID.
Definition at line 1888 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary().
|
inline |
Definition at line 1662 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1663 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1732 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 363 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 369 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 1857 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1858 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1854 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1855 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 170 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 2070 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 1700 of file ModuleSummaryIndex.h.
References assert(), llvm::CallingConv::C, discoverNodes(), llvm::dyn_cast(), and F.
Referenced by calculateCallGraphRoot(), and discoverNodes().
| LLVM_DUMP_METHOD void ModuleSummaryIndex::dump | ( | ) | const |
Dump to stderr (for debugging).
Definition at line 5526 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 412 of file ModuleSummaryIndex.cpp.
References llvm::cast(), F, I, llvm::scc_begin(), and llvm::utostr().
|
inline |
Definition at line 1794 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1664 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1665 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 593 of file ModuleSummaryIndex.cpp.
References _, A(), assert(), collectDefinedGVSummariesPerModule(), llvm::DenseMapBase< DerivedT, 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< 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().
|
inline |
Find the summary for global GUID in module ModuleId, or nullptr if not found.
Definition at line 1913 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 1899 of file ModuleSummaryIndex.h.
References llvm::find_if().
Referenced by findSummaryInModule().
|
inline |
Definition at line 1658 of file ModuleSummaryIndex.h.
| uint64_t ModuleSummaryIndex::getFlags | ( | ) | const |
Definition at line 96 of file ModuleSummaryIndex.cpp.
References enableSplitLTOUnit(), hasUnifiedLTO(), partiallySplitLTOUnits(), skipModuleByDistributedBackend(), withAttributePropagation(), withDSOLocalPropagation(), withGlobalValueDeadStripping(), withInternalizeAndPromote(), 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 1953 of file ModuleSummaryIndex.h.
References getGlobalNameForLocal(), and llvm::utostr().
Referenced by getGlobalNameForLocal(), and llvm::updateIndexWPDForExports().
|
inlinestatic |
Definition at line 1959 of file ModuleSummaryIndex.h.
|
inline |
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
Definition at line 1923 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 188 of file ModuleSummaryIndex.cpp.
References assert(), and getValueInfo().
|
inline |
Return the GUID for OriginalId in the OidGuidMap.
Definition at line 1849 of file ModuleSummaryIndex.h.
References I.
|
inline |
Return module entry for module with the given ModPath.
Definition at line 1984 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Return module entry for module with the given ModPath.
Definition at line 1991 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Get the module SHA1 hash recorded for the given module path.
Definition at line 1945 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 1970 of file ModuleSummaryIndex.h.
Referenced by findValueInfoForFunc(), 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 2046 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 2009 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 1841 of file ModuleSummaryIndex.h.
References assert(), and llvm::GlobalValue::getGUID().
|
inline |
Return a ValueInfo for GUID.
Definition at line 1823 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary(), and addGlobalValueSummary().
|
inline |
Return a ValueInfo for GUID setting value Name.
Definition at line 1833 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1649 of file ModuleSummaryIndex.h.
Referenced by checkCombinedSummaryForTesting().
Definition at line 1682 of file ModuleSummaryIndex.h.
References assert().
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 2053 of file ModuleSummaryIndex.h.
References I.
|
inline |
Definition at line 2032 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 2023 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 1812 of file ModuleSummaryIndex.h.
Referenced by exportToDot(), findSummaryInModule(), findValueInfoForFunc(), getGlobalValueSummary(), and isGUIDLive().
|
inline |
Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().
Definition at line 1817 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 2000 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1803 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1797 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1653 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1805 of file ModuleSummaryIndex.h.
References llvm::GlobalValueSummary::isLive().
Referenced by isGUIDLive(), and propagateAttributes().
| bool ModuleSummaryIndex::isGUIDLive | ( | GlobalValue::GUID | GUID | ) | const |
Definition at line 198 of file ModuleSummaryIndex.cpp.
References getValueInfo(), I, and isGlobalValueLive().
|
inline |
Definition at line 1777 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeReadOnly().
Referenced by canImportGlobalVar().
|
inline |
Definition at line 1780 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeWriteOnly().
Referenced by canImportGlobalVar().
|
inline |
Table of modules, containing hash and id.
Definition at line 1942 of file ModuleSummaryIndex.h.
|
inline |
Table of modules, containing module hash and id.
Definition at line 1937 of file ModuleSummaryIndex.h.
Referenced by exportToDot().
|
inline |
Definition at line 1800 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 5453 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 293 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 1692 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1830 of file ModuleSummaryIndex.h.
References llvm::String.
|
inline |
Definition at line 1660 of file ModuleSummaryIndex.h.
References llvm::CallingConv::C.
|
inline |
Definition at line 1795 of file ModuleSummaryIndex.h.
Referenced by setFlags().
| void ModuleSummaryIndex::setFlags | ( | uint64_t | Flags | ) |
Definition at line 122 of file ModuleSummaryIndex.cpp.
References assert(), setEnableSplitLTOUnit(), setPartiallySplitLTOUnits(), setSkipModuleByDistributedBackend(), setUnifiedLTO(), setWithAttributePropagation(), setWithDSOLocalPropagation(), setWithGlobalValueDeadStripping(), setWithInternalizeAndPromote(), setWithSupportsHotColdNew(), and setWithWholeProgramVisibility().
|
inline |
Definition at line 1801 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1790 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1798 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1764 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1769 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1759 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1772 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1785 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1775 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1666 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1787 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1669 of file ModuleSummaryIndex.h.
Definition at line 1673 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2038 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2004 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1763 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1768 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1756 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1771 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1784 of file ModuleSummaryIndex.h.
Referenced by llvm::PassBuilder::buildLTODefaultPipeline(), llvm::PassBuilder::buildThinLTODefaultPipeline(), and getFlags().
|
inline |
Definition at line 1774 of file ModuleSummaryIndex.h.
Referenced by getFlags(), and llvm::lto::thinBackend().
|
staticconstexpr |
Definition at line 1646 of file ModuleSummaryIndex.h.