LLVM API Documentation
#include <Constants.h>


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 * | 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 * | 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 * | getSizeOf (const Type *Ty) |
| static Constant * | get (unsigned Opcode, Constant *C1, Constant *C2) |
| static Constant * | getCompare (unsigned short pred, Constant *C1, Constant *C2) |
| Return an ICmp, FCmp, VICmp, or VFCmp comparison operator constant expression. | |
| static Constant * | getNeg (Constant *C) |
| static Constant * | getNot (Constant *C) |
| static Constant * | getAdd (Constant *C1, Constant *C2) |
| static Constant * | getSub (Constant *C1, Constant *C2) |
| static Constant * | getMul (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 * | getICmp (unsigned short pred, Constant *LHS, Constant *RHS) |
| static Constant * | getFCmp (unsigned short pred, Constant *LHS, Constant *RHS) |
| static Constant * | getVICmp (unsigned short pred, Constant *LHS, Constant *RHS) |
| static Constant * | getVFCmp (unsigned short pred, Constant *LHS, Constant *RHS) |
| static Constant * | getShl (Constant *C1, Constant *C2) |
| static Constant * | getLShr (Constant *C1, Constant *C2) |
| static Constant * | getAShr (Constant *C1, Constant *C2) |
| static Constant * | getGetElementPtr (Constant *C, Constant *const *IdxList, unsigned NumIdx) |
| static Constant * | getGetElementPtr (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 Constant * | getZeroValueForNegationExpr (const Type *Ty) |
| 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 | ConvertConstantType< ConstantExpr, Type > |
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 554 of file Constants.h.
| Constant * ConstantExpr::getTy | ( | const Type * | Ty, | |
| unsigned | Opcode, | |||
| Constant * | C1, | |||
| Constant * | C2 | |||
| ) | [static, protected] |
Definition at line 2007 of file Constants.cpp.
References llvm::ConstantFoldBinaryInstruction(), llvm::Value::getType(), and llvm::Type::Int1Ty.
Referenced by llvm::ConvertConstantType< ConstantExpr, Type >::convert(), and get().
| Constant * ConstantExpr::getCompareTy | ( | unsigned short | pred, | |
| Constant * | C1, | |||
| Constant * | C2 | |||
| ) | [static, protected] |
Definition at line 2025 of file Constants.cpp.
References llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, getFCmp(), getICmp(), llvm::Value::getType(), llvm::Type::getTypeID(), getVFCmp(), getVICmp(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, and llvm::Type::VectorTyID.
Referenced by getCompare().
| Constant * ConstantExpr::getSelectTy | ( | const Type * | Ty, | |
| Constant * | C1, | |||
| Constant * | C2, | |||
| Constant * | C3 | |||
| ) | [static, protected] |
Definition at line 2112 of file Constants.cpp.
References llvm::SelectInst::areInvalidOperands(), llvm::ConstantFoldSelectInstruction(), and llvm::Value::getType().
Referenced by llvm::ConvertConstantType< ConstantExpr, Type >::convert(), and getSelect().
| Constant * ConstantExpr::getGetElementPtrTy | ( | const Type * | Ty, | |
| Constant * | C, | |||
| Value *const * | Idxs, | |||
| unsigned | NumIdxs | |||
| ) | [static, protected] |
Definition at line 2127 of file Constants.cpp.
References llvm::ConstantFoldGetElementPtr(), and llvm::Value::getType().
Referenced by llvm::ConvertConstantType< ConstantExpr, Type >::convert(), and getGetElementPtr().
| Constant * ConstantExpr::getExtractElementTy | ( | const Type * | Ty, | |
| Constant * | Val, | |||
| Constant * | Idx | |||
| ) | [static, protected] |
Definition at line 2293 of file Constants.cpp.
References llvm::ConstantFoldExtractElementInstruction().
Referenced by getExtractElement().
| Constant * ConstantExpr::getInsertElementTy | ( | const Type * | Ty, | |
| Constant * | Val, | |||
| Constant * | Elt, | |||
| Constant * | Idx | |||
| ) | [static, protected] |
Definition at line 2313 of file Constants.cpp.
References llvm::ConstantFoldInsertElementInstruction(), and InsertElement.
Referenced by getInsertElement().
| Constant * ConstantExpr::getShuffleVectorTy | ( | const Type * | Ty, | |
| Constant * | V1, | |||
| Constant * | V2, | |||
| Constant * | Mask | |||
| ) | [static, protected] |
Definition at line 2336 of file Constants.cpp.
References llvm::ConstantFoldShuffleVectorInstruction().
Referenced by getShuffleVector().
| Constant * ConstantExpr::getExtractValueTy | ( | const Type * | Ty, | |
| Constant * | Agg, | |||
| const unsigned * | Idxs, | |||
| unsigned | NumIdxs | |||
| ) | [static, protected] |
Definition at line 2384 of file Constants.cpp.
References llvm::ConstantFoldExtractValueInstruction(), llvm::Value::getType(), and llvm::Type::isFirstClassType().
Referenced by getExtractValue().
| Constant * ConstantExpr::getInsertValueTy | ( | const Type * | Ty, | |
| Constant * | Agg, | |||
| Constant * | Val, | |||
| const unsigned * | Idxs, | |||
| unsigned | NumIdxs | |||
| ) | [static, protected] |
Definition at line 2355 of file Constants.cpp.
References llvm::ConstantFoldInsertValueInstruction(), llvm::Value::getType(), and llvm::Type::isFirstClassType().
Referenced by getInsertValue().
Cast constant expr
Definition at line 1884 of file Constants.cpp.
References getFoldedCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), and llvm::Type::isInteger().
Referenced by getCast(), and llvm::ScalarEvolution::getTruncateExpr().
Definition at line 1893 of file Constants.cpp.
References getFoldedCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::Type::isInteger(), and llvm::Attribute::SExt.
Referenced by llvm::ConstantFoldGetElementPtr(), getCast(), llvm::ScalarEvolution::getSignExtendExpr(), IdxCompare(), and IndexOperandsEqual().
Definition at line 1902 of file Constants.cpp.
References getFoldedCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::Type::isInteger(), and ZExt.
Referenced by llvm::ConstantFoldGetElementPtr(), getCast(), and llvm::ScalarEvolution::getZeroExtendExpr().
Definition at line 1911 of file Constants.cpp.
References FPTrunc, getFoldedCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), and llvm::Type::isFloatingPoint().
Referenced by getCast().
Definition at line 1918 of file Constants.cpp.
References getFoldedCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), and llvm::Type::isFloatingPoint().
Referenced by getCast().
Definition at line 1925 of file Constants.cpp.
References getFoldedCast(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::Type::isFPOrFPVector(), llvm::Type::isIntOrIntVector(), UIToFP, and llvm::Type::VectorTyID.
Referenced by getCast().
Definition at line 1936 of file Constants.cpp.
References getFoldedCast(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::Type::isFPOrFPVector(), llvm::Type::isIntOrIntVector(), and llvm::Type::VectorTyID.
Referenced by getCast().
Definition at line 1947 of file Constants.cpp.
References FPToUI, getFoldedCast(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::Type::isFPOrFPVector(), llvm::Type::isIntOrIntVector(), and llvm::Type::VectorTyID.
Referenced by getCast().
Definition at line 1958 of file Constants.cpp.
References getFoldedCast(), llvm::Value::getType(), llvm::Type::getTypeID(), llvm::Type::isFPOrFPVector(), llvm::Type::isIntOrIntVector(), and llvm::Type::VectorTyID.
Referenced by getCast().
Definition at line 1969 of file Constants.cpp.
References getFoldedCast(), llvm::Value::getType(), llvm::Type::isInteger(), and PtrToInt.
Referenced by getCast().
Definition at line 1975 of file Constants.cpp.
References getFoldedCast(), llvm::Value::getType(), and llvm::Type::isInteger().
Referenced by llvm::ConstantFoldGetElementPtr(), getCast(), and llvm::JIT::runFunction().
Definition at line 1981 of file Constants.cpp.
References BitCast, getFoldedCast(), llvm::Type::getPrimitiveSizeInBits(), and llvm::Value::getType().
Referenced by llvm::ConstantFoldInstOperands(), llvm::DebugInfoBuilder::createBasicTypeDescriptor(), llvm::DebugInfoBuilder::createCompileUnitDescriptor(), llvm::DIFactory::CreateGlobalVariable(), llvm::DebugInfoBuilder::createPointerTypeDescriptor(), llvm::DebugInfoBuilder::createSubProgramDescriptor(), getCast(), llvm::Module::getOrInsertFunction(), llvm::Module::getOrInsertGlobal(), llvm::DISerializer::getString(), OptimizeGlobalAddressOfMalloc(), and OptimizeOnceStoredGlobal().
| llvm::ConstantExpr::DECLARE_TRANSPARENT_OPERAND_ACCESSORS | ( | Constant | ) |
Transparently provide more efficient getOperand methods.
| ops | The opcode for the conversion |
| C | The constant to be converted |
| Ty | The type to which the constant is converted |
Definition at line 1807 of file Constants.cpp.
References BitCast, FPToUI, FPTrunc, getBitCast(), getFPExtend(), getFPToSI(), getFPToUI(), getFPTrunc(), getIntToPtr(), getPtrToInt(), getSExt(), getSIToFP(), getTrunc(), getUIToFP(), getZExt(), llvm::Instruction::isCast(), llvm::Type::isFirstClassType(), PtrToInt, llvm::Attribute::SExt, UIToFP, and ZExt.
Referenced by llvm::ConstantFoldCastInstruction(), llvm::ConstantFoldInstOperands(), llvm::ConvertConstantType< ConstantExpr, Type >::convert(), llvm::TargetFolder::CreateCast(), llvm::ConstantFolder::CreateCast(), getFPCast(), getIntegerCast(), getPointerCast(), getSExtOrBitCast(), getSizeOf(), getTruncOrBitCast(), getWithOperandReplaced(), getWithOperands(), getZExtOrBitCast(), llvm::SCEVExpander::InsertCastOfTo(), OptimizeAwayTrappingUsesOfValue(), and replaceUsesOfWithOnConstant().
| C | The constant to zext or bitcast |
| Ty | The type to zext or bitcast C to |
Definition at line 1833 of file Constants.cpp.
References BitCast, getCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), and ZExt.
| C | The constant to sext or bitcast |
| Ty | The type to sext or bitcast C to |
Definition at line 1839 of file Constants.cpp.
References BitCast, getCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), and llvm::Attribute::SExt.
Referenced by llvm::ConstantFoldGetElementPtr().
| C | The constant to trunc or bitcast |
| Ty | The type to trunc or bitcast C to |
Definition at line 1845 of file Constants.cpp.
References BitCast, getCast(), llvm::Type::getPrimitiveSizeInBits(), and llvm::Value::getType().
Referenced by llvm::TargetFolder::CreateTruncOrBitCast(), and llvm::ConstantFolder::CreateTruncOrBitCast().
Create a BitCast or a PtrToInt cast constant expression.
| C | The pointer value to be casted (operand 0) |
| Ty | The type to which cast should be made |
Definition at line 1851 of file Constants.cpp.
References BitCast, getCast(), llvm::Value::getType(), llvm::Type::isInteger(), and PtrToInt.
Referenced by llvm::ConstantFoldCastInstruction().
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
| 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 1860 of file Constants.cpp.
References BitCast, getCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::Type::isInteger(), opcode, llvm::Attribute::SExt, and ZExt.
Referenced by llvm::ConstantFoldCompareInstOperands(), llvm::ConstantFoldInstOperands(), llvm::TargetFolder::CreateIntCast(), llvm::ConstantFolder::CreateIntCast(), and llvm::AsmPrinter::EmitConstantValueOnly().
Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.
| C | The integer constant to be casted |
| Ty | The integer type to cast to |
Definition at line 1872 of file Constants.cpp.
References FPTrunc, getCast(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::Type::isFloatingPoint(), and opcode.
| bool ConstantExpr::isCast | ( | ) | const |
Return true if this is a convert constant expression.
Definition at line 729 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 733 of file Constants.cpp.
References FCmp, getOpcode(), and VICmp.
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 738 of file Constants.cpp.
References ExtractValue, and getOpcode().
Referenced by getValType().
| static Constant* llvm::ConstantExpr::getSelect | ( | Constant * | C, | |
| Constant * | V1, | |||
| Constant * | V2 | |||
| ) | [inline, static] |
Select constant expr
Definition at line 669 of file Constants.h.
References getSelectTy(), and llvm::Value::getType().
Referenced by llvm::ConstantFoldInstOperands(), llvm::TargetFolder::CreateSelect(), llvm::ConstantFolder::CreateSelect(), getWithOperandReplaced(), getWithOperands(), and replaceUsesOfWithOnConstant().
getSizeOf constant expr - computes the size of a type in a target independent way (Note: the return type is an i64).
Definition at line 1999 of file Constants.cpp.
References llvm::ConstantInt::get(), getCast(), getGetElementPtr(), llvm::Constant::getNullValue(), llvm::PointerType::getUnqual(), llvm::Type::Int32Ty, llvm::Type::Int64Ty, and PtrToInt.
Referenced by llvm::InlineFunction().
ConstantExpr::get - Return a binary or shift operator constant expression, folding if possible.
Definition at line 2047 of file Constants.cpp.
References Add(), And(), getTy(), llvm::Value::getType(), llvm::Type::isFloatingPoint(), llvm::Type::isInteger(), LShr, llvm::APIntOps::Or(), and llvm::APIntOps::Xor().
Referenced by llvm::ConstantFoldGetElementPtr(), llvm::ConstantFoldInstOperands(), llvm::TargetFolder::CreateBinOp(), llvm::ConstantFolder::CreateBinOp(), getWithOperandReplaced(), getWithOperands(), llvm::SCEVExpander::InsertBinop(), and replaceUsesOfWithOnConstant().
Return an ICmp, FCmp, VICmp, or VFCmp comparison operator constant expression.
Definition at line 2106 of file Constants.cpp.
References getCompareTy(), and llvm::Value::getType().
Referenced by llvm::ConstantFoldCompareInstOperands(), llvm::TargetFolder::CreateFCmp(), llvm::ConstantFolder::CreateFCmp(), llvm::TargetFolder::CreateICmp(), llvm::ConstantFolder::CreateICmp(), llvm::TargetFolder::CreateVFCmp(), llvm::ConstantFolder::CreateVFCmp(), llvm::TargetFolder::CreateVICmp(), llvm::ConstantFolder::CreateVICmp(), and getWithOperands().
ConstantExpr::get* - Return some common constants without having to specify the full Instruction::OPCODE identifier.
ConstantExpr::get* - Return some common constants without having to specify the full Instruction::OPCODE identifier.
Definition at line 754 of file Constants.cpp.
References llvm::Value::getType(), and getZeroValueForNegationExpr().
Referenced by llvm::TargetFolder::CreateNeg(), llvm::ConstantFolder::CreateNeg(), llvm::ScalarEvolution::getNegativeSCEV(), and llvm::PatternMatch::neg_match< LHS_t >::match().
Definition at line 759 of file Constants.cpp.
References llvm::Constant::getAllOnesValue(), llvm::Value::getType(), and llvm::APIntOps::Xor().
Referenced by llvm::TargetFolder::CreateNot(), llvm::ConstantFolder::CreateNot(), llvm::ScalarEvolution::getNotSCEV(), and llvm::PatternMatch::not_match< LHS_t >::match().