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:919

Member Variables

public static const uint64_t BitcodeSummaryVersion = 8

Method Overview

Methods

ModuleSummaryIndex(
    bool HaveGVs,
    bool EnableSplitLTOUnit = false)

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

Parameters

bool HaveGVs
bool EnableSplitLTOUnit = false

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:1180

Parameters

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

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:1173

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:1167

Parameters

const llvm::GlobalValue& GV
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:1283

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:1190

Parameters

GlobalValue::GUID ValueGUID
GlobalValue::GUID OrigGUID

llvm::gvsummary_iterator begin()

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

llvm::const_gvsummary_iterator begin() const

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

llvm::FunctionSummary calculateCallGraphRoot()

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

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:1392

Parameters

llvm::GlobalValueSummary* S
bool AnalyzeRefs

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

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

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

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

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

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

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

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

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:1358

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:1365

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:1015

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:1378

void dumpSCCs(llvm::raw_ostream& OS)

Description

Print out strongly connected components for debugging.

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

Parameters

llvm::raw_ostream& OS

bool enableSplitLTOUnit() const

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

llvm::gvsummary_iterator end()

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

llvm::const_gvsummary_iterator end() const

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

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:1382

Parameters

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

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:1216

Parameters

GlobalValue::GUID ValueGUID
llvm::StringRef ModuleId

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:1202

Parameters

llvm::ValueInfo VI
llvm::StringRef ModuleId

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:1155

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:1262

Parameters

llvm::StringRef Name
llvm::ModuleHash ModHash

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:1235

Parameters

GlobalValue::GUID ValueGUID
bool PerModuleIndex = true

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:1226

Parameters

const llvm::GlobalValue& GV
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:1289

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:1254

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:1249

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:1342

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:1307

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:1147

Parameters

const llvm::GlobalValue* GV

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:1139

Parameters

GlobalValue::GUID GUID
llvm::StringRef Name

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

Description

Return a ValueInfo for \p GUID.

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

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:1274

Parameters

llvm::StringRef Name

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:1349

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:1319

Parameters

llvm::StringRef TypeId

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

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

Parameters

llvm::StringRef TypeId

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:1118

Parameters

const GlobalValueSummaryMapTy::value_type& R

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:1123

Parameters

GlobalValue::GUID GUID

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:1298

Parameters

const llvm::Module& M

bool hasSyntheticEntryCounts() const

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

bool haveGVs() const

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

bool isGUIDLive(GlobalValue::GUID GUID) const

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

Parameters

GlobalValue::GUID GUID

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

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

Parameters

const llvm::GlobalValueSummary* GVS

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

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

Parameters

const llvm::GlobalVarSummary* GVS

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

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

Parameters

const llvm::GlobalVarSummary* GVS

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:1239

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

Description

Table of modules, containing hash and id.

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

bool partiallySplitLTOUnits() const

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

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

Description

Print to an output stream.

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

Parameters

llvm::raw_ostream& OS
bool IsForDebug = false

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

Description

Analyze index and detect unmodified globals

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

Parameters

const DenseSet<GlobalValue::GUID>& PreservedSymbols

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

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

Parameters

llvm::StringRef String

void setEnableSplitLTOUnit()

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

void setHasSyntheticEntryCounts()

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

void setPartiallySplitLTOUnits()

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

void setSkipModuleByDistributedBackend()

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

void setWithAttributePropagation()

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

void setWithGlobalValueDeadStripping()

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

size_t size() const

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

bool skipModuleByDistributedBackend() const

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

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

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

const llvm::TypeIdSummaryMapTy& typeIds() const

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

bool withAttributePropagation() const

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

bool withGlobalValueDeadStripping() const

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