Go to the documentation of this file.
19 #ifndef LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
20 #define LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
38 virtual void anchor();
50 bool HasNSW =
false)
const override {
67 bool IsInBounds =
false)
const override {
90 return ConstFolder.CreateFAdd(
LHS,
RHS);
93 bool HasNSW =
false)
const override {
94 return ConstFolder.CreateSub(
LHS,
RHS, HasNUW, HasNSW);
97 return ConstFolder.CreateFSub(
LHS,
RHS);
100 bool HasNSW =
false)
const override {
101 return ConstFolder.CreateMul(
LHS,
RHS, HasNUW, HasNSW);
104 return ConstFolder.CreateFMul(
LHS,
RHS);
107 bool isExact =
false)
const override {
108 return ConstFolder.CreateUDiv(
LHS,
RHS, isExact);
111 bool isExact =
false)
const override {
112 return ConstFolder.CreateSDiv(
LHS,
RHS, isExact);
115 return ConstFolder.CreateFDiv(
LHS,
RHS);
118 return ConstFolder.CreateURem(
LHS,
RHS);
121 return ConstFolder.CreateSRem(
LHS,
RHS);
124 return ConstFolder.CreateFRem(
LHS,
RHS);
127 bool HasNSW =
false)
const override {
128 return ConstFolder.CreateShl(
LHS,
RHS, HasNUW, HasNSW);
131 bool isExact =
false)
const override {
132 return ConstFolder.CreateLShr(
LHS,
RHS, isExact);
135 bool isExact =
false)
const override {
136 return ConstFolder.CreateAShr(
LHS,
RHS, isExact);
139 return ConstFolder.CreateXor(
LHS,
RHS);
144 return ConstFolder.CreateBinOp(Opc,
LHS,
RHS);
152 bool HasNSW =
false)
const override {
153 return ConstFolder.CreateNeg(
C, HasNUW, HasNSW);
156 return ConstFolder.CreateFNeg(
C);
159 return ConstFolder.CreateNot(
C);
163 return ConstFolder.CreateUnOp(Opc,
C);
171 Type *DestTy)
const override {
172 if (
C->getType() == DestTy)
174 return ConstFolder.CreateCast(
Op,
C, DestTy);
177 bool isSigned)
const override {
178 if (
C->getType() == DestTy)
180 return ConstFolder.CreateIntCast(
C, DestTy, isSigned);
183 if (
C->getType() == DestTy)
185 return ConstFolder.CreatePointerCast(
C, DestTy);
188 if (
C->getType() == DestTy)
190 return ConstFolder.CreateFPCast(
C, DestTy);
193 return ConstFolder.CreateBitCast(
C, DestTy);
196 return ConstFolder.CreateIntToPtr(
C, DestTy);
199 return ConstFolder.CreatePtrToInt(
C, DestTy);
202 if (
C->getType() == DestTy)
204 return ConstFolder.CreateZExtOrBitCast(
C, DestTy);
207 if (
C->getType() == DestTy)
209 return ConstFolder.CreateSExtOrBitCast(
C, DestTy);
212 if (
C->getType() == DestTy)
214 return ConstFolder.CreateTruncOrBitCast(
C, DestTy);
218 Type *DestTy)
const override {
219 if (
C->getType() == DestTy)
221 return ConstFolder.CreatePointerBitCastOrAddrSpaceCast(
C, DestTy);
230 return ConstFolder.CreateFCmp(
P,
LHS,
RHS);
238 return ConstFolder.CreateExtractElement(Vec, Idx);
243 return ConstFolder.CreateInsertElement(Vec, NewElt, Idx);
248 return ConstFolder.CreateShuffleVector(V1,
V2,
Mask);
254 #endif // LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
Value * CreateLShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
Value * CreateFDiv(Constant *LHS, Constant *RHS) const override
This is an optimization pass for GlobalISel generic memory operations.
Value * CreateShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask) const override
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.
Value * CreateFRem(Constant *LHS, Constant *RHS) const override
Value * CreateUDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
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 * SimplifyAndInst(Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an And, fold the result or return null.
Value * FoldInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > IdxList) const override
Value * SimplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal, const SimplifyQuery &Q)
Given operands for a SelectInst, fold the result or return null.
IRBuilderFolder - Interface for constant folding in IRBuilder.
Value * CreateExtractElement(Constant *Vec, Constant *Idx) const override
The instances of the Type class are immutable: once they are created, they are never changed.
Value * CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const override
Value * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const override
Value * CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const override
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 * CreateSRem(Constant *LHS, Constant *RHS) const override
Value * CreateSExtOrBitCast(Constant *C, Type *DestTy) const override
Value * FoldOr(Value *LHS, Value *RHS) const override
Value * CreateMul(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
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 * 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 * SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an ICmpInst, fold the result or return null.
Value * CreateSDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
Value * CreateBitCast(Constant *C, Type *DestTy) const override
Value * CreateShl(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Value * CreateNot(Constant *C) const override
Value * CreateFAdd(Constant *LHS, Constant *RHS) const override
This is an important base class in LLVM.
Value * CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const override
Value * CreateZExtOrBitCast(Constant *C, Type *DestTy) const override
Value * CreateTruncOrBitCast(Constant *C, Type *DestTy) const override
Value * CreatePointerCast(Constant *C, Type *DestTy) const override
Value * CreateFSub(Constant *LHS, Constant *RHS) const override
Value * CreateNeg(Constant *C, bool HasNUW=false, bool HasNSW=false) 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)
Value * CreateAShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
InstSimplifyFolder - Use InstructionSimplify to fold operations to existing values.
Value * SimplifyExtractValueInst(Value *Agg, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an ExtractValueInst, fold the result or return null.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Value * SimplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an InsertValueInst, fold the result or return null.
Value * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override
TargetFolder - Create constants with target dependent folding.
Value * CreateSub(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Value * CreateXor(Constant *LHS, Constant *RHS) const override
Value * CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const override
Value * CreateURem(Constant *LHS, Constant *RHS) const override
Value * CreateFMul(Constant *LHS, Constant *RHS) const override
Value * SimplifyOrInst(Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an Or, fold the result or return null.
Value * FoldAnd(Value *LHS, Value *RHS) const override
Value * FoldAdd(Value *LHS, Value *RHS, bool HasNUW=false, bool HasNSW=false) const override
Value * CreateIntToPtr(Constant *C, Type *DestTy) const override
Value * CreateFPCast(Constant *C, Type *DestTy) const override
Value * SimplifyAddInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW, const SimplifyQuery &Q)
Given operands for an Add, fold the result or return null.
LLVM Value Representation.