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. More... | |
unsigned | getNumElements () const |
getNumElements - Return the number of elements in the array or vector. More... | |
uint64_t | getElementByteSize () const |
getElementByteSize - Return the size in bytes of the elements in the data. More... | |
bool | isString () const |
isString - This method returns true if this is an array of i8. More... | |
bool | isCString () const |
StringRef | getAsString () const |
StringRef | getAsCString () const |
StringRef | getRawDataValues () const |
virtual void | destroyConstant () |
![]() | |
bool | isNullValue () const |
bool | isAllOnesValue () const |
bool | isNegativeZeroValue () const |
bool | isZeroValue () const |
Return true if the value is negative zero or null value. More... | |
bool | canTrap () const |
bool | isThreadDependent () const |
isThreadDependent - Return true if the value can vary between threads. More... | |
bool | isConstantUsed () const |
PossibleRelocationsTy | getRelocationInfo () const |
Constant * | getAggregateElement (unsigned Elt) const |
Constant * | getAggregateElement (Constant *Elt) const |
Constant * | getSplatValue () const |
const APInt & | getUniqueInteger () const |
virtual void | replaceUsesOfWithOnConstant (Value *, Value *, Use *) |
void | removeDeadConstantUsers () const |
![]() | |
~User () | |
void | operator delete (void *Usr) |
operator delete - free memory allocated for User and Use objects More... | |
void | operator delete (void *, unsigned) |
placement delete - required by std, but never called. More... | |
void | operator delete (void *, unsigned, bool) |
placement delete - required by std, but never called. More... | |
Value * | getOperand (unsigned i) const |
void | setOperand (unsigned i, Value *Val) |
const Use & | getOperandUse (unsigned i) const |
Use & | getOperandUse (unsigned i) |
unsigned | getNumOperands () const |
op_iterator | op_begin () |
const_op_iterator | op_begin () const |
op_iterator | op_end () |
const_op_iterator | op_end () const |
value_op_iterator | value_op_begin () |
value_op_iterator | value_op_end () |
void | dropAllReferences () |
void | replaceUsesOfWith (Value *From, Value *To) |
![]() | |
virtual | ~Value () |
void | dump () const |
dump - Support for debugging, callable in GDB: V->dump() More... | |
void | print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const |
Type * | getType () const |
LLVMContext & | getContext () const |
All values hold a context through their type. More... | |
bool | hasName () const |
ValueName * | getValueName () const |
void | setValueName (ValueName *VN) |
StringRef | getName () const |
void | setName (const Twine &Name) |
void | takeName (Value *V) |
void | replaceAllUsesWith (Value *V) |
bool | use_empty () const |
use_iterator | use_begin () |
const_use_iterator | use_begin () const |
use_iterator | use_end () |
const_use_iterator | use_end () const |
User * | use_back () |
const User * | use_back () const |
bool | hasOneUse () const |
bool | hasNUses (unsigned N) const |
bool | hasNUsesOrMore (unsigned N) const |
bool | isUsedInBasicBlock (const BasicBlock *BB) const |
unsigned | getNumUses () const |
void | addUse (Use &U) |
unsigned | getValueID () const |
unsigned | getRawSubclassOptionalData () const |
void | clearSubclassOptionalData () |
bool | hasSameSubclassOptionalData (const Value *V) const |
void | intersectOptionalDataWith (const Value *V) |
bool | hasValueHandle () const |
Value * | stripPointerCasts () |
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCasts () const |
Value * | stripPointerCastsNoFollowAliases () |
Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More... | |
const Value * | stripPointerCastsNoFollowAliases () const |
Value * | stripInBoundsConstantOffsets () |
Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsConstantOffsets () const |
Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More... | |
const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
Value * | stripInBoundsOffsets () |
Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More... | |
const Value * | stripInBoundsOffsets () const |
bool | isDereferenceablePointer () const |
Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
void | mutateType (Type *Ty) |
Static Public Member Functions | |
static bool | isElementTypeCompatible (const Type *Ty) |
static bool | classof (const Value *V) |
![]() | |
static bool | classof (const Value *V) |
static Constant * | getNullValue (Type *Ty) |
static Constant * | getAllOnesValue (Type *Ty) |
Get the all ones value. More... | |
static Constant * | getIntegerValue (Type *Ty, const APInt &V) |
![]() | |
static bool | classof (const Value *V) |
Protected Member Functions | |
ConstantDataSequential (Type *ty, ValueTy VT, const char *Data) | |
~ConstantDataSequential () | |
void * | operator new (size_t s) |
![]() | |
Constant (Type *ty, ValueTy vty, Use *Ops, unsigned NumOps) | |
void | destroyConstantImpl () |
![]() | |
void * | operator new (size_t s, unsigned Us) |
User (Type *ty, unsigned vty, Use *OpList, unsigned NumOps) | |
Use * | allocHungoffUses (unsigned) const |
void | dropHungoffUses () |
template<int Idx> | |
Use & | Op () |
template<int Idx> | |
const Use & | Op () const |
![]() | |
virtual void | printCustom (raw_ostream &O) const |
Value (Type *Ty, unsigned scid) | |
unsigned short | getSubclassDataFromValue () const |
void | setValueSubclassData (unsigned short D) |
Static Protected Member Functions | |
static Constant * | getImpl (StringRef Bytes, Type *Ty) |
![]() | |
template<int Idx, typename U > | |
static Use & | OpFrom (const U *that) |
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 524 of file Constants.h.
|
inlineexplicitprotected |
Definition at line 538 of file Constants.h.
|
inlineprotected |
Definition at line 540 of file Constants.h.
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition at line 631 of file Constants.h.
References llvm::Value::ConstantDataArrayVal, llvm::Value::ConstantDataVectorVal, and llvm::Value::getValueID().
|
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 2278 of file Constants.cpp.
References llvm::LLVMContextImpl::CDSConstants, llvm::Constant::destroyConstantImpl(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::Value::getContext(), llvm::Type::getContext(), getRawDataValues(), getType(), and llvm::LLVMContext::pImpl.
|
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 616 of file Constants.h.
References getAsString(), isCString(), llvm::StringRef::size(), and llvm::StringRef::substr().
|
inline |
getAsString - If this array is isString(), then this method returns the array as a StringRef. Otherwise, it asserts out.
Definition at line 607 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 2465 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 2504 of file Constants.cpp.
References llvm::ConstantInt::get(), llvm::ConstantFP::get(), llvm::Value::getContext(), getElementAsAPFloat(), getElementAsInteger(), and getElementType().
Referenced by getLogBase2Vector(), and 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 2493 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 2484 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 2443 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 2225 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 2189 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 2248 of file Constants.cpp.
References llvm::LLVMContextImpl::CDSConstants, llvm::ConstantAggregateZero::get(), llvm::Type::getContext(), llvm::StringMapEntry< ValueTy >::getKeyData(), llvm::Type::getSequentialElementType(), llvm::StringMapEntry< ValueTy >::getValue(), 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 2217 of file Constants.cpp.
References getType(), and llvm::Type::getVectorNumElements().
Referenced by emitGlobalConstantDataSequential(), llvm::ExecutionEngine::getConstantValue(), getLogBase2Vector(), 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 2193 of file Constants.cpp.
References getElementByteSize(), and getNumElements().
Referenced by destroyConstant(), getAsString(), llvm::ConstantDataVector::getSplatValue(), and isRepeatedByteSequence().
|
inline |
getType - Specialize the getType() method to always return a SequentialType, which reduces the amount of casting needed in parts of the compiler.
Definition at line 581 of file Constants.h.
References llvm::Value::getType().
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 2518 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 2201 of file Constants.cpp.
References llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), and IT().
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 2512 of file Constants.cpp.
References getElementType(), getType(), and llvm::Type::isIntegerTy().
Referenced by emitGlobalConstantDataSequential(), getAsString(), llvm::getConstantStringInfo(), and isCString().
|
inlineprotected |
Definition at line 546 of file Constants.h.
|
friend |
Definition at line 525 of file Constants.h.