19#ifndef LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
20#define LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
38 virtual void anchor();
56 bool IsExact)
const override {
61 bool HasNUW,
bool HasNSW)
const override {
80 bool IsInBounds =
false)
const override {
110 cast<VectorType>(V1->
getType())->getElementType(), Mask.size(),
111 isa<ScalableVectorType>(V1->
getType()));
120 Type *DestTy)
const override {
121 if (
C->getType() == DestTy)
123 return ConstFolder.CreateCast(Op,
C, DestTy);
127 if (
C->getType() == DestTy)
129 return ConstFolder.CreateIntCast(
C, DestTy,
isSigned);
132 if (
C->getType() == DestTy)
134 return ConstFolder.CreatePointerCast(
C, DestTy);
137 if (
C->getType() == DestTy)
139 return ConstFolder.CreateFPCast(
C, DestTy);
142 return ConstFolder.CreateBitCast(
C, DestTy);
145 return ConstFolder.CreateIntToPtr(
C, DestTy);
148 return ConstFolder.CreatePtrToInt(
C, DestTy);
151 if (
C->getType() == DestTy)
153 return ConstFolder.CreateZExtOrBitCast(
C, DestTy);
156 if (
C->getType() == DestTy)
158 return ConstFolder.CreateSExtOrBitCast(
C, DestTy);
161 if (
C->getType() == DestTy)
163 return ConstFolder.CreateTruncOrBitCast(
C, DestTy);
167 Type *DestTy)
const override {
168 if (
C->getType() == DestTy)
170 return ConstFolder.CreatePointerBitCastOrAddrSpaceCast(
C, DestTy);
179 return ConstFolder.CreateFCmp(
P,
LHS,
RHS);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static bool isSigned(unsigned int Opcode)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Convenience struct for specifying and reasoning about fast-math flags.
IRBuilderFolder - Interface for constant folding in IRBuilder.
InstSimplifyFolder - Use InstructionSimplify to fold operations to existing values.
Value * FoldICmp(CmpInst::Predicate P, Value *LHS, Value *RHS) const override
Value * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const override
Value * CreatePtrToInt(Constant *C, Type *DestTy) const override
Value * FoldExactBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool IsExact) const override
Value * FoldUnOpFMF(Instruction::UnaryOps Opc, Value *V, FastMathFlags FMF) const override
InstSimplifyFolder(const DataLayout &DL)
Value * CreateSExtOrBitCast(Constant *C, Type *DestTy) const override
Value * FoldBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS) const override
Value * FoldInsertElement(Value *Vec, Value *NewElt, Value *Idx) const override
Value * FoldNoWrapBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool HasNUW, bool HasNSW) const override
Value * CreateZExtOrBitCast(Constant *C, Type *DestTy) const override
Value * FoldSelect(Value *C, Value *True, Value *False) const override
Value * FoldBinOpFMF(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, FastMathFlags FMF) const override
Value * FoldGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, bool IsInBounds=false) const override
Value * CreateBitCast(Constant *C, Type *DestTy) const override
Value * CreateFPCast(Constant *C, Type *DestTy) const override
Value * FoldInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > IdxList) const override
Value * CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const override
Value * FoldShuffleVector(Value *V1, Value *V2, ArrayRef< int > Mask) const override
Value * FoldExtractElement(Value *Vec, Value *Idx) const override
Value * CreateIntToPtr(Constant *C, Type *DestTy) const override
Value * CreateTruncOrBitCast(Constant *C, Type *DestTy) const override
Value * FoldExtractValue(Value *Agg, ArrayRef< unsigned > IdxList) const override
Value * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override
Value * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const override
Value * CreatePointerCast(Constant *C, Type *DestTy) const override
TargetFolder - Create constants with target dependent folding.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
Value * simplifyUnOp(unsigned Opcode, Value *Op, const SimplifyQuery &Q)
Given operand for a UnaryOperator, fold the result or return null.
Value * simplifyShuffleVectorInst(Value *Op0, Value *Op1, ArrayRef< int > Mask, Type *RetTy, const SimplifyQuery &Q)
Given operands for a ShuffleVectorInst, fold the result or return null.
Value * simplifyExtractValueInst(Value *Agg, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an ExtractValueInst, fold the result or return null.
Value * simplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an InsertValueInst, fold the result or return null.
Value * simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an ICmpInst, fold the result or return null.
Value * simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for a BinaryOperator, fold the result or return null.
Value * simplifyInsertElementInst(Value *Vec, Value *Elt, Value *Idx, const SimplifyQuery &Q)
Given operands for an InsertElement, fold the result or return null.
Value * simplifyGEPInst(Type *SrcTy, Value *Ptr, ArrayRef< Value * > Indices, bool InBounds, const SimplifyQuery &Q)
Given operands for a GetElementPtrInst, fold the result or return null.
Value * simplifyExtractElementInst(Value *Vec, Value *Idx, const SimplifyQuery &Q)
Given operands for an ExtractElementInst, fold the result or return null.
Value * simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal, const SimplifyQuery &Q)
Given operands for a SelectInst, fold the result or return null.