class ModuleSummaryIndex

Declaration

class ModuleSummaryIndex { /* full declaration omitted */ };

Description

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

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1087

Member Variables

private llvm::GlobalValueSummaryMapTy GlobalValueMap
Map from value name to list of summary instances for values of that name (may be duplicates in the COMDAT case, e.g.).
private llvm::ModulePathStringTableTy ModulePathStringTable
Holds strings for combined index, mapping to the corresponding module ID.
private llvm::TypeIdSummaryMapTy TypeIdMap
Mapping from type identifier GUIDs to type identifier and its summary information. Produced by thin link.
private std::map<std::string, TypeIdCompatibleVtableInfo, std::less<>> TypeIdCompatibleVtableMap
Mapping from type identifier to information about vtables decorated with that type identifier's metadata. Produced by per module summary analysis and consumed by thin link. For more information, see description above where TypeIdCompatibleVtableInfo is defined.
private std::map<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap
Mapping from original ID to GUID. If original ID can map to multiple GUIDs, it will be mapped to 0.
private bool WithGlobalValueDeadStripping = false
Indicates that summary-based GlobalValue GC has run, and values with GVFlags::Live==false are really dead. Otherwise, all values must be considered live.
private bool WithAttributePropagation = false
Indicates that summary-based attribute propagation has run and GVarFlags::MaybeReadonly / GVarFlags::MaybeWriteonly are really read/write only.
private bool WithDSOLocalPropagation = false
Indicates that summary-based DSOLocal propagation has run and the flag in every summary of a GV is synchronized.
private bool WithWholeProgramVisibility = false
Indicates that we have whole program visibility.
private bool HasSyntheticEntryCounts = false
Indicates that summary-based synthetic entry count propagation has run
private bool SkipModuleByDistributedBackend = false
Indicates that distributed backend should skip compilation of the module. Flag is suppose to be set by distributed ThinLTO indexing when it detected that the module is not needed during the final linking. As result distributed backend should just output a minimal valid object file.
private bool HaveGVs
If true then we're performing analysis of IR module, or parsing along with the IR from assembly. The value of 'false' means we're reading summary from BC or YAML source. Affects the type of value stored in NameOrGV union.
private bool EnableSplitLTOUnit
private bool PartiallySplitLTOUnits = false
private bool HasParamAccess = false
True if some of the FunctionSummary contains a ParamAccess.
private std::set<std::string> CfiFunctionDefs
private std::set<std::string> CfiFunctionDecls
private llvm::BumpPtrAllocator Alloc
private llvm::StringSaver Saver
private uint64_t BlockCount
public static const uint64_t BitcodeSummaryVersion = 9

Method Overview

Methods

ModuleSummaryIndex(
    bool HaveGVs,
    bool EnableSplitLTOUnit = false)

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1177

Parameters

bool HaveGVs
bool EnableSplitLTOUnit = false

void addBlockCount(uint64_t C)

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1199

Parameters

uint64_t C

void addGlobalValueSummary(
    llvm::StringRef ValueName,
    std::unique_ptr<GlobalValueSummary> Summary)

Description

Add a global value summary for a value of the given name.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1376

Parameters

llvm::StringRef ValueName
std::unique_ptr<GlobalValueSummary> Summary

void addGlobalValueSummary(
    const llvm::GlobalValue& GV,
    std::unique_ptr<GlobalValueSummary> Summary)

Description

Add a global value summary for a value.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1370

Parameters

const llvm::GlobalValue& GV
std::unique_ptr<GlobalValueSummary> Summary

void addGlobalValueSummary(
    llvm::ValueInfo VI,
    std::unique_ptr<GlobalValueSummary> Summary)

Description

Add a global value summary for the given ValueInfo.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1383

Parameters

llvm::ValueInfo VI
std::unique_ptr<GlobalValueSummary> Summary

llvm::ModuleSummaryIndex::ModuleInfo* addModule(
    llvm::StringRef ModPath,
    uint64_t ModId,
    llvm::ModuleHash Hash =
        std::array<unsigned int, 5>{{0}})

Description

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

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1488

Parameters

llvm::StringRef ModPath
uint64_t ModId
llvm::ModuleHash Hash = std::array<unsigned int, 5>{{0}}

void addOriginalName(GlobalValue::GUID ValueGUID,
                     GlobalValue::GUID OrigGUID)

Description

Add an original name for the value of the given GUID.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1395

Parameters

GlobalValue::GUID ValueGUID
GlobalValue::GUID OrigGUID

llvm::gvsummary_iterator begin()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1202

llvm::const_gvsummary_iterator begin() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1203

llvm::FunctionSummary calculateCallGraphRoot()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1242

bool canImportGlobalVar(
    llvm::GlobalValueSummary* S,
    bool AnalyzeRefs) const

Description

Checks if we can import global variable from another module.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1596

Parameters

llvm::GlobalValueSummary* S
bool AnalyzeRefs

const std::set<std::string>& cfiFunctionDecls()
    const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1367

std::set<std::string>& cfiFunctionDecls()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1366

const std::set<std::string>& cfiFunctionDefs()
    const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1364

std::set<std::string>& cfiFunctionDefs()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1363

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

Description

Collect for the given module the list of functions it defines (GUID -> Summary).

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1562

Parameters

llvm::StringRef ModulePath
llvm::GVSummaryMapTy& GVSummaryMap

template <class Map>
void collectDefinedGVSummariesPerModule(
    Map& ModuleToDefinedGVSummaries) const

Description

Collect for each module the list of Summaries it defines (GUID -> Summary).

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1569

Templates

Map

Parameters

Map& ModuleToDefinedGVSummaries

static void discoverNodes(
    llvm::ValueInfo V,
    std::map<ValueInfo, bool>& FunctionHasParent)

Description

Convenience function for doing a DFS on a ValueInfo. Marks the function in the FunctionHasParent map.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1210

Parameters

llvm::ValueInfo V
std::map<ValueInfo, bool>& FunctionHasParent

void dump() const

Description

Dump to stderr (for debugging).

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1582

void dumpSCCs(llvm::raw_ostream& OS)

Description

Print out strongly connected components for debugging.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1590

Parameters

llvm::raw_ostream& OS

bool enableSplitLTOUnit() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1306

llvm::const_gvsummary_iterator end() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1205

llvm::gvsummary_iterator end()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1204

void exportToDot(
    llvm::raw_ostream& OS,
    const DenseSet<GlobalValue::GUID>&
        GUIDPreservedSymbols) const

Description

Export summary to dot file for GraphViz.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1586

Parameters

llvm::raw_ostream& OS
const DenseSet<GlobalValue::GUID>& GUIDPreservedSymbols

llvm::GlobalValueSummary* findSummaryInModule(
    llvm::ValueInfo VI,
    llvm::StringRef ModuleId) const

Description

Find the summary for ValueInfo \p VI in module \p ModuleId, or nullptr if not found.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1407

Parameters

llvm::ValueInfo VI
llvm::StringRef ModuleId

llvm::GlobalValueSummary* findSummaryInModule(
    GlobalValue::GUID ValueGUID,
    llvm::StringRef ModuleId) const

Description

Find the summary for global \p GUID in module \p ModuleId, or nullptr if not found.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1421

Parameters

GlobalValue::GUID ValueGUID
llvm::StringRef ModuleId

uint64_t getBlockCount() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1198

uint64_t getFlags() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1195

GlobalValue::GUID getGUIDFromOriginalID(
    GlobalValue::GUID OriginalID) const

Description

Return the GUID for \p OriginalId in the OidGuidMap.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1358

Parameters

GlobalValue::GUID OriginalID

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

Description

Convenience method for creating a promoted global name for the given value name of a local, and its original module's ID.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1467

Parameters

llvm::StringRef Name
llvm::ModuleHash ModHash

llvm::GlobalValueSummary* getGlobalValueSummary(
    const llvm::GlobalValue& GV,
    bool PerModuleIndex = true) const

Description

Returns the first GlobalValueSummary for \p GV, asserting that there is only one if \p PerModuleIndex.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1431

Parameters

const llvm::GlobalValue& GV
bool PerModuleIndex = true

llvm::GlobalValueSummary* getGlobalValueSummary(
    GlobalValue::GUID ValueGUID,
    bool PerModuleIndex = true) const

Description

Returns the first GlobalValueSummary for \p ValueGUID, asserting that there is only one if \p PerModuleIndex.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1440

Parameters

GlobalValue::GUID ValueGUID
bool PerModuleIndex = true

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

Description

Return module entry for module with the given \p ModPath.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1494

Parameters

llvm::StringRef ModPath

const llvm::ModuleHash& getModuleHash(
    const llvm::StringRef ModPath) const

Description

Get the module SHA1 hash recorded for the given module path.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1459

Parameters

const llvm::StringRef ModPath

uint64_t getModuleId(
    const llvm::StringRef ModPath) const

Description

Get the module ID recorded for the given module path.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1454

Parameters

const llvm::StringRef ModPath

llvm::TypeIdCompatibleVtableInfo&
getOrInsertTypeIdCompatibleVtableSummary(
    llvm::StringRef TypeId)

Description

Return an existing or new TypeIdCompatibleVtableMap entry for \p TypeId. This accessor can mutate the map and therefore should not be used in the ThinLTO backends.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1546

Parameters

llvm::StringRef TypeId

llvm::TypeIdSummary& getOrInsertTypeIdSummary(
    llvm::StringRef TypeId)

Description

Return an existing or new TypeIdSummary entry for \p TypeId. This accessor can mutate the map and therefore should not be used in the ThinLTO backends.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1512

Parameters

