LLVM API Documentation

llvm::ConstantExpr Class Reference

#include <Constants.h>

Inheritance diagram for llvm::ConstantExpr:
[legend]
Collaboration diagram for llvm::ConstantExpr:
[legend]

List of all members.

Public Member Functions

 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Constant)
 Transparently provide more efficient getOperand methods.
bool isCast () const
 Return true if this is a convert constant expression.
bool isCompare () const
 Return true if this is a compare constant expression.
bool hasIndices () const
 Return true if this is an insertvalue or extractvalue expression, and the getIndices() method may be used.
virtual bool isNullValue () const
unsigned getOpcode () const
 getOpcode - Return the opcode at the root of this constant expression
unsigned getPredicate () const
const SmallVector< unsigned, 4 > & getIndices () const
const char * getOpcodeName () const
 getOpcodeName - Return a string representation for an opcode.
Constant * getWithOperandReplaced (unsigned OpNo, Constant *Op) const
Constant * getWithOperands (const std::vector< Constant * > &Ops) const
Constant * getWithOperands (Constant *const *Ops, unsigned NumOps) const
virtual void destroyConstant ()
virtual void replaceUsesOfWithOnConstant (Value *From, Value *To, Use *U)

Static Public Member Functions

static Constant * getAlignOf (const Type *Ty)
static Constant * getSizeOf (const Type *Ty)
static Constant * getOffsetOf (const StructType *Ty, unsigned FieldNo)
static Constant * getNeg (Constant *C)
static Constant * getFNeg (Constant *C)
static Constant * getNot (Constant *C)
static Constant * getAdd (Constant *C1, Constant *C2)
static Constant * getFAdd (Constant *C1, Constant *C2)
static Constant * getSub (Constant *C1, Constant *C2)
static Constant * getFSub (Constant *C1, Constant *C2)
static Constant * getMul (Constant *C1, Constant *C2)
static Constant * getFMul (Constant *C1, Constant *C2)
static Constant * getUDiv (Constant *C1, Constant *C2)
static Constant * getSDiv (Constant *C1, Constant *C2)
static Constant * getFDiv (Constant *C1, Constant *C2)
static Constant * getURem (Constant *C1, Constant *C2)
static Constant * getSRem (Constant *C1, Constant *C2)
static Constant * getFRem (Constant *C1, Constant *C2)
static Constant * getAnd (Constant *C1, Constant *C2)
static Constant * getOr (Constant *C1, Constant *C2)
static Constant * getXor (Constant *C1, Constant *C2)
static Constant * getShl (Constant *C1, Constant *C2)
static Constant * getLShr (Constant *C1, Constant *C2)
static Constant * getAShr (Constant *C1, Constant *C2)
static Constant * getTrunc (Constant *C, const Type *Ty)
static Constant * getSExt (Constant *C, const Type *Ty)
static Constant * getZExt (Constant *C, const Type *Ty)
static Constant * getFPTrunc (Constant *C, const Type *Ty)
static Constant * getFPExtend (Constant *C, const Type *Ty)
static Constant * getUIToFP (Constant *C, const Type *Ty)
static Constant * getSIToFP (Constant *C, const Type *Ty)
static Constant * getFPToUI (Constant *C, const Type *Ty)
static Constant * getFPToSI (Constant *C, const Type *Ty)
static Constant * getPtrToInt (Constant *C, const Type *Ty)
static Constant * getIntToPtr (Constant *C, const Type *Ty)
static Constant * getBitCast (Constant *C, const Type *Ty)
static Constant * getNSWAdd (Constant *C1, Constant *C2)
static Constant * getExactSDiv (Constant *C1, Constant *C2)
static Constant * getCast (unsigned ops, Constant *C, const Type *Ty)
static Constant * getZExtOrBitCast (Constant *C, const Type *Ty)
static Constant * getSExtOrBitCast (Constant *C, const Type *Ty)
static Constant * getTruncOrBitCast (Constant *C, const Type *Ty)
static Constant * getPointerCast (Constant *C, const Type *Ty)
 Create a BitCast or a PtrToInt cast constant expression.
