LLVM API Documentation
#include <Constant.h>
Inheritance diagram for llvm::Constant:
Public Member Functions | |
virtual bool | isNullValue () const =0 |
virtual void | print (std::ostream &O) const |
Constant * | getOperand (unsigned i) |
const Constant * | getOperand (unsigned i) const |
void | setOperand (unsigned i, Constant *C) |
virtual void | destroyConstant () |
virtual void | replaceUsesOfWithOnConstant (Value *, Value *, Use *) |
std::string | getStringValue (bool Chop=true, unsigned Offset=0) |
Static Public Member Functions | |
static Constant * | getNullValue (const Type *Ty) |
static bool | classof (const Constant *) |
static bool | classof (const GlobalValue *) |
static bool | classof (const Value *V) |
static void | clearAllValueMaps () |
Protected Member Functions | |
Constant (const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps, const std::string &Name="") | |
void | destroyConstantImpl () |
Definition at line 21 of file Constant.h.
static bool llvm::Constant::classof | ( | const Value * | V | ) | [inline, static] |
Reimplemented from llvm::User.
Reimplemented in llvm::ConstantIntegral, llvm::ConstantBool, llvm::ConstantInt, llvm::ConstantSInt, llvm::ConstantUInt, llvm::ConstantFP, llvm::ConstantAggregateZero, llvm::ConstantArray, llvm::ConstantStruct, llvm::ConstantPacked, llvm::ConstantPointerNull, llvm::ConstantExpr, llvm::UndefValue, llvm::Function, llvm::GlobalValue, and llvm::GlobalVariable.
Definition at line 65 of file Constant.h.
References llvm::Value::ConstantFirstVal, llvm::Value::ConstantLastVal, and V.
static bool llvm::Constant::classof | ( | const GlobalValue * | ) | [inline, static] |
static bool llvm::Constant::classof | ( | const Constant * | ) | [inline, static] |
Definition at line 63 of file Constant.h.
void Constant::clearAllValueMaps | ( | ) | [static] |
clearAllValueMaps - This method frees all internal memory used by the constant subsystem, which can be used in environments where this memory is otherwise reported as a leak.
Definition at line 1746 of file Constants.cpp.
References AggZeroConstants, DoubleConstants, E, ExprConstants, FloatConstants, NullPtrConstants, PackedConstants, SIntConstants, UIntConstants, and UndefValueConstants.
virtual void llvm::Constant::destroyConstant | ( | ) | [inline, 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 in llvm::ConstantAggregateZero, llvm::ConstantArray, llvm::ConstantStruct, llvm::ConstantPacked, llvm::ConstantPointerNull, llvm::ConstantExpr, llvm::UndefValue, and llvm::GlobalValue.
Definition at line 60 of file Constant.h.
Referenced by destroyConstantImpl().
void Constant::destroyConstantImpl | ( | ) | [protected] |
Definition at line 35 of file Constants.cpp.
References destroyConstant(), llvm::Value::use_back(), llvm::Value::use_empty(), and V.
Referenced by llvm::ConstantExpr::destroyConstant(), llvm::UndefValue::destroyConstant(), llvm::ConstantPointerNull::destroyConstant(), llvm::ConstantPacked::destroyConstant(), llvm::ConstantStruct::destroyConstant(), llvm::ConstantArray::destroyConstant(), and llvm::ConstantAggregateZero::destroyConstant().
Static constructor to get a '0' constant of arbitrary type...
Definition at line 64 of file Constants.cpp.
References llvm::Type::ArrayTyID, llvm::Type::BoolTyID, llvm::Type::DoubleTy, llvm::Type::DoubleTyID, llvm::Type::FloatTy, llvm::Type::FloatTyID, llvm::ConstantAggregateZero::get(), llvm::ConstantPointerNull::get(), llvm::ConstantFP::get(), llvm::ConstantUInt::get(), llvm::ConstantSInt::get(), llvm::ConstantBool::get(), llvm::Type::getTypeID(), llvm::Type::IntTy, llvm::Type::IntTyID, llvm::Type::LongTy, llvm::Type::LongTyID, llvm::Type::PackedTyID, llvm::Type::PointerTyID, llvm::Type::SByteTy, llvm::Type::SByteTyID, llvm::Type::ShortTy, llvm::Type::ShortTyID, llvm::Type::StructTyID, llvm::Type::UByteTy, llvm::Type::UByteTyID, llvm::Type::UIntTy, llvm::Type::UIntTyID, llvm::Type::ULongTy, llvm::Type::ULongTyID, llvm::Type::UShortTy, and llvm::Type::UShortTyID.
Referenced by llvm::ConstantFoldBinaryInstruction(), llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldExtractElementInstruction(), llvm::ConstantFoldInsertElementInstruction(), llvm::ConstantFoldInstruction(), llvm::ConstantFoldLoadThroughGEPConstantExpr(), llvm::ConvertExpressionToType(), llvm::BinaryOperator::createNeg(), llvm::DecomposeArrayRef(), llvm::ExpressionConvertibleToType(), llvm::SCEVUnknown::getIntegerSCEV(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getSignExtend(), llvm::ConstantExpr::getSizeOf(), llvm::RSProfilers_std::IncrementCounterInBlock(), llvm::IncrementCounterInBlock(), llvm::InsertProfilingInitCall(), llvm::BinaryOperator::isNeg(), llvm::DefaultIntrinsicLowering::LowerIntrinsicCall(), llvm::BytecodeReader::ParseCompactionTable(), llvm::RemoveSuccessor(), llvm::SCEVExpander::visitAddRecExpr(), and llvm::ConstantRange::zeroExtend().
const Constant* llvm::Constant::getOperand | ( | unsigned | i | ) | const [inline] |
Reimplemented from llvm::User.
Reimplemented in llvm::ConstantExpr.
Definition at line 46 of file Constant.h.
References llvm::User::getOperand().
Constant* llvm::Constant::getOperand | ( | unsigned | i | ) | [inline] |
Reimplemented in llvm::ConstantExpr.
Definition at line 43 of file Constant.h.
References llvm::User::getOperand().
Referenced by CastConstantPacked(), llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldLoadThroughGEPConstantExpr(), llvm::ConvertConstantType< ConstantPacked, PackedType >::convert(), llvm::ConvertConstantType< ConstantStruct, StructType >::convert(), llvm::ConvertConstantType< ConstantArray, ArrayType >::convert(), llvm::ConvertExpressionToType(), llvm::AsmPrinter::EmitGlobalConstant(), ConstantPackedRules::EqualTo(), evaluateRelation(), EvaluateStoreInto(), EvalVectorOp(), FindScalarElement(), FindStaticTors(), getAggregateConstantElement(), getAsCString(), llvm::ConstantArray::getAsString(), getCommonReturnValue(), llvm::DbgStopPointInst::getDirectory(), llvm::DbgStopPointInst::getFileName(), getUIntOperand(), getValType(), llvm::SelectionDAGLowering::getValue(), llvm::ExecutionEngine::InitializeMemory(), llvm::BinaryOperator::isNeg(), llvm::ConstantArray::isString(), llvm::MapValue(), ParseGlobalCtors(), printAsCString(), RemapOperand(), llvm::GlobalVariable::replaceUsesOfWithOnConstant(), llvm::ConstantPacked::replaceUsesOfWithOnConstant(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), llvm::ConstantArray::replaceUsesOfWithOnConstant(), llvm::ExecutionEngine::runStaticConstructorsDestructors(), and WriteConstantInt().
std::string Constant::getStringValue | ( | bool | Chop = true , |
|
unsigned | Offset = 0 | |||
) |
getStringValue - Turn an LLVM constant pointer that eventually points to a global into a string value. Return an empty string if we can't do it. Parameter Chop determines if the result is chopped at the first null terminator.
Definition at line 1775 of file Constants.cpp.
References llvm::ConstantArray::getAsString(), getStringValue(), GV, isNullValue(), and llvm::ConstantArray::isString().
Referenced by llvm::DbgStopPointInst::getDirectory(), llvm::DbgStopPointInst::getFileName(), getStringValue(), and llvm::SelectionDAGLowering::visitMemIntrinsic().
virtual bool llvm::Constant::isNullValue | ( | ) | const [pure virtual] |
isNullValue - Return true if this is the value that would be returned by getNullValue.
Implemented in llvm::ConstantIntegral, llvm::ConstantBool, llvm::ConstantInt, llvm::ConstantFP, llvm::ConstantAggregateZero, llvm::ConstantArray, llvm::ConstantStruct, llvm::ConstantPacked, llvm::ConstantPointerNull, llvm::ConstantExpr, llvm::UndefValue, and llvm::GlobalValue.
Referenced by llvm::ConstantFoldGetElementPtr(), llvm::ConstantFoldInsertElementInstruction(), llvm::AsmPrinter::EmitConstantValueOnly(), llvm::AsmPrinter::EmitGlobalConstant(), evaluateRelation(), getStringValue(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), llvm::ConstantArray::replaceUsesOfWithOnConstant(), llvm::ExecutionEngine::runStaticConstructorsDestructors(), and ShrinkGlobalToBoolean().
void Constant::print | ( | std::ostream & | O | ) | const [virtual] |
print - Implement operator<< on Value...
Implements llvm::Value.
Reimplemented in llvm::Function, and llvm::GlobalVariable.
Definition at line 1311 of file AsmWriter.cpp.
References llvm::Type::getDescription(), llvm::Value::getType(), and WriteConstantInt().
virtual void llvm::Constant::replaceUsesOfWithOnConstant | ( | Value * | , | |
Value * | , | |||
Use * | ||||
) | [inline, virtual] |
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 in llvm::ConstantArray, llvm::ConstantStruct, llvm::ConstantPacked, llvm::ConstantExpr, and llvm::GlobalVariable.
Definition at line 80 of file Constant.h.
References llvm::User::getNumOperands().
void llvm::Constant::setOperand | ( | unsigned | i, | |
Constant * | C | |||
) | [inline] |
Definition at line 49 of file Constant.h.
References llvm::CallingConv::C, and llvm::User::setOperand().
Referenced by llvm::GlobalVariable::replaceUsesOfWithOnConstant(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), and llvm::ConstantArray::replaceUsesOfWithOnConstant().