clang: clang::CodeGen::ConstantAggregateBuilderBase Class Reference (original) (raw)

A concrete base class for struct and array aggregate initializer builders. More...

#include "[clang/CodeGen/ConstantInitBuilder.h](ConstantInitBuilder%5F8h%5Fsource.html)"

Public Member Functions
ConstantAggregateBuilderBase (const ConstantAggregateBuilderBase &)=delete
ConstantAggregateBuilderBase & operator= (const ConstantAggregateBuilderBase &)=delete
ConstantAggregateBuilderBase (ConstantAggregateBuilderBase &&other)
ConstantAggregateBuilderBase & operator= (ConstantAggregateBuilderBase &&other)=delete
size_t size () const
Return the number of elements that have been added to this struct or array.
bool empty () const
Return true if no elements have yet been added to this struct or array.
void abandon ()
Abandon this builder completely.
void add (llvm::Constant *value)
Add a new value to this initializer.
void addSize (CharUnits size)
Add an integer value of type size_t.
void addInt (llvm::IntegerType *intTy, uint64_t value, bool isSigned=false)
Add an integer value of a specific type.
void addSignedPointer (llvm::Constant *Pointer, const PointerAuthSchema &Schema, GlobalDecl CalleeDecl, QualType CalleeType)
Add a signed pointer using the given pointer authentication schema.
void addNullPointer (llvm::PointerType *ptrTy)
Add a null pointer of a specific type.
void addAll (llvm::ArrayRef< llvm::Constant * > values)
Add a bunch of new values to this initializer.
void addRelativeOffset (llvm::IntegerType *type, llvm::Constant *target)
Add a relative offset to the given target address, i.e.
void addRelativeOffsetToPosition (llvm::IntegerType *type, llvm::Constant *target, size_t position)
Same as addRelativeOffset(), but instead relative to an element in this aggregate, identified by its index.
void addTaggedRelativeOffset (llvm::IntegerType *type, llvm::Constant *address, unsigned tag)
Add a relative offset to the target address, plus a small constant offset.
CharUnits getNextOffsetFromGlobal () const
Return the offset from the start of the initializer to the next position, assuming no padding is required prior to it.
PlaceholderPosition addPlaceholder ()
Add a placeholder value to the structure.
PlaceholderPosition addPlaceholderWithSize (llvm::Type *expectedType)
Add a placeholder, giving the expected type that will be filled in.
void fillPlaceholderWithInt (PlaceholderPosition position, llvm::IntegerType *type, uint64_t value, bool isSigned=false)
Fill a previously-added placeholder.
void fillPlaceholder (PlaceholderPosition position, llvm::Constant *value)
Fill a previously-added placeholder.
llvm::Constant * getAddrOfCurrentPosition (llvm::Type *type)
Produce an address which will eventually point to the next position to be filled.
llvm::Constant * getAddrOfPosition (llvm::Type *type, size_t position)
Produce an address which points to a position in the aggregate being constructed.
llvm::ArrayRef< llvm::Constant * > getGEPIndicesToCurrentPosition (llvm::SmallVectorImpl< llvm::Constant * > &indices)
Protected Member Functions
llvm::SmallVectorImpl< llvm::Constant * > & getBuffer ()
const llvm::SmallVectorImpl< llvm::Constant * > & getBuffer () const
ConstantAggregateBuilderBase (ConstantInitBuilderBase &builder, ConstantAggregateBuilderBase *parent)
~ConstantAggregateBuilderBase ()
void markFinished ()
llvm::Constant * finishArray (llvm::Type *eltTy)
llvm::Constant * finishStruct (llvm::StructType *structTy)
Protected Attributes
ConstantInitBuilderBase & Builder
ConstantAggregateBuilderBase * Parent
size_t Begin
size_t CachedOffsetEnd = 0
bool Finished = false
bool Frozen = false
bool Packed = false
CharUnits CachedOffsetFromGlobal

A concrete base class for struct and array aggregate initializer builders.

Definition at line 100 of file ConstantInitBuilder.h.

~ConstantAggregateBuilderBase()

clang::CodeGen::ConstantAggregateBuilderBase::~ConstantAggregateBuilderBase ( ) inlineprotected

ConstantAggregateBuilderBase() [2/3]

ConstantAggregateBuilderBase() [3/3]

abandon()

void clang::CodeGen::ConstantAggregateBuilderBase::abandon ( ) inline

add()

void clang::CodeGen::ConstantAggregateBuilderBase::add ( llvm::Constant * value) inline

Add a new value to this initializer.

Definition at line 189 of file ConstantInitBuilder.h.

References Builder, Finished, and Frozen.

Referenced by addInt(), addNullPointer(), AddPointerLayoutOffset(), AddRelativeLayoutOffset(), addRelativeOffset(), addRelativeOffsetToPosition(), addSignedPointer(), addSize(), and addTaggedRelativeOffset().

addAll()

void clang::CodeGen::ConstantAggregateBuilderBase::addAll ( llvm::ArrayRef< llvm::Constant * > values) inline

addInt()

void clang::CodeGen::ConstantAggregateBuilderBase::addInt ( llvm::IntegerType * intTy, uint64_t value, bool isSigned = false ) inline

addNullPointer()

void clang::CodeGen::ConstantAggregateBuilderBase::addNullPointer ( llvm::PointerType * ptrTy) inline

