class GlobalObject

Declaration

class GlobalObject : public GlobalValue { /* full declaration omitted */ };

Description

This is an important base class in LLVM. It provides the common facilities of all constant values in an LLVM program. A constant is a value that is immutable at runtime. Functions are constants because their address is immutable. Same with global variables. All constants share the capabilities provided in this class. All constants can have a null value. They can have an operand list. Constants can be simple (integer and floating point values), complex (arrays and structures), or expression based (computations yielding a constant value composed of only certain operators and other constant values). Note that Constants are immutable (once created they never change) and are fully shared by structural equivalence. This means that two structurally equivalent constants will always have the same address. Constants are created on demand as needed and never deleted: thus clients don't have to worry about the lifetime of the objects. LLVM Constant Representation

Declared at: llvm/include/llvm/IR/GlobalObject.h:30

Inherits from: GlobalValue

Member Variables

protected llvm::Comdat* ObjComdat
protected static const unsigned int GlobalObjectSubClassDataBits = GlobalValueSubClassDataBits - GlobalObjectBits

Inherited from GlobalValue:

protected ValueType
protected Linkage
protected Visibility
protected UnnamedAddrVal
protected DllStorageClass
protected ThreadLocal
protected HasLLVMReservedName
protected IsDSOLocal
protected HasPartition
protected IntID
protected Parent
protected static GlobalValueSubClassDataBits = 16

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 29
public static MaximumAlignment = 1U << MaxAlignmentExponent

Method Overview

Inherited from GlobalValue:

Inherited from Constant:

Inherited from User:

Inherited from Value:

Methods

GlobalObject(const llvm::GlobalObject&)

Declared at: llvm/include/llvm/IR/GlobalObject.h:71

Parameters

const llvm::GlobalObject&

GlobalObject(
    llvm::Type* Ty,
    llvm::Value::ValueTy VTy,
    llvm::Use* Ops,
    unsigned int NumOps,
    llvm::GlobalValue::LinkageTypes Linkage,
    const llvm::Twine& Name,
    unsigned int AddressSpace = 0)

Declared at: llvm/include/llvm/IR/GlobalObject.h:46

Parameters

llvm::Type* Ty
llvm::Value::ValueTy VTy
llvm::Use* Ops
unsigned int NumOps
llvm::GlobalValue::LinkageTypes Linkage
const llvm::Twine& Name
unsigned int AddressSpace = 0

void addMetadata(llvm::StringRef Kind,
                 llvm::MDNode& MD)

Declared at: llvm/include/llvm/IR/GlobalObject.h:164

Parameters

llvm::StringRef Kind
llvm::MDNode& MD

void addMetadata(unsigned int KindID,
                 llvm::MDNode& MD)

Description

