class ConstantDataArray

Declaration

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

Description

An array constant whose element type is a simple 1/2/4/8-byte integer or 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.

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

Inherits from: ConstantDataSequential

Member Variables

Inherited from Value:

protected SubclassOptionalData
protected NumUserOperands
protected IsUsedByMD
protected HasName
protected HasHungOffUses
protected HasDescriptor
public static MaxAlignmentExponent = 29
public static MaximumAlignment = 1U << MaxAlignmentExponent

Method Overview

  • public ConstantDataArray(const llvm::ConstantDataArray &)
  • public static bool classof(const llvm::Value * V)
  • public template <typename ElementTy>static llvm::Constant * get(llvm::LLVMContext & Context, ArrayRef<ElementTy> Elts)
  • public template <typename ArrayTy>static llvm::Constant * get(llvm::LLVMContext & Context, ArrayTy & Elts)
  • public static llvm::Constant * getFP(llvm::LLVMContext & Context, ArrayRef<uint16_t> Elts)
  • public static llvm::Constant * getFP(llvm::LLVMContext & Context, ArrayRef<uint32_t> Elts)
  • public static llvm::Constant * getFP(llvm::LLVMContext & Context, ArrayRef<uint64_t> Elts)
  • public static llvm::Constant * getRaw(llvm::StringRef Data, uint64_t NumElements, llvm::Type * ElementTy)
  • public static llvm::Constant * getString(llvm::LLVMContext & Context, llvm::StringRef Initializer, bool AddNull = true)
  • public inline llvm::ArrayType * getType() const

Inherited from ConstantDataSequential:

Inherited from ConstantData:

Inherited from Constant:

Inherited from User:

Inherited from Value:

Methods

ConstantDataArray(const llvm::ConstantDataArray&)

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

Parameters

const llvm::ConstantDataArray&

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

Parameters

const llvm::Value* V

template <typename ElementTy>
static llvm::Constant* get(
    llvm::LLVMContext& Context,
    ArrayRef<ElementTy> Elts)

Description

get() constructor - Return a constant with array type with an element count and element type matching the ArrayRef passed in. Note that this can return a ConstantAggregateZero object.

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

Templates

ElementTy

Parameters

llvm::LLVMContext& Context
ArrayRef<ElementTy> Elts

template <typename ArrayTy>
static llvm::Constant* get(
    llvm::LLVMContext& Context,
    ArrayTy& Elts)

Description

get() constructor - ArrayTy needs to be compatible with ArrayRef <ElementTy >. Calls get(LLVMContext, ArrayRef <ElementTy >).

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

Templates

ArrayTy

Parameters

llvm::LLVMContext& Context
ArrayTy& Elts

static llvm::Constant* getFP(
    llvm::LLVMContext& Context,
    ArrayRef<uint16_t> Elts)

Description

getFP() constructors - Return a constant with array type with an element count and element type of float with precision matching the number of bits in the ArrayRef passed in. (i.e. half for 16bits, float for 32bits, double for 64bits) Note that this can return a ConstantAggregateZero object.

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

Parameters

llvm::LLVMContext& Context
ArrayRef<uint16_t> Elts

static llvm::Constant* getFP(
    llvm::LLVMContext& Context,
    ArrayRef<uint32_t> Elts)

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

Parameters

llvm::LLVMContext& Context
ArrayRef<uint32_t> Elts

static llvm::Constant* getFP(
    llvm::LLVMContext& Context,
    ArrayRef<uint64_t> Elts)

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

Parameters

llvm::LLVMContext& Context
ArrayRef<uint64_t> Elts

static llvm::Constant* getRaw(
    llvm::StringRef Data,
    uint64_t NumElements,
    llvm::Type* ElementTy)

Description

get() constructor - Return a constant with array type with an element count and element type matching the NumElements and ElementTy parameters passed in. Note that this can return a ConstantAggregateZero object. ElementTy needs to be one of i8/i16/i32/i64/float/double. Data is the buffer containing the elements. Be careful to make sure Data uses the right endianness, the buffer will be used as-is.

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

Parameters

llvm::StringRef Data
uint64_t NumElements
llvm::Type* ElementTy

static llvm::Constant* getString(
    llvm::LLVMContext& Context,
    llvm::StringRef Initializer,
    bool AddNull = true)

Description

This method constructs a CDS and initializes it with a text string. The default behavior (AddNull==true) causes a null terminator to be placed at the end of the array (increasing the length of the string by one more than the StringRef would normally indicate. Pass AddNull=false to disable this behavior.

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

Parameters

llvm::LLVMContext& Context
llvm::StringRef Initializer
bool AddNull = true

inline llvm::ArrayType* getType() const

Description

Specialize the getType() method to always return an ArrayType, which reduces the amount of casting needed in parts of the compiler.

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