clang
9.0.0
|
A concrete base class for struct and array aggregate initializer builders. More...
#include "clang/CodeGen/ConstantInitBuilder.h"
Classes | |
class | PlaceholderPosition |
An opaque class to hold the abstract position of a placeholder. More... | |
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. More... | |
bool | empty () const |
Return true if no elements have yet been added to this struct or array. More... | |
void | abandon () |
Abandon this builder completely. More... | |
void | add (llvm::Constant *value) |
Add a new value to this initializer. More... | |
void | addSize (CharUnits size) |
Add an integer value of type size_t. More... | |
void | addInt (llvm::IntegerType *intTy, uint64_t value, bool isSigned=false) |
Add an integer value of a specific type. More... | |
void | addNullPointer (llvm::PointerType *ptrTy) |
Add a null pointer of a specific type. More... | |
void | addBitCast (llvm::Constant *value, llvm::Type *type) |
Add a bitcast of a value to a specific type. More... | |
void | addAll (llvm::ArrayRef< llvm::Constant *> values) |
Add a bunch of new values to this initializer. More... | |
void | addRelativeOffset (llvm::IntegerType *type, llvm::Constant *target) |
Add a relative offset to the given target address, i.e. More... | |
void | addTaggedRelativeOffset (llvm::IntegerType *type, llvm::Constant *address, unsigned tag) |
Add a relative offset to the target address, plus a small constant offset. More... | |
CharUnits | getNextOffsetFromGlobal () const |
Return the offset from the start of the initializer to the next position, assuming no padding is required prior to it. More... | |
PlaceholderPosition | addPlaceholder () |
Add a placeholder value to the structure. More... | |
PlaceholderPosition | addPlaceholderWithSize (llvm::Type *expectedType) |
Add a placeholder, giving the expected type that will be filled in. More... | |
void | fillPlaceholderWithInt (PlaceholderPosition position, llvm::IntegerType *type, uint64_t value, bool isSigned=false) |
Fill a previously-added placeholder. More... | |
void | fillPlaceholder (PlaceholderPosition position, llvm::Constant *value) |
Fill a previously-added placeholder. More... | |
llvm::Constant * | getAddrOfCurrentPosition (llvm::Type *type) |
Produce an address which will eventually point to the next position to be filled. More... | |
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 97 of file ConstantInitBuilder.h.
|
inlineprotected |
Definition at line 116 of file ConstantInitBuilder.h.
References Frozen.
|
inlineprotected |
Definition at line 128 of file ConstantInitBuilder.h.
|
delete |
|
inline |
Definition at line 155 of file ConstantInitBuilder.h.
|
inline |
Abandon this builder completely.
Definition at line 180 of file ConstantInitBuilder.h.
|
inline |
Add a new value to this initializer.
Definition at line 186 of file ConstantInitBuilder.h.
|
inline |
Add a bunch of new values to this initializer.
Definition at line 213 of file ConstantInitBuilder.h.
|
inline |
Add a bitcast of a value to a specific type.
Definition at line 208 of file ConstantInitBuilder.h.
|
inline |
Add an integer value of a specific type.
Definition at line 197 of file ConstantInitBuilder.h.
|
inline |
Add a null pointer of a specific type.
Definition at line 203 of file ConstantInitBuilder.h.
|
inline |
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 271 of file ConstantInitBuilder.h.
References clang::CodeGen::Type.
ConstantAggregateBuilderBase::PlaceholderPosition ConstantAggregateBuilderBase::addPlaceholderWithSize | ( | llvm::Type * | expectedType | ) |
Add a placeholder, giving the expected type that will be filled in.
Definition at line 182 of file ConstantInitBuilder.cpp.
|
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 225 of file ConstantInitBuilder.h.
void ConstantAggregateBuilderBase::addSize | ( | CharUnits | size | ) |
Add an integer value of type size_t.
Definition at line 124 of file ConstantInitBuilder.cpp.
|
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 233 of file ConstantInitBuilder.h.
|
inline |
Return true if no elements have yet been added to this struct or array.
Definition at line 175 of file ConstantInitBuilder.h.
|
inline |
Fill a previously-added placeholder.
Definition at line 289 of file ConstantInitBuilder.h.
References clang::CodeGen::Type.
|
inline |
Fill a previously-added placeholder.
Definition at line 282 of file ConstantInitBuilder.h.
|
protected |
Definition at line 244 of file ConstantInitBuilder.cpp.
References Begin.
|
protected |
Definition at line 260 of file ConstantInitBuilder.cpp.
References Begin.
llvm::Constant * ConstantAggregateBuilderBase::getAddrOfCurrentPosition | ( | llvm::Type * | type | ) |
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 position.
Definition at line 148 of file ConstantInitBuilder.cpp.
|
inlineprotected |
Definition at line 108 of file ConstantInitBuilder.h.
|
inlineprotected |
Definition at line 112 of file ConstantInitBuilder.h.
|
inline |
Definition at line 305 of file ConstantInitBuilder.h.
References clang::CodeGen::Type.
|
inline |
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.
Definition at line 249 of file ConstantInitBuilder.h.
|
inlineprotected |
Definition at line 132 of file ConstantInitBuilder.h.
References clang::CodeGen::ConstantInitBuilderBase::ConstantAggregateBuilderBase, and Frozen.
|
delete |
|
delete |
|
inline |
Return the number of elements that have been added to this struct or array.
Definition at line 167 of file ConstantInitBuilder.h.
References Begin.
|
protected |
Definition at line 101 of file ConstantInitBuilder.h.
|
protected |
Definition at line 99 of file ConstantInitBuilder.h.
|
mutableprotected |
Definition at line 102 of file ConstantInitBuilder.h.
|
mutableprotected |
Definition at line 106 of file ConstantInitBuilder.h.
Definition at line 103 of file ConstantInitBuilder.h.
Definition at line 104 of file ConstantInitBuilder.h.
Referenced by ConstantAggregateBuilderBase(), and markFinished().
Definition at line 105 of file ConstantInitBuilder.h.
|
protected |
Definition at line 100 of file ConstantInitBuilder.h.