LLVM: include/llvm/Analysis/InstSimplifyFolder.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
20#define LLVM_ANALYSIS_INSTSIMPLIFYFOLDER_H
21
29
30namespace llvm {
32
33
34
35
39
41
42public:
44
45
46
47
48
49
50
51
56
58 bool IsExact) const override {
60 }
61
63 bool HasNUW, bool HasNSW) const override {
65 }
66
71
76
80
85
89
94
99
103
105 Value *Idx) const override {
107 }
108
116
118 Type *DestTy) const override {
120 }
121
127
128
129
130
131
133 if (C->getType() == DestTy)
134 return C;
135 return ConstFolder.CreatePointerCast(C, DestTy);
136 }
137
139 Type *DestTy) const override {
140 if (C->getType() == DestTy)
141 return C;
142 return ConstFolder.CreatePointerBitCastOrAddrSpaceCast(C, DestTy);
143 }
144};
145
146}
147
148#endif
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION()
\macro LLVM_VIRTUAL_ANCHOR_FUNCTION This macro is used to adhere to LLVM's policy that each class wit...
static Value * simplifyShuffleVectorInst(Value *Op0, Value *Op1, ArrayRef< int > Mask, Type *RetTy, const SimplifyQuery &Q, unsigned MaxRecurse)
static Value * simplifyExtractValueInst(Value *Agg, ArrayRef< unsigned > Idxs, const SimplifyQuery &, unsigned)
Given operands for an ExtractValueInst, see if we can fold the result.
static Value * simplifySelectInst(Value *, Value *, Value *, const SimplifyQuery &, unsigned)
Given operands for a SelectInst, see if we can fold the result.
static Value * simplifyUnOp(unsigned, Value *, const SimplifyQuery &, unsigned)
Given the operand for a UnaryOperator, see if we can fold the result.
static Value * simplifyExtractElementInst(Value *Vec, Value *Idx, const SimplifyQuery &Q, unsigned)
Given operands for an ExtractElementInst, see if we can fold the result.
static Value * simplifyCmpInst(CmpPredicate, Value *, Value *, const SimplifyQuery &, unsigned)
Given operands for a CmpInst, see if we can fold the result.
static Value * simplifyGEPInst(Type *, Value *, ArrayRef< Value * >, GEPNoWrapFlags, const SimplifyQuery &, unsigned)
Given operands for an GetElementPtrInst, see if we can fold the result.
static Value * simplifyCastInst(unsigned, Value *, Type *, const SimplifyQuery &, unsigned)
static Value * simplifyBinOp(unsigned, Value *, Value *, const SimplifyQuery &, unsigned)
Given operands for a BinaryOperator, see if we can fold the result.
static Value * simplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q, unsigned)
Given operands for an InsertValueInst, see if we can fold the result.
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.
This provides a helper for copying FMF from an instruction or setting specified flags.
Convenience struct for specifying and reasoning about fast-math flags.
Represents flags for the getelementptr instruction/expression.
IRBuilderFolder - Interface for constant folding in IRBuilder.
Value * FoldGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, GEPNoWrapFlags NW) const override
Definition InstSimplifyFolder.h:81
Value * FoldExactBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool IsExact) const override
Definition InstSimplifyFolder.h:57
Value * FoldUnOpFMF(Instruction::UnaryOps Opc, Value *V, FastMathFlags FMF) const override
Definition InstSimplifyFolder.h:72
InstSimplifyFolder(const DataLayout &DL)
Definition InstSimplifyFolder.h:43
Value * FoldBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS, Type *Ty, Instruction *FMFSource=nullptr) const override
Definition InstSimplifyFolder.h:122
Value * FoldBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS) const override
Definition InstSimplifyFolder.h:52
Value * FoldInsertElement(Value *Vec, Value *NewElt, Value *Idx) const override
Definition InstSimplifyFolder.h:104
Value * FoldNoWrapBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool HasNUW, bool HasNSW) const override
Definition InstSimplifyFolder.h:62
Value * FoldSelect(Value *C, Value *True, Value *False) const override
Definition InstSimplifyFolder.h:86
Value * FoldBinOpFMF(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, FastMathFlags FMF) const override
Definition InstSimplifyFolder.h:67
Value * FoldInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > IdxList) const override
Definition InstSimplifyFolder.h:95
Value * FoldCast(Instruction::CastOps Op, Value *V, Type *DestTy) const override
Definition InstSimplifyFolder.h:117
Value * FoldShuffleVector(Value *V1, Value *V2, ArrayRef< int > Mask) const override
Definition InstSimplifyFolder.h:109
Value * FoldExtractElement(Value *Vec, Value *Idx) const override
Definition InstSimplifyFolder.h:100
Value * FoldCmp(CmpInst::Predicate P, Value *LHS, Value *RHS) const override
Definition InstSimplifyFolder.h:77
Value * FoldExtractValue(Value *Agg, ArrayRef< unsigned > IdxList) const override
Definition InstSimplifyFolder.h:90
Value * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override
Definition InstSimplifyFolder.h:138
Value * CreatePointerCast(Constant *C, Type *DestTy) const override
Definition InstSimplifyFolder.h:132
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 LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present - Functionally identical to dyn_cast, except that a null (or none in the case ...
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
DWARFExpression::Operation Op
LLVM_ABI Value * simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType, Value *Op0, Value *Op1, const SimplifyQuery &Q, const CallBase *Call)
Given operands for a BinaryIntrinsic, fold the result or return null.
LLVM_ABI Value * simplifyInsertElementInst(Value *Vec, Value *Elt, Value *Idx, const SimplifyQuery &Q)
Given operands for an InsertElement, fold the result or return null.
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.