Go to the documentation of this file.
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 {
75 bool IsInBounds =
false)
const override {
98 Value *Idx)
const override {
105 cast<VectorType>(V1->
getType())->getElementType(),
Mask.size(),
106 isa<ScalableVectorType>(V1->
getType()));
115 return ConstFolder.CreateFNeg(
C);
119 return ConstFolder.CreateUnOp(Opc,
C);
127 Type *DestTy)
const override {
128 if (
C->getType() == DestTy)
130 return ConstFolder.CreateCast(
Op,
C, DestTy);
133 bool isSigned)
const override {
134 if (
C->getType() == DestTy)
136 return ConstFolder.CreateIntCast(
C, DestTy, isSigned);
139 if (
C->getType() == DestTy)
141 return ConstFolder.CreatePointerCast(
C, DestTy);
144 if (
C->getType() == DestTy)
146 return ConstFolder.CreateFPCast(
C, DestTy);
149 return ConstFolder.CreateBitCast(
C, DestTy);
152 return ConstFolder.CreateIntToPtr(
C, DestTy);
155 return ConstFolder.CreatePtrToInt(
C, DestTy);
158 if (
C->getType() == DestTy)
160 return ConstFolder.CreateZExtOrBitCast(
C, DestTy);
163 if (
C->getType() == DestTy)
165 return ConstFolder.CreateSExtOrBitCast(
C, DestTy);
168 if (
C->getType() == DestTy)
170 return ConstFolder.CreateTruncOrBitCast(
C, DestTy);
174 Type *DestTy)
const override {
175 if (
C->getType() == DestTy)
177 return ConstFolder.CreatePointerBitCastOrAddrSpaceCast(
C, DestTy);
186 return ConstFolder.CreateFCmp(
P,
LHS,
RHS);
192 #endif // LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
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.
This is an optimization pass for GlobalISel generic memory operations.
A parsed version of the target data layout string in and methods for querying it.
Value * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const override
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Value * FoldInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > IdxList) const override
IRBuilderFolder - Interface for constant folding in IRBuilder.
The instances of the Type class are immutable: once they are created, they are never changed.
Value * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const override
Value * simplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an InsertValueInst, fold the result or return null.
Value * CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const override
Value * FoldBinOpFMF(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, FastMathFlags FMF) const override
Convenience struct for specifying and reasoning about fast-math flags.
Value * CreateSExtOrBitCast(Constant *C, Type *DestTy) const override
Value * simplifyExtractValueInst(Value *Agg, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an ExtractValueInst, 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.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Value * FoldInsertElement(Value *Vec, Value *NewElt, Value *Idx) const override
Value * FoldGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, bool IsInBounds=false) const override
Value * CreateFNeg(Constant *C) const override
Value * FoldSelect(Value *C, Value *True, Value *False) const override
Value * CreatePtrToInt(Constant *C, Type *DestTy) const override
(vector float) vec_cmpeq(*A, *B) C
Value * CreateBitCast(Constant *C, Type *DestTy) const override
Value * simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for a BinaryOperator, fold the result or return null.
Value * FoldExactBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool IsExact) const override
Value * simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an ICmpInst, fold the result or return null.
This is an important base class in LLVM.
Value * FoldNoWrapBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool HasNUW, bool HasNSW) const override
Value * CreateZExtOrBitCast(Constant *C, Type *DestTy) const override
Value * simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal, const SimplifyQuery &Q)
Given operands for a SelectInst, fold the result or return null.
Value * FoldExtractElement(Value *Vec, Value *Idx) const override
Value * CreateTruncOrBitCast(Constant *C, Type *DestTy) const override
Value * CreatePointerCast(Constant *C, Type *DestTy) const override
Value * FoldExtractValue(Value *Agg, ArrayRef< unsigned > IdxList) const override
Value * FoldICmp(CmpInst::Predicate P, Value *LHS, Value *RHS) const override
InstSimplifyFolder(const DataLayout &DL)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
InstSimplifyFolder - Use InstructionSimplify to fold operations to existing values.
Type * getType() const
All values are typed, get the type of this value.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Value * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override
TargetFolder - Create constants with target dependent folding.
Value * FoldBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS) 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 * CreateIntToPtr(Constant *C, Type *DestTy) const override
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 * CreateFPCast(Constant *C, Type *DestTy) const override
LLVM Value Representation.
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.