static Constant * getIntegerCast (Constant *C, const Type *Ty, bool isSigned)
 Create a ZExt, Bitcast or Trunc for integer -> integer casts.
static Constant * getFPCast (Constant *C, const Type *Ty)
 Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.
static Constant * getSelect (Constant *C, Constant *V1, Constant *V2)
static Constant * get (unsigned Opcode, Constant *C1, Constant *C2)
static Constant * getCompare (unsigned short pred, Constant *C1, Constant *C2)
 Return an ICmp or FCmp comparison operator constant expression.
static Constant * getICmp (unsigned short pred, Constant *LHS, Constant *RHS)
static Constant * getFCmp (unsigned short pred, Constant *LHS, Constant *RHS)
static Constant * getGetElementPtr (Constant *C, Constant *const *IdxList, unsigned NumIdx)
static Constant * getGetElementPtr (Constant *C, Value *const *IdxList, unsigned NumIdx)
static Constant * getInBoundsGetElementPtr (Constant *C, Constant *const *IdxList, unsigned NumIdx)
static Constant * getInBoundsGetElementPtr (Constant *C, Value *const *IdxList, unsigned NumIdx)
static Constant * getExtractElement (Constant *Vec, Constant *Idx)
static Constant * getInsertElement (Constant *Vec, Constant *Elt, Constant *Idx)
static Constant * getShuffleVector (Constant *V1, Constant *V2, Constant *Mask)
static Constant * getExtractValue (Constant *Agg, const unsigned *IdxList, unsigned NumIdx)
static Constant * getInsertValue (Constant *Agg, Constant *Val, const unsigned *IdxList, unsigned NumIdx)
static bool classof (const ConstantExpr *)
 Methods for support type inquiry through isa, cast, and dyn_cast:.
static bool classof (const Value *V)

Protected Member Functions

 ConstantExpr (const Type *ty, unsigned Opcode, Use *Ops, unsigned NumOps)

Static Protected Member Functions

static Constant * getTy (const Type *Ty, unsigned Opcode, Constant *C1, Constant *C2)
static Constant * getCompareTy (unsigned short pred, Constant *C1, Constant *C2)
static Constant * getSelectTy (const Type *Ty, Constant *C1, Constant *C2, Constant *C3)
static Constant * getGetElementPtrTy (const Type *Ty, Constant *C, Value *const *Idxs, unsigned NumIdxs)
static Constant * getExtractElementTy (const Type *Ty, Constant *Val, Constant *Idx)
static Constant * getInsertElementTy (const Type *Ty, Constant *Val, Constant *Elt, Constant *Idx)
static Constant * getShuffleVectorTy (const Type *Ty, Constant *V1, Constant *V2, Constant *Mask)
static Constant * getExtractValueTy (const Type *Ty, Constant *Agg, const unsigned *Idxs, unsigned NumIdxs)
static Constant * getInsertValueTy (const Type *Ty, Constant *Agg, Constant *Val, const unsigned *Idxs, unsigned NumIdxs)

Friends

struct ConstantCreator< ConstantExpr, Type, std::pair< unsigned, std::vector< Constant * > > >
struct ConvertConstant< ConstantExpr, Type >


Detailed Description

ConstantExpr - a constant value that is initialized with an expression using other constant values.

This class uses the standard Instruction opcodes to define the various constant expressions. The Opcode field for the ConstantExpr class is maintained in the Value::SubclassData field.

Definition at line 559 of file Constants.h.


Constructor & Destructor Documentation

llvm::ConstantExpr::ConstantExpr ( const Type *  ty,
unsigned  Opcode,
Use *  Ops,
unsigned  NumOps 
) [inline, protected]

Definition at line 565 of file Constants.h.

References llvm::Value::SubclassData.


Member Function Documentation

Constant * ConstantExpr::getTy ( const Type *  Ty,
unsigned  Opcode,
Constant *  C1,
Constant *  C2 
) [static, protected]

