class ConstantAggregateBuilderBase

Declaration

class ConstantAggregateBuilderBase { /* full declaration omitted */ };

Description

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

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:97

Member Variables

protected clang::CodeGen::ConstantInitBuilderBase& Builder
protected clang::CodeGen::ConstantAggregateBuilderBase* Parent
protected size_t Begin
protected size_t CachedOffsetEnd = 0
protected bool Finished = false
protected bool Frozen = false
protected bool Packed = false
protected clang::CharUnits CachedOffsetFromGlobal

Method Overview

Methods

ConstantAggregateBuilderBase(
    clang::CodeGen::ConstantInitBuilderBase&
        builder,
    clang::CodeGen::ConstantAggregateBuilderBase*
        parent)

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:116

Parameters

clang::CodeGen::ConstantInitBuilderBase& builder
clang::CodeGen::ConstantAggregateBuilderBase* parent

ConstantAggregateBuilderBase(
    const clang::CodeGen::
        ConstantAggregateBuilderBase&)

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:149

Parameters

const clang::CodeGen:: ConstantAggregateBuilderBase&

ConstantAggregateBuilderBase(
    clang::CodeGen::ConstantAggregateBuilderBase&&
        other)

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:155

Parameters

clang::CodeGen::ConstantAggregateBuilderBase&& other

void abandon()

Description

Abandon this builder completely.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:180

void add(llvm::Constant* value)

Description

Add a new value to this initializer.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:186

Parameters

llvm::Constant* value

void addAll(
    llvm::ArrayRef<llvm::Constant*> values)

Description

Add a bunch of new values to this initializer.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:213

Parameters

llvm::ArrayRef<llvm::Constant*> values

void addBitCast(llvm::Constant* value,
                llvm::Type* type)

Description

Add a bitcast of a value to a specific type.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:208

Parameters

llvm::Constant* value
llvm::Type* type

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

Description

Add an integer value of a specific type.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:197

Parameters

llvm::IntegerType* intTy
uint64_t value
bool isSigned = false

void addNullPointer(llvm::PointerType* ptrTy)

Description

Add a null pointer of a specific type.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:203

Parameters

llvm::PointerType* ptrTy

clang::CodeGen::ConstantAggregateBuilderBase::
    PlaceholderPosition
    addPlaceholder()

Description

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.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:278

clang::CodeGen::ConstantAggregateBuilderBase::
    PlaceholderPosition
    addPlaceholderWithSize(
        llvm::Type* expectedType)

Description

Add a placeholder, giving the expected type that will be filled in.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:286

Parameters

llvm::Type* expectedType

void addRelativeOffset(llvm::IntegerType* type,
                       llvm::Constant* target)

Description

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.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:225

Parameters

llvm::IntegerType* type
llvm::Constant* target

void addRelativeOffsetToPosition(
    llvm::IntegerType* type,
    llvm::Constant* target,
    size_t position)

Description

Same as addRelativeOffset(), but instead relative to an element in this aggregate, identified by its index.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:231

Parameters

llvm::IntegerType* type
llvm::Constant* target
size_t position

void addSize(clang::CharUnits size)

Description

Add an integer value of type size_t.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:194

Parameters

clang::CharUnits size

void addTaggedRelativeOffset(
    llvm::IntegerType* type,
    llvm::Constant* address,
    unsigned int tag)

Description

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.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:240

Parameters

llvm::IntegerType* type
llvm::Constant* address
unsigned int tag

bool empty() const

Description

Return true if no elements have yet been added to this struct or array.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:175

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

Description

Fill a previously-added placeholder.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:296

Parameters

clang::CodeGen::ConstantAggregateBuilderBase:: PlaceholderPosition position
llvm::Constant* value

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

Description

Fill a previously-added placeholder.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:289

Parameters

clang::CodeGen::ConstantAggregateBuilderBase:: PlaceholderPosition position
llvm::IntegerType* type
uint64_t value
bool isSigned = false

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

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:327

Parameters

llvm::Type* eltTy

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

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:328

Parameters

llvm::StructType* structTy

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

Description

Produce an address which will eventually point to the next position to be filled. 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.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:310

Parameters

llvm::Type* type

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

Description

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.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:318

Parameters

llvm::Type* type
size_t position

const llvm::SmallVectorImpl<llvm::Constant*>&
getBuffer() const

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:112

llvm::SmallVectorImpl<llvm::Constant*>&
getBuffer()

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:108

void getGEPIndicesTo(
    llvm::SmallVectorImpl<llvm::Constant*>&
        indices,
    size_t position) const

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:331

Parameters

llvm::SmallVectorImpl<llvm::Constant*>& indices
size_t position

llvm::ArrayRef<llvm::Constant*>
getGEPIndicesToCurrentPosition(
    llvm::SmallVectorImpl<llvm::Constant*>&
        indices)

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:320

Parameters

llvm::SmallVectorImpl<llvm::Constant*>& indices

clang::CharUnits getNextOffsetFromGlobal() const

Description

Return the offset from the start of the initializer to the next position, assuming no padding is required prior to it. This operation will not succeed if any unsized placeholders are currently in place in the initializer.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:256

clang::CharUnits getOffsetFromGlobalTo(
    size_t index) const

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:341

Parameters

size_t index

llvm::Constant* getRelativeOffset(
    llvm::IntegerType* offsetType,
    llvm::Constant* target)

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:334

Parameters

llvm::IntegerType* offsetType
llvm::Constant* target

llvm::Constant* getRelativeOffsetToPosition(
    llvm::IntegerType* offsetType,
    llvm::Constant* target,
    size_t position)

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:337

Parameters

llvm::IntegerType* offsetType
llvm::Constant* target
size_t position

void markFinished()

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:132

size_t size() const

Description

Return the number of elements that have been added to this struct or array.

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:167

~ConstantAggregateBuilderBase()

Declared at: clang/include/clang/CodeGen/ConstantInitBuilder.h:128