class ConstantDataSequential

Declaration

class ConstantDataSequential : public ConstantData { /* full declaration omitted */ };

Description

ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integer or half/bfloat/float/double, and whose elements are just simple data values (i.e. ConstantInt/ConstantFP). This Constant node has no operands because it stores all of the elements of the constant as densely packed data, instead of as Value*'s. This is the common base class of ConstantDataArray and ConstantDataVector.

Declared at: llvm/include/llvm/IR/Constants.h:570

Inherits from: ConstantData

Member Variables

private const char* DataElements
A pointer to the bytes underlying this constant (which is owned by the uniquing StringMap).
private std::unique_ptr<ConstantDataSequential> Next
This forms a link list of ConstantDataSequential nodes that have the same value but different type. For example, 0,0,0,1 could be a 4 element array of i8, or a 1-element array of i32. They'll both end up in the same StringMap bucket, linked up.

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

Inherited from Constant:

Inherited from User:

Inherited from Value:

Methods

ConstantDataSequential(llvm::Type* ty,
                       llvm::Value::ValueTy VT,
                       const char* Data)

Declared at: llvm/include/llvm/IR/Constants.h:587

Parameters

llvm::Type* ty
llvm::Value::ValueTy VT
const char* Data

ConstantDataSequential(
    const llvm::ConstantDataSequential&)

Declared at: llvm/include/llvm/IR/Constants.h:593

Parameters

const llvm::ConstantDataSequential&

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

Description

Methods for support type inquiry through isa, cast, and dyn_cast:

Declared at: llvm/include/llvm/IR/Constants.h:664

Parameters

const llvm::Value* V

void destroyConstantImpl()

Declared at: llvm/include/llvm/IR/Constants.h:584

llvm::StringRef getAsCString() const

Description

If this array is isCString(), then this method returns the array (without the trailing null byte) as a StringRef. Otherwise, it asserts out.

Declared at: llvm/include/llvm/IR/Constants.h:652

llvm::StringRef getAsString() const

Description

If this array is isString(), then this method returns the array as a StringRef. Otherwise, it asserts out.

Declared at: llvm/include/llvm/IR/Constants.h:645

llvm::APFloat getElementAsAPFloat(
    unsigned int i) const

Description

If this is a sequential container of floating point type, return the specified element as an APFloat.

Declared at: llvm/include/llvm/IR/Constants.h:611

Parameters

unsigned int i

llvm::APInt getElementAsAPInt(
    unsigned int i) const

Description

If this is a sequential container of integers (of any size), return the specified element as an APInt.

Declared at: llvm/include/llvm/IR/Constants.h:607

Parameters

unsigned int i

llvm::Constant* getElementAsConstant(
    unsigned int i) const

Description

Return a Constant for a specified index's element. Note that this has to compute a new constant to return, so it isn't as efficient as getElementAsInteger/Float/Double.

Declared at: llvm/include/llvm/IR/Constants.h:624

Parameters

unsigned int i

double getElementAsDouble(unsigned int i) const

Description

If this is an sequential container of doubles, return the specified element as a double.

Declared at: llvm/include/llvm/IR/Constants.h:619

Parameters

unsigned int i

float getElementAsFloat(unsigned int i) const

Description

If this is an sequential container of floats, return the specified element as a float.

Declared at: llvm/include/llvm/IR/Constants.h:615

Parameters

unsigned int i

uint64_t getElementAsInteger(unsigned int i) const

Description

If this is a sequential container of integers (of any size), return the specified element in the low bits of a uint64_t.

Declared at: llvm/include/llvm/IR/Constants.h:603

Parameters

unsigned int i

uint64_t getElementByteSize() const

Description

Return the size (in bytes) of each element in the array/vector. The size of the elements is known to be a multiple of one byte.

Declared at: llvm/include/llvm/IR/Constants.h:634

const char* getElementPointer(
    unsigned int Elt) const

Declared at: llvm/include/llvm/IR/Constants.h:670

Parameters

unsigned int Elt

llvm::Type* getElementType() const

Description

Return the element type of the array/vector.

Declared at: llvm/include/llvm/IR/Constants.h:627

static llvm::Constant* getImpl(
    llvm::StringRef Bytes,
    llvm::Type* Ty)

Declared at: llvm/include/llvm/IR/Constants.h:590

Parameters

llvm::StringRef Bytes
llvm::Type* Ty

unsigned int getNumElements() const

Description

Return the number of elements in the array or vector.

Declared at: llvm/include/llvm/IR/Constants.h:630

llvm::StringRef getRawDataValues() const

Description

Return the raw, underlying, bytes of this data. Note that this is an extremely tricky thing to work with, as it exposes the host endianness of the data elements.

Declared at: llvm/include/llvm/IR/Constants.h:661

bool isCString() const

Description

This method returns true if the array "isString", ends with a null byte, and does not contains any other null bytes.

Declared at: llvm/include/llvm/IR/Constants.h:641

static bool isElementTypeCompatible(
    llvm::Type* Ty)

Description

Return true if a ConstantDataSequential can be formed with a vector or array of the specified element type. ConstantDataArray only works with normal float and int types that are stored densely in memory, not with things like i42 or x86_f80.

Declared at: llvm/include/llvm/IR/Constants.h:599

Parameters

llvm::Type* Ty

bool isString(unsigned int CharSize = 8) const

Description

This method returns true if this is an array of \p CharSize integers.

Declared at: llvm/include/llvm/IR/Constants.h:637

Parameters

unsigned int CharSize = 8