Constant * ConstantExpr::getCompareTy ( unsigned short  pred,
Constant *  C1,
Constant *  C2 
) [static, protected]

Constant * ConstantExpr::getSelectTy ( const Type *  Ty,
Constant *  C1,
Constant *  C2,
Constant *  C3 
) [static, protected]

Constant * ConstantExpr::getGetElementPtrTy ( const Type *  Ty,
Constant *  C,
Value *const *  Idxs,
unsigned  NumIdxs 
) [static, protected]

Constant * ConstantExpr::getExtractElementTy ( const Type *  Ty,
Constant *  Val,
Constant *  Idx 
) [static, protected]

Constant * ConstantExpr::getInsertElementTy ( const Type *  Ty,
Constant *  Val,
Constant *  Elt,
Constant *  Idx 
) [static, protected]

Constant * ConstantExpr::getShuffleVectorTy ( const Type *  Ty,
Constant *  V1,
Constant *  V2,
Constant *  Mask 
) [static, protected]

Constant * ConstantExpr::getExtractValueTy ( const Type *  Ty,
Constant *  Agg,
const unsigned *  Idxs,
unsigned  NumIdxs 
) [static, protected]

Constant * ConstantExpr::getInsertValueTy ( const Type *  Ty,
Constant *  Agg,
Constant *  Val,
const unsigned *  Idxs,
unsigned  NumIdxs 
) [static, protected]

Constant * ConstantExpr::getAlignOf ( const Type *  Ty  )  [static]

Cast constant expr getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the return type is an i32; Note: assumes that i8 is byte aligned).

Definition at line 1401 of file Constants.cpp.

References llvm::StructType::get(), llvm::ConstantInt::get(), getCast(), llvm::Type::getContext(), getGetElementPtr(), llvm::Type::getInt32Ty(), llvm::Type::getInt8Ty(), llvm::Constant::getNullValue(), llvm::Type::getPointerTo(), and PtrToInt.

Constant * ConstantExpr::getSizeOf ( const Type *  Ty  )  [static]

getSizeOf constant expr - computes the size of a type in a target independent way (Note: the return type is an i64).

Definition at line 1391 of file Constants.cpp.

