LLVM  14.0.0git
TargetFolder.h
Go to the documentation of this file.
1 //====- TargetFolder.h - Constant folding helper ---------------*- C++ -*-====//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the TargetFolder class, a helper for IRBuilder.
10 // It provides IRBuilder with a set of methods for creating constants with
11 // target dependent folding, in addition to the same target-independent
12 // folding that the ConstantFolder class provides. For general constant
13 // creation and folding, use ConstantExpr and the routines in
14 // llvm/Analysis/ConstantFolding.h.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_ANALYSIS_TARGETFOLDER_H
19 #define LLVM_ANALYSIS_TARGETFOLDER_H
20 
21 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/IR/Constants.h"
24 #include "llvm/IR/InstrTypes.h"
26 
27 namespace llvm {
28 
29 class DataLayout;
30 
31 /// TargetFolder - Create constants with target dependent folding.
32 class TargetFolder final : public IRBuilderFolder {
33  const DataLayout &DL;
34 
35  /// Fold - Fold the constant using target specific information.
36  Constant *Fold(Constant *C) const {
37  return ConstantFoldConstant(C, DL);
38  }
39 
40  virtual void anchor();
41 
42 public:
43  explicit TargetFolder(const DataLayout &DL) : DL(DL) {}
44 
45  //===--------------------------------------------------------------------===//
46  // Binary Operators
47  //===--------------------------------------------------------------------===//
48 
50  bool HasNUW = false, bool HasNSW = false) const override {
51  return Fold(ConstantExpr::getAdd(LHS, RHS, HasNUW, HasNSW));
52  }
53  Constant *CreateFAdd(Constant *LHS, Constant *RHS) const override {
54  return Fold(ConstantExpr::getFAdd(LHS, RHS));
55  }
57  bool HasNUW = false, bool HasNSW = false) const override {
58  return Fold(ConstantExpr::getSub(LHS, RHS, HasNUW, HasNSW));
59  }
60  Constant *CreateFSub(Constant *LHS, Constant *RHS) const override {
61  return Fold(ConstantExpr::getFSub(LHS, RHS));
62  }
64  bool HasNUW = false, bool HasNSW = false) const override {
65  return Fold(ConstantExpr::getMul(LHS, RHS, HasNUW, HasNSW));
66  }
67  Constant *CreateFMul(Constant *LHS, Constant *RHS) const override {
68  return Fold(ConstantExpr::getFMul(LHS, RHS));
69  }
71  bool isExact = false) const override {
72  return Fold(ConstantExpr::getUDiv(LHS, RHS, isExact));
73  }
75  bool isExact = false) const override {
76  return Fold(ConstantExpr::getSDiv(LHS, RHS, isExact));
77  }
78  Constant *CreateFDiv(Constant *LHS, Constant *RHS) const override {
79  return Fold(ConstantExpr::getFDiv(LHS, RHS));
80  }
81  Constant *CreateURem(Constant *LHS, Constant *RHS) const override {
82  return Fold(ConstantExpr::getURem(LHS, RHS));
83  }
84  Constant *CreateSRem(Constant *LHS, Constant *RHS) const override {
85  return Fold(ConstantExpr::getSRem(LHS, RHS));
86  }
87  Constant *CreateFRem(Constant *LHS, Constant *RHS) const override {
88  return Fold(ConstantExpr::getFRem(LHS, RHS));
89  }
91  bool HasNUW = false, bool HasNSW = false) const override {
92  return Fold(ConstantExpr::getShl(LHS, RHS, HasNUW, HasNSW));
93  }
95  bool isExact = false) const override {
96  return Fold(ConstantExpr::getLShr(LHS, RHS, isExact));
97  }
99  bool isExact = false) const override {
100  return Fold(ConstantExpr::getAShr(LHS, RHS, isExact));
101  }
102  Constant *CreateAnd(Constant *LHS, Constant *RHS) const override {
103  return Fold(ConstantExpr::getAnd(LHS, RHS));
104  }
105  Constant *CreateOr(Constant *LHS, Constant *RHS) const override {
106  return Fold(ConstantExpr::getOr(LHS, RHS));
107  }
108  Constant *CreateXor(Constant *LHS, Constant *RHS) const override {
109  return Fold(ConstantExpr::getXor(LHS, RHS));
110  }
111 
113  Constant *LHS, Constant *RHS) const override {
114  return Fold(ConstantExpr::get(Opc, LHS, RHS));
115  }
116 
117  //===--------------------------------------------------------------------===//
118  // Unary Operators
119  //===--------------------------------------------------------------------===//
120 
122  bool HasNUW = false, bool HasNSW = false) const override {
123  return Fold(ConstantExpr::getNeg(C, HasNUW, HasNSW));
124  }
125  Constant *CreateFNeg(Constant *C) const override {
126  return Fold(ConstantExpr::getFNeg(C));
127  }
128  Constant *CreateNot(Constant *C) const override {
129  return Fold(ConstantExpr::getNot(C));
130  }
131 
133  return Fold(ConstantExpr::get(Opc, C));
134  }
135 
136  //===--------------------------------------------------------------------===//
137  // Memory Instructions
138  //===--------------------------------------------------------------------===//
139 
141  ArrayRef<Constant *> IdxList) const override {
142  return Fold(ConstantExpr::getGetElementPtr(Ty, C, IdxList));
143  }
145  Constant *Idx) const override {
146  // This form of the function only exists to avoid ambiguous overload
147  // warnings about whether to convert Idx to ArrayRef<Constant *> or
148  // ArrayRef<Value *>.
149  return Fold(ConstantExpr::getGetElementPtr(Ty, C, Idx));
150  }
152  ArrayRef<Value *> IdxList) const override {
153  return Fold(ConstantExpr::getGetElementPtr(Ty, C, IdxList));
154  }
155 
157  Type *Ty, Constant *C, ArrayRef<Constant *> IdxList) const override {
158  return Fold(ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList));
159  }
161  Constant *Idx) const override {
162  // This form of the function only exists to avoid ambiguous overload
163  // warnings about whether to convert Idx to ArrayRef<Constant *> or
164  // ArrayRef<Value *>.
165  return Fold(ConstantExpr::getInBoundsGetElementPtr(Ty, C, Idx));
166  }
168  Type *Ty, Constant *C, ArrayRef<Value *> IdxList) const override {
169  return Fold(ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList));
170  }
171 
172  //===--------------------------------------------------------------------===//
173  // Cast/Conversion Operators
174  //===--------------------------------------------------------------------===//
175 
177  Type *DestTy) const override {
178  if (C->getType() == DestTy)
179  return C; // avoid calling Fold
180  return Fold(ConstantExpr::getCast(Op, C, DestTy));
181  }
183  bool isSigned) const override {
184  if (C->getType() == DestTy)
185  return C; // avoid calling Fold
186  return Fold(ConstantExpr::getIntegerCast(C, DestTy, isSigned));
187  }
188  Constant *CreatePointerCast(Constant *C, Type *DestTy) const override {
189  if (C->getType() == DestTy)
190  return C; // avoid calling Fold
191  return Fold(ConstantExpr::getPointerCast(C, DestTy));
192  }
193  Constant *CreateFPCast(Constant *C, Type *DestTy) const override {
194  if (C->getType() == DestTy)
195  return C; // avoid calling Fold
196  return Fold(ConstantExpr::getFPCast(C, DestTy));
197  }
198  Constant *CreateBitCast(Constant *C, Type *DestTy) const override {
199  return CreateCast(Instruction::BitCast, C, DestTy);
200  }
201  Constant *CreateIntToPtr(Constant *C, Type *DestTy) const override {
202  return CreateCast(Instruction::IntToPtr, C, DestTy);
203  }
204  Constant *CreatePtrToInt(Constant *C, Type *DestTy) const override {
205  return CreateCast(Instruction::PtrToInt, C, DestTy);
206  }
207  Constant *CreateZExtOrBitCast(Constant *C, Type *DestTy) const override {
208  if (C->getType() == DestTy)
209  return C; // avoid calling Fold
210  return Fold(ConstantExpr::getZExtOrBitCast(C, DestTy));
211  }
212  Constant *CreateSExtOrBitCast(Constant *C, Type *DestTy) const override {
213  if (C->getType() == DestTy)
214  return C; // avoid calling Fold
215  return Fold(ConstantExpr::getSExtOrBitCast(C, DestTy));
216  }
217  Constant *CreateTruncOrBitCast(Constant *C, Type *DestTy) const override {
218  if (C->getType() == DestTy)
219  return C; // avoid calling Fold
220  return Fold(ConstantExpr::getTruncOrBitCast(C, DestTy));
221  }
222 
224  Type *DestTy) const override {
225  if (C->getType() == DestTy)
226  return C; // avoid calling Fold
228  }
229 
230  //===--------------------------------------------------------------------===//
231  // Compare Instructions
232  //===--------------------------------------------------------------------===//
233 
235  Constant *RHS) const override {
236  return Fold(ConstantExpr::getCompare(P, LHS, RHS));
237  }
239  Constant *RHS) const override {
240  return Fold(ConstantExpr::getCompare(P, LHS, RHS));
241  }
242 
243  //===--------------------------------------------------------------------===//
244  // Other Instructions
245  //===--------------------------------------------------------------------===//
246 
248  Constant *False) const override {
249  return Fold(ConstantExpr::getSelect(C, True, False));
250  }
251 
252  Constant *CreateExtractElement(Constant *Vec, Constant *Idx) const override {
253  return Fold(ConstantExpr::getExtractElement(Vec, Idx));
254  }
255 
257  Constant *Idx) const override {
258  return Fold(ConstantExpr::getInsertElement(Vec, NewElt, Idx));
259  }
260 
262  ArrayRef<int> Mask) const override {
263  return Fold(ConstantExpr::getShuffleVector(V1, V2, Mask));
264  }
265 
267  ArrayRef<unsigned> IdxList) const override {
268  return Fold(ConstantExpr::getExtractValue(Agg, IdxList));
269  }
270 
272  ArrayRef<unsigned> IdxList) const override {
273  return Fold(ConstantExpr::getInsertValue(Agg, Val, IdxList));
274  }
275 };
276 
277 }
278 
279 #endif
llvm::TargetFolder::CreateAdd
Constant * CreateAdd(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: TargetFolder.h:49
llvm::TargetFolder::CreateFSub
Constant * CreateFSub(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:60
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::ConstantExpr::getFDiv
static Constant * getFDiv(Constant *C1, Constant *C2)
Definition: Constants.cpp:2733
llvm::ConstantExpr::getExtractElement
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2552
llvm::ConstantExpr::getNot
static Constant * getNot(Constant *C)
Definition: Constants.cpp:2684
llvm::ConstantExpr::getZExtOrBitCast
static Constant * getZExtOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2027
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::Instruction::UnaryOps
UnaryOps
Definition: Instruction.h:778
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:720
P
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
Definition: README-SSE.txt:411
llvm::ConstantExpr::getFRem
static Constant * getFRem(Constant *C1, Constant *C2)
Definition: Constants.cpp:2745
llvm::TargetFolder::CreateFRem
Constant * CreateFRem(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:87
llvm::ConstantExpr::getFPCast
static Constant * getFPCast(Constant *C, Type *Ty)
Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.
Definition: Constants.cpp:2083
llvm::IRBuilderFolder
IRBuilderFolder - Interface for constant folding in IRBuilder.
Definition: IRBuilderFolder.h:24
llvm::TargetFolder::CreateFCmp
Constant * CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:238
llvm::TargetFolder::CreatePtrToInt
Constant * CreatePtrToInt(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:204
llvm::TargetFolder::CreateXor
Constant * CreateXor(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:108
llvm::ConstantExpr::getSelect
static Constant * getSelect(Constant *C, Constant *V1, Constant *V2, Type *OnlyIfReducedTy=nullptr)
Select constant expr.
Definition: Constants.cpp:2420
llvm::ConstantExpr::getInsertValue
static Constant * getInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2623
llvm::TargetFolder::CreateICmp
Constant * CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:234
llvm::TargetFolder::CreateAnd
Constant * CreateAnd(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:102
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::TargetFolder::CreateSDiv
Constant * CreateSDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: TargetFolder.h:74
llvm::TargetFolder::CreateMul
Constant * CreateMul(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: TargetFolder.h:63
llvm::TargetFolder::CreateInsertValue
Constant * CreateInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > IdxList) const override
Definition: TargetFolder.h:271
llvm::ConstantExpr::getInBoundsGetElementPtr
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition: Constants.h:1237
llvm::TargetFolder::CreateInBoundsGetElementPtr
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList) const override
Definition: TargetFolder.h:167
llvm::BitmaskEnumDetail::Mask
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.
Definition: BitmaskEnum.h:80
ConstantFolding.h
llvm::TargetFolder::CreateNot
Constant * CreateNot(Constant *C) const override
Definition: TargetFolder.h:128
llvm::TargetFolder::CreateFAdd
Constant * CreateFAdd(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:53
llvm::ConstantExpr::getPointerCast
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
Definition: Constants.cpp:2045
llvm::TargetFolder::CreateGetElementPtr
Constant * CreateGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const override
Definition: TargetFolder.h:140
llvm::TargetFolder::CreateInBoundsGetElementPtr
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const override
Definition: TargetFolder.h:156
llvm::ConstantExpr::getSub
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2701
Constants.h
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::TargetFolder::CreateLShr
Constant * CreateLShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: TargetFolder.h:94
InstrTypes.h
llvm::ConstantExpr::getUDiv
static Constant * getUDiv(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2723
llvm::Instruction::CastOps
CastOps
Definition: Instruction.h:799
llvm::TargetFolder::CreateExtractValue
Constant * CreateExtractValue(Constant *Agg, ArrayRef< unsigned > IdxList) const override
Definition: TargetFolder.h:266
llvm::ConstantExpr::getXor
static Constant * getXor(Constant *C1, Constant *C2)
Definition: Constants.cpp:2757
llvm::ConstantExpr::getURem
static Constant * getURem(Constant *C1, Constant *C2)
Definition: Constants.cpp:2737
llvm::TargetFolder::CreateGetElementPtr
Constant * CreateGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const override
Definition: TargetFolder.h:144
llvm::TargetFolder::CreateExtractElement
Constant * CreateExtractElement(Constant *Vec, Constant *Idx) const override
Definition: TargetFolder.h:252
llvm::TargetFolder::CreatePointerCast
Constant * CreatePointerCast(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:188
llvm::ConstantExpr::getFNeg
static Constant * getFNeg(Constant *C)
Definition: Constants.cpp:2678
llvm::TargetFolder::CreateNeg
Constant * CreateNeg(Constant *C, bool HasNUW=false, bool HasNSW=false) const override
Definition: TargetFolder.h:121
llvm::ConstantExpr::getAShr
static Constant * getAShr(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2778
llvm::TargetFolder::CreateGetElementPtr
Constant * CreateGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList) const override
Definition: TargetFolder.h:151
llvm::TargetFolder::CreateBitCast
Constant * CreateBitCast(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:198
llvm::ConstantExpr::getShuffleVector
static Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2597
llvm::ConstantExpr::getCompare
static Constant * getCompare(unsigned short pred, Constant *C1, Constant *C2, bool OnlyIfReduced=false)
Return an ICmp or FCmp comparison operator constant expression.
Definition: Constants.cpp:2398
llvm::TargetFolder::CreateFPCast
Constant * CreateFPCast(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:193
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::ConstantExpr::get
static Constant * get(unsigned Opcode, Constant *C1, unsigned Flags=0, Type *OnlyIfReducedTy=nullptr)
get - Return a unary operator constant expression, folding if possible.
Definition: Constants.cpp:2267
llvm::TargetFolder::CreateUDiv
Constant * CreateUDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: TargetFolder.h:70
llvm::ConstantExpr::getShl
static Constant * getShl(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2766
llvm::ConstantExpr::getFSub
static Constant * getFSub(Constant *C1, Constant *C2)
Definition: Constants.cpp:2708
llvm::ConstantExpr::getOr
static Constant * getOr(Constant *C1, Constant *C2)
Definition: Constants.cpp:2753
ArrayRef.h
IRBuilderFolder.h
llvm::TargetFolder::CreateSelect
Constant * CreateSelect(Constant *C, Constant *True, Constant *False) const override
Definition: TargetFolder.h:247
llvm::TargetFolder::CreateUnOp
Constant * CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const override
Definition: TargetFolder.h:132
llvm::ConstantExpr::getCast
static Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)
Convenience function for getting a Cast operation.
Definition: Constants.cpp:1988
llvm::ConstantExpr::getTruncOrBitCast
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2039
llvm::TargetFolder::CreateSRem
Constant * CreateSRem(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:84
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::TargetFolder::CreatePointerBitCastOrAddrSpaceCast
Constant * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:223
llvm::ConstantExpr::getSExtOrBitCast
static Constant * getSExtOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2033
llvm::TargetFolder::CreateIntCast
Constant * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const override
Definition: TargetFolder.h:182
llvm::TargetFolder::CreateZExtOrBitCast
Constant * CreateZExtOrBitCast(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:207
llvm::TargetFolder::CreateFMul
Constant * CreateFMul(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:67
llvm::ConstantExpr::getInsertElement
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2574
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::ConstantExpr::getIntegerCast
static Constant * getIntegerCast(Constant *C, Type *Ty, bool IsSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
Definition: Constants.cpp:2071
llvm::ConstantExpr::getFMul
static Constant * getFMul(Constant *C1, Constant *C2)
Definition: Constants.cpp:2719
llvm::TargetFolder::CreateCast
Constant * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:176
llvm::TargetFolder::CreateSExtOrBitCast
Constant * CreateSExtOrBitCast(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:212
llvm::TargetFolder::CreateBinOp
Constant * CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:112
llvm::NVPTX::PTXLdStInstCode::V2
@ V2
Definition: NVPTX.h:123
llvm::ConstantExpr::getSDiv
static Constant * getSDiv(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2728
llvm::TargetFolder
TargetFolder - Create constants with target dependent folding.
Definition: TargetFolder.h:32
llvm::TargetFolder::TargetFolder
TargetFolder(const DataLayout &DL)
Definition: TargetFolder.h:43
llvm::ConstantExpr::getNeg
static Constant * getNeg(Constant *C, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2671
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:324
llvm::ConstantExpr::getAdd
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2690
llvm::TargetFolder::CreateOr
Constant * CreateOr(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:105
llvm::ConstantExpr::getAnd
static Constant * getAnd(Constant *C1, Constant *C2)
Definition: Constants.cpp:2749
llvm::ConstantExpr::getGetElementPtr
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false, Optional< unsigned > InRangeIndex=None, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
Definition: Constants.h:1210
llvm::ConstantExpr::getLShr
static Constant * getLShr(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2773
llvm::TargetFolder::CreateIntToPtr
Constant * CreateIntToPtr(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:201
llvm::TargetFolder::CreateFNeg
Constant * CreateFNeg(Constant *C) const override
Definition: TargetFolder.h:125
llvm::TargetFolder::CreateShl
Constant * CreateShl(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: TargetFolder.h:90
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:785
llvm::TargetFolder::CreateShuffleVector
Constant * CreateShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask) const override
Definition: TargetFolder.h:261
llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast
static Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)
Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.
Definition: Constants.cpp:2060
llvm::ConstantExpr::getSRem
static Constant * getSRem(Constant *C1, Constant *C2)
Definition: Constants.cpp:2741
llvm::ConstantExpr::getMul
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2712
llvm::TargetFolder::CreateInBoundsGetElementPtr
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const override
Definition: TargetFolder.h:160
llvm::ConstantFoldConstant
Constant * ConstantFoldConstant(const Constant *C, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr)
ConstantFoldConstant - Fold the constant using the specified DataLayout.
Definition: ConstantFolding.cpp:1157
llvm::TargetFolder::CreateSub
Constant * CreateSub(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: TargetFolder.h:56
llvm::TargetFolder::CreateTruncOrBitCast
Constant * CreateTruncOrBitCast(Constant *C, Type *DestTy) const override
Definition: TargetFolder.h:217
llvm::ConstantExpr::getFAdd
static Constant * getFAdd(Constant *C1, Constant *C2)
Definition: Constants.cpp:2697
llvm::TargetFolder::CreateURem
Constant * CreateURem(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:81
llvm::TargetFolder::CreateFDiv
Constant * CreateFDiv(Constant *LHS, Constant *RHS) const override
Definition: TargetFolder.h:78
llvm::TargetFolder::CreateAShr
Constant * CreateAShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: TargetFolder.h:98
llvm::ConstantExpr::getExtractValue
static Constant * getExtractValue(Constant *Agg, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2647
llvm::TargetFolder::CreateInsertElement
Constant * CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const override
Definition: TargetFolder.h:256