LLVM: include/llvm/Transforms/IPO/FunctionSpecialization.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81#ifndef LLVM_TRANSFORMS_IPO_FUNCTIONSPECIALIZATION_H
82#define LLVM_TRANSFORMS_IPO_FUNCTIONSPECIALIZATION_H
83
94
95namespace llvm {
96
97
98
99
101
102
104
105
107
108
109
126
127
129
131
132
134
135
137
138
140
141
143
144
146
151};
152
159
161
163
165
166
167
168
170
172
173public:
177 : GetBFI(GetBFI), F(F), DL(DL), TTI(TTI), Solver(Solver) {}
178
180 return Solver.isBlockExecutable(BB) && !DeadBlocks.contains(BB);
181 }
182
184
186
188
189private:
191
193
195
198
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216 bool discoverTransitivelyIncomingValues(Constant *Const, PHINode *Root,
218
230};
231
233
234
236
238
239
241
242
247
252 unsigned NGlobals = 0;
253
254public:
261 : Solver(Solver), M(M), FAM(FAM), GetBFI(GetBFI), GetTLI(GetTLI),
262 GetTTI(GetTTI), GetAC(GetAC) {}
263
265
267
271 }
272
274
275private:
277
278
279
280
282
283
284
285 void promoteConstantStackValues(Function *F);
286
287
288 void removeDeadFunctions();
289
290
291 void cleanUpSSA();
292
293
294
295
296
297
298
299 bool findSpecializations(Function *F, unsigned FuncSize,
301
302
304
305 bool isCandidateFunction(Function *F);
306
307
308
309
310
312
313
314
315 bool isArgumentInteresting(Argument *A);
316
317
318
320
321
322
323
324
325 void updateCallSites(Function *F, const Spec *Begin, const Spec *End);
326};
327}
328
329#endif
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This pass exposes codegen information to IR-level passes.
an instruction to allocate memory on the stack
This class represents an incoming formal argument to a Function.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Conditional or Unconditional Branch instruction.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class represents a function call, abstracting a target machine's calling convention.
This is the base class for all instructions that perform data casts.
This class is the base class for the comparison instructions.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Implements a dense probed hash-table based set.
This class represents a freeze function that returns random concrete value if an operand is either a ...
LLVM_ABI ~FunctionSpecializer()
LLVM_ABI bool run()
Attempt to specialize functions in the module to enable constant propagation across function boundari...
FunctionSpecializer(SCCPSolver &Solver, Module &M, FunctionAnalysisManager *FAM, std::function< BlockFrequencyInfo &(Function &)> GetBFI, std::function< const TargetLibraryInfo &(Function &)> GetTLI, std::function< TargetTransformInfo &(Function &)> GetTTI, std::function< AssumptionCache &(Function &)> GetAC)
Definition FunctionSpecialization.h:255
InstCostVisitor getInstCostVisitorFor(Function *F)
Definition FunctionSpecialization.h:268
bool isDeadFunction(Function *F)
Definition FunctionSpecialization.h:273
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
LLVM_ABI Cost getLatencySavingsForKnownConstants()
Compute the latency savings from replacing all arguments with constants for a specialization candidat...
LLVM_ABI Cost getCodeSizeSavingsForArg(Argument *A, Constant *C)
Compute the codesize savings for replacing argument A with constant C.
LLVM_ABI Cost getCodeSizeSavingsFromPendingPHIs()
InstCostVisitor(std::function< BlockFrequencyInfo &(Function &)> GetBFI, Function *F, const DataLayout &DL, TargetTransformInfo &TTI, SCCPSolver &Solver)
Definition FunctionSpecialization.h:174
bool isBlockExecutable(BasicBlock *BB) const
Definition FunctionSpecialization.h:179
Base class for instruction visitors.
An instruction for reading from memory.
A Module instance is used to store all the information related to an LLVM module.
SCCPSolver - This interface class is a general purpose solver for Sparse Conditional Constant Propaga...
This class represents the LLVM 'select' instruction.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Provides information about what library functions are available for the current target.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
An opaque object representing a hash code.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
InstructionCost Cost
Definition FunctionSpecialization.h:103
DenseMap< Value *, Constant * > ConstMap
Definition FunctionSpecialization.h:106
DenseMap< Function *, std::pair< unsigned, unsigned > > SpecMap
Definition FunctionSpecialization.h:100
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
SmallVector< ArgInfo, 4 > Args
Definition FunctionSpecialization.h:114
bool operator==(const SpecSig &Other) const
Definition FunctionSpecialization.h:116
friend hash_code hash_value(const SpecSig &S)
Definition FunctionSpecialization.h:122
unsigned Key
Definition FunctionSpecialization.h:113
unsigned CodeSize
Definition FunctionSpecialization.h:142
Function * Clone
Definition FunctionSpecialization.h:133
unsigned Score
Definition FunctionSpecialization.h:139
Spec(Function *F, const SpecSig &&S, unsigned Score, unsigned CodeSize)
Definition FunctionSpecialization.h:149
SmallVector< CallBase * > CallSites
Definition FunctionSpecialization.h:145
Function * F
Definition FunctionSpecialization.h:130
Spec(Function *F, const SpecSig &S, unsigned Score, unsigned CodeSize)
Definition FunctionSpecialization.h:147
SpecSig Sig
Definition FunctionSpecialization.h:136