References llvm::ConstantInt::get(), getCast(), llvm::Type::getContext(), getGetElementPtr(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Constant::getNullValue(), llvm::PointerType::getUnqual(), and PtrToInt.

Referenced by llvm::IRBuilder< true, llvm::TargetFolder >::CreatePtrDiff(), and llvm::InlineFunction().

Constant * ConstantExpr::getOffsetOf ( const StructType *  Ty,
unsigned  FieldNo 
) [static]

getOffsetOf constant expr - computes the offset of a field in a target independent way (Note: the return type is an i64).

Definition at line 1415 of file Constants.cpp.

References llvm::ConstantInt::get(), getCast(), llvm::Type::getContext(), getGetElementPtr(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::Constant::getNullValue(), llvm::PointerType::getUnqual(), and PtrToInt.

Constant * ConstantExpr::getNeg ( Constant *  C  )  [static]

Constant * ConstantExpr::getFNeg ( Constant *  C  )  [static]

Constant * ConstantExpr::getNot ( Constant *  C  )  [static]

Constant * ConstantExpr::getAdd ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getFAdd ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getSub ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getFSub ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getMul ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getFMul ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getUDiv ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getSDiv ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getFDiv ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getURem ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getSRem ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getFRem ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getAnd ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getOr ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getXor ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getShl ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getLShr ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getAShr ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getTrunc ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getSExt ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getZExt ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getFPTrunc ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getFPExtend ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getUIToFP ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getSIToFP ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getFPToUI ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getFPToSI ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getPtrToInt ( Constant *  C,
const Type *  Ty 
) [static]

Definition at line 1245 of file Constants.cpp.

References getFoldedCast(), llvm::Value::getType(), llvm::Type::isInteger(), and PtrToInt.

Referenced by getCast().

Constant * ConstantExpr::getIntToPtr ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getBitCast ( Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getNSWAdd ( Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getExactSDiv ( Constant *  C1,
Constant *  C2 
) [static]

llvm::ConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Constant   ) 

Transparently provide more efficient getOperand methods.

Constant * ConstantExpr::getCast ( unsigned  ops,
Constant *  C,
const Type *  Ty 
) [static]

Constant * ConstantExpr::getZExtOrBitCast ( Constant *  C,
const Type *  Ty 
) [static]

Parameters:
C  The constant to zext or bitcast
Ty  The type to zext or bitcast C to

Definition at line 1083 of file Constants.cpp.

References BitCast, getCast(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), and ZExt.

Referenced by llvm::ConstantFolder::CreateZExtOrBitCast().

Constant * ConstantExpr::getSExtOrBitCast ( Constant *  C,
const Type *  Ty 
) [static]

Parameters:
C  The constant to sext or bitcast
Ty  The type to sext or bitcast C to

Definition at line 1089 of file Constants.cpp.

References BitCast, getCast(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), and llvm::Attribute::SExt.

Referenced by llvm::ConstantFoldGetElementPtr(), and llvm::ConstantFolder::CreateSExtOrBitCast().

Constant * ConstantExpr::getTruncOrBitCast ( Constant *  C,
const Type *  Ty 
) [static]

Parameters:
C  The constant to trunc or bitcast
Ty  The type to trunc or bitcast C to

Definition at line 1095 of file Constants.cpp.

References BitCast, getCast(), llvm::Type::getScalarSizeInBits(), and llvm::Value::getType().

Referenced by llvm::TargetFolder::CreateTruncOrBitCast(), and llvm::ConstantFolder::CreateTruncOrBitCast().

Constant * ConstantExpr::getPointerCast ( Constant *  C,
const Type *  Ty 
) [static]

Create a BitCast or a PtrToInt cast constant expression.

Parameters:
C  The pointer value to be casted (operand 0)
Ty  The type to which cast should be made

Definition at line 1101 of file Constants.cpp.

References BitCast, getCast(), llvm::Value::getType(), llvm::Type::isInteger(), and PtrToInt.

Referenced by llvm::ConstantFoldCastInstruction(), and llvm::ConstantFolder::CreatePointerCast().

Constant * ConstantExpr::getIntegerCast ( Constant *  C,
const Type *  Ty,
bool  isSigned 
) [static]

Create a ZExt, Bitcast or Trunc for integer -> integer casts.

Parameters:
C  The integer constant to be casted
Ty  The integer type to cast to
isSigned  Whether C should be treated as signed or not

Definition at line 1110 of file Constants.cpp.

References BitCast, getCast(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::isIntOrIntVector(), opcode, llvm::Attribute::SExt, and ZExt.

Referenced by llvm::ConstantFoldCompareInstOperands(), llvm::ConstantFoldInstOperands(), llvm::TargetFolder::CreateIntCast(), llvm::ConstantFolder::CreateIntCast(), and llvm::AsmPrinter::EmitConstantValueOnly().

Constant * ConstantExpr::getFPCast ( Constant *  C,
const Type *  Ty 
) [static]

Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.

Parameters:
C  The integer constant to be casted
Ty  The integer type to cast to

Definition at line 1123 of file Constants.cpp.

References FPTrunc, getCast(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::isFPOrFPVector(), and opcode.

Referenced by llvm::ConstantFolder::CreateFPCast().

bool ConstantExpr::isCast (  )  const

Return true if this is a convert constant expression.

Definition at line 653 of file Constants.cpp.

References getOpcode(), and llvm::Instruction::isCast().

Referenced by FindStaticTors(), foldConstantCastPair(), and replaceUsesOfWithOnConstant().

bool ConstantExpr::isCompare (  )  const

Return true if this is a compare constant expression.

Definition at line 657 of file Constants.cpp.

References FCmp, and getOpcode().

Referenced by llvm::ConstantFoldConstantExpression(), getValType(), and replaceUsesOfWithOnConstant().

bool ConstantExpr::hasIndices (  )  const

Return true if this is an insertvalue or extractvalue expression, and the getIndices() method may be used.

Definition at line 661 of file Constants.cpp.

References ExtractValue, and getOpcode().

Referenced by getValType().

static Constant* llvm::ConstantExpr::getSelect ( Constant *  C,
Constant *  V1,
Constant *  V2 
) [inline, static]

Constant * ConstantExpr::get ( unsigned  Opcode,
Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getCompare ( unsigned short  pred,
Constant *  C1,
Constant *  C2 
) [static]

Constant * ConstantExpr::getICmp ( unsigned short  pred,
Constant *  LHS,
Constant *  RHS 
) [static]

Constant * ConstantExpr::getFCmp ( unsigned short  pred,
Constant *  LHS,
Constant *  RHS 
) [static]

Constant * ConstantExpr::getGetElementPtr ( Constant *  C,
Constant *const *  IdxList,
unsigned  NumIdx 
) [static]

Constant * ConstantExpr::getGetElementPtr ( Constant *  C,
Value *const *  IdxList,
unsigned  NumIdx 
) [static]

Constant * ConstantExpr::getInBoundsGetElementPtr ( Constant *  C,
Constant *const *  IdxList,
unsigned  NumIdx 
) [static]

Create an "inbounds" getelementptr. See the documentation for the "inbounds" flag in LangRef.html for details.

Definition at line 1508 of file Constants.cpp.

Referenced by llvm::TargetFolder::CreateInBoundsGetElementPtr(), llvm::NoFolder::CreateInBoundsGetElementPtr(), and llvm::ConstantFolder::CreateInBoundsGetElementPtr().

Constant * ConstantExpr::getInBoundsGetElementPtr ( Constant *  C,
Value *const *  IdxList,
unsigned  NumIdx 
) [static]

Definition at line 1492 of file Constants.cpp.

References getGetElementPtr().

Constant * ConstantExpr::getExtractElement ( Constant *  Vec,
Constant *  Idx 
) [static]

Constant * ConstantExpr::getInsertElement ( Constant *  Vec,
Constant *  Elt,
Constant *  Idx 
) [static]

Constant * ConstantExpr::getShuffleVector ( Constant *  V1,
Constant *  V2,
Constant *  Mask 
) [static]

Constant * ConstantExpr::getExtractValue ( Constant *  Agg,
const unsigned *  IdxList,
unsigned  NumIdx 
) [static]

Constant * ConstantExpr::getInsertValue ( Constant *  Agg,
Constant *  Val,
const unsigned *  IdxList,
unsigned  NumIdx 
) [static]

virtual bool llvm::ConstantExpr::isNullValue (  )  const [inline, virtual]

isNullValue - Return true if this is the value that would be returned by getNullValue.

Implements llvm::Constant.

Definition at line 759 of file Constants.h.

unsigned llvm::ConstantExpr::getOpcode (  )  const [inline]

unsigned ConstantExpr::getPredicate (  )  const

getPredicate - Return the ICMP or FCMP predicate value. Assert if this is not an ICMP or FCMP constant expression.

Definition at line 674 of file Constants.cpp.

References FCmp, and getOpcode().

Referenced by llvm::ConstantFoldConstantExpression(), getValType(), getWithOperands(), llvm::MSILWriter::printConstantExpr(), and replaceUsesOfWithOnConstant().

const SmallVector< unsigned, 4 > & ConstantExpr::getIndices (  )  const

getIndices - Assert that this is an insertvalue or exactvalue expression and return the list of indices.

Definition at line 666 of file Constants.cpp.

Referenced by getValType(), and replaceUsesOfWithOnConstant().

const char * ConstantExpr::getOpcodeName (  )  const

getOpcodeName - Return a string representation for an opcode.

Definition at line 1802 of file Constants.cpp.

References getOpcode(), and llvm::Instruction::getOpcodeName().

Constant * ConstantExpr::getWithOperandReplaced ( unsigned  OpNo,
Constant *  Op 
) const

getWithOperandReplaced - Return a constant expression identical to this one, but with the specified operand set to the specified value.

getWithOperandReplaced - Return a constant expression identical to this one, but with the specified operand set to the specified value.

Definition at line 683 of file Constants.cpp.

References BitCast, ExtractElement(), FPToUI, FPTrunc, get(), getCast(), getExtractElement(), getGetElementPtr(), getInsertElement(), llvm::User::getNumOperands(), getOpcode(), llvm::Constant::getOperand(), getSelect(), getShuffleVector(), llvm::Value::getType(), InsertElement, PtrToInt, llvm::SmallVectorImpl< T >::resize(), llvm::Attribute::SExt, llvm::SmallVectorImpl< T >::size(), UIToFP, and ZExt.

Constant* llvm::ConstantExpr::getWithOperands ( const std::vector< Constant * > &  Ops  )  const [inline]

getWithOperands - This returns the current constant expression with the operands replaced with the specified values. The specified operands must match count and type with the existing ones.

Definition at line 782 of file Constants.h.

Constant * ConstantExpr::getWithOperands ( Constant *const *  Ops,
unsigned  NumOps 
) const

getWithOperands - This returns the current constant expression with the operands replaced with the specified values. The specified operands must match count and type with the existing ones.

Definition at line 746 of file Constants.cpp.

References BitCast, ExtractElement(), FCmp, FPToUI, FPTrunc, get(), getCast(), getCompare(), getExtractElement(), getGetElementPtr(), getInsertElement(), llvm::User::getNumOperands(), getOpcode(), llvm::Constant::getOperand(), getPredicate(), getSelect(), getShuffleVector(), llvm::Value::getType(), InsertElement, PtrToInt, llvm::Attribute::SExt, UIToFP, and ZExt.

void ConstantExpr::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 1795 of file Constants.cpp.

References llvm::Constant::destroyConstantImpl(), llvm::LLVMContextImpl::ExprConstants, llvm::Type::getContext(), llvm::Value::getType(), and llvm::LLVMContext::pImpl.

Referenced by llvm::ConvertConstant< ConstantExpr, Type >::convert(), and replaceUsesOfWithOnConstant().

void ConstantExpr::replaceUsesOfWithOnConstant ( Value *  ,
Value *  ,
Use *   
) [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 from llvm::Constant.

Definition at line 2021 of file Constants.cpp.

References C2, destroyConstant(), ExtractElement(), ExtractValue, FCmp, get(), getCast(), getExtractElement(), getExtractValue(), getFCmp(), getGetElementPtr(), getICmp(), getIndices(), getInsertElement(), getInsertValue(), llvm::User::getNumOperands(), getOpcode(), llvm::Constant::getOperand(), getPredicate(), getSelect(), getShuffleVector(), llvm::Value::getType(), InsertElement, isCast(), isCompare(), llvm_unreachable, llvm::SmallVectorImpl< T >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::SmallVectorImpl< T >::size(), To, llvm::Value::uncheckedReplaceAllUsesWith(), and Val.

static bool llvm::ConstantExpr::classof ( const ConstantExpr *   )  [inline, static]

Methods for support type inquiry through isa, cast, and dyn_cast:.

Definition at line 791 of file Constants.h.

static bool llvm::ConstantExpr::classof ( const Value *  V  )  [inline, static]

Reimplemented from llvm::Constant.

Definition at line 792 of file Constants.h.

References llvm::Value::ConstantExprVal, and llvm::Value::getValueID().


Friends And Related Function Documentation

friend struct ConstantCreator< ConstantExpr, Type,std::pair< unsigned, std::vector< Constant * > > > [friend]

Definition at line 561 of file Constants.h.

friend struct ConvertConstant< ConstantExpr, Type > [friend]

Definition at line 562 of file Constants.h.


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