llvmlite 0.44.0rc1__cp312-cp312-win_amd64.whl → 0.45.0rc1__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of llvmlite might be problematic. Click here for more details.
- llvmlite/__init__.py +6 -5
- llvmlite/_version.py +2 -2
- llvmlite/binding/__init__.py +1 -2
- llvmlite/binding/config.py +143 -0
- llvmlite/binding/context.py +2 -10
- llvmlite/binding/ffi.py +1 -1
- llvmlite/binding/initfini.py +14 -2
- llvmlite/binding/llvmlite.dll +0 -0
- llvmlite/binding/newpassmanagers.py +759 -67
- llvmlite/binding/targets.py +14 -72
- llvmlite/binding/typeref.py +1 -19
- llvmlite/ir/builder.py +1 -1
- llvmlite/ir/module.py +11 -1
- llvmlite/ir/types.py +15 -19
- llvmlite/tests/refprune_proto.py +1 -0
- llvmlite/tests/test_binding.py +394 -452
- llvmlite/tests/test_ir.py +176 -67
- llvmlite/tests/test_refprune.py +10 -166
- {llvmlite-0.44.0rc1.dist-info → llvmlite-0.45.0rc1.dist-info}/METADATA +13 -8
- llvmlite-0.45.0rc1.dist-info/RECORD +44 -0
- {llvmlite-0.44.0rc1.dist-info → llvmlite-0.45.0rc1.dist-info}/WHEEL +1 -1
- llvmlite/binding/passmanagers.py +0 -946
- llvmlite/binding/transforms.py +0 -151
- llvmlite-0.44.0rc1.dist-info/LICENSE.thirdparty +0 -225
- llvmlite-0.44.0rc1.dist-info/RECORD +0 -46
- {llvmlite-0.44.0rc1.dist-info → llvmlite-0.45.0rc1.dist-info/licenses}/LICENSE +0 -0
- {llvmlite-0.44.0rc1.dist-info → llvmlite-0.45.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from ctypes import c_bool, c_int, c_size_t
|
|
1
|
+
from ctypes import c_bool, c_int, c_size_t, POINTER, Structure, byref, c_char_p
|
|
2
|
+
from collections import namedtuple
|
|
2
3
|
from enum import IntFlag
|
|
3
4
|
from llvmlite.binding import ffi
|
|
4
5
|
|
|
@@ -19,6 +20,89 @@ def create_pipeline_tuning_options(speed_level=2, size_level=0):
|
|
|
19
20
|
return PipelineTuningOptions(speed_level, size_level)
|
|
20
21
|
|
|
21
22
|
|
|
23
|
+
_prunestats = namedtuple('PruneStats',
|
|
24
|
+
('basicblock diamond fanout fanout_raise'))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PruneStats(_prunestats):
|
|
28
|
+
""" Holds statistics from reference count pruning.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def __add__(self, other):
|
|
32
|
+
if not isinstance(other, PruneStats):
|
|
33
|
+
msg = 'PruneStats can only be added to another PruneStats, got {}.'
|
|
34
|
+
raise TypeError(msg.format(type(other)))
|
|
35
|
+
return PruneStats(self.basicblock + other.basicblock,
|
|
36
|
+
self.diamond + other.diamond,
|
|
37
|
+
self.fanout + other.fanout,
|
|
38
|
+
self.fanout_raise + other.fanout_raise)
|
|
39
|
+
|
|
40
|
+
def __sub__(self, other):
|
|
41
|
+
if not isinstance(other, PruneStats):
|
|
42
|
+
msg = ('PruneStats can only be subtracted from another PruneStats, '
|
|
43
|
+
'got {}.')
|
|
44
|
+
raise TypeError(msg.format(type(other)))
|
|
45
|
+
return PruneStats(self.basicblock - other.basicblock,
|
|
46
|
+
self.diamond - other.diamond,
|
|
47
|
+
self.fanout - other.fanout,
|
|
48
|
+
self.fanout_raise - other.fanout_raise)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class _c_PruneStats(Structure):
|
|
52
|
+
_fields_ = [
|
|
53
|
+
('basicblock', c_size_t),
|
|
54
|
+
('diamond', c_size_t),
|
|
55
|
+
('fanout', c_size_t),
|
|
56
|
+
('fanout_raise', c_size_t)]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def dump_refprune_stats(printout=False):
|
|
60
|
+
""" Returns a namedtuple containing the current values for the refop pruning
|
|
61
|
+
statistics. If kwarg `printout` is True the stats are printed to stderr,
|
|
62
|
+
default is False.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
stats = _c_PruneStats(0, 0, 0, 0)
|
|
66
|
+
do_print = c_bool(printout)
|
|
67
|
+
|
|
68
|
+
ffi.lib.LLVMPY_DumpRefPruneStats(byref(stats), do_print)
|
|
69
|
+
return PruneStats(stats.basicblock, stats.diamond, stats.fanout,
|
|
70
|
+
stats.fanout_raise)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# TODO: Rename and add tests for these
|
|
74
|
+
# Although new pass manager has its own timing APIs, we still need to support
|
|
75
|
+
# the legacy ones as LLVM backend still used the LegacyPassManager. These APIs
|
|
76
|
+
# will be used to time the backend passes such as instruction selection,
|
|
77
|
+
# regalloc, etc
|
|
78
|
+
def set_time_passes(enable):
|
|
79
|
+
"""Enable or disable the pass timers.
|
|
80
|
+
|
|
81
|
+
Parameters
|
|
82
|
+
----------
|
|
83
|
+
enable : bool
|
|
84
|
+
Set to True to enable the pass timers.
|
|
85
|
+
Set to False to disable the pass timers.
|
|
86
|
+
"""
|
|
87
|
+
ffi.lib.LLVMPY_SetTimePasses(c_bool(enable))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def report_and_reset_timings():
|
|
91
|
+
"""Returns the pass timings report and resets the LLVM internal timers.
|
|
92
|
+
|
|
93
|
+
Pass timers are enabled by ``set_time_passes()``. If the timers are not
|
|
94
|
+
enabled, this function will return an empty string.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
res : str
|
|
99
|
+
LLVM generated timing report.
|
|
100
|
+
"""
|
|
101
|
+
with ffi.OutputString() as buf:
|
|
102
|
+
ffi.lib.LLVMPY_ReportAndResetTimings(buf)
|
|
103
|
+
return str(buf)
|
|
104
|
+
|
|
105
|
+
|
|
22
106
|
class RefPruneSubpasses(IntFlag):
|
|
23
107
|
PER_BB = 0b0001 # noqa: E221
|
|
24
108
|
DIAMOND = 0b0010 # noqa: E221
|
|
@@ -27,39 +111,336 @@ class RefPruneSubpasses(IntFlag):
|
|
|
27
111
|
ALL = PER_BB | DIAMOND | FANOUT | FANOUT_RAISE
|
|
28
112
|
|
|
29
113
|
|
|
30
|
-
class
|
|
31
|
-
|
|
32
|
-
def __init__(self, ptr=None):
|
|
33
|
-
if ptr is None:
|
|
34
|
-
ptr = ffi.lib.LLVMPY_CreateNewModulePassManager()
|
|
35
|
-
super().__init__(ptr)
|
|
114
|
+
class NewPassManager():
|
|
36
115
|
|
|
37
|
-
def
|
|
38
|
-
|
|
116
|
+
def __init__(self):
|
|
117
|
+
if type(self) is NewPassManager:
|
|
118
|
+
raise TypeError("Cannot instantiate NewPassManager directly")
|
|
39
119
|
|
|
40
|
-
def
|
|
41
|
-
|
|
120
|
+
def run(self,IR, pb):
|
|
121
|
+
if isinstance(self, ModulePassManager):
|
|
122
|
+
ffi.lib.LLVMPY_RunNewModulePassManager(self, IR, pb)
|
|
123
|
+
else:
|
|
124
|
+
ffi.lib.LLVMPY_RunNewFunctionPassManager(self, IR, pb)
|
|
42
125
|
|
|
43
126
|
def add_aa_eval_pass(self):
|
|
44
|
-
|
|
127
|
+
if isinstance(self, ModulePassManager):
|
|
128
|
+
ffi.lib.LLVMPY_module_AddAAEvaluator(self)
|
|
129
|
+
else:
|
|
130
|
+
ffi.lib.LLVMPY_function_AddAAEvaluator(self)
|
|
45
131
|
|
|
46
132
|
def add_simplify_cfg_pass(self):
|
|
47
|
-
|
|
133
|
+
if isinstance(self, ModulePassManager):
|
|
134
|
+
ffi.lib.LLVMPY_module_AddSimplifyCFGPass(self)
|
|
135
|
+
else:
|
|
136
|
+
ffi.lib.LLVMPY_function_AddSimplifyCFGPass(self)
|
|
48
137
|
|
|
49
138
|
def add_loop_unroll_pass(self):
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
139
|
+
if isinstance(self, ModulePassManager):
|
|
140
|
+
ffi.lib.LLVMPY_module_AddLoopUnrollPass(self)
|
|
141
|
+
else:
|
|
142
|
+
ffi.lib.LLVMPY_function_AddLoopUnrollPass(self)
|
|
54
143
|
|
|
55
144
|
def add_instruction_combine_pass(self):
|
|
56
|
-
|
|
145
|
+
if isinstance(self, ModulePassManager):
|
|
146
|
+
ffi.lib.LLVMPY_module_AddInstCombinePass(self)
|
|
147
|
+
else:
|
|
148
|
+
ffi.lib.LLVMPY_function_AddInstCombinePass(self)
|
|
57
149
|
|
|
58
150
|
def add_jump_threading_pass(self, threshold=-1):
|
|
59
|
-
|
|
151
|
+
if isinstance(self, ModulePassManager):
|
|
152
|
+
ffi.lib.LLVMPY_AddJumpThreadingPass_module(self, threshold)
|
|
153
|
+
else:
|
|
154
|
+
ffi.lib.LLVMPY_AddJumpThreadingPass_function(self, threshold)
|
|
155
|
+
|
|
156
|
+
def add_cfg_printer_pass(self):
|
|
157
|
+
if isinstance(self, ModulePassManager):
|
|
158
|
+
ffi.lib.LLVMPY_module_AddCFGPrinterPass(self)
|
|
159
|
+
else:
|
|
160
|
+
ffi.lib.LLVMPY_function_AddCFGPrinterPass(self)
|
|
161
|
+
|
|
162
|
+
def add_cfg_only_printer_pass(self):
|
|
163
|
+
if isinstance(self, ModulePassManager):
|
|
164
|
+
ffi.lib.LLVMPY_module_AddCFGOnlyPrinterPass(self)
|
|
165
|
+
else:
|
|
166
|
+
ffi.lib.LLVMPY_function_AddCFGOnlyPrinterPass(self)
|
|
167
|
+
|
|
168
|
+
def add_dom_printer_pass(self):
|
|
169
|
+
if isinstance(self, ModulePassManager):
|
|
170
|
+
ffi.lib.LLVMPY_module_AddDomPrinter(self)
|
|
171
|
+
else:
|
|
172
|
+
ffi.lib.LLVMPY_function_AddDomPrinter(self)
|
|
173
|
+
|
|
174
|
+
def add_dom_only_printer_pass(self):
|
|
175
|
+
if isinstance(self, ModulePassManager):
|
|
176
|
+
ffi.lib.LLVMPY_module_AddDomOnlyPrinter(self)
|
|
177
|
+
else:
|
|
178
|
+
ffi.lib.LLVMPY_function_AddDomOnlyPrinter(self)
|
|
179
|
+
|
|
180
|
+
def add_post_dom_printer_pass(self):
|
|
181
|
+
if isinstance(self, ModulePassManager):
|
|
182
|
+
ffi.lib.LLVMPY_module_AddPostDomPrinter(self)
|
|
183
|
+
else:
|
|
184
|
+
ffi.lib.LLVMPY_function_AddPostDomPrinter(self)
|
|
185
|
+
|
|
186
|
+
def add_post_dom_only_printer_pass(self):
|
|
187
|
+
if isinstance(self, ModulePassManager):
|
|
188
|
+
ffi.lib.LLVMPY_module_AddPostDomOnlyPrinter(self)
|
|
189
|
+
else:
|
|
190
|
+
ffi.lib.LLVMPY_function_AddPostDomOnlyPrinter(self)
|
|
191
|
+
|
|
192
|
+
def add_dom_viewer_pass(self):
|
|
193
|
+
if isinstance(self, ModulePassManager):
|
|
194
|
+
ffi.lib.LLVMPY_module_AddDomViewer(self)
|
|
195
|
+
else:
|
|
196
|
+
ffi.lib.LLVMPY_function_AddDomViewer(self)
|
|
197
|
+
|
|
198
|
+
def add_dom_only_viewer_pass(self):
|
|
199
|
+
if isinstance(self, ModulePassManager):
|
|
200
|
+
ffi.lib.LLVMPY_module_AddDomOnlyViewer(self)
|
|
201
|
+
else:
|
|
202
|
+
ffi.lib.LLVMPY_function_AddDomOnlyViewer(self)
|
|
203
|
+
|
|
204
|
+
def add_post_dom_viewer_pass(self):
|
|
205
|
+
if isinstance(self, ModulePassManager):
|
|
206
|
+
ffi.lib.LLVMPY_module_AddPostDomViewer(self)
|
|
207
|
+
else:
|
|
208
|
+
ffi.lib.LLVMPY_function_AddPostDomViewer(self)
|
|
209
|
+
|
|
210
|
+
def add_post_dom_only_viewer_pass(self):
|
|
211
|
+
if isinstance(self, ModulePassManager):
|
|
212
|
+
ffi.lib.LLVMPY_module_AddPostDomOnlyViewer(self)
|
|
213
|
+
else:
|
|
214
|
+
ffi.lib.LLVMPY_function_AddPostDomOnlyViewer(self)
|
|
215
|
+
|
|
216
|
+
def add_lint_pass(self):
|
|
217
|
+
if isinstance(self, ModulePassManager):
|
|
218
|
+
ffi.lib.LLVMPY_module_AddLintPass(self)
|
|
219
|
+
else:
|
|
220
|
+
ffi.lib.LLVMPY_function_AddLintPass(self)
|
|
221
|
+
|
|
222
|
+
def add_aggressive_dce_pass(self):
|
|
223
|
+
if isinstance(self, ModulePassManager):
|
|
224
|
+
ffi.lib.LLVMPY_module_AddADCEPass(self)
|
|
225
|
+
else:
|
|
226
|
+
ffi.lib.LLVMPY_function_AddADCEPass(self)
|
|
227
|
+
|
|
228
|
+
def add_break_critical_edges_pass(self):
|
|
229
|
+
if isinstance(self, ModulePassManager):
|
|
230
|
+
ffi.lib.LLVMPY_module_AddBreakCriticalEdgesPass(self)
|
|
231
|
+
else:
|
|
232
|
+
ffi.lib.LLVMPY_function_AddBreakCriticalEdgesPass(self)
|
|
233
|
+
|
|
234
|
+
def add_dead_store_elimination_pass(self):
|
|
235
|
+
if isinstance(self, ModulePassManager):
|
|
236
|
+
ffi.lib.LLVMPY_module_AddDSEPass(self)
|
|
237
|
+
else:
|
|
238
|
+
ffi.lib.LLVMPY_function_AddDSEPass(self)
|
|
239
|
+
|
|
240
|
+
def add_dead_code_elimination_pass(self):
|
|
241
|
+
if isinstance(self, ModulePassManager):
|
|
242
|
+
ffi.lib.LLVMPY_module_AddDCEPass(self)
|
|
243
|
+
else:
|
|
244
|
+
ffi.lib.LLVMPY_function_AddDCEPass(self)
|
|
245
|
+
|
|
246
|
+
def add_aggressive_instcombine_pass(self):
|
|
247
|
+
if isinstance(self, ModulePassManager):
|
|
248
|
+
ffi.lib.LLVMPY_module_AddAggressiveInstCombinePass(self)
|
|
249
|
+
else:
|
|
250
|
+
ffi.lib.LLVMPY_function_AddAggressiveInstCombinePass(self)
|
|
251
|
+
|
|
252
|
+
def add_lcssa_pass(self):
|
|
253
|
+
if isinstance(self, ModulePassManager):
|
|
254
|
+
ffi.lib.LLVMPY_module_AddLCSSAPass(self)
|
|
255
|
+
else:
|
|
256
|
+
ffi.lib.LLVMPY_function_AddLCSSAPass(self)
|
|
257
|
+
|
|
258
|
+
def add_new_gvn_pass(self):
|
|
259
|
+
if isinstance(self, ModulePassManager):
|
|
260
|
+
ffi.lib.LLVMPY_module_AddNewGVNPass(self)
|
|
261
|
+
else:
|
|
262
|
+
ffi.lib.LLVMPY_function_AddNewGVNPass(self)
|
|
263
|
+
|
|
264
|
+
def add_loop_simplify_pass(self):
|
|
265
|
+
if isinstance(self, ModulePassManager):
|
|
266
|
+
ffi.lib.LLVMPY_module_AddLoopSimplifyPass(self)
|
|
267
|
+
else:
|
|
268
|
+
ffi.lib.LLVMPY_function_AddLoopSimplifyPass(self)
|
|
269
|
+
|
|
270
|
+
def add_loop_unroll_and_jam_pass(self):
|
|
271
|
+
if isinstance(self, ModulePassManager):
|
|
272
|
+
ffi.lib.LLVMPY_module_AddLoopUnrollAndJamPass(self)
|
|
273
|
+
else:
|
|
274
|
+
ffi.lib.LLVMPY_function_AddLoopUnrollAndJamPass(self)
|
|
275
|
+
|
|
276
|
+
def add_sccp_pass(self):
|
|
277
|
+
if isinstance(self, ModulePassManager):
|
|
278
|
+
ffi.lib.LLVMPY_module_AddSCCPPass(self)
|
|
279
|
+
else:
|
|
280
|
+
ffi.lib.LLVMPY_function_AddSCCPPass(self)
|
|
281
|
+
|
|
282
|
+
def add_lower_atomic_pass(self):
|
|
283
|
+
if isinstance(self, ModulePassManager):
|
|
284
|
+
ffi.lib.LLVMPY_module_AddLowerAtomicPass(self)
|
|
285
|
+
else:
|
|
286
|
+
ffi.lib.LLVMPY_function_AddLowerAtomicPass(self)
|
|
287
|
+
|
|
288
|
+
def add_lower_invoke_pass(self):
|
|
289
|
+
if isinstance(self, ModulePassManager):
|
|
290
|
+
ffi.lib.LLVMPY_module_AddLowerInvokePass(self)
|
|
291
|
+
else:
|
|
292
|
+
ffi.lib.LLVMPY_function_AddLowerInvokePass(self)
|
|
293
|
+
|
|
294
|
+
def add_lower_switch_pass(self):
|
|
295
|
+
if isinstance(self, ModulePassManager):
|
|
296
|
+
ffi.lib.LLVMPY_module_AddLowerSwitchPass(self)
|
|
297
|
+
else:
|
|
298
|
+
ffi.lib.LLVMPY_function_AddLowerSwitchPass(self)
|
|
299
|
+
|
|
300
|
+
def add_mem_copy_opt_pass(self):
|
|
301
|
+
if isinstance(self, ModulePassManager):
|
|
302
|
+
ffi.lib.LLVMPY_module_AddMemCpyOptPass(self)
|
|
303
|
+
else:
|
|
304
|
+
ffi.lib.LLVMPY_function_AddMemCpyOptPass(self)
|
|
305
|
+
|
|
306
|
+
def add_unify_function_exit_nodes_pass(self):
|
|
307
|
+
if isinstance(self, ModulePassManager):
|
|
308
|
+
ffi.lib.LLVMPY_module_AddUnifyFunctionExitNodesPass(self)
|
|
309
|
+
else:
|
|
310
|
+
ffi.lib.LLVMPY_function_AddUnifyFunctionExitNodesPass(self)
|
|
311
|
+
|
|
312
|
+
def add_reassociate_pass(self):
|
|
313
|
+
if isinstance(self, ModulePassManager):
|
|
314
|
+
ffi.lib.LLVMPY_module_AddReassociatePass(self)
|
|
315
|
+
else:
|
|
316
|
+
ffi.lib.LLVMPY_function_AddReassociatePass(self)
|
|
317
|
+
|
|
318
|
+
def add_register_to_memory_pass(self):
|
|
319
|
+
if isinstance(self, ModulePassManager):
|
|
320
|
+
ffi.lib.LLVMPY_module_AddRegToMemPass(self)
|
|
321
|
+
else:
|
|
322
|
+
ffi.lib.LLVMPY_function_AddRegToMemPass(self)
|
|
323
|
+
|
|
324
|
+
def add_sroa_pass(self):
|
|
325
|
+
if isinstance(self, ModulePassManager):
|
|
326
|
+
ffi.lib.LLVMPY_module_AddSROAPass(self)
|
|
327
|
+
else:
|
|
328
|
+
ffi.lib.LLVMPY_function_AddSROAPass(self)
|
|
329
|
+
|
|
330
|
+
def add_sinking_pass(self):
|
|
331
|
+
if isinstance(self, ModulePassManager):
|
|
332
|
+
ffi.lib.LLVMPY_module_AddSinkingPass(self)
|
|
333
|
+
else:
|
|
334
|
+
ffi.lib.LLVMPY_function_AddSinkingPass(self)
|
|
335
|
+
|
|
336
|
+
def add_tail_call_elimination_pass(self):
|
|
337
|
+
if isinstance(self, ModulePassManager):
|
|
338
|
+
ffi.lib.LLVMPY_module_AddTailCallElimPass(self)
|
|
339
|
+
else:
|
|
340
|
+
ffi.lib.LLVMPY_function_AddTailCallElimPass(self)
|
|
341
|
+
|
|
342
|
+
def add_instruction_namer_pass(self):
|
|
343
|
+
if isinstance(self, ModulePassManager):
|
|
344
|
+
ffi.lib.LLVMPY_module_AddInstructionNamerPass(self)
|
|
345
|
+
else:
|
|
346
|
+
ffi.lib.LLVMPY_function_AddInstructionNamerPass(self)
|
|
347
|
+
|
|
348
|
+
def add_loop_deletion_pass(self):
|
|
349
|
+
if isinstance(self, ModulePassManager):
|
|
350
|
+
ffi.lib.LLVMPY_module_AddLoopDeletionPass(self)
|
|
351
|
+
else:
|
|
352
|
+
ffi.lib.LLVMPY_function_AddLoopDeletionPass(self)
|
|
353
|
+
|
|
354
|
+
def add_loop_strength_reduce_pass(self):
|
|
355
|
+
if isinstance(self, ModulePassManager):
|
|
356
|
+
ffi.lib.LLVMPY_module_AddLoopStrengthReducePass(self)
|
|
357
|
+
else:
|
|
358
|
+
ffi.lib.LLVMPY_function_AddLoopStrengthReducePass(self)
|
|
359
|
+
|
|
360
|
+
def add_loop_rotate_pass(self):
|
|
361
|
+
if isinstance(self, ModulePassManager):
|
|
362
|
+
ffi.lib.LLVMPY_module_AddLoopRotatePass(self)
|
|
363
|
+
else:
|
|
364
|
+
ffi.lib.LLVMPY_function_AddLoopRotatePass(self)
|
|
60
365
|
|
|
61
366
|
def _dispose(self):
|
|
62
|
-
|
|
367
|
+
if isinstance(self, ModulePassManager):
|
|
368
|
+
ffi.lib.LLVMPY_DisposeNewModulePassManger(self)
|
|
369
|
+
else:
|
|
370
|
+
ffi.lib.LLVMPY_DisposeNewFunctionPassManger(self)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class ModulePassManager(ffi.ObjectRef, NewPassManager):
|
|
374
|
+
|
|
375
|
+
def __init__(self, ptr=None):
|
|
376
|
+
if ptr is None:
|
|
377
|
+
ptr = ffi.lib.LLVMPY_CreateNewModulePassManager()
|
|
378
|
+
super().__init__(ptr)
|
|
379
|
+
|
|
380
|
+
def add_verifier(self):
|
|
381
|
+
ffi.lib.LLVMPY_module_AddVerifierPass(self)
|
|
382
|
+
|
|
383
|
+
def add_constant_merge_pass(self):
|
|
384
|
+
ffi.lib.LLVMPY_module_AddConstantMergePass(self)
|
|
385
|
+
|
|
386
|
+
def add_dead_arg_elimination_pass(self):
|
|
387
|
+
ffi.lib.LLVMPY_module_AddDeadArgumentEliminationPass(self)
|
|
388
|
+
|
|
389
|
+
def add_dot_call_graph_printer_pass(self):
|
|
390
|
+
ffi.lib.LLVMPY_module_AddCallGraphDOTPrinterPass(self)
|
|
391
|
+
|
|
392
|
+
# TODO: There are a lot more printer passes in llvm that can be exposed
|
|
393
|
+
# FIXME: Find a way to write the output to a buffer instead of stdout
|
|
394
|
+
def add_module_debug_info_pass(self):
|
|
395
|
+
ffi.lib.LLVMPY_module_AddModuleDebugInfoPrinterPass(self)
|
|
396
|
+
|
|
397
|
+
def add_always_inliner_pass(self):
|
|
398
|
+
ffi.lib.LLVMPY_module_AddAlwaysInlinerPass(self)
|
|
399
|
+
|
|
400
|
+
def add_rpo_function_attrs_pass(self):
|
|
401
|
+
ffi.lib.LLVMPY_module_AddReversePostOrderFunctionAttrsPass(self)
|
|
402
|
+
|
|
403
|
+
def add_global_dead_code_eliminate_pass(self):
|
|
404
|
+
ffi.lib.LLVMPY_module_AddGlobalDCEPass(self)
|
|
405
|
+
|
|
406
|
+
def add_global_opt_pass(self):
|
|
407
|
+
ffi.lib.LLVMPY_module_AddGlobalOptPass(self)
|
|
408
|
+
|
|
409
|
+
def add_ipsccp_pass(self):
|
|
410
|
+
ffi.lib.LLVMPY_module_AddIPSCCPPass(self)
|
|
411
|
+
|
|
412
|
+
def add_internalize_pass(self):
|
|
413
|
+
ffi.lib.LLVMPY_module_AddInternalizePass(self)
|
|
414
|
+
|
|
415
|
+
def add_loop_extract_pass(self):
|
|
416
|
+
ffi.lib.LLVMPY_module_AddLoopExtractorPass(self)
|
|
417
|
+
|
|
418
|
+
def add_merge_functions_pass(self):
|
|
419
|
+
ffi.lib.LLVMPY_module_AddMergeFunctionsPass(self)
|
|
420
|
+
|
|
421
|
+
def add_partial_inliner_pass(self):
|
|
422
|
+
ffi.lib.LLVMPY_module_AddPartialInlinerPass(self)
|
|
423
|
+
|
|
424
|
+
def add_strip_symbols_pass(self):
|
|
425
|
+
ffi.lib.LLVMPY_module_AddStripSymbolsPass(self)
|
|
426
|
+
|
|
427
|
+
def add_strip_dead_debug_info_pass(self):
|
|
428
|
+
ffi.lib.LLVMPY_module_AddStripDeadDebugInfoPass(self)
|
|
429
|
+
|
|
430
|
+
def add_strip_dead_prototype_pass(self):
|
|
431
|
+
ffi.lib.LLVMPY_module_AddStripDeadPrototypesPass(self)
|
|
432
|
+
|
|
433
|
+
def add_strip_debug_declare_pass(self):
|
|
434
|
+
ffi.lib.LLVMPY_module_AddStripDebugDeclarePass(self)
|
|
435
|
+
|
|
436
|
+
def add_strip_non_debug_symbols_pass(self):
|
|
437
|
+
ffi.lib.LLVMPY_module_AddStripNonDebugSymbolsPass(self)
|
|
438
|
+
|
|
439
|
+
def add_argument_promotion_pass(self):
|
|
440
|
+
ffi.lib.LLVMPY_module_AddArgumentPromotionPass(self)
|
|
441
|
+
|
|
442
|
+
def add_post_order_function_attributes_pass(self):
|
|
443
|
+
ffi.lib.LLVMPY_module_AddPostOrderFunctionAttrsPass(self)
|
|
63
444
|
|
|
64
445
|
# Non-standard LLVM passes
|
|
65
446
|
def add_refprune_pass(self, subpasses_flags=RefPruneSubpasses.ALL,
|
|
@@ -80,37 +461,13 @@ class ModulePassManager(ffi.ObjectRef):
|
|
|
80
461
|
ffi.lib.LLVMPY_AddRefPrunePass_module(self, iflags, subgraph_limit)
|
|
81
462
|
|
|
82
463
|
|
|
83
|
-
class FunctionPassManager(ffi.ObjectRef):
|
|
464
|
+
class FunctionPassManager(ffi.ObjectRef, NewPassManager):
|
|
84
465
|
|
|
85
466
|
def __init__(self, ptr=None):
|
|
86
467
|
if ptr is None:
|
|
87
468
|
ptr = ffi.lib.LLVMPY_CreateNewFunctionPassManager()
|
|
88
469
|
super().__init__(ptr)
|
|
89
470
|
|
|
90
|
-
def run(self, fun, pb):
|
|
91
|
-
ffi.lib.LLVMPY_RunNewFunctionPassManager(self, fun, pb)
|
|
92
|
-
|
|
93
|
-
def add_aa_eval_pass(self):
|
|
94
|
-
ffi.lib.LLVMPY_AddAAEvalPass_function(self)
|
|
95
|
-
|
|
96
|
-
def add_simplify_cfg_pass(self):
|
|
97
|
-
ffi.lib.LLVMPY_AddSimplifyCFGPass_function(self)
|
|
98
|
-
|
|
99
|
-
def add_loop_unroll_pass(self):
|
|
100
|
-
ffi.lib.LLVMPY_AddLoopUnrollPass_function(self)
|
|
101
|
-
|
|
102
|
-
def add_loop_rotate_pass(self):
|
|
103
|
-
ffi.lib.LLVMPY_AddLoopRotatePass_function(self)
|
|
104
|
-
|
|
105
|
-
def add_instruction_combine_pass(self):
|
|
106
|
-
ffi.lib.LLVMPY_AddInstructionCombinePass_function(self)
|
|
107
|
-
|
|
108
|
-
def add_jump_threading_pass(self, threshold=-1):
|
|
109
|
-
ffi.lib.LLVMPY_AddJumpThreadingPass_function(self, threshold)
|
|
110
|
-
|
|
111
|
-
def _dispose(self):
|
|
112
|
-
ffi.lib.LLVMPY_DisposeNewFunctionPassManger(self)
|
|
113
|
-
|
|
114
471
|
# Non-standard LLVM passes
|
|
115
472
|
def add_refprune_pass(self, subpasses_flags=RefPruneSubpasses.ALL,
|
|
116
473
|
subgraph_limit=1000):
|
|
@@ -195,25 +552,33 @@ class PipelineTuningOptions(ffi.ObjectRef):
|
|
|
195
552
|
def loop_unrolling(self, value):
|
|
196
553
|
ffi.lib.LLVMPY_PTOSetLoopUnrolling(self, value)
|
|
197
554
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
# return ffi.lib.LLVMPY_PTOGetInlinerThreshold(self)
|
|
555
|
+
@property
|
|
556
|
+
def inlining_threshold(self):
|
|
557
|
+
return ffi.lib.LLVMPY_PTOGetInlinerThreshold(self)
|
|
202
558
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
559
|
+
@inlining_threshold.setter
|
|
560
|
+
def inlining_threshold(self, value):
|
|
561
|
+
ffi.lib.LLVMPY_PTOSetInlinerThreshold(self, value)
|
|
206
562
|
|
|
207
563
|
def _dispose(self):
|
|
208
564
|
ffi.lib.LLVMPY_DisposePipelineTuningOptions(self)
|
|
209
565
|
|
|
210
566
|
|
|
567
|
+
class TimePassesHandler(ffi.ObjectRef):
|
|
568
|
+
def __init__(self):
|
|
569
|
+
super().__init__(ffi.lib.LLVMPY_CreateTimePassesHandler())
|
|
570
|
+
|
|
571
|
+
def _dispose(self):
|
|
572
|
+
ffi.lib.LLVMPY_DisposeTimePassesHandler(self)
|
|
573
|
+
|
|
574
|
+
|
|
211
575
|
class PassBuilder(ffi.ObjectRef):
|
|
212
576
|
|
|
213
577
|
def __init__(self, tm, pto):
|
|
214
578
|
super().__init__(ffi.lib.LLVMPY_CreatePassBuilder(tm, pto))
|
|
215
579
|
self._pto = pto
|
|
216
580
|
self._tm = tm
|
|
581
|
+
self._time_passes_handler = None
|
|
217
582
|
|
|
218
583
|
def getModulePassManager(self):
|
|
219
584
|
return ModulePassManager(
|
|
@@ -227,6 +592,38 @@ class PassBuilder(ffi.ObjectRef):
|
|
|
227
592
|
self, self._pto.speed_level, self._pto.size_level)
|
|
228
593
|
)
|
|
229
594
|
|
|
595
|
+
def start_pass_timing(self):
|
|
596
|
+
"""Enable the pass timers.
|
|
597
|
+
|
|
598
|
+
Raises
|
|
599
|
+
------
|
|
600
|
+
RuntimeError
|
|
601
|
+
If pass timing is already enabled.
|
|
602
|
+
"""
|
|
603
|
+
if self._time_passes_handler:
|
|
604
|
+
raise RuntimeError("Pass timing can only be done once")
|
|
605
|
+
self._time_passes_handler = TimePassesHandler()
|
|
606
|
+
ffi.lib.LLVMPY_EnableTimePasses(self, self._time_passes_handler)
|
|
607
|
+
|
|
608
|
+
def finish_pass_timing(self):
|
|
609
|
+
"""Returns the pass timings report and disables the LLVM internal
|
|
610
|
+
timers. Pass timers are enabled by ``start_pass_timing()``. If the
|
|
611
|
+
timers are not enabled, this function will return an empty string.
|
|
612
|
+
|
|
613
|
+
Returns
|
|
614
|
+
-------
|
|
615
|
+
res : str
|
|
616
|
+
LLVM generated timing report.
|
|
617
|
+
"""
|
|
618
|
+
|
|
619
|
+
if not self._time_passes_handler:
|
|
620
|
+
raise RuntimeError("Pass timing is not enabled")
|
|
621
|
+
|
|
622
|
+
with ffi.OutputString() as buf:
|
|
623
|
+
ffi.lib.LLVMPY_ReportAndDisableTimePasses(
|
|
624
|
+
self._time_passes_handler, buf)
|
|
625
|
+
return str(buf)
|
|
626
|
+
|
|
230
627
|
def _dispose(self):
|
|
231
628
|
ffi.lib.LLVMPY_DisposePassBuilder(self)
|
|
232
629
|
|
|
@@ -234,6 +631,12 @@ class PassBuilder(ffi.ObjectRef):
|
|
|
234
631
|
# ============================================================================
|
|
235
632
|
# FFI
|
|
236
633
|
|
|
634
|
+
ffi.lib.LLVMPY_DumpRefPruneStats.argtypes = [POINTER(_c_PruneStats), c_bool]
|
|
635
|
+
|
|
636
|
+
ffi.lib.LLVMPY_SetTimePasses.argtypes = [c_bool]
|
|
637
|
+
|
|
638
|
+
ffi.lib.LLVMPY_ReportAndResetTimings.argtypes = [POINTER(c_char_p)]
|
|
639
|
+
|
|
237
640
|
# ModulePassManager
|
|
238
641
|
|
|
239
642
|
ffi.lib.LLVMPY_CreateNewModulePassManager.restype = ffi.LLVMModulePassManagerRef
|
|
@@ -242,23 +645,185 @@ ffi.lib.LLVMPY_RunNewModulePassManager.argtypes = [
|
|
|
242
645
|
ffi.LLVMModulePassManagerRef, ffi.LLVMModuleRef,
|
|
243
646
|
ffi.LLVMPassBuilderRef,]
|
|
244
647
|
|
|
245
|
-
ffi.lib.
|
|
246
|
-
ffi.lib.
|
|
247
|
-
ffi.lib.
|
|
648
|
+
ffi.lib.LLVMPY_module_AddVerifierPass.argtypes = [ffi.LLVMModulePassManagerRef,]
|
|
649
|
+
ffi.lib.LLVMPY_module_AddAAEvaluator.argtypes = [ffi.LLVMModulePassManagerRef,]
|
|
650
|
+
ffi.lib.LLVMPY_module_AddSimplifyCFGPass.argtypes = [
|
|
248
651
|
ffi.LLVMModulePassManagerRef,]
|
|
249
652
|
|
|
250
|
-
ffi.lib.
|
|
653
|
+
ffi.lib.LLVMPY_module_AddLoopUnrollPass.argtypes = [
|
|
251
654
|
ffi.LLVMModulePassManagerRef,]
|
|
252
655
|
|
|
253
|
-
ffi.lib.
|
|
656
|
+
ffi.lib.LLVMPY_module_AddLoopRotatePass.argtypes = [
|
|
254
657
|
ffi.LLVMModulePassManagerRef,]
|
|
255
658
|
|
|
256
|
-
ffi.lib.
|
|
659
|
+
ffi.lib.LLVMPY_module_AddInstCombinePass.argtypes = [
|
|
257
660
|
ffi.LLVMModulePassManagerRef,]
|
|
258
661
|
|
|
259
662
|
ffi.lib.LLVMPY_AddJumpThreadingPass_module.argtypes = [
|
|
260
663
|
ffi.LLVMModulePassManagerRef,]
|
|
261
664
|
|
|
665
|
+
ffi.lib.LLVMPY_module_AddCFGPrinterPass.argtypes = [
|
|
666
|
+
ffi.LLVMModulePassManagerRef,]
|
|
667
|
+
|
|
668
|
+
ffi.lib.LLVMPY_module_AddCFGOnlyPrinterPass.argtypes = [
|
|
669
|
+
ffi.LLVMModulePassManagerRef,]
|
|
670
|
+
|
|
671
|
+
ffi.lib.LLVMPY_module_AddDomPrinter.argtypes = [
|
|
672
|
+
ffi.LLVMModulePassManagerRef,]
|
|
673
|
+
|
|
674
|
+
ffi.lib.LLVMPY_module_AddDomOnlyPrinter.argtypes = [
|
|
675
|
+
ffi.LLVMModulePassManagerRef,]
|
|
676
|
+
|
|
677
|
+
ffi.lib.LLVMPY_module_AddPostDomPrinter.argtypes = [
|
|
678
|
+
ffi.LLVMModulePassManagerRef,]
|
|
679
|
+
|
|
680
|
+
ffi.lib.LLVMPY_module_AddPostDomOnlyPrinter.argtypes = [
|
|
681
|
+
ffi.LLVMModulePassManagerRef,]
|
|
682
|
+
|
|
683
|
+
ffi.lib.LLVMPY_module_AddDomViewer.argtypes = [
|
|
684
|
+
ffi.LLVMModulePassManagerRef,]
|
|
685
|
+
|
|
686
|
+
ffi.lib.LLVMPY_module_AddDomOnlyViewer.argtypes = [
|
|
687
|
+
ffi.LLVMModulePassManagerRef,]
|
|
688
|
+
|
|
689
|
+
ffi.lib.LLVMPY_module_AddPostDomViewer.argtypes = [
|
|
690
|
+
ffi.LLVMModulePassManagerRef,]
|
|
691
|
+
|
|
692
|
+
ffi.lib.LLVMPY_module_AddPostDomOnlyViewer.argtypes = [
|
|
693
|
+
ffi.LLVMModulePassManagerRef,]
|
|
694
|
+
|
|
695
|
+
ffi.lib.LLVMPY_module_AddLintPass.argtypes = [
|
|
696
|
+
ffi.LLVMModulePassManagerRef,]
|
|
697
|
+
|
|
698
|
+
ffi.lib.LLVMPY_module_AddADCEPass.argtypes = [
|
|
699
|
+
ffi.LLVMModulePassManagerRef,]
|
|
700
|
+
|
|
701
|
+
ffi.lib.LLVMPY_module_AddBreakCriticalEdgesPass.argtypes = [
|
|
702
|
+
ffi.LLVMModulePassManagerRef,]
|
|
703
|
+
|
|
704
|
+
ffi.lib.LLVMPY_module_AddDSEPass.argtypes = [
|
|
705
|
+
ffi.LLVMModulePassManagerRef,]
|
|
706
|
+
|
|
707
|
+
ffi.lib.LLVMPY_module_AddDCEPass.argtypes = [
|
|
708
|
+
ffi.LLVMModulePassManagerRef,]
|
|
709
|
+
|
|
710
|
+
ffi.lib.LLVMPY_module_AddAggressiveInstCombinePass.argtypes = [
|
|
711
|
+
ffi.LLVMModulePassManagerRef,]
|
|
712
|
+
|
|
713
|
+
ffi.lib.LLVMPY_module_AddLCSSAPass.argtypes = [
|
|
714
|
+
ffi.LLVMModulePassManagerRef,]
|
|
715
|
+
|
|
716
|
+
ffi.lib.LLVMPY_module_AddNewGVNPass.argtypes = [
|
|
717
|
+
ffi.LLVMModulePassManagerRef,]
|
|
718
|
+
|
|
719
|
+
ffi.lib.LLVMPY_module_AddLoopSimplifyPass.argtypes = [
|
|
720
|
+
ffi.LLVMModulePassManagerRef,]
|
|
721
|
+
|
|
722
|
+
ffi.lib.LLVMPY_module_AddLoopUnrollAndJamPass.argtypes = [
|
|
723
|
+
ffi.LLVMModulePassManagerRef,]
|
|
724
|
+
|
|
725
|
+
ffi.lib.LLVMPY_module_AddSCCPPass.argtypes = [
|
|
726
|
+
ffi.LLVMModulePassManagerRef,]
|
|
727
|
+
|
|
728
|
+
ffi.lib.LLVMPY_module_AddLowerAtomicPass.argtypes = [
|
|
729
|
+
ffi.LLVMModulePassManagerRef,]
|
|
730
|
+
|
|
731
|
+
ffi.lib.LLVMPY_module_AddLowerInvokePass.argtypes = [
|
|
732
|
+
ffi.LLVMModulePassManagerRef,]
|
|
733
|
+
|
|
734
|
+
ffi.lib.LLVMPY_module_AddLowerSwitchPass.argtypes = [
|
|
735
|
+
ffi.LLVMModulePassManagerRef,]
|
|
736
|
+
|
|
737
|
+
ffi.lib.LLVMPY_module_AddMemCpyOptPass.argtypes = [
|
|
738
|
+
ffi.LLVMModulePassManagerRef,]
|
|
739
|
+
|
|
740
|
+
ffi.lib.LLVMPY_module_AddUnifyFunctionExitNodesPass.argtypes = [
|
|
741
|
+
ffi.LLVMModulePassManagerRef,]
|
|
742
|
+
|
|
743
|
+
ffi.lib.LLVMPY_module_AddReassociatePass.argtypes = [
|
|
744
|
+
ffi.LLVMModulePassManagerRef,]
|
|
745
|
+
|
|
746
|
+
ffi.lib.LLVMPY_module_AddRegToMemPass.argtypes = [
|
|
747
|
+
ffi.LLVMModulePassManagerRef,]
|
|
748
|
+
|
|
749
|
+
ffi.lib.LLVMPY_module_AddSROAPass.argtypes = [
|
|
750
|
+
ffi.LLVMModulePassManagerRef,]
|
|
751
|
+
|
|
752
|
+
ffi.lib.LLVMPY_module_AddSinkingPass.argtypes = [
|
|
753
|
+
ffi.LLVMModulePassManagerRef,]
|
|
754
|
+
|
|
755
|
+
ffi.lib.LLVMPY_module_AddTailCallElimPass.argtypes = [
|
|
756
|
+
ffi.LLVMModulePassManagerRef,]
|
|
757
|
+
|
|
758
|
+
ffi.lib.LLVMPY_module_AddInstructionNamerPass.argtypes = [
|
|
759
|
+
ffi.LLVMModulePassManagerRef,]
|
|
760
|
+
|
|
761
|
+
ffi.lib.LLVMPY_module_AddLoopDeletionPass.argtypes = [
|
|
762
|
+
ffi.LLVMModulePassManagerRef,]
|
|
763
|
+
|
|
764
|
+
ffi.lib.LLVMPY_module_AddLoopStrengthReducePass.argtypes = [
|
|
765
|
+
ffi.LLVMModulePassManagerRef,]
|
|
766
|
+
|
|
767
|
+
ffi.lib.LLVMPY_module_AddConstantMergePass.argtypes = [
|
|
768
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
769
|
+
|
|
770
|
+
ffi.lib.LLVMPY_module_AddDeadArgumentEliminationPass.argtypes = [
|
|
771
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
772
|
+
|
|
773
|
+
ffi.lib.LLVMPY_module_AddCallGraphDOTPrinterPass.argtypes = [
|
|
774
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
775
|
+
|
|
776
|
+
ffi.lib.LLVMPY_module_AddModuleDebugInfoPrinterPass.argtypes = [
|
|
777
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
778
|
+
|
|
779
|
+
ffi.lib.LLVMPY_module_AddAlwaysInlinerPass.argtypes = [
|
|
780
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
781
|
+
|
|
782
|
+
ffi.lib.LLVMPY_module_AddReversePostOrderFunctionAttrsPass.argtypes = [
|
|
783
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
784
|
+
|
|
785
|
+
ffi.lib.LLVMPY_module_AddGlobalDCEPass.argtypes = [
|
|
786
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
787
|
+
|
|
788
|
+
ffi.lib.LLVMPY_module_AddGlobalOptPass.argtypes = [
|
|
789
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
790
|
+
|
|
791
|
+
ffi.lib.LLVMPY_module_AddIPSCCPPass.argtypes = [
|
|
792
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
793
|
+
|
|
794
|
+
ffi.lib.LLVMPY_module_AddInternalizePass.argtypes = [
|
|
795
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
796
|
+
|
|
797
|
+
ffi.lib.LLVMPY_module_AddLoopExtractorPass.argtypes = [
|
|
798
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
799
|
+
|
|
800
|
+
ffi.lib.LLVMPY_module_AddMergeFunctionsPass.argtypes = [
|
|
801
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
802
|
+
|
|
803
|
+
ffi.lib.LLVMPY_module_AddPartialInlinerPass.argtypes = [
|
|
804
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
805
|
+
|
|
806
|
+
ffi.lib.LLVMPY_module_AddStripSymbolsPass.argtypes = [
|
|
807
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
808
|
+
|
|
809
|
+
ffi.lib.LLVMPY_module_AddStripDeadDebugInfoPass.argtypes = [
|
|
810
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
811
|
+
|
|
812
|
+
ffi.lib.LLVMPY_module_AddStripDeadPrototypesPass.argtypes = [
|
|
813
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
814
|
+
|
|
815
|
+
ffi.lib.LLVMPY_module_AddStripDebugDeclarePass.argtypes = [
|
|
816
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
817
|
+
|
|
818
|
+
ffi.lib.LLVMPY_module_AddStripNonDebugSymbolsPass.argtypes = [
|
|
819
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
820
|
+
|
|
821
|
+
ffi.lib.LLVMPY_module_AddArgumentPromotionPass.argtypes = [
|
|
822
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
823
|
+
|
|
824
|
+
ffi.lib.LLVMPY_module_AddPostOrderFunctionAttrsPass.argtypes = [
|
|
825
|
+
ffi.LLVMModulePassManagerRef, ]
|
|
826
|
+
|
|
262
827
|
ffi.lib.LLVMPY_DisposeNewModulePassManger.argtypes = [
|
|
263
828
|
ffi.LLVMModulePassManagerRef,]
|
|
264
829
|
|
|
@@ -275,24 +840,126 @@ ffi.lib.LLVMPY_RunNewFunctionPassManager.argtypes = [
|
|
|
275
840
|
ffi.LLVMFunctionPassManagerRef, ffi.LLVMValueRef,
|
|
276
841
|
ffi.LLVMPassBuilderRef,]
|
|
277
842
|
|
|
278
|
-
ffi.lib.
|
|
843
|
+
ffi.lib.LLVMPY_function_AddAAEvaluator.argtypes = [
|
|
279
844
|
ffi.LLVMFunctionPassManagerRef,]
|
|
280
845
|
|
|
281
|
-
ffi.lib.
|
|
846
|
+
ffi.lib.LLVMPY_function_AddSimplifyCFGPass.argtypes = [
|
|
282
847
|
ffi.LLVMFunctionPassManagerRef,]
|
|
283
848
|
|
|
284
|
-
ffi.lib.
|
|
849
|
+
ffi.lib.LLVMPY_function_AddLoopUnrollPass.argtypes = [
|
|
285
850
|
ffi.LLVMFunctionPassManagerRef,]
|
|
286
851
|
|
|
287
|
-
ffi.lib.
|
|
288
|
-
ffi.LLVMFunctionPassManagerRef,]
|
|
289
|
-
|
|
290
|
-
ffi.lib.LLVMPY_AddInstructionCombinePass_function.argtypes = [
|
|
852
|
+
ffi.lib.LLVMPY_function_AddInstCombinePass.argtypes = [
|
|
291
853
|
ffi.LLVMFunctionPassManagerRef,]
|
|
292
854
|
|
|
293
855
|
ffi.lib.LLVMPY_AddJumpThreadingPass_function.argtypes = [
|
|
294
856
|
ffi.LLVMFunctionPassManagerRef, c_int,]
|
|
295
857
|
|
|
858
|
+
ffi.lib.LLVMPY_function_AddCFGPrinterPass.argtypes = [
|
|
859
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
860
|
+
|
|
861
|
+
ffi.lib.LLVMPY_function_AddCFGOnlyPrinterPass.argtypes = [
|
|
862
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
863
|
+
|
|
864
|
+
ffi.lib.LLVMPY_function_AddDomPrinter.argtypes = [
|
|
865
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
866
|
+
|
|
867
|
+
ffi.lib.LLVMPY_function_AddDomOnlyPrinter.argtypes = [
|
|
868
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
869
|
+
|
|
870
|
+
ffi.lib.LLVMPY_function_AddPostDomPrinter.argtypes = [
|
|
871
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
872
|
+
|
|
873
|
+
ffi.lib.LLVMPY_function_AddPostDomOnlyPrinter.argtypes = [
|
|
874
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
875
|
+
|
|
876
|
+
ffi.lib.LLVMPY_function_AddDomViewer.argtypes = [
|
|
877
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
878
|
+
|
|
879
|
+
ffi.lib.LLVMPY_function_AddDomOnlyViewer.argtypes = [
|
|
880
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
881
|
+
|
|
882
|
+
ffi.lib.LLVMPY_function_AddPostDomViewer.argtypes = [
|
|
883
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
884
|
+
|
|
885
|
+
ffi.lib.LLVMPY_function_AddPostDomOnlyViewer.argtypes = [
|
|
886
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
887
|
+
|
|
888
|
+
ffi.lib.LLVMPY_function_AddLintPass.argtypes = [
|
|
889
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
890
|
+
|
|
891
|
+
ffi.lib.LLVMPY_function_AddADCEPass.argtypes = [
|
|
892
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
893
|
+
|
|
894
|
+
ffi.lib.LLVMPY_function_AddBreakCriticalEdgesPass.argtypes = [
|
|
895
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
896
|
+
|
|
897
|
+
ffi.lib.LLVMPY_function_AddDSEPass.argtypes = [
|
|
898
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
899
|
+
|
|
900
|
+
ffi.lib.LLVMPY_function_AddDCEPass.argtypes = [
|
|
901
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
902
|
+
|
|
903
|
+
ffi.lib.LLVMPY_function_AddAggressiveInstCombinePass.argtypes = [
|
|
904
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
905
|
+
|
|
906
|
+
ffi.lib.LLVMPY_function_AddLCSSAPass.argtypes = [
|
|
907
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
908
|
+
|
|
909
|
+
ffi.lib.LLVMPY_function_AddNewGVNPass.argtypes = [
|
|
910
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
911
|
+
|
|
912
|
+
ffi.lib.LLVMPY_function_AddLoopSimplifyPass.argtypes = [
|
|
913
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
914
|
+
|
|
915
|
+
ffi.lib.LLVMPY_function_AddLoopUnrollAndJamPass.argtypes = [
|
|
916
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
917
|
+
|
|
918
|
+
ffi.lib.LLVMPY_function_AddSCCPPass.argtypes = [
|
|
919
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
920
|
+
|
|
921
|
+
ffi.lib.LLVMPY_function_AddLowerAtomicPass.argtypes = [
|
|
922
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
923
|
+
|
|
924
|
+
ffi.lib.LLVMPY_function_AddLowerInvokePass.argtypes = [
|
|
925
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
926
|
+
|
|
927
|
+
ffi.lib.LLVMPY_function_AddLowerSwitchPass.argtypes = [
|
|
928
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
929
|
+
|
|
930
|
+
ffi.lib.LLVMPY_function_AddMemCpyOptPass.argtypes = [
|
|
931
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
932
|
+
|
|
933
|
+
ffi.lib.LLVMPY_function_AddUnifyFunctionExitNodesPass.argtypes = [
|
|
934
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
935
|
+
|
|
936
|
+
ffi.lib.LLVMPY_function_AddReassociatePass.argtypes = [
|
|
937
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
938
|
+
|
|
939
|
+
ffi.lib.LLVMPY_function_AddRegToMemPass.argtypes = [
|
|
940
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
941
|
+
|
|
942
|
+
ffi.lib.LLVMPY_function_AddSROAPass.argtypes = [
|
|
943
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
944
|
+
|
|
945
|
+
ffi.lib.LLVMPY_function_AddSinkingPass.argtypes = [
|
|
946
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
947
|
+
|
|
948
|
+
ffi.lib.LLVMPY_function_AddTailCallElimPass.argtypes = [
|
|
949
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
950
|
+
|
|
951
|
+
ffi.lib.LLVMPY_function_AddInstructionNamerPass.argtypes = [
|
|
952
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
953
|
+
|
|
954
|
+
ffi.lib.LLVMPY_function_AddLoopRotatePass.argtypes = [
|
|
955
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
956
|
+
|
|
957
|
+
ffi.lib.LLVMPY_function_AddLoopDeletionPass.argtypes = [
|
|
958
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
959
|
+
|
|
960
|
+
ffi.lib.LLVMPY_function_AddLoopStrengthReducePass.argtypes = [
|
|
961
|
+
ffi.LLVMFunctionPassManagerRef, ]
|
|
962
|
+
|
|
296
963
|
ffi.lib.LLVMPY_DisposeNewFunctionPassManger.argtypes = [
|
|
297
964
|
ffi.LLVMFunctionPassManagerRef,]
|
|
298
965
|
|
|
@@ -333,25 +1000,50 @@ ffi.lib.LLVMPY_PTOGetLoopUnrolling.argtypes = [
|
|
|
333
1000
|
ffi.lib.LLVMPY_PTOSetLoopUnrolling.argtypes = [
|
|
334
1001
|
ffi.LLVMPipelineTuningOptionsRef, c_bool]
|
|
335
1002
|
|
|
1003
|
+
ffi.lib.LLVMPY_PTOGetInlinerThreshold.restype = c_int
|
|
1004
|
+
|
|
1005
|
+
ffi.lib.LLVMPY_PTOSetInlinerThreshold.argtypes = [
|
|
1006
|
+
ffi.LLVMPipelineTuningOptionsRef, c_int]
|
|
1007
|
+
|
|
336
1008
|
ffi.lib.LLVMPY_DisposePipelineTuningOptions.argtypes = \
|
|
337
1009
|
[ffi.LLVMPipelineTuningOptionsRef,]
|
|
338
1010
|
|
|
339
1011
|
# PassBuilder
|
|
340
1012
|
|
|
341
1013
|
ffi.lib.LLVMPY_CreatePassBuilder.restype = ffi.LLVMPassBuilderRef
|
|
342
|
-
ffi.lib.LLVMPY_CreatePassBuilder.argtypes = [
|
|
343
|
-
|
|
1014
|
+
ffi.lib.LLVMPY_CreatePassBuilder.argtypes = [
|
|
1015
|
+
ffi.LLVMTargetMachineRef,
|
|
1016
|
+
ffi.LLVMPipelineTuningOptionsRef,
|
|
1017
|
+
]
|
|
344
1018
|
|
|
345
1019
|
ffi.lib.LLVMPY_DisposePassBuilder.argtypes = [ffi.LLVMPassBuilderRef,]
|
|
346
1020
|
|
|
1021
|
+
ffi.lib.LLVMPY_CreateTimePassesHandler.restype = \
|
|
1022
|
+
ffi.LLVMTimePassesHandlerRef
|
|
1023
|
+
|
|
1024
|
+
ffi.lib.LLVMPY_DisposeTimePassesHandler.argtypes = [
|
|
1025
|
+
ffi.LLVMTimePassesHandlerRef,]
|
|
1026
|
+
|
|
1027
|
+
ffi.lib.LLVMPY_EnableTimePasses.argtypes = [
|
|
1028
|
+
ffi.LLVMPassBuilderRef,
|
|
1029
|
+
ffi.LLVMTimePassesHandlerRef,
|
|
1030
|
+
]
|
|
1031
|
+
|
|
1032
|
+
ffi.lib.LLVMPY_ReportAndDisableTimePasses.argtypes = [
|
|
1033
|
+
ffi.LLVMTimePassesHandlerRef,
|
|
1034
|
+
POINTER(c_char_p),
|
|
1035
|
+
]
|
|
1036
|
+
|
|
347
1037
|
# Pipeline builders
|
|
348
1038
|
|
|
349
1039
|
ffi.lib.LLVMPY_buildPerModuleDefaultPipeline.restype = \
|
|
350
1040
|
ffi.LLVMModulePassManagerRef
|
|
1041
|
+
|
|
351
1042
|
ffi.lib.LLVMPY_buildPerModuleDefaultPipeline.argtypes = [
|
|
352
1043
|
ffi.LLVMPassBuilderRef, c_int, c_int]
|
|
353
1044
|
|
|
354
1045
|
ffi.lib.LLVMPY_buildFunctionSimplificationPipeline.restype = \
|
|
355
1046
|
ffi.LLVMFunctionPassManagerRef
|
|
1047
|
+
|
|
356
1048
|
ffi.lib.LLVMPY_buildFunctionSimplificationPipeline.argtypes = [
|
|
357
1049
|
ffi.LLVMPassBuilderRef, c_int, c_int]
|