LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvm::Constant Class Reference

#include <Constant.h>

Inheritance diagram for llvm::Constant:

Inheritance graph
[legend]
Collaboration diagram for llvm::Constant:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void setName (const std::string &name, SymbolTable *ST=0)
virtual bool isNullValue () const =0
virtual void print (std::ostream &O) const
ConstantgetOperand (unsigned i)
const ConstantgetOperand (unsigned i) const
void setOperand (unsigned i, Constant *C)
virtual void destroyConstant ()
virtual void replaceUsesOfWithOnConstant (Value *From, Value *To, bool DisableChecking=false)

Static Public Member Functions

static ConstantgetNullValue (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=Value::SimpleConstantVal, const std::string &Name="")
 ~Constant ()
void destroyConstantImpl ()

Detailed Description

Definition at line 21 of file Constant.h.


Constructor & Destructor Documentation

llvm::Constant::Constant const Type Ty,
ValueTy  vty = Value::SimpleConstantVal,
const std::string &  Name = ""
[inline, protected]
 

Definition at line 23 of file Constant.h.

llvm::Constant::~Constant  )  [inline, protected]
 

Definition at line 26 of file Constant.h.


Member Function Documentation

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 67 of file Constant.h.

References llvm::Value::ConstantAggregateZeroVal, llvm::Value::ConstantExprVal, llvm::Value::FunctionVal, llvm::Value::getValueType(), llvm::Value::GlobalVariableVal, llvm::Value::SimpleConstantVal, and llvm::Value::UndefValueVal.

static bool llvm::Constant::classof const GlobalValue  )  [inline, static]
 

Reimplemented in llvm::GlobalValue.

Definition at line 66 of file Constant.h.

static bool llvm::Constant::classof const Constant  )  [inline, static]
 

Definition at line 65 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 1417 of file Constants.cpp.

References E.

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 62 of file Constant.h.

Referenced by destroyConstantImpl().

void Constant::destroyConstantImpl  )  [protected]
 

Definition at line 41 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().

Constant * Constant::getNullValue const Type Ty  )  [static]
 

Static constructor to get a '0' constant of arbitrary type...

Definition at line 70 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::ConstantFoldInstruction(), llvm::ConvertExpressionToType(), ConvertOperandToType(), llvm::BinaryOperator::createNeg(), llvm::DecomposeArrayRef(), llvm::ExpressionConvertibleToType(), GetAddressedElementFromGlobal(), llvm::SCEVUnknown::getIntegerSCEV(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getSizeOf(), llvm::getTriggerCode(), llvm::IncrementCounterInBlock(), llvm::InsertProfilingInitCall(), llvm::BinaryOperator::isNeg(), LinkAppendingVars(), llvm::DefaultIntrinsicLowering::LowerIntrinsicCall(), llvm::BytecodeReader::ParseCompactionTable(), llvm::PHINode::removeIncomingValue(), llvm::BasicBlock::removePredecessor(), llvm::RemoveSuccessor(), ReplaceCallWith(), llvm::SimplifyCFG(), and llvm::ConstantRange::zeroExtend().

const Constant* llvm::Constant::getOperand unsigned  i  )  const [inline]
 

Reimplemented from llvm::User.

Reimplemented in llvm::ConstantExpr.

Definition at line 48 of file Constant.h.

References llvm::User::getOperand().

Constant* llvm::Constant::getOperand unsigned  i  )  [inline]
 

Reimplemented from llvm::User.

Reimplemented in llvm::ConstantExpr.

Definition at line 45 of file Constant.h.

References llvm::User::getOperand().

Referenced by CheckVarargs(), llvm::ConvertConstantType< ConstantPacked, PackedType >::convert(), llvm::ConvertConstantType< ConstantStruct, StructType >::convert(), llvm::ConvertConstantType< ConstantArray, ArrayType >::convert(), llvm::ConvertExpressionToType(), llvm::SCEVMulExpr::get(), getAsCString(), llvm::ConstantArray::getAsString(), llvm::Loop::getCanonicalInductionVariable(), getCommonReturnValue(), GetGEPGlobalInitializer(), getValType(), llvm::ExecutionEngine::InitializeMemory(), llvm::BinaryOperator::isNeg(), llvm::ConstantArray::isString(), isStringCompatible(), printAsCString(), RemoveDeadConstant(), llvm::GlobalVariable::replaceUsesOfWithOnConstant(), llvm::ConstantPacked::replaceUsesOfWithOnConstant(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), llvm::ConstantArray::replaceUsesOfWithOnConstant(), and ValueRequiresCast().

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::AsmPrinter::emitConstantValueOnly(), llvm::AsmPrinter::emitGlobalConstant(), evaluateRelation(), llvm::ConstantPacked::get(), llvm::ConstantArray::get(), and OptimizeOnceStoredGlobal().

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 1222 of file AsmWriter.cpp.

References llvm::Type::getDescription(), llvm::Value::getType(), and WriteConstantInt().

virtual void llvm::Constant::replaceUsesOfWithOnConstant Value From,
Value To,
bool  DisableChecking = false
[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::ConstantAggregateZero, llvm::ConstantArray, llvm::ConstantStruct, llvm::ConstantPacked, llvm::ConstantExpr, and llvm::GlobalVariable.

Definition at line 86 of file Constant.h.

References llvm::User::getNumOperands().

void Constant::setName const std::string &  name,
SymbolTable ST = 0
[virtual]
 

Reimplemented from llvm::Value.

Reimplemented in llvm::Function, and llvm::GlobalVariable.

Definition at line 35 of file Constants.cpp.

References llvm::SymbolTable::insert().

Referenced by ForceRenaming().

void llvm::Constant::setOperand unsigned  i,
Constant C
[inline]
 

Definition at line 51 of file Constant.h.

References llvm::User::setOperand().

Referenced by AssociativeOpt(), and llvm::GlobalVariable::replaceUsesOfWithOnConstant().


The documentation for this class was generated from the following files: