|
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 1547 of file ModuleSummaryIndex.h.
Definition at line 2017 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1667 of file ModuleSummaryIndex.h.
Referenced by getTypeIdSummary(), and print().
|
inline |
Definition at line 1691 of file ModuleSummaryIndex.h.
|
inline |
Add a global value summary for a value.
Definition at line 1903 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 1909 of file ModuleSummaryIndex.h.
References addGlobalValueSummary(), llvm::GlobalValue::getGUIDAssumingExternalLinkage(), and getOrInsertValueInfo().
|
inline |
Add a global value summary for the given ValueInfo.
Definition at line 1918 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 2021 of file ModuleSummaryIndex.h.
Definition at line 1707 of file ModuleSummaryIndex.h.
References uint64_t.
|
inline |
Add an original name for the value of the given GUID.
Definition at line 1930 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary().
|
inline |
Definition at line 1694 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1695 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1764 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 1899 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1900 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1896 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1897 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 2112 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 1732 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 5804 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 1829 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1696 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1697 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 600 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 1955 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 1941 of file ModuleSummaryIndex.h.
References llvm::find_if().
Referenced by findSummaryInModule().
|
inline |
Definition at line 1690 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 1995 of file ModuleSummaryIndex.h.
References getGlobalNameForLocal(), uint64_t, and llvm::utostr().
Referenced by getGlobalNameForLocal(), and llvm::updateIndexWPDForExports().
|
inlinestatic |
Definition at line 2001 of file ModuleSummaryIndex.h.
|
inline |
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
Definition at line 1965 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 1891 of file ModuleSummaryIndex.h.
References I.
Referenced by findIndirectTailCallCallsite().
|
inline |
Return module entry for module with the given ModPath.
Definition at line 2026 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Return module entry for module with the given ModPath.
Definition at line 2033 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Get the module SHA1 hash recorded for the given module path.
Definition at line 1987 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 2012 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 2088 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 2051 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 1886 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 1877 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Return a ValueInfo for GUID.
Definition at line 1858 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary(), addGlobalValueSummary(), and getOrInsertValueInfo().
|
inline |
Return a ValueInfo for GUID setting value Name.
Definition at line 1868 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1681 of file ModuleSummaryIndex.h.
Referenced by checkCombinedSummaryForTesting().
Definition at line 1714 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 2095 of file ModuleSummaryIndex.h.
References I.
|
inline |
Definition at line 2074 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 2065 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 1847 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 1852 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 2042 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1838 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1832 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1685 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1840 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 1812 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeReadOnly().
Referenced by canImportGlobalVar().
|
inline |
Definition at line 1815 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeWriteOnly().
Referenced by canImportGlobalVar().
|
inline |
Table of modules, containing hash and id.
Definition at line 1984 of file ModuleSummaryIndex.h.
|
inline |
Table of modules, containing module hash and id.
Definition at line 1979 of file ModuleSummaryIndex.h.
Referenced by exportToDot().
|
inline |
Definition at line 1835 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 5733 of file AsmWriter.cpp.
References ModuleSummaryIndex(), and print().
Referenced by print().
| 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 1724 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1865 of file ModuleSummaryIndex.h.
References llvm::String.
|
inline |
Definition at line 1692 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1830 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 1836 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1825 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1833 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1796 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1801 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1791 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1804 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1810 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1820 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1807 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1698 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1822 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1701 of file ModuleSummaryIndex.h.
Definition at line 1705 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2080 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2046 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1795 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1800 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1788 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1803 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1809 of file ModuleSummaryIndex.h.
Referenced by getFlags(), and llvm::lto::thinBackend().
|
inline |
Definition at line 1819 of file ModuleSummaryIndex.h.
Referenced by llvm::PassBuilder::buildLTODefaultPipeline(), llvm::PassBuilder::buildThinLTODefaultPipeline(), and getFlags().
|
inline |
Definition at line 1806 of file ModuleSummaryIndex.h.
Referenced by getFlags(), and llvm::lto::thinBackend().
|
staticconstexpr |
Definition at line 1678 of file ModuleSummaryIndex.h.