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.
More...
#include "llvm/IR/Constants.h"
Inheritance diagram for llvm::ConstantDataArray:
Specialize the
getType() method to always return an
ArrayType, which reduces the amount of casting needed in parts of the compiler.
If this is a sequential container of integers (of any size), return the specified element in the low bits of a
uint64_t.
If this is a sequential container of integers (of any size), return the specified element as an
APInt.
If this is a sequential container of floating point type, return the specified element as an
APFloat.
If this is an sequential container of floats, return the specified element as a float.
If this is an sequential container of doubles, return the specified element as a double.
Return a
Constant for a specified index's element.
Return the element type of the array/vector.
Return the number of elements in the array or vector.
Return the size (in bytes) of each element in the array/vector.
This method returns true if this is an array of CharSize integers.
This method returns true if the array "isString", ends with a null byte, and does not contains any other null bytes.
If this array is
isCString(), then this method returns the array (without the trailing null byte) as a
StringRef.
Return the raw, underlying, bytes of this data.
Return true if this is the value that would be returned by getNullValue.
Returns true if the value is one.
Return true if the value is not the one value, or, for vectors, does not contain one value elements.
Return true if this is the value that would be returned by getAllOnesValue.
Return true if the value is what would be returned by getZeroValueForNegation.
Return true if the value is negative zero or null value.
Return true if the value is not the smallest signed value, or, for vectors, does not contain smallest signed value elements.
Return true if the value is the smallest signed value.
Return true if this is a finite and non-zero floating-point scalar constant or a fixed width vector constant with all finite and non-zero elements.
Return true if this is a normal (as opposed to denormal, infinity, nan, or zero) floating-point scalar constant or a vector constant with all normal elements.
Return true if this scalar has an exact multiplicative inverse or this vector has an exact multiplicative inverse for each element in the vector.
Return true if this is a floating-point NaN constant or a vector floating-point constant with all NaN elements.
Return true if this constant and a constant 'Y' are element-wise equal.
Return true if this is a vector constant that includes any undef or poison elements.
Return true if this is a vector constant that includes any poison elements.
Return true if this is a vector constant that includes any strictly undef (not poison) elements.
Return true if this is a fixed width vector constant that includes any constant expressions.
Return true if the value can vary between threads.
Return true if the value is dependent on a dllimport variable.
Return true if the constant has users other than constant expressions and other dangling things.
This method classifies the entry according to whether or not it may generate a relocation entry (either static or dynamic).
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if possible, or null if not.
If all elements of the vector constant have the same value, return that value.
If C is a constant integer then return its value, otherwise C must be a vector of constant integers, all equal, and the common value is returned.
Convert constant to an approximate constant range.
Called if some element of this constant is no longer valid.
This method is a special form of
User::replaceUsesOfWith (which does not work on constants) that does work on constants.
If there are any dead constant users dangling off of this constant, remove them.
Return true if the constant has exactly one live use.
Return true if the constant has no live uses.
Free memory allocated for
User and
Use objects.
Placement delete - required by std, called if the ctor throws.
Placement delete - required by std, called if the ctor throws.
Placement delete - required by std, called if the ctor throws.
Returns the descriptor co-allocated with this
User instance.
Returns the descriptor co-allocated with this
User instance.
Subclasses with hung off uses need to manage the operand count themselves.
A droppable user is a user for which uses can be dropped without affecting correctness and should be dropped rather than preventing a transformation from happening.
Drop all references to operands.
Replace uses of one
Value with another.
Delete a pointer to a generic
Value.
Support for debugging, callable in GDB: V->
dump()
All values are typed, get the type of this value.
All values hold a context through their type.
Return a constant reference to the value's name.
Change the name of the value.
Transfer the name from V to this value.
Change all uses of this to point to a new
Value.
Change non-metadata uses of this to point to a new
Value.
Go through the uses list for this definition and make each use point to "V" if the callback ShouldReplace returns true for the given
Use.
replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block.
Return true if there is exactly one use of this value.
Return true if this
Value has exactly N uses.
Return true if this value has N uses or more.
Return true if there is exactly one user of this value.
Return true if there is exactly one use of this value that cannot be dropped.
Return true if there is exactly one unique user of this value that cannot be dropped (that user can have multiple uses of this value).
Return true if there this value.
Return true if this value has N uses or more.
Remove every uses that can safely be removed.
Remove every use of this value in
User that can safely be removed.
Check if this value is used in the specified basic block.
This method computes the number of uses of this
Value.
This method should only be used by the
Use class.
Return an
ID for the concrete type of this object.
Return the raw optional flags value contained in this value.
Clear the optional flags contained in this value.
Check the optional flags for equality.
Return true if there is a value handle associated with this value.
Return true if there is metadata referencing this value.
Return true if this value is a swifterror value.
Strip off pointer casts, all-zero GEPs and address space casts.
Strip off pointer casts, all-zero GEPs, address space casts, and aliases.
Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the result stays the same.
Strip off pointer casts, all-zero GEPs, single-argument phi nodes and invariant group info.
Strip off pointer casts and all-constant inbounds GEPs.
Accumulate the constant offset this value has compared to a base pointer.
This is a wrapper around stripAndAccumulateConstantOffsets with the in-bounds requirement set to false.
Strip off pointer casts and inbounds GEPs.
If this ptr is provably equal to Other plus a constant offset, return that offset in bytes.
Return true if the memory object referred to by V can by freed in the scope for which the SSA value defining the allocation is statically defined.
Returns the number of bytes known to be dereferenceable for the pointer value.
Returns an alignment of the pointer value.
Translate PHI node to its predecessor from the given basic block.
Mutate the type of this
Value to be of the specified type.
template<class Compare>
Sort the use-list.
Reverse the use-list.
Implement operator<< on
Value.
template<typename ElementTy>
get() constructor - Return a constant with array type with an element count and element type matching the
ArrayRef passed in.
template<typename ArrayTy>
getRaw() constructor - Return a constant with array type with an element count and element type matching the NumElements and ElementTy parameters passed in.
getFP() constructors - Return a constant of array type with a float element type taken from argument ‘ElementType’, and count taken from / argument ‘Elts’.
This method constructs a CDS and initializes it with a text string.
Methods for support type inquiry through isa, cast, and dyn_cast:
Methods for support type inquiry through isa, cast, and dyn_cast:
Methods to support type inquiry through isa, cast, and dyn_cast.
Constructor to create a '0' constant of arbitrary type.
Return the value for an integer or pointer constant, or a vector thereof, with the given scalar value.
Try to replace undefined constant C or undefined elements in C with Replacement.
Merges undefs of a
Constant with another
Constant, along with the undefs already present.
Static Public Member Functions inherited from
llvm::User
Static Public Member Functions inherited from
llvm::Value
Remove the droppable use U.
The maximum alignment for instructions.
The number of operands in the subclass.
More...
Protected Member Functions inherited from
llvm::User
Allocate a
User with an operand pointer co-allocated.
Allocate a
User with the operands co-allocated.
Allocate a
User with the operands co-allocated.
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the
User.
Grow the number of hung off uses.
template<int Idx>
template<int Idx>
Value's destructor should be virtual by design, but that would require that
Value and all of its subclasses have a vtable that effectively duplicates the information in the value
ID.
Appends all metadata attached to this value to MDs, sorting by KindID.
Return true if this value has any metadata attached to it.
Erase all metadata attachments with the given kind.
Erase all metadata attachments matching the given predicate.
Erase all metadata attached to this
Value.
Get metadata for the given kind, if any.
Get the current metadata attachments for the given kind, if any.
Appends all attachments with the given
ID to
MDs in insertion order.
Return true if this value has the given type of metadata attached.
Set a particular kind of metadata attachment.
Add a metadata attachment.
This is the underlying implementation of all of the ConstantDataSequential::get methods.
Static Protected Member Functions inherited from
llvm::User
template<int Idx, typename U>
Hold subclass data that can be dropped.
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.
Definition at line 702 of file Constants.h.
◆ ConstantDataArray()
◆ classof()
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition at line 765 of file Constants.h.
◆ get() [1/2]
template<typename ElementTy>
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.
Definition at line 715 of file Constants.h.
References llvm::ConstantDataSequential::Constant, llvm::Data, llvm::ArrayRef< T >::data(), getRaw(), llvm::Type::getScalarTy(), and llvm::ArrayRef< T >::size().
Referenced by llvm::TargetLowering::CTTZTableLookup(), llvm::embedBitcodeInModule(), llvm::embedBufferInModule(), get(), llvm::sandboxir::ConstantDataArray::get(), getString(), promoteToConstantPool(), llvm::ReadByteArrayFromGlobal(), and tagGlobalDefinition().
◆ get() [2/2]
template<typename ArrayTy>
ArrayTy & Elts )
inlinestatic
◆ getFP() [1/3]
getFP() constructors - Return a constant of array type with a float element type taken from argument ‘ElementType’, and count taken from / argument ‘Elts’.
The amount of bits of the contained type must match the number of bits of the type contained in the passed in ArrayRef. (i.e. half or bfloat for 16bits, float for 32bits, double for 64bits) Note that this can return a ConstantAggregateZero object.
Definition at line 2971 of file Constants.cpp.
References assert(), llvm::ConstantDataSequential::Constant, llvm::Data, llvm::ArrayRef< T >::data(), llvm::ArrayType::get(), llvm::ConstantDataSequential::getImpl(), and llvm::ArrayRef< T >::size().
Referenced by llvm::sandboxir::ConstantDataArray::getFP(), llvm::sandboxir::ConstantDataArray::getFP(), and llvm::sandboxir::ConstantDataArray::getFP().
◆ getFP() [2/3]
◆ getFP() [3/3]
◆ getRaw()
◆ getString()
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.
Definition at line 2992 of file Constants.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::ArrayRef(), llvm::ConstantDataSequential::Constant, llvm::Data, get(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::IRBuilderBase::CreateGlobalString(), createMemprofDefaultOptionsVar(), llvm::createPGOFuncNameVar(), createPrivateConstGlobalForString(), llvm::createPrivateGlobalForString(), createProfileFileNameVar(), llvm::createProfileFileNameVar(), getGlobalForName(), llvm::offloading::getOffloadingEntryInitializer(), llvm::sandboxir::ConstantDataArray::getString(), LLVMConstStringInContext(), and LLVMConstStringInContext2().
◆ getType()
ArrayType * llvm::ConstantDataArray::getType
(
)
const
inline
◆ ConstantDataSequential
The documentation for this class was generated from the following files: