LLVM  14.0.0git
ConstantFolder.h
Go to the documentation of this file.
1 //===- ConstantFolder.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 ConstantFolder class, a helper for IRBuilder.
10 // It provides IRBuilder with a set of methods for creating constants
11 // with minimal folding. For general constant creation and folding,
12 // use ConstantExpr and the routines in llvm/Analysis/ConstantFolding.h.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_IR_CONSTANTFOLDER_H
17 #define LLVM_IR_CONSTANTFOLDER_H
18 
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/InstrTypes.h"
22 #include "llvm/IR/Instruction.h"
24 
25 namespace llvm {
26 
27 /// ConstantFolder - Create constants with minimum, target independent, folding.
28 class ConstantFolder final : public IRBuilderFolder {
29  virtual void anchor();
30 
31 public:
32  explicit ConstantFolder() = default;
33 
34  //===--------------------------------------------------------------------===//
35  // Binary Operators
36  //===--------------------------------------------------------------------===//
37 
39  bool HasNUW = false, bool HasNSW = false) const override {
40  return ConstantExpr::getAdd(LHS, RHS, HasNUW, HasNSW);
41  }
42 
43  Constant *CreateFAdd(Constant *LHS, Constant *RHS) const override {
44  return ConstantExpr::getFAdd(LHS, RHS);
45  }
46 
48  bool HasNUW = false, bool HasNSW = false) const override {
49  return ConstantExpr::getSub(LHS, RHS, HasNUW, HasNSW);
50  }
51 
52  Constant *CreateFSub(Constant *LHS, Constant *RHS) const override {
53  return ConstantExpr::getFSub(LHS, RHS);
54  }
55 
57  bool HasNUW = false, bool HasNSW = false) const override {
58  return ConstantExpr::getMul(LHS, RHS, HasNUW, HasNSW);
59  }
60 
61  Constant *CreateFMul(Constant *LHS, Constant *RHS) const override {
62  return ConstantExpr::getFMul(LHS, RHS);
63  }
64 
66  bool isExact = false) const override {
67  return ConstantExpr::getUDiv(LHS, RHS, isExact);
68  }
69 
71  bool isExact = false) const override {
72  return ConstantExpr::getSDiv(LHS, RHS, isExact);
73  }
74 
75  Constant *CreateFDiv(Constant *LHS, Constant *RHS) const override {
76  return ConstantExpr::getFDiv(LHS, RHS);
77  }
78 
79  Constant *CreateURem(Constant *LHS, Constant *RHS) const override {
80  return ConstantExpr::getURem(LHS, RHS);
81  }
82 
83  Constant *CreateSRem(Constant *LHS, Constant *RHS) const override {
84  return ConstantExpr::getSRem(LHS, RHS);
85  }
86 
87  Constant *CreateFRem(Constant *LHS, Constant *RHS) const override {
88  return ConstantExpr::getFRem(LHS, RHS);
89  }
90 
92  bool HasNUW = false, bool HasNSW = false) const override {
93  return ConstantExpr::getShl(LHS, RHS, HasNUW, HasNSW);
94  }
95 
97  bool isExact = false) const override {
98  return ConstantExpr::getLShr(LHS, RHS, isExact);
99  }
100 
102  bool isExact = false) const override {
103  return ConstantExpr::getAShr(LHS, RHS, isExact);
104  }
105 
106  Constant *CreateAnd(Constant *LHS, Constant *RHS) const override {
107  return ConstantExpr::getAnd(LHS, RHS);
108  }
109 
110  Constant *CreateOr(Constant *LHS, Constant *RHS) const override {
111  return ConstantExpr::getOr(LHS, RHS);
112  }
113 
114  Constant *CreateXor(Constant *LHS, Constant *RHS) const override {
115  return ConstantExpr::getXor(LHS, RHS);
116  }
117 
119  Constant *LHS, Constant *RHS) const override {
120  return ConstantExpr::get(Opc, LHS, RHS);
121  }
122 
123  //===--------------------------------------------------------------------===//
124  // Unary Operators
125  //===--------------------------------------------------------------------===//
126 
128  bool HasNUW = false, bool HasNSW = false) const override {
129  return ConstantExpr::getNeg(C, HasNUW, HasNSW);
130  }
131 
132  Constant *CreateFNeg(Constant *C) const override {
133  return ConstantExpr::getFNeg(C);
134  }
135 
136  Constant *CreateNot(Constant *C) const override {
137  return ConstantExpr::getNot(C);
138  }
139 
141  return ConstantExpr::get(Opc, C);
142  }
143 
144  //===--------------------------------------------------------------------===//
145  // Memory Instructions
146  //===--------------------------------------------------------------------===//
147 
149  ArrayRef<Constant *> IdxList) const override {
150  return ConstantExpr::getGetElementPtr(Ty, C, IdxList);
151  }
152 
154  Constant *Idx) const override {
155  // This form of the function only exists to avoid ambiguous overload
156  // warnings about whether to convert Idx to ArrayRef<Constant *> or
157  // ArrayRef<Value *>.
158  return ConstantExpr::getGetElementPtr(Ty, C, Idx);
159  }
160 
162  ArrayRef<Value *> IdxList) const override {
163  return ConstantExpr::getGetElementPtr(Ty, C, IdxList);
164  }
165 
167  Type *Ty, Constant *C, ArrayRef<Constant *> IdxList) const override {
168  return ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList);
169  }
170 
172  Constant *Idx) const override {
173  // This form of the function only exists to avoid ambiguous overload
174  // warnings about whether to convert Idx to ArrayRef<Constant *> or
175  // ArrayRef<Value *>.
176  return ConstantExpr::getInBoundsGetElementPtr(Ty, C, Idx);
177  }
178 
180  Type *Ty, Constant *C, ArrayRef<Value *> IdxList) const override {
181  return ConstantExpr::getInBoundsGetElementPtr(Ty, C, IdxList);
182  }
183 
184  //===--------------------------------------------------------------------===//
185  // Cast/Conversion Operators
186  //===--------------------------------------------------------------------===//
187 
189  Type *DestTy) const override {
190  return ConstantExpr::getCast(Op, C, DestTy);
191  }
192 
193  Constant *CreatePointerCast(Constant *C, Type *DestTy) const override {
194  return ConstantExpr::getPointerCast(C, DestTy);
195  }
196 
198  Type *DestTy) const override {
200  }
201 
203  bool isSigned) const override {
204  return ConstantExpr::getIntegerCast(C, DestTy, isSigned);
205  }
206 
207  Constant *CreateFPCast(Constant *C, Type *DestTy) const override {
208  return ConstantExpr::getFPCast(C, DestTy);
209  }
210 
211  Constant *CreateBitCast(Constant *C, Type *DestTy) const override {
212  return CreateCast(Instruction::BitCast, C, DestTy);
213  }
214 
215  Constant *CreateIntToPtr(Constant *C, Type *DestTy) const override {
216  return CreateCast(Instruction::IntToPtr, C, DestTy);
217  }
218 
219  Constant *CreatePtrToInt(Constant *C, Type *DestTy) const override {
220  return CreateCast(Instruction::PtrToInt, C, DestTy);
221  }
222 
223  Constant *CreateZExtOrBitCast(Constant *C, Type *DestTy) const override {
224  return ConstantExpr::getZExtOrBitCast(C, DestTy);
225  }
226 
227  Constant *CreateSExtOrBitCast(Constant *C, Type *DestTy) const override {
228  return ConstantExpr::getSExtOrBitCast(C, DestTy);
229  }
230 
231  Constant *CreateTruncOrBitCast(Constant *C, Type *DestTy) const override {
232  return ConstantExpr::getTruncOrBitCast(C, DestTy);
233  }
234 
235  //===--------------------------------------------------------------------===//
236  // Compare Instructions
237  //===--------------------------------------------------------------------===//
238 
240  Constant *RHS) const override {
241  return ConstantExpr::getCompare(P, LHS, RHS);
242  }
243 
245  Constant *RHS) const override {
246  return ConstantExpr::getCompare(P, LHS, RHS);
247  }
248 
249  //===--------------------------------------------------------------------===//
250  // Other Instructions
251  //===--------------------------------------------------------------------===//
252 
254  Constant *False) const override {
255  return ConstantExpr::getSelect(C, True, False);
256  }
257 
258  Constant *CreateExtractElement(Constant *Vec, Constant *Idx) const override {
259  return ConstantExpr::getExtractElement(Vec, Idx);
260  }
261 
263  Constant *Idx) const override {
264  return ConstantExpr::getInsertElement(Vec, NewElt, Idx);
265  }
266 
268  ArrayRef<int> Mask) const override {
270  }
271 
273  ArrayRef<unsigned> IdxList) const override {
274  return ConstantExpr::getExtractValue(Agg, IdxList);
275  }
276 
278  ArrayRef<unsigned> IdxList) const override {
279  return ConstantExpr::getInsertValue(Agg, Val, IdxList);
280  }
281 };
282 
283 } // end namespace llvm
284 
285 #endif // LLVM_IR_CONSTANTFOLDER_H
llvm::ConstantFolder::CreateExtractElement
Constant * CreateExtractElement(Constant *Vec, Constant *Idx) const override
Definition: ConstantFolder.h:258
llvm::ConstantFolder::CreateInsertElement
Constant * CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const override
Definition: ConstantFolder.h:262
llvm
This is an optimization pass for GlobalISel generic memory operations.
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::ConstantFolder::CreateSExtOrBitCast
Constant * CreateSExtOrBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:227
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::Instruction::UnaryOps
UnaryOps
Definition: Instruction.h:782
llvm::ConstantFolder::CreateICmp
Constant * CreateICmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:239
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:721
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::ConstantExpr::getFPCast
static Constant * getFPCast(Constant *C, Type *Ty)
Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.
Definition: Constants.cpp:2083
llvm::ConstantFolder::CreateAnd
Constant * CreateAnd(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:106
llvm::ConstantFolder::CreateInBoundsGetElementPtr
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList) const override
Definition: ConstantFolder.h:179
llvm::IRBuilderFolder
IRBuilderFolder - Interface for constant folding in IRBuilder.
Definition: IRBuilderFolder.h:24
llvm::ConstantFolder::CreateOr
Constant * CreateOr(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:110
llvm::ConstantFolder::CreateAdd
Constant * CreateAdd(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:38
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::ConstantFolder::CreateAShr
Constant * CreateAShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:101
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::ConstantFolder::CreateFMul
Constant * CreateFMul(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:61
llvm::ConstantFolder::CreateShl
Constant * CreateShl(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:91
llvm::ConstantFolder::CreateFNeg
Constant * CreateFNeg(Constant *C) const override
Definition: ConstantFolder.h:132
llvm::ConstantFolder::CreateSub
Constant * CreateSub(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:47
llvm::ConstantExpr::getInBoundsGetElementPtr
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition: Constants.h:1237
llvm::ConstantFolder::CreateGetElementPtr
Constant * CreateGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList) const override
Definition: ConstantFolder.h:161
llvm::ConstantFolder::CreatePointerBitCastOrAddrSpaceCast
Constant * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:197
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
llvm::ConstantFolder::CreateExtractValue
Constant * CreateExtractValue(Constant *Agg, ArrayRef< unsigned > IdxList) const override
Definition: ConstantFolder.h:272
llvm::ConstantFolder::CreateSRem
Constant * CreateSRem(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:83
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::ConstantFolder::CreateInsertValue
Constant * CreateInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > IdxList) const override
Definition: ConstantFolder.h:277
llvm::ConstantExpr::getSub
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2701
llvm::ConstantFolder::CreateFRem
Constant * CreateFRem(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:87
Instruction.h
llvm::ConstantFolder
ConstantFolder - Create constants with minimum, target independent, folding.
Definition: ConstantFolder.h:28
llvm::ConstantFolder::CreateSDiv
Constant * CreateSDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:70
Constants.h
llvm::ConstantFolder::CreateZExtOrBitCast
Constant * CreateZExtOrBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:223
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::ConstantFolder::CreateNeg
Constant * CreateNeg(Constant *C, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:127
InstrTypes.h
llvm::ConstantFolder::CreateNot
Constant * CreateNot(Constant *C) const override
Definition: ConstantFolder.h:136
llvm::ConstantFolder::CreateUnOp
Constant * CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const override
Definition: ConstantFolder.h:140
llvm::ConstantExpr::getUDiv
static Constant * getUDiv(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2723
llvm::Instruction::CastOps
CastOps
Definition: Instruction.h:803
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::ConstantFolder::CreateSelect
Constant * CreateSelect(Constant *C, Constant *True, Constant *False) const override
Definition: ConstantFolder.h:253
llvm::ConstantFolder::CreateUDiv
Constant * CreateUDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:65
llvm::ConstantFolder::ConstantFolder
ConstantFolder()=default
llvm::ConstantExpr::getFNeg
static Constant * getFNeg(Constant *C)
Definition: Constants.cpp:2678
llvm::ConstantExpr::getAShr
static Constant * getAShr(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2778
llvm::ConstantExpr::getShuffleVector
static Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2597
llvm::ConstantFolder::CreatePtrToInt
Constant * CreatePtrToInt(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:219
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::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::ConstantFolder::CreateFAdd
Constant * CreateFAdd(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:43
llvm::ConstantFolder::CreateURem
Constant * CreateURem(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:79
llvm::ConstantFolder::CreateBinOp
Constant * CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:118
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::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::ConstantFolder::CreatePointerCast
Constant * CreatePointerCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:193
llvm::ConstantExpr::getOr
static Constant * getOr(Constant *C1, Constant *C2)
Definition: Constants.cpp:2753
ArrayRef.h
IRBuilderFolder.h
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::ConstantFolder::CreateMul
Constant * CreateMul(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:56
llvm::ConstantFolder::CreateGetElementPtr
Constant * CreateGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const override
Definition: ConstantFolder.h:148
llvm::ConstantExpr::getTruncOrBitCast
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2039
llvm::ConstantFolder::CreateXor
Constant * CreateXor(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:114
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::ConstantFolder::CreateInBoundsGetElementPtr
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const override
Definition: ConstantFolder.h:171
llvm::ConstantExpr::getSExtOrBitCast
static Constant * getSExtOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2033
llvm::ConstantExpr::getInsertElement
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2574
llvm::ConstantFolder::CreateFCmp
Constant * CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:244
llvm::ConstantFolder::CreateIntToPtr
Constant * CreateIntToPtr(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:215
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::ConstantFolder::CreateShuffleVector
Constant * CreateShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask) const override
Definition: ConstantFolder.h:267
llvm::ConstantExpr::getFMul
static Constant * getFMul(Constant *C1, Constant *C2)
Definition: Constants.cpp:2719
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::ConstantFolder::CreateFSub
Constant * CreateFSub(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:52
llvm::ConstantFolder::CreateFPCast
Constant * CreateFPCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:207
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:325
llvm::ConstantExpr::getAdd
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2690
llvm::ConstantExpr::getAnd
static Constant * getAnd(Constant *C1, Constant *C2)
Definition: Constants.cpp:2749
llvm::ConstantFolder::CreateBitCast
Constant * CreateBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:211
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::ConstantFolder::CreateTruncOrBitCast
Constant * CreateTruncOrBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:231
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:789
llvm::ConstantFolder::CreateLShr
Constant * CreateLShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:96
llvm::ConstantFolder::CreateIntCast
Constant * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const override
Definition: ConstantFolder.h:202
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::ConstantFolder::CreateGetElementPtr
Constant * CreateGetElementPtr(Type *Ty, Constant *C, Constant *Idx) const override
Definition: ConstantFolder.h:153
llvm::ConstantExpr::getMul
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2712
llvm::ConstantFolder::CreateFDiv
Constant * CreateFDiv(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:75
llvm::ConstantExpr::getFAdd
static Constant * getFAdd(Constant *C1, Constant *C2)
Definition: Constants.cpp:2697
llvm::ConstantFolder::CreateInBoundsGetElementPtr
Constant * CreateInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList) const override
Definition: ConstantFolder.h:166
llvm::ConstantExpr::getExtractValue
static Constant * getExtractValue(Constant *Agg, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2647
llvm::ConstantFolder::CreateCast
Constant * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:188