LLVM: include/llvm/Analysis/AssumptionCache.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_ANALYSIS_ASSUMPTIONCACHE_H
16#define LLVM_ANALYSIS_ASSUMPTIONCACHE_H
17
26#include
27
28namespace llvm {
29
36
37
38
39
40
41
42
43
45public:
46
47
48 enum : unsigned { ExprResultIdx = std::numeric_limits::max() };
49
58
59private:
60
61
62
64
66
67
68
70
73
74 void deleted() override;
75 void allUsesReplacedWith(Value *) override;
76
77 public:
79
82 };
83
84 friend AffectedValueCallbackVH;
85
86
87
88 using AffectedValuesMap =
89 DenseMap<AffectedValueCallbackVH, SmallVector<ResultElem, 1>,
90 AffectedValueCallbackVH::DMI>;
91 AffectedValuesMap AffectedValues;
92
93
95
96
97 void transferAffectedValuesInCache(Value *OV, Value *NV);
98
99
100
101
102
103 bool Scanned = false;
104
105
106 LLVM_ABI void scanFunction();
107
108public:
109
110
113
114
115
117 FunctionAnalysisManager::Invalidator &) {
118 return false;
119 }
120
121
122
123
124
126
127
128
130
131
132
134
135
136
137
139 AssumeHandles.clear();
140 AffectedValues.clear();
141 Scanned = false;
142 }
143
144
145
146
147
148
149
150
151
153 if (!Scanned)
154 scanFunction();
155 return AssumeHandles;
156 }
157
158
160 if (!Scanned)
161 scanFunction();
162
163 auto AVI = AffectedValues.find_as(const_cast<Value *>(V));
164 if (AVI == AffectedValues.end())
166
167 return AVI->second;
168 }
169
170
171 static void
174};
175
176
177
178
179
182
184
185public:
187
189};
190
191
194
195public:
197
199
201};
202
203
204
205
206
207
208
209
210
212
213
216
217 void deleted() override;
218
219 public:
221
224 };
225
226 friend FunctionCallbackVH;
227
228 using FunctionCallsMap =
230 FunctionCallbackVH::DMI>;
231
232 FunctionCallsMap AssumptionCaches;
233
234public:
235
236
237
238
240
241
242
244
247
250 AssumptionCaches.shrink_and_clear();
251 }
252
253 void verifyAnalysis() const override;
254
259
261};
262
277
278}
279
280#endif
This file defines DenseMapInfo traits for DenseMap.
This file defines the DenseMap class.
This header defines various interfaces for pass management in LLVM.
This file defines the SmallVector class.
This represents the llvm.assume intrinsic.
A function analysis which provides an AssumptionCache.
Definition AssumptionCache.h:180
AssumptionCache Result
Definition AssumptionCache.h:186
LLVM_ABI AssumptionCache run(Function &F, FunctionAnalysisManager &)
bool doFinalization(Module &) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
Definition AssumptionCache.h:255
~AssumptionCacheTracker() override
AssumptionCache * lookupAssumptionCache(Function &F)
Return the cached assumptions for a function if it has already been scanned.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Definition AssumptionCache.h:248
static char ID
Definition AssumptionCache.h:260
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
AssumptionCache & getAssumptionCache(Function &F)
Get the cached assumptions for a function.
A cache of @llvm.assume calls within a function.
Definition AssumptionCache.h:44
@ ExprResultIdx
Definition AssumptionCache.h:48
static void findValuesAffectedByOperandBundle(OperandBundleUse Bundle, function_ref< void(Value *)> InsertAffected)
Determine which values are affected by this assume operand bundle.
LLVM_ABI void registerAssumption(AssumeInst *CI)
Add an @llvm.assume intrinsic to this function's cache.
void clear()
Clear the cache of @llvm.assume intrinsics for a function.
Definition AssumptionCache.h:138
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
This cache is designed to be self-updating and so it should never be invalidated.
Definition AssumptionCache.h:116
LLVM_ABI void updateAffectedValues(AssumeInst *CI)
Update the cache of values being affected by this assumption (i.e.
MutableArrayRef< WeakVH > assumptions()
Access the list of assumption handles currently tracked for this function.
Definition AssumptionCache.h:152
LLVM_ABI void unregisterAssumption(AssumeInst *CI)
Remove an @llvm.assume intrinsic from this function's cache if it has been added to the cache earlier...
AssumptionCache(Function &F, TargetTransformInfo *TTI=nullptr)
Construct an AssumptionCache from a function by scanning all of its instructions.
Definition AssumptionCache.h:111
MutableArrayRef< ResultElem > assumptionsFor(const Value *V)
Access the list of assumptions which affect this value.
Definition AssumptionCache.h:159
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
AssumptionPrinterPass(raw_ostream &OS)
Definition AssumptionCache.h:196
static bool isRequired()
Definition AssumptionCache.h:200
Value handle with callbacks on RAUW and destruction.
A Module instance is used to store all the information related to an LLVM module.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
A set of analyses that are preserved following a run of a transformation pass.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
LLVM Value Representation.
A nullable Value handle that is nullable.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition AssumptionCache.h:50
unsigned Index
contains either ExprResultIdx or the index of the operand bundle containing the knowledge.
Definition AssumptionCache.h:55
WeakVH Assume
Definition AssumptionCache.h:51
An information struct used to provide DenseMap with the various necessary components for a given valu...
A lightweight accessor for an operand bundle meant to be passed around by value.
A CRTP mix-in to automatically provide informational APIs needed for passes.
static SimpleType getSimplifiedValue(AssumptionCache::ResultElem &Val)
Definition AssumptionCache.h:266
Value * SimpleType
Definition AssumptionCache.h:264
Value * SimpleType
Definition AssumptionCache.h:271
static SimpleType getSimplifiedValue(const AssumptionCache::ResultElem &Val)
Definition AssumptionCache.h:273
Define a template that can be specialized by smart pointers to reflect the fact that they are automat...