LLVM API Documentation
#include <Constants.h>


Public Member Functions | |
| uint64_t | getElementAsInteger (unsigned i) const |
| APFloat | getElementAsAPFloat (unsigned i) const |
| float | getElementAsFloat (unsigned i) const |
| double | getElementAsDouble (unsigned i) const |
| Constant * | getElementAsConstant (unsigned i) const |
| SequentialType * | getType () const |
| Type * | getElementType () const |
| getElementType - Return the element type of the array/vector. | |
| unsigned | getNumElements () const |
| getNumElements - Return the number of elements in the array or vector. | |
| uint64_t | getElementByteSize () const |
| getElementByteSize - Return the size in bytes of the elements in the data. | |
| bool | isString () const |
| isString - This method returns true if this is an array of i8. | |
| bool | isCString () const |
| StringRef | getAsString () const |
| StringRef | getAsCString () const |
| StringRef | getRawDataValues () const |
| virtual void | destroyConstant () |
Static Public Member Functions | |
| static bool | isElementTypeCompatible (const Type *Ty) |
| static bool | classof (const Value *V) |
Protected Member Functions | |
| ConstantDataSequential (Type *ty, ValueTy VT, const char *Data) | |
| ~ConstantDataSequential () | |
| void * | operator new (size_t s) |
Static Protected Member Functions | |
| static Constant * | getImpl (StringRef Bytes, Type *Ty) |
Friends | |
| class | LLVMContextImpl |
ConstantDataSequential - A vector or 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.
This is the common base class of ConstantDataArray and ConstantDataVector.
Definition at line 526 of file Constants.h.
| llvm::ConstantDataSequential::ConstantDataSequential | ( | Type * | ty, |
| ValueTy | VT, | ||
| const char * | Data | ||
| ) | [inline, explicit, protected] |
Definition at line 540 of file Constants.h.
| llvm::ConstantDataSequential::~ConstantDataSequential | ( | ) | [inline, protected] |
Definition at line 542 of file Constants.h.
Methods for support type inquiry through isa, cast, and dyn_cast:
Reimplemented from llvm::Constant.
Reimplemented in llvm::ConstantDataVector, and llvm::ConstantDataArray.
Definition at line 633 of file Constants.h.
References llvm::Value::ConstantDataArrayVal, llvm::Value::ConstantDataVectorVal, and llvm::Value::getValueID().
| void ConstantDataSequential::destroyConstant | ( | ) | [virtual] |
destroyConstant - Called if some element of this constant is no longer valid. At this point only other constants may be on the use_list for this constant. Any constants on our Use list must also be destroy'd. The implementation must be sure to remove the constant from the list of available cached constants. Implementations should call destroyConstantImpl as the last thing they do, to destroy all users and delete this.
Reimplemented from llvm::Constant.
Definition at line 2253 of file Constants.cpp.
References llvm::LLVMContextImpl::CDSConstants, llvm::Constant::destroyConstantImpl(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::erase(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::Value::getContext(), llvm::Type::getContext(), getRawDataValues(), getType(), and llvm::LLVMContext::pImpl.
| StringRef llvm::ConstantDataSequential::getAsCString | ( | ) | const [inline] |
getAsCString - If this array is isCString(), then this method returns the array (without the trailing null byte) as a StringRef. Otherwise, it asserts out.
Definition at line 618 of file Constants.h.
References getAsString(), isCString(), llvm::StringRef::size(), and llvm::StringRef::substr().
| StringRef llvm::ConstantDataSequential::getAsString | ( | ) | const [inline] |
getAsString - If this array is isString(), then this method returns the array as a StringRef. Otherwise, it asserts out.
Definition at line 609 of file Constants.h.
References getRawDataValues(), and isString().
Referenced by emitGlobalConstantDataSequential(), getAsCString(), llvm::getConstantStringInfo(), and isCString().
getElementAsAPFloat - If this is a sequential container of floating point type, return the specified element as an APFloat.
Definition at line 2440 of file Constants.cpp.
References llvm::lltok::APFloat, llvm::Type::DoubleTyID, llvm::Type::FloatTyID, getElementType(), getTypeID(), and llvm_unreachable.
Referenced by getElementAsConstant().
getElementAsConstant - 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.
Definition at line 2479 of file Constants.cpp.
References llvm::ConstantInt::get(), llvm::ConstantFP::get(), llvm::Value::getContext(), getElementAsAPFloat(), getElementAsInteger(), and getElementType().
Referenced by llvm::ConstantDataVector::getSplatValue().
| double ConstantDataSequential::getElementAsDouble | ( | unsigned | Elt | ) | const |
getElementAsDouble - If this is an sequential container of doubles, return the specified element as a double.
getElementAsDouble - If this is an sequential container of doubles, return the specified element as a float.
Definition at line 2468 of file Constants.cpp.
References getElementType().
Referenced by emitGlobalConstantDataSequential(), and llvm::ExecutionEngine::getConstantValue().
| float ConstantDataSequential::getElementAsFloat | ( | unsigned | Elt | ) | const |
getElementAsFloat - If this is an sequential container of floats, return the specified element as a float.
Definition at line 2459 of file Constants.cpp.
References getElementType().
Referenced by emitGlobalConstantDataSequential(), and llvm::ExecutionEngine::getConstantValue().
| uint64_t ConstantDataSequential::getElementAsInteger | ( | unsigned | Elt | ) | const |
getElementAsInteger - If this is a sequential container of integers (of any size), return the specified element in the low bits of a uint64_t.
Definition at line 2418 of file Constants.cpp.
References getElementType(), and llvm_unreachable.
Referenced by emitGlobalConstantDataSequential(), FoldBitCast(), llvm::ExecutionEngine::getConstantValue(), getElementAsConstant(), and WriteConstants().
| uint64_t ConstantDataSequential::getElementByteSize | ( | ) | const |
getElementByteSize - Return the size in bytes of the elements in the data.
getElementByteSize - 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.
Definition at line 2200 of file Constants.cpp.
References getElementType(), and llvm::Type::getPrimitiveSizeInBits().
Referenced by emitGlobalConstantDataSequential(), getRawDataValues(), and llvm::ConstantDataVector::getSplatValue().
| Type * ConstantDataSequential::getElementType | ( | ) | const |
getElementType - Return the element type of the array/vector.
Definition at line 2164 of file Constants.cpp.
References llvm::SequentialType::getElementType(), and getType().
Referenced by emitGlobalConstantDataSequential(), llvm::ExecutionEngine::getConstantValue(), getElementAsAPFloat(), getElementAsConstant(), getElementAsDouble(), getElementAsFloat(), getElementAsInteger(), getElementByteSize(), and isString().
getImpl - This is the underlying implementation of all of the ConstantDataSequential::get methods. They all thunk down to here, providing the correct element type. We take the bytes in as a StringRef because we *want* an underlying "char*" to avoid TBAA type punning violations.
StringMap bucket, linked up by their Next pointers. Walk the list.
Definition at line 2223 of file Constants.cpp.
References llvm::LLVMContextImpl::CDSConstants, llvm::ConstantAggregateZero::get(), llvm::Type::getContext(), llvm::StringMap< ValueTy, AllocatorTy >::GetOrCreateValue(), llvm::Type::getSequentialElementType(), isAllZeros(), isElementTypeCompatible(), and llvm::LLVMContext::pImpl.
Referenced by llvm::ConstantDataArray::get(), and llvm::ConstantDataVector::get().
| unsigned ConstantDataSequential::getNumElements | ( | ) | const |
getNumElements - Return the number of elements in the array or vector.
Definition at line 2192 of file Constants.cpp.
References getType(), and llvm::Type::getVectorNumElements().
Referenced by emitGlobalConstantDataSequential(), llvm::ExecutionEngine::getConstantValue(), getRawDataValues(), llvm::ConstantDataVector::getSplatValue(), and WriteConstants().
| StringRef ConstantDataSequential::getRawDataValues | ( | ) | const |
getRawDataValues - 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.
Definition at line 2168 of file Constants.cpp.
References getElementByteSize(), and getNumElements().
Referenced by destroyConstant(), getAsString(), llvm::ConstantDataVector::getSplatValue(), and isRepeatedByteSequence().
| SequentialType* llvm::ConstantDataSequential::getType | ( | ) | const [inline] |
getType - Specialize the getType() method to always return a SequentialType, which reduces the amount of casting needed in parts of the compiler.
Reimplemented from llvm::Value.
Reimplemented in llvm::ConstantDataVector, and llvm::ConstantDataArray.
Definition at line 583 of file Constants.h.
Referenced by destroyConstant(), emitGlobalConstantDataSequential(), getElementType(), getNumElements(), and isString().
| bool ConstantDataSequential::isCString | ( | ) | const |
isCString - This method returns true if the array "isString", ends with a nul byte, and does not contains any other nul bytes.
Definition at line 2493 of file Constants.cpp.
References llvm::StringRef::back(), llvm::StringRef::drop_back(), llvm::StringRef::find(), getAsString(), isString(), and llvm::StringRef::npos.
Referenced by getAsCString(), and WriteConstants().
isElementTypeCompatible - 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.
Definition at line 2176 of file Constants.cpp.
References llvm::Type::isDoubleTy(), and llvm::Type::isFloatTy().
Referenced by llvm::ConstantArray::get(), llvm::ConstantVector::get(), getImpl(), llvm::ConstantVector::getSplat(), and llvm::ConstantDataVector::getSplat().
| bool ConstantDataSequential::isString | ( | ) | const |
isString - This method returns true if this is an array of i8.
Definition at line 2487 of file Constants.cpp.
References getElementType(), getType(), and llvm::Type::isIntegerTy().
Referenced by emitGlobalConstantDataSequential(), getAsString(), llvm::getConstantStringInfo(), and isCString().
| void* llvm::ConstantDataSequential::operator new | ( | size_t | s | ) | [inline, protected] |
Reimplemented from llvm::User.
Reimplemented in llvm::ConstantDataVector, and llvm::ConstantDataArray.
Definition at line 548 of file Constants.h.
References operator new().
friend class LLVMContextImpl [friend] |
Definition at line 527 of file Constants.h.