llvm::StringRef TypeId

llvm::ValueInfo getOrInsertValueInfo(
    const llvm::GlobalValue* GV)

Description

Return a ValueInfo for \p GV and mark it as belonging to GV.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1350

Parameters

const llvm::GlobalValue* GV

llvm::ValueInfo getOrInsertValueInfo(
    GlobalValue::GUID GUID)

Description

Return a ValueInfo for \p GUID.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1332

Parameters

GlobalValue::GUID GUID

llvm::ValueInfo getOrInsertValueInfo(
    GlobalValue::GUID GUID,
    llvm::StringRef Name)

Description

Return a ValueInfo for \p GUID setting value \p Name.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1342

Parameters

GlobalValue::GUID GUID
llvm::StringRef Name

GlobalValueSummaryMapTy::value_type*
getOrInsertValuePtr(GlobalValue::GUID GUID)

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1170

Parameters

GlobalValue::GUID GUID

static llvm::StringRef
getOriginalNameBeforePromote(llvm::StringRef Name)

Description

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.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1479

Parameters

llvm::StringRef Name

static constexpr const char*
getRegularLTOModuleName()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1189

Optional<llvm::TypeIdCompatibleVtableInfo>
getTypeIdCompatibleVtableSummary(
    llvm::StringRef TypeId) const

Description

For the given \p TypeId, this returns the TypeIdCompatibleVtableMap entry if present in the summary map. This may be used when importing.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1553

Parameters

llvm::StringRef TypeId

llvm::TypeIdSummary* getTypeIdSummary(
    llvm::StringRef TypeId)

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1532

Parameters

llvm::StringRef TypeId

const llvm::TypeIdSummary* getTypeIdSummary(
    llvm::StringRef TypeId) const

Description

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.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1524

Parameters

llvm::StringRef TypeId

llvm::ValueInfo getValueInfo(
    GlobalValue::GUID GUID) const

Description

Return a ValueInfo for GUID if it exists, otherwise return ValueInfo().

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1326

Parameters

GlobalValue::GUID GUID

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

Description

Return a ValueInfo for the index value_type (convenient when iterating index).

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1321

Parameters

const GlobalValueSummaryMapTy::value_type& R

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

Description

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.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1503

Parameters

const llvm::Module& M

bool hasParamAccess() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1312

bool hasSyntheticEntryCounts() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1296

bool haveGVs() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1193

bool isGUIDLive(GlobalValue::GUID GUID) const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1317

Parameters

GlobalValue::GUID GUID

bool isGlobalValueLive(
    const llvm::GlobalValueSummary* GVS) const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1314

Parameters

const llvm::GlobalValueSummary* GVS

bool isReadOnly(
    const llvm::GlobalVarSummary* GVS) const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1289

Parameters

const llvm::GlobalVarSummary* GVS

bool isWriteOnly(
    const llvm::GlobalVarSummary* GVS) const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1292

Parameters

const llvm::GlobalVarSummary* GVS

StringMap<std::pair<uint64_t, ModuleHash>>&
modulePaths()

Description

Table of modules, containing hash and id.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1449

const StringMap<std::pair<uint64_t, ModuleHash>>&
modulePaths() const

Description

Table of modules, containing module hash and id.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1444

bool partiallySplitLTOUnits() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1309

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

Description

Print to an output stream.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1579

Parameters

llvm::raw_ostream& OS
bool IsForDebug = false

void propagateAttributes(
    const DenseSet<GlobalValue::GUID>&
        PreservedSymbols)

Description

Do the access attribute and DSOLocal propagation in combined index.

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1593

Parameters

const DenseSet<GlobalValue::GUID>& PreservedSymbols

llvm::StringRef saveString(llvm::StringRef String)

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1339

Parameters

llvm::StringRef String

void setBlockCount(uint64_t C)

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1200

Parameters

uint64_t C

void setEnableSplitLTOUnit()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1307

void setFlags(uint64_t Flags)

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1196

Parameters

uint64_t Flags

void setHasSyntheticEntryCounts()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1297

void setPartiallySplitLTOUnits()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1310

void setSkipModuleByDistributedBackend()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1302

void setWithAttributePropagation()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1279

void setWithDSOLocalPropagation()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1284

void setWithGlobalValueDeadStripping()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1274

void setWithWholeProgramVisibility()

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1287

size_t size() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1206

bool skipModuleByDistributedBackend() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1299

const std::map<std::string,
               TypeIdCompatibleVtableInfo,
               std::less<>>&
typeIdCompatibleVtableMap() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1538

const llvm::TypeIdSummaryMapTy& typeIds() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1507

bool withAttributePropagation() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1278

bool withDSOLocalPropagation() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1283

bool withGlobalValueDeadStripping() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1271

bool withWholeProgramVisibility() const

Declared at: llvm/include/llvm/IR/ModuleSummaryIndex.h:1286