addPlaceholder()

Add a placeholder value to the structure.

The returned position can be used to set the value later; it will not be invalidated by any intermediate operations except (1) filling the same position or (2) finishing the entire builder.

This is useful for emitting certain kinds of structure which contain some sort of summary field, generally a count, before any of the data. By emitting a placeholder first, the structure can be emitted eagerly.

Definition at line 281 of file ConstantInitBuilder.h.

References Builder, Finished, and Frozen.

Referenced by addPlaceholderWithSize().

addPlaceholderWithSize()

addRelativeOffset()

void clang::CodeGen::ConstantAggregateBuilderBase::addRelativeOffset ( llvm::IntegerType * type, llvm::Constant * target ) inline

Add a relative offset to the given target address, i.e.

the static difference between the target address and the address of the relative offset. The target must be known to be defined in the current linkage unit. The offset will have the given integer type, which must be no wider than intptr_t. Some targets may not fully support this operation.

Definition at line 228 of file ConstantInitBuilder.h.

References add(), and clang::ast_matchers::type.

addRelativeOffsetToPosition()

void clang::CodeGen::ConstantAggregateBuilderBase::addRelativeOffsetToPosition ( llvm::IntegerType * type, llvm::Constant * target, size_t position ) inline

addSignedPointer()

addSize()

void ConstantAggregateBuilderBase::addSize ( CharUnits size )

addTaggedRelativeOffset()

void clang::CodeGen::ConstantAggregateBuilderBase::addTaggedRelativeOffset ( llvm::IntegerType * type, llvm::Constant * address, unsigned tag ) inline

Add a relative offset to the target address, plus a small constant offset.

This is primarily useful when the relative offset is known to be a multiple of (say) four and therefore the tag can be used to express an extra two bits of information.

Definition at line 243 of file ConstantInitBuilder.h.

References add(), and clang::ast_matchers::type.

empty()

bool clang::CodeGen::ConstantAggregateBuilderBase::empty ( ) const inline

fillPlaceholder()

void clang::CodeGen::ConstantAggregateBuilderBase::fillPlaceholder ( PlaceholderPosition position, llvm::Constant * value ) inline

fillPlaceholderWithInt()

void clang::CodeGen::ConstantAggregateBuilderBase::fillPlaceholderWithInt ( PlaceholderPosition position, llvm::IntegerType * type, uint64_t value, bool isSigned = false ) inline

finishArray()

llvm::Constant * ConstantAggregateBuilderBase::finishArray ( llvm::Type * eltTy) protected

finishStruct()

llvm::Constant * ConstantAggregateBuilderBase::finishStruct ( llvm::StructType * structTy) protected

getAddrOfCurrentPosition()

llvm::Constant * ConstantAggregateBuilderBase::getAddrOfCurrentPosition ( llvm::Type * type )

getAddrOfPosition()

llvm::Constant * ConstantAggregateBuilderBase::getAddrOfPosition ( llvm::Type * type,
size_t position )

Produce an address which points to a position in the aggregate being constructed.

This is computed with an indexed getelementptr rather than by computing offsets.

The returned pointer will have type T*, where T is the given type. This type can differ from the type of the actual element.

Definition at line 154 of file ConstantInitBuilder.cpp.

References Begin, Builder, and clang::ast_matchers::type.

getBuffer() [1/2]

llvm::SmallVectorImpl< llvm::Constant * > & clang::CodeGen::ConstantAggregateBuilderBase::getBuffer ( ) inlineprotected

getBuffer() [2/2]

const llvm::SmallVectorImpl< llvm::Constant * > & clang::CodeGen::ConstantAggregateBuilderBase::getBuffer ( ) const inlineprotected

getGEPIndicesToCurrentPosition()

getNextOffsetFromGlobal()

CharUnits clang::CodeGen::ConstantAggregateBuilderBase::getNextOffsetFromGlobal ( ) const inline

markFinished()

void clang::CodeGen::ConstantAggregateBuilderBase::markFinished ( ) inlineprotected

operator=() [1/2]

operator=() [2/2]

size()

size_t clang::CodeGen::ConstantAggregateBuilderBase::size ( ) const inline

Begin

size_t clang::CodeGen::ConstantAggregateBuilderBase::Begin protected

Builder

Definition at line 102 of file ConstantInitBuilder.h.

Referenced by abandon(), add(), addAll(), addPlaceholder(), addPlaceholderWithSize(), addSignedPointer(), addSize(), ConstantAggregateBuilderBase(), ConstantAggregateBuilderBase(), fillPlaceholder(), finishStruct(), getAddrOfCurrentPosition(), getAddrOfPosition(), getBuffer(), getBuffer(), getGEPIndicesToCurrentPosition(), getNextOffsetFromGlobal(), and markFinished().

CachedOffsetEnd

size_t clang::CodeGen::ConstantAggregateBuilderBase::CachedOffsetEnd = 0 mutableprotected

CachedOffsetFromGlobal

CharUnits clang::CodeGen::ConstantAggregateBuilderBase::CachedOffsetFromGlobal mutableprotected

Finished

bool clang::CodeGen::ConstantAggregateBuilderBase::Finished = false protected

Frozen

bool clang::CodeGen::ConstantAggregateBuilderBase::Frozen = false protected

Packed

bool clang::CodeGen::ConstantAggregateBuilderBase::Packed = false protected

Parent


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