|
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 1516 of file ModuleSummaryIndex.h.
Definition at line 1980 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1633 of file ModuleSummaryIndex.h.
Referenced by getTypeIdSummary().
|
inline |
Definition at line 1657 of file ModuleSummaryIndex.h.
|
inline |
Add a global value summary for a value.
Definition at line 1866 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 1872 of file ModuleSummaryIndex.h.
References addGlobalValueSummary(), llvm::GlobalValue::getGUIDAssumingExternalLinkage(), and getOrInsertValueInfo().
|
inline |
Add a global value summary for the given ValueInfo.
Definition at line 1881 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 1984 of file ModuleSummaryIndex.h.
Definition at line 1673 of file ModuleSummaryIndex.h.
References uint64_t.
|
inline |
Add an original name for the value of the given GUID.
Definition at line 1893 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary().
|
inline |
Definition at line 1660 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1661 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1730 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 1862 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1863 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1859 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1860 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 2075 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 1698 of file ModuleSummaryIndex.h.
References assert(), 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 5554 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 1792 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1662 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1663 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 1918 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 1904 of file ModuleSummaryIndex.h.
References llvm::find_if().
Referenced by findSummaryInModule().
|
inline |
Definition at line 1656 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(), 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 1958 of file ModuleSummaryIndex.h.
References getGlobalNameForLocal(), uint64_t, and llvm::utostr().
Referenced by getGlobalNameForLocal(), and llvm::updateIndexWPDForExports().
|
inlinestatic |
Definition at line 1964 of file ModuleSummaryIndex.h.
|
inline |
Returns the first GlobalValueSummary for GV, asserting that there is only one if PerModuleIndex.
Definition at line 1928 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 1854 of file ModuleSummaryIndex.h.
References I.
|
inline |
Return module entry for module with the given ModPath.
Definition at line 1989 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Return module entry for module with the given ModPath.
Definition at line 1996 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Get the module SHA1 hash recorded for the given module path.
Definition at line 1950 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 1975 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 2051 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 2014 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 1849 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 1840 of file ModuleSummaryIndex.h.
References assert().
|
inline |
Return a ValueInfo for GUID.
Definition at line 1821 of file ModuleSummaryIndex.h.
Referenced by addGlobalValueSummary(), addGlobalValueSummary(), and getOrInsertValueInfo().
|
inline |
Return a ValueInfo for GUID setting value Name.
Definition at line 1831 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1647 of file ModuleSummaryIndex.h.
Referenced by checkCombinedSummaryForTesting().
Definition at line 1680 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 2058 of file ModuleSummaryIndex.h.
References I.
|
inline |
Definition at line 2037 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 2028 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 1810 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 1815 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 2005 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1801 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1795 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1651 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1803 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 1775 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeReadOnly().
Referenced by canImportGlobalVar().
|
inline |
Definition at line 1778 of file ModuleSummaryIndex.h.
References llvm::GlobalVarSummary::maybeWriteOnly().
Referenced by canImportGlobalVar().
|
inline |
Table of modules, containing hash and id.
Definition at line 1947 of file ModuleSummaryIndex.h.
|
inline |
Table of modules, containing module hash and id.
Definition at line 1942 of file ModuleSummaryIndex.h.
Referenced by exportToDot().
|
inline |
Definition at line 1798 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 5481 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 1690 of file ModuleSummaryIndex.h.
References assert().
Definition at line 1828 of file ModuleSummaryIndex.h.
References llvm::String.
|
inline |
Definition at line 1658 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1793 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 1799 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1788 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1796 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1762 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1767 of file ModuleSummaryIndex.h.
Referenced by propagateAttributes(), and setFlags().
|
inline |
Definition at line 1757 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1770 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1783 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1773 of file ModuleSummaryIndex.h.
Referenced by setFlags().
|
inline |
Definition at line 1664 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1785 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1667 of file ModuleSummaryIndex.h.
Definition at line 1671 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2043 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 2009 of file ModuleSummaryIndex.h.
|
inline |
Definition at line 1761 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1766 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1754 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1769 of file ModuleSummaryIndex.h.
Referenced by getFlags().
|
inline |
Definition at line 1782 of file ModuleSummaryIndex.h.
Referenced by llvm::PassBuilder::buildLTODefaultPipeline(), llvm::PassBuilder::buildThinLTODefaultPipeline(), and getFlags().
|
inline |
Definition at line 1772 of file ModuleSummaryIndex.h.
Referenced by getFlags(), and llvm::lto::thinBackend().
|
staticconstexpr |
Definition at line 1644 of file ModuleSummaryIndex.h.