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

Inherits from: GlobalValue

Member Variables

protected llvm::Comdat* ObjComdat = nullptr
protected static const unsigned int GlobalObjectSubClassDataBits = GlobalValueSubClassDataBits - GlobalObjectBits
private static const unsigned int AlignmentBits = LastAlignmentBit + 1
private static const unsigned int AlignmentMask = (1 << AlignmentBits) - 1
private static const unsigned int GlobalObjectMask = (1 << GlobalObjectBits) - 1

Inherited from GlobalValue:

protected ValueType
protected Linkage
protected Visibility
protected UnnamedAddrVal
protected DllStorageClass
protected ThreadLocal
protected HasLLVMReservedName
protected IsDSOLocal
protected HasPartition
protected HasSanitizerMetadata
protected IntID = (unsigned int)0U
protected Parent = nullptr
protected static GlobalValueSubClassDataBits = 15

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasMetadata
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 32
public static MaximumAlignment = 1ULL << MaxAlignmentExponent

Method Overview

Inherited from GlobalValue:

Inherited from Constant:

Inherited from User:

Inherited from Value:

Methods

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

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

GlobalObject(const llvm::GlobalObject&)

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

Parameters

const llvm::GlobalObject&

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

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

Parameters

unsigned int Offset
llvm::Metadata* TypeID

bool canIncreaseAlignment() const

Description

Returns true if the alignment of the value can be unilaterally increased. Note that for functions this is the alignment of the code, not the alignment of a function pointer.

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

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

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

Parameters

const llvm::Value* V

void copyAttributesFrom(
    const llvm::GlobalObject* Src)

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

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

Parameters

const llvm::GlobalObject* Src
unsigned int Offset

llvm::MaybeAlign getAlign() const

Description

Returns the alignment of the given variable or function. Note that for functions this is the alignment of the code, not the alignment of a function pointer.

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

uint64_t getAlignment() const

Description

FIXME: Remove this function once transition to Align is over.

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

const llvm::Comdat* getComdat() const

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

llvm::Comdat* getComdat()

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

unsigned int getGlobalObjectSubClassData() const

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

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

llvm::StringRef getSectionImpl() const

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

llvm::GlobalObject::VCallVisibility
getVCallVisibility() const

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

bool hasComdat() const

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

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

void setAlignment(llvm::MaybeAlign Align)

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

Parameters

llvm::MaybeAlign Align

void setComdat(llvm::Comdat* C)

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

Parameters

llvm::Comdat* C

void setGlobalObjectFlag(unsigned int Bit,
                         bool Val)

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

Parameters

unsigned int Bit
bool Val

void setGlobalObjectSubClassData(unsigned int Val)

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

Parameters

unsigned int Val

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

Parameters

llvm::StringRef S

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

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

Parameters

llvm::GlobalObject::VCallVisibility Visibility

~GlobalObject()

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