Add a metadata attachment. @ {

Declared at: llvm/include/llvm/IR/GlobalObject.h:163

Parameters

unsigned int KindID
llvm::MDNode& MD

void addTypeMetadata(unsigned int Offset,
                     llvm::Metadata* TypeID)

Declared at: llvm/include/llvm/IR/GlobalObject.h:180

Parameters

unsigned int Offset
llvm::Metadata* TypeID

void addVCallVisibilityMetadata(
    llvm::GlobalObject::VCallVisibility
        Visibility)

Declared at: llvm/include/llvm/IR/GlobalObject.h:181

Parameters

llvm::GlobalObject::VCallVisibility Visibility

static bool classof(const llvm::Value* V)

Declared at: llvm/include/llvm/IR/GlobalObject.h:189

Parameters

const llvm::Value* V

void clearMetadata()

Declared at: llvm/include/llvm/IR/GlobalObject.h:194

void copyAttributesFrom(
    const llvm::GlobalObject* Src)

Declared at: llvm/include/llvm/IR/GlobalObject.h:185

Parameters

const llvm::GlobalObject* Src

void copyMetadata(const llvm::GlobalObject* Src,
                  unsigned int Offset)

Description

Copy metadata from Src, adjusting offsets by Offset.

Declared at: llvm/include/llvm/IR/GlobalObject.h:178

Parameters

const llvm::GlobalObject* Src
unsigned int Offset

bool eraseMetadata(unsigned int KindID)

Description

Erase all metadata attachments with the given kind.

Declared at: llvm/include/llvm/IR/GlobalObject.h:175

Parameters

unsigned int KindID

Returns

true if any metadata was removed.

unsigned int getAlignment() const

Declared at: llvm/include/llvm/IR/GlobalObject.h:73

void getAllMetadata(
    SmallVectorImpl<
        std::pair<unsigned int, MDNode*>>& MDs)
    const

Description

Appends all attachments for the global to \c MDs, sorting by attachment ID. Attachments with the same ID appear in insertion order.

Declared at: llvm/include/llvm/IR/GlobalObject.h:170

Parameters

SmallVectorImpl<std::pair<unsigned int, MDNode*>>& MDs

const llvm::Comdat* getComdat() const

Declared at: llvm/include/llvm/IR/GlobalObject.h:120

llvm::Comdat* getComdat()

Declared at: llvm/include/llvm/IR/GlobalObject.h:121

unsigned int getGlobalObjectSubClassData() const

Declared at: llvm/include/llvm/IR/GlobalObject.h:85

llvm::MDNode* getMetadata(
    unsigned int KindID) const

Description

Get the current metadata attachments for the given kind, if any. These functions require that the function have at most a single attachment of the given kind, and return \c nullptr if such an attachment is missing. @ {

Declared at: llvm/include/llvm/IR/GlobalObject.h:140

Parameters

unsigned int KindID

llvm::MDNode* getMetadata(
    llvm::StringRef Kind) const

Declared at: llvm/include/llvm/IR/GlobalObject.h:141

Parameters

llvm::StringRef Kind

void getMetadata(
    unsigned int KindID,
    SmallVectorImpl<llvm::MDNode*>& MDs) const

Description

Appends all attachments with the given ID to \c MDs in insertion order. If the global has no attachments with the given ID, or if ID is invalid, leaves MDs unchanged. @ {

Declared at: llvm/include/llvm/IR/GlobalObject.h:148

Parameters

unsigned int KindID
SmallVectorImpl<llvm::MDNode*>& MDs

void getMetadata(
    llvm::StringRef Kind,
    SmallVectorImpl<llvm::MDNode*>& MDs) const

Declared at: llvm/include/llvm/IR/GlobalObject.h:149

Parameters

llvm::StringRef Kind
SmallVectorImpl<llvm::MDNode*>& MDs

llvm::StringRef getSection() const

Description

Get the custom section of this global if it has one. If this global does not have a custom section, this will be empty and the default object file section (.text, .data, etc) will be used.

Declared at: llvm/include/llvm/IR/GlobalObject.h:109

llvm::GlobalObject::VCallVisibility
getVCallVisibility() const

Declared at: llvm/include/llvm/IR/GlobalObject.h:182

bool hasComdat() const

Declared at: llvm/include/llvm/IR/GlobalObject.h:119

bool hasMetadata(llvm::StringRef Kind) const

Declared at: llvm/include/llvm/IR/GlobalObject.h:131

Parameters

llvm::StringRef Kind

bool hasMetadata(unsigned int KindID) const

Description

Check if this has any metadata of the given kind.

Declared at: llvm/include/llvm/IR/GlobalObject.h:128

Parameters

unsigned int KindID

bool hasMetadata() const

Description

Check if this has any metadata.

Declared at: llvm/include/llvm/IR/GlobalObject.h:125

bool hasSection() const

Description

Check if this global has a custom object file section. This is more efficient than calling getSection() and checking for an empty string.

Declared at: llvm/include/llvm/IR/GlobalObject.h:101

void setAlignment(llvm::MaybeAlign Align)

Declared at: llvm/include/llvm/IR/GlobalObject.h:83

Parameters

llvm::MaybeAlign Align

void setComdat(llvm::Comdat* C)

Declared at: llvm/include/llvm/IR/GlobalObject.h:122

Parameters

llvm::Comdat* C

void setGlobalObjectSubClassData(unsigned int Val)

Declared at: llvm/include/llvm/IR/GlobalObject.h:90

Parameters

unsigned int Val

void setMetadata(llvm::StringRef Kind,
                 llvm::MDNode* MD)

Declared at: llvm/include/llvm/IR/GlobalObject.h:158

Parameters

llvm::StringRef Kind
llvm::MDNode* MD

void setMetadata(unsigned int KindID,
                 llvm::MDNode* MD)

Description

Set a particular kind of metadata attachment. Sets the given attachment to \c MD, erasing it if \c MD is \c nullptr or replacing it if it already exists. @ {

Declared at: llvm/include/llvm/IR/GlobalObject.h:157

Parameters

unsigned int KindID
llvm::MDNode* MD

void setSection(llvm::StringRef S)

Description

Change the section for this global. Setting the section to the empty string tells LLVM to choose an appropriate default object file section.

Declared at: llvm/include/llvm/IR/GlobalObject.h:117

Parameters

llvm::StringRef S