LLVM API Documentation
#include <Constants.h>
Inheritance diagram for llvm::ConstantArray:
Public Member Functions | |
const ArrayType * | getType () const |
bool | isString () const |
std::string | getAsString () const |
virtual bool | isNullValue () const |
virtual void | destroyConstant () |
virtual void | replaceUsesOfWithOnConstant (Value *From, Value *To, Use *U) |
Static Public Member Functions | |
static Constant * | get (const ArrayType *T, const std::vector< Constant * > &) |
get() - Static factory methods - Return objects of the specified value | |
static Constant * | get (const std::string &Initializer, bool AddNull=true) |
static bool | classof (const ConstantArray *) |
Methods for support type inquiry through isa, cast, and dyn_cast:. | |
static bool | classof (const Value *V) |
Protected Member Functions | |
ConstantArray (const ArrayType *T, const std::vector< Constant * > &Val) | |
~ConstantArray () | |
Friends | |
struct | ConstantCreator< ConstantArray, ArrayType, std::vector< Constant * > > |
Definition at line 338 of file Constants.h.
ConstantArray::ConstantArray | ( | const ArrayType * | T, | |
const std::vector< Constant * > & | Val | |||
) | [protected] |
Definition at line 246 of file Constants.cpp.
References C, E, llvm::Type::getTypeID(), llvm::Type::isAbstract(), llvm::User::OperandList, and T.
ConstantArray::~ConstantArray | ( | ) | [protected] |
get() - Static factory methods - Return objects of the specified value
Definition at line 1010 of file Constants.cpp.
References ArrayConstants, C, llvm::ConstantAggregateZero::get(), and llvm::ValueMap< ValType, TypeClass, ConstantClass, HasLargeKey >::getOrCreate().
Referenced by DISerializeVisitor::Apply(), llvm::ConvertConstantType< ConstantArray, ArrayType >::convert(), get(), llvm::DISerializer::getString(), llvm::MapValue(), llvm::BytecodeReader::ParseConstantPoolValue(), and llvm::BytecodeReader::ParseStringConstants().
Constant * ConstantArray::get | ( | const std::string & | Initializer, | |
bool | AddNull = true | |||
) | [static] |
This method constructs a ConstantArray 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. This effectively increases the length of the array by one (you've been warned). However, in some situations this is not desired so if AddNull==false then the string is copied without null termination.
Definition at line 1037 of file Constants.cpp.
References get(), llvm::ArrayType::get(), llvm::ConstantSInt::get(), and llvm::Type::SByteTy.
const ArrayType* llvm::ConstantArray::getType | ( | ) | const [inline] |
getType - Specialize the getType() method to always return an ArrayType, which reduces the amount of casting needed in parts of the compiler.
Reimplemented from llvm::Value.
Definition at line 360 of file Constants.h.
References llvm::Value::getType().
Referenced by isString(), and replaceUsesOfWithOnConstant().
bool ConstantArray::isString | ( | ) | const |
isString - This method returns true if the array is an array of sbyte or ubyte, and if the elements of the array are all ConstantInt's.
Definition at line 1053 of file Constants.cpp.
References llvm::User::getNumOperands(), llvm::Constant::getOperand(), getType(), llvm::Type::SByteTy, and llvm::Type::UByteTy.
Referenced by getAsString(), llvm::Constant::getStringValue(), isStringValue(), and printAsCString().
std::string ConstantArray::getAsString | ( | ) | const |
getAsString - If this array is isString(), then this method converts the array to an std::string and returns it. Otherwise, it asserts out.
Definition at line 1070 of file Constants.cpp.
References llvm::User::getNumOperands(), llvm::Constant::getOperand(), and isString().
Referenced by llvm::Constant::getStringValue().
virtual bool llvm::ConstantArray::isNullValue | ( | ) | const [inline, virtual] |
isNullValue - Return true if this is the value that would be returned by getNullValue. This always returns false because zero arrays are always created as ConstantAggregateZero objects.
Implements llvm::Constant.
Definition at line 376 of file Constants.h.
void ConstantArray::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 1026 of file Constants.cpp.
References ArrayConstants, llvm::Constant::destroyConstantImpl(), and llvm::ValueMap< ValType, TypeClass, ConstantClass, HasLargeKey >::remove().
Referenced by llvm::ConvertConstantType< ConstantArray, ArrayType >::convert(), and replaceUsesOfWithOnConstant().
replaceUsesOfWithOnConstant - This method is a special form of User::replaceUsesOfWith (which does not work on constants) that does work on constants. Basically this method goes through the trouble of building a new constant that is equivalent to the current one, with all uses of From replaced with uses of To. After this construction is completed, all of the users of 'this' are replaced to use the new constant, and then 'this' is deleted. In general, you should not call this method, instead, use Value::replaceAllUsesWith, which automatically dispatches to this method as needed.
Reimplemented from llvm::Constant.
Definition at line 1626 of file Constants.cpp.
References ArrayConstants, destroyConstant(), E, llvm::ConstantAggregateZero::get(), llvm::User::getNumOperands(), llvm::Constant::getOperand(), getType(), llvm::ValueMap< ValType, TypeClass, ConstantClass, HasLargeKey >::InsertOrGetItem(), llvm::Constant::isNullValue(), Lookup(), llvm::ValueMap< ValType, TypeClass, ConstantClass, HasLargeKey >::MoveConstantToNewSlot(), llvm::User::OperandList, Replacement, llvm::Constant::setOperand(), U, llvm::Value::uncheckedReplaceAllUsesWith(), and Val.
static bool llvm::ConstantArray::classof | ( | const ConstantArray * | ) | [inline, static] |
Methods for support type inquiry through isa, cast, and dyn_cast:.
Definition at line 382 of file Constants.h.
static bool llvm::ConstantArray::classof | ( | const Value * | V | ) | [inline, static] |
Reimplemented from llvm::Constant.
Definition at line 383 of file Constants.h.
References llvm::Value::ConstantArrayVal, and V.
friend struct ConstantCreator< ConstantArray, ArrayType,std::vector< Constant * > > [friend] |
Definition at line 340 of file Constants.h.