LLVM 22.0.0git
llvm::GlobalVarSummary Class Reference

Global variable summary information to aid decisions and implementation of importing. More...

#include "llvm/IR/ModuleSummaryIndex.h"

Inheritance diagram for llvm::GlobalVarSummary:
[legend]

Classes

struct  GVarFlags

Public Member Functions

 GlobalVarSummary (GVFlags Flags, GVarFlags VarFlags, SmallVectorImpl< ValueInfo > &&Refs)
GVarFlags varflags () const
void setReadOnly (bool RO)
void setWriteOnly (bool WO)
bool maybeReadOnly () const
bool maybeWriteOnly () const
bool isConstant () const
void setVCallVisibility (GlobalObject::VCallVisibility Vis)
GlobalObject::VCallVisibility getVCallVisibility () const
void setVTableFuncs (VTableFuncList Funcs)
ArrayRef< VirtFuncOffsetvTableFuncs () const
Public Member Functions inherited from llvm::GlobalValueSummary
virtual ~GlobalValueSummary ()=default
GlobalValue::GUID getOriginalName () const
 Returns the hash of the original name, it is identical to the GUID for externally visible symbols, but not for local ones.
void setOriginalName (GlobalValue::GUID Name)
 Initialize the original name hash in this summary.
SummaryKind getSummaryKind () const
 Which kind of summary subclass this is.
void setModulePath (StringRef ModPath)
 Set the path to the module containing this function, for use in the combined index.
StringRef modulePath () const
 Get the path to the module containing this function.
GVFlags flags () const
 Get the flags for this GlobalValue (see struct GVFlags).
GlobalValue::LinkageTypes linkage () const
 Return linkage type recorded for this global value.
void setLinkage (GlobalValue::LinkageTypes Linkage)
 Sets the linkage to the value determined by global summary-based optimization.
bool notEligibleToImport () const
 Return true if this global value can't be imported.
bool isLive () const
void setLive (bool Live)
void setDSOLocal (bool Local)
bool isDSOLocal () const
void setCanAutoHide (bool CanAutoHide)
bool canAutoHide () const
bool shouldImportAsDecl () const
void setImportKind (ImportKind IK)
GlobalValueSummary::ImportKind importType () const
GlobalValue::VisibilityTypes getVisibility () const
void setVisibility (GlobalValue::VisibilityTypes Vis)
void setNotEligibleToImport ()
 Flag that this global value cannot be imported.
ArrayRef< ValueInforefs () const
 Return the list of values referenced by this global value definition.
GlobalValueSummarygetBaseObject ()
 If this is an alias summary, returns the summary of the aliased object (a global variable or function), otherwise returns itself.
const GlobalValueSummarygetBaseObject () const

Static Public Member Functions

static bool classof (const GlobalValueSummary *GVS)
 Check if this is a global variable summary.

Public Attributes

struct llvm::GlobalVarSummary::GVarFlags VarFlags

Additional Inherited Members

Public Types inherited from llvm::GlobalValueSummary
enum  SummaryKind : unsigned { AliasKind , FunctionKind , GlobalVarKind }
 Sububclass discriminator (for dyn_cast<> et al.) More...
enum  ImportKind : unsigned { Definition = 0 , Declaration = 1 }
Protected Member Functions inherited from llvm::GlobalValueSummary
 GlobalValueSummary (SummaryKind K, GVFlags Flags, SmallVectorImpl< ValueInfo > &&Refs)

Detailed Description

Global variable summary information to aid decisions and implementation of importing.

Global variable summary has two extra flag, telling if it is readonly or writeonly. Both readonly and writeonly variables can be optimized in the backed: readonly variables can be const-folded, while writeonly vars can be completely eliminated together with corresponding stores. We let both things happen by means of internalizing such variables after ThinLTO import.

Definition at line 1127 of file ModuleSummaryIndex.h.

Constructor & Destructor Documentation

◆ GlobalVarSummary()

llvm::GlobalVarSummary::GlobalVarSummary ( GVFlags Flags,
GVarFlags VarFlags,
SmallVectorImpl< ValueInfo > && Refs )
inline

Member Function Documentation

◆ classof()

bool llvm::GlobalVarSummary::classof ( const GlobalValueSummary * GVS)
inlinestatic

◆ getVCallVisibility()

GlobalObject::VCallVisibility llvm::GlobalVarSummary::getVCallVisibility ( ) const
inline

Definition at line 1183 of file ModuleSummaryIndex.h.

References VarFlags.

◆ isConstant()

bool llvm::GlobalVarSummary::isConstant ( ) const
inline

Definition at line 1179 of file ModuleSummaryIndex.h.

References VarFlags.

◆ maybeReadOnly()

bool llvm::GlobalVarSummary::maybeReadOnly ( ) const
inline

Definition at line 1177 of file ModuleSummaryIndex.h.

References VarFlags.

Referenced by llvm::ModuleSummaryIndex::isReadOnly().

◆ maybeWriteOnly()

bool llvm::GlobalVarSummary::maybeWriteOnly ( ) const
inline

Definition at line 1178 of file ModuleSummaryIndex.h.

References VarFlags.

Referenced by llvm::ModuleSummaryIndex::isWriteOnly().

◆ setReadOnly()

void llvm::GlobalVarSummary::setReadOnly ( bool RO)
inline

Definition at line 1175 of file ModuleSummaryIndex.h.

References VarFlags.

◆ setVCallVisibility()

void llvm::GlobalVarSummary::setVCallVisibility ( GlobalObject::VCallVisibility Vis)
inline

Definition at line 1180 of file ModuleSummaryIndex.h.

References VarFlags.

◆ setVTableFuncs()

void llvm::GlobalVarSummary::setVTableFuncs ( VTableFuncList Funcs)
inline

Definition at line 1187 of file ModuleSummaryIndex.h.

References assert().

◆ setWriteOnly()

void llvm::GlobalVarSummary::setWriteOnly ( bool WO)
inline

Definition at line 1176 of file ModuleSummaryIndex.h.

References VarFlags.

◆ varflags()

GVarFlags llvm::GlobalVarSummary::varflags ( ) const
inline

Definition at line 1174 of file ModuleSummaryIndex.h.

References VarFlags.

◆ vTableFuncs()

ArrayRef< VirtFuncOffset > llvm::GlobalVarSummary::vTableFuncs ( ) const
inline

Definition at line 1192 of file ModuleSummaryIndex.h.

Member Data Documentation

◆ VarFlags


The documentation for this class was generated from the following file: