llvmlite 0.46.0b1__cp310-cp310-macosx_11_0_universal2.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.

Files changed (45) hide show
  1. llvmlite/__init__.py +11 -0
  2. llvmlite/_version.py +11 -0
  3. llvmlite/binding/__init__.py +18 -0
  4. llvmlite/binding/analysis.py +69 -0
  5. llvmlite/binding/common.py +34 -0
  6. llvmlite/binding/config.py +143 -0
  7. llvmlite/binding/context.py +31 -0
  8. llvmlite/binding/dylib.py +45 -0
  9. llvmlite/binding/executionengine.py +330 -0
  10. llvmlite/binding/ffi.py +395 -0
  11. llvmlite/binding/initfini.py +85 -0
  12. llvmlite/binding/libllvmlite.dylib +0 -0
  13. llvmlite/binding/linker.py +20 -0
  14. llvmlite/binding/module.py +349 -0
  15. llvmlite/binding/newpassmanagers.py +1049 -0
  16. llvmlite/binding/object_file.py +82 -0
  17. llvmlite/binding/options.py +17 -0
  18. llvmlite/binding/orcjit.py +342 -0
  19. llvmlite/binding/targets.py +462 -0
  20. llvmlite/binding/typeref.py +267 -0
  21. llvmlite/binding/value.py +632 -0
  22. llvmlite/ir/__init__.py +11 -0
  23. llvmlite/ir/_utils.py +80 -0
  24. llvmlite/ir/builder.py +1120 -0
  25. llvmlite/ir/context.py +20 -0
  26. llvmlite/ir/instructions.py +920 -0
  27. llvmlite/ir/module.py +256 -0
  28. llvmlite/ir/transforms.py +64 -0
  29. llvmlite/ir/types.py +730 -0
  30. llvmlite/ir/values.py +1217 -0
  31. llvmlite/tests/__init__.py +57 -0
  32. llvmlite/tests/__main__.py +3 -0
  33. llvmlite/tests/customize.py +407 -0
  34. llvmlite/tests/refprune_proto.py +330 -0
  35. llvmlite/tests/test_binding.py +3155 -0
  36. llvmlite/tests/test_ir.py +3095 -0
  37. llvmlite/tests/test_refprune.py +574 -0
  38. llvmlite/tests/test_valuerepr.py +60 -0
  39. llvmlite/utils.py +29 -0
  40. llvmlite-0.46.0b1.dist-info/LICENSE +24 -0
  41. llvmlite-0.46.0b1.dist-info/LICENSE.thirdparty +225 -0
  42. llvmlite-0.46.0b1.dist-info/METADATA +137 -0
  43. llvmlite-0.46.0b1.dist-info/RECORD +45 -0
  44. llvmlite-0.46.0b1.dist-info/WHEEL +5 -0
  45. llvmlite-0.46.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,632 @@
1
+ from ctypes import (POINTER, byref, cast, c_char_p, c_double, c_int, c_size_t,
2
+ c_uint, c_uint64, c_bool, c_void_p)
3
+ import enum
4
+
5
+ from llvmlite.binding import ffi
6
+ from llvmlite.binding.common import _decode_string, _encode_string
7
+ from llvmlite.binding.typeref import TypeRef
8
+
9
+
10
+ class Linkage(enum.IntEnum):
11
+ # The LLVMLinkage enum from llvm-c/Core.h
12
+
13
+ external = 0
14
+ available_externally = 1
15
+ linkonce_any = 2
16
+ linkonce_odr = 3
17
+ linkonce_odr_autohide = 4
18
+ weak_any = 5
19
+ weak_odr = 6
20
+ appending = 7
21
+ internal = 8
22
+ private = 9
23
+ dllimport = 10
24
+ dllexport = 11
25
+ external_weak = 12
26
+ ghost = 13
27
+ common = 14
28
+ linker_private = 15
29
+ linker_private_weak = 16
30
+
31
+
32
+ class Visibility(enum.IntEnum):
33
+ # The LLVMVisibility enum from llvm-c/Core.h
34
+
35
+ default = 0
36
+ hidden = 1
37
+ protected = 2
38
+
39
+
40
+ class StorageClass(enum.IntEnum):
41
+ # The LLVMDLLStorageClass enum from llvm-c/Core.h
42
+
43
+ default = 0
44
+ dllimport = 1
45
+ dllexport = 2
46
+
47
+
48
+ class ValueKind(enum.IntEnum):
49
+ # The LLVMValueKind enum from llvm-c/Core.h
50
+
51
+ argument = 0
52
+ basic_block = 1
53
+ memory_use = 2
54
+ memory_def = 3
55
+ memory_phi = 4
56
+
57
+ function = 5
58
+ global_alias = 6
59
+ global_ifunc = 7
60
+ global_variable = 8
61
+ block_address = 9
62
+ constant_expr = 10
63
+ constant_array = 11
64
+ constant_struct = 12
65
+ constant_vector = 13
66
+
67
+ undef_value = 14
68
+ constant_aggregate_zero = 15
69
+ constant_data_array = 16
70
+ constant_data_vector = 17
71
+ constant_int = 18
72
+ constant_fp = 19
73
+ constant_pointer_null = 20
74
+ constant_token_none = 21
75
+
76
+ metadata_as_value = 22
77
+ inline_asm = 23
78
+
79
+ instruction = 24
80
+ poison_value = 25
81
+
82
+
83
+ class ValueRef(ffi.ObjectRef):
84
+ """A weak reference to a LLVM value.
85
+ """
86
+
87
+ def __init__(self, ptr, kind, parents):
88
+ self._kind = kind
89
+ self._parents = parents
90
+ ffi.ObjectRef.__init__(self, ptr)
91
+
92
+ def __str__(self):
93
+ with ffi.OutputString() as outstr:
94
+ ffi.lib.LLVMPY_PrintValueToString(self, outstr)
95
+ return str(outstr)
96
+
97
+ @property
98
+ def module(self):
99
+ """
100
+ The module this function or global variable value was obtained from.
101
+ """
102
+ return self._parents.get('module')
103
+
104
+ @property
105
+ def function(self):
106
+ """
107
+ The function this argument or basic block value was obtained from.
108
+ """
109
+ return self._parents.get('function')
110
+
111
+ @property
112
+ def block(self):
113
+ """
114
+ The block this instruction value was obtained from.
115
+ """
116
+ return self._parents.get('block')
117
+
118
+ @property
119
+ def instruction(self):
120
+ """
121
+ The instruction this operand value was obtained from.
122
+ """
123
+ return self._parents.get('instruction')
124
+
125
+ @property
126
+ def is_global(self):
127
+ return self._kind == 'global'
128
+
129
+ @property
130
+ def is_function(self):
131
+ return self._kind == 'function'
132
+
133
+ @property
134
+ def is_block(self):
135
+ return self._kind == 'block'
136
+
137
+ @property
138
+ def is_argument(self):
139
+ return self._kind == 'argument'
140
+
141
+ @property
142
+ def is_instruction(self):
143
+ return self._kind == 'instruction'
144
+
145
+ @property
146
+ def is_operand(self):
147
+ return self._kind == 'operand'
148
+
149
+ @property
150
+ def is_constant(self):
151
+ return bool(ffi.lib.LLVMPY_IsConstant(self))
152
+
153
+ @property
154
+ def value_kind(self):
155
+ return ValueKind(ffi.lib.LLVMPY_GetValueKind(self))
156
+
157
+ @property
158
+ def name(self):
159
+ return _decode_string(ffi.lib.LLVMPY_GetValueName(self))
160
+
161
+ @name.setter
162
+ def name(self, val):
163
+ ffi.lib.LLVMPY_SetValueName(self, _encode_string(val))
164
+
165
+ @property
166
+ def linkage(self):
167
+ return Linkage(ffi.lib.LLVMPY_GetLinkage(self))
168
+
169
+ @linkage.setter
170
+ def linkage(self, value):
171
+ if not isinstance(value, Linkage):
172
+ value = Linkage[value]
173
+ ffi.lib.LLVMPY_SetLinkage(self, value)
174
+
175
+ @property
176
+ def visibility(self):
177
+ return Visibility(ffi.lib.LLVMPY_GetVisibility(self))
178
+
179
+ @visibility.setter
180
+ def visibility(self, value):
181
+ if not isinstance(value, Visibility):
182
+ value = Visibility[value]
183
+ ffi.lib.LLVMPY_SetVisibility(self, value)
184
+
185
+ @property
186
+ def storage_class(self):
187
+ return StorageClass(ffi.lib.LLVMPY_GetDLLStorageClass(self))
188
+
189
+ @storage_class.setter
190
+ def storage_class(self, value):
191
+ if not isinstance(value, StorageClass):
192
+ value = StorageClass[value]
193
+ ffi.lib.LLVMPY_SetDLLStorageClass(self, value)
194
+
195
+ def add_function_attribute(self, attr):
196
+ """Only works on function value
197
+
198
+ Parameters
199
+ -----------
200
+ attr : str
201
+ attribute name
202
+ """
203
+ if not self.is_function:
204
+ raise ValueError('expected function value, got %s' % (self._kind,))
205
+ attrname = str(attr)
206
+ attrval = ffi.lib.LLVMPY_GetEnumAttributeKindForName(
207
+ _encode_string(attrname), len(attrname))
208
+ if attrval == 0:
209
+ raise ValueError('no such attribute {!r}'.format(attrname))
210
+ ffi.lib.LLVMPY_AddFunctionAttr(self, attrval)
211
+
212
+ @property
213
+ def type(self):
214
+ """
215
+ This value's LLVM type.
216
+ """
217
+ # XXX what does this return?
218
+ return TypeRef(ffi.lib.LLVMPY_TypeOf(self))
219
+
220
+ @property
221
+ def global_value_type(self):
222
+ """
223
+ Uses ``LLVMGlobalGetValueType()``.
224
+ Needed for opaque pointers in globals.
225
+ > For globals, use getValueType().
226
+ See https://llvm.org/docs/OpaquePointers.html#migration-instructions
227
+ """
228
+ assert self.is_global or self.is_function
229
+ return TypeRef(ffi.lib.LLVMPY_GlobalGetValueType(self))
230
+
231
+ @property
232
+ def is_declaration(self):
233
+ """
234
+ Whether this value (presumably global) is defined in the current
235
+ module.
236
+ """
237
+ if not (self.is_global or self.is_function):
238
+ raise ValueError('expected global or function value, got %s'
239
+ % (self._kind,))
240
+ return ffi.lib.LLVMPY_IsDeclaration(self)
241
+
242
+ @property
243
+ def attributes(self):
244
+ """
245
+ Return an iterator over this value's attributes.
246
+ The iterator will yield a string for each attribute.
247
+ """
248
+ itr = iter(())
249
+ if self.is_function:
250
+ it = ffi.lib.LLVMPY_FunctionAttributesIter(self)
251
+ itr = _AttributeListIterator(it)
252
+ elif self.is_instruction:
253
+ if self.opcode == 'call':
254
+ it = ffi.lib.LLVMPY_CallInstAttributesIter(self)
255
+ itr = _AttributeListIterator(it)
256
+ elif self.opcode == 'invoke':
257
+ it = ffi.lib.LLVMPY_InvokeInstAttributesIter(self)
258
+ itr = _AttributeListIterator(it)
259
+ elif self.is_global:
260
+ it = ffi.lib.LLVMPY_GlobalAttributesIter(self)
261
+ itr = _AttributeSetIterator(it)
262
+ elif self.is_argument:
263
+ it = ffi.lib.LLVMPY_ArgumentAttributesIter(self)
264
+ itr = _AttributeSetIterator(it)
265
+ return itr
266
+
267
+ @property
268
+ def blocks(self):
269
+ """
270
+ Return an iterator over this function's blocks.
271
+ The iterator will yield a ValueRef for each block.
272
+ """
273
+ if not self.is_function:
274
+ raise ValueError('expected function value, got %s' % (self._kind,))
275
+ it = ffi.lib.LLVMPY_FunctionBlocksIter(self)
276
+ parents = self._parents.copy()
277
+ parents.update(function=self)
278
+ return _BlocksIterator(it, parents)
279
+
280
+ @property
281
+ def arguments(self):
282
+ """
283
+ Return an iterator over this function's arguments.
284
+ The iterator will yield a ValueRef for each argument.
285
+ """
286
+ if not self.is_function:
287
+ raise ValueError('expected function value, got %s' % (self._kind,))
288
+ it = ffi.lib.LLVMPY_FunctionArgumentsIter(self)
289
+ parents = self._parents.copy()
290
+ parents.update(function=self)
291
+ return _ArgumentsIterator(it, parents)
292
+
293
+ @property
294
+ def instructions(self):
295
+ """
296
+ Return an iterator over this block's instructions.
297
+ The iterator will yield a ValueRef for each instruction.
298
+ """
299
+ if not self.is_block:
300
+ raise ValueError('expected block value, got %s' % (self._kind,))
301
+ it = ffi.lib.LLVMPY_BlockInstructionsIter(self)
302
+ parents = self._parents.copy()
303
+ parents.update(block=self)
304
+ return _InstructionsIterator(it, parents)
305
+
306
+ @property
307
+ def operands(self):
308
+ """
309
+ Return an iterator over this instruction's operands.
310
+ The iterator will yield a ValueRef for each operand.
311
+ """
312
+ if not self.is_instruction:
313
+ raise ValueError('expected instruction value, got %s'
314
+ % (self._kind,))
315
+ it = ffi.lib.LLVMPY_InstructionOperandsIter(self)
316
+ parents = self._parents.copy()
317
+ parents.update(instruction=self)
318
+ return _OperandsIterator(it, parents)
319
+
320
+ @property
321
+ def opcode(self):
322
+ if not self.is_instruction:
323
+ raise ValueError('expected instruction value, got %s'
324
+ % (self._kind,))
325
+ return ffi.ret_string(ffi.lib.LLVMPY_GetOpcodeName(self))
326
+
327
+ @property
328
+ def incoming_blocks(self):
329
+ """
330
+ Return an iterator over this phi instruction's incoming blocks.
331
+ The iterator will yield a ValueRef for each block.
332
+ """
333
+ if not self.is_instruction or self.opcode != 'phi':
334
+ raise ValueError('expected phi instruction value, got %s'
335
+ % (self._kind,))
336
+ it = ffi.lib.LLVMPY_PhiIncomingBlocksIter(self)
337
+ parents = self._parents.copy()
338
+ parents.update(instruction=self)
339
+ return _IncomingBlocksIterator(it, parents)
340
+
341
+ def get_constant_value(self, signed_int=False, round_fp=False):
342
+ """
343
+ Return the constant value, either as a literal (when supported)
344
+ or as a string.
345
+
346
+ Parameters
347
+ -----------
348
+ signed_int : bool
349
+ if True and the constant is an integer, returns a signed version
350
+ round_fp : bool
351
+ if True and the constant is a floating point value, rounds the
352
+ result upon accuracy loss (e.g., when querying an fp128 value).
353
+ By default, raises an exception on accuracy loss
354
+ """
355
+ if not self.is_constant:
356
+ raise ValueError('expected constant value, got %s'
357
+ % (self._kind,))
358
+
359
+ if self.value_kind == ValueKind.constant_int:
360
+ # Python integers are also arbitrary-precision
361
+ little_endian = c_bool(False)
362
+ words = ffi.lib.LLVMPY_GetConstantIntNumWords(self)
363
+ ptr = ffi.lib.LLVMPY_GetConstantIntRawValue(
364
+ self, byref(little_endian))
365
+ asbytes = bytes(cast(ptr, POINTER(c_uint64 * words)).contents)
366
+ return int.from_bytes(
367
+ asbytes,
368
+ ('little' if little_endian.value else 'big'),
369
+ signed=signed_int,
370
+ )
371
+ elif self.value_kind == ValueKind.constant_fp:
372
+ # Convert floating-point values to double-precision (Python float)
373
+ accuracy_loss = c_bool(False)
374
+ value = ffi.lib.LLVMPY_GetConstantFPValue(self,
375
+ byref(accuracy_loss))
376
+ if accuracy_loss.value and not round_fp:
377
+ raise ValueError(
378
+ 'Accuracy loss encountered in conversion of constant '
379
+ f'value {str(self)}')
380
+
381
+ return value
382
+
383
+ # Otherwise, return the IR string
384
+ return str(self)
385
+
386
+
387
+ class _ValueIterator(ffi.ObjectRef):
388
+
389
+ kind = None # derived classes must specify the Value kind value
390
+ # as class attribute
391
+
392
+ def __init__(self, ptr, parents):
393
+ ffi.ObjectRef.__init__(self, ptr)
394
+ # Keep parent objects (module, function, etc) alive
395
+ self._parents = parents
396
+ if self.kind is None:
397
+ raise NotImplementedError('%s must specify kind attribute'
398
+ % (type(self).__name__,))
399
+
400
+ def __next__(self):
401
+ vp = self._next()
402
+ if vp:
403
+ return ValueRef(vp, self.kind, self._parents)
404
+ else:
405
+ raise StopIteration
406
+
407
+ next = __next__
408
+
409
+ def __iter__(self):
410
+ return self
411
+
412
+
413
+ class _AttributeIterator(ffi.ObjectRef):
414
+
415
+ def __next__(self):
416
+ vp = self._next()
417
+ if vp:
418
+ return vp
419
+ else:
420
+ raise StopIteration
421
+
422
+ next = __next__
423
+
424
+ def __iter__(self):
425
+ return self
426
+
427
+
428
+ class _AttributeListIterator(_AttributeIterator):
429
+
430
+ def _dispose(self):
431
+ self._capi.LLVMPY_DisposeAttributeListIter(self)
432
+
433
+ def _next(self):
434
+ return ffi.ret_bytes(ffi.lib.LLVMPY_AttributeListIterNext(self))
435
+
436
+
437
+ class _AttributeSetIterator(_AttributeIterator):
438
+
439
+ def _dispose(self):
440
+ self._capi.LLVMPY_DisposeAttributeSetIter(self)
441
+
442
+ def _next(self):
443
+ return ffi.ret_bytes(ffi.lib.LLVMPY_AttributeSetIterNext(self))
444
+
445
+
446
+ class _BlocksIterator(_ValueIterator):
447
+
448
+ kind = 'block'
449
+
450
+ def _dispose(self):
451
+ self._capi.LLVMPY_DisposeBlocksIter(self)
452
+
453
+ def _next(self):
454
+ return ffi.lib.LLVMPY_BlocksIterNext(self)
455
+
456
+
457
+ class _ArgumentsIterator(_ValueIterator):
458
+
459
+ kind = 'argument'
460
+
461
+ def _dispose(self):
462
+ self._capi.LLVMPY_DisposeArgumentsIter(self)
463
+
464
+ def _next(self):
465
+ return ffi.lib.LLVMPY_ArgumentsIterNext(self)
466
+
467
+
468
+ class _InstructionsIterator(_ValueIterator):
469
+
470
+ kind = 'instruction'
471
+
472
+ def _dispose(self):
473
+ self._capi.LLVMPY_DisposeInstructionsIter(self)
474
+
475
+ def _next(self):
476
+ return ffi.lib.LLVMPY_InstructionsIterNext(self)
477
+
478
+
479
+ class _OperandsIterator(_ValueIterator):
480
+
481
+ kind = 'operand'
482
+
483
+ def _dispose(self):
484
+ self._capi.LLVMPY_DisposeOperandsIter(self)
485
+
486
+ def _next(self):
487
+ return ffi.lib.LLVMPY_OperandsIterNext(self)
488
+
489
+
490
+ class _IncomingBlocksIterator(_ValueIterator):
491
+
492
+ kind = 'block'
493
+
494
+ def _dispose(self):
495
+ self._capi.LLVMPY_DisposeIncomingBlocksIter(self)
496
+
497
+ def _next(self):
498
+ return ffi.lib.LLVMPY_IncomingBlocksIterNext(self)
499
+
500
+
501
+ # FFI
502
+
503
+ ffi.lib.LLVMPY_PrintValueToString.argtypes = [
504
+ ffi.LLVMValueRef,
505
+ POINTER(c_char_p)
506
+ ]
507
+
508
+ ffi.lib.LLVMPY_GetGlobalParent.argtypes = [ffi.LLVMValueRef]
509
+ ffi.lib.LLVMPY_GetGlobalParent.restype = ffi.LLVMModuleRef
510
+
511
+ ffi.lib.LLVMPY_GetValueName.argtypes = [ffi.LLVMValueRef]
512
+ ffi.lib.LLVMPY_GetValueName.restype = c_char_p
513
+
514
+ ffi.lib.LLVMPY_SetValueName.argtypes = [ffi.LLVMValueRef, c_char_p]
515
+
516
+ ffi.lib.LLVMPY_TypeOf.argtypes = [ffi.LLVMValueRef]
517
+ ffi.lib.LLVMPY_TypeOf.restype = ffi.LLVMTypeRef
518
+
519
+ ffi.lib.LLVMPY_GlobalGetValueType.argtypes = [ffi.LLVMValueRef]
520
+ ffi.lib.LLVMPY_GlobalGetValueType.restype = ffi.LLVMTypeRef
521
+
522
+ ffi.lib.LLVMPY_GetTypeName.argtypes = [ffi.LLVMTypeRef]
523
+ ffi.lib.LLVMPY_GetTypeName.restype = c_void_p
524
+
525
+ ffi.lib.LLVMPY_GetLinkage.argtypes = [ffi.LLVMValueRef]
526
+ ffi.lib.LLVMPY_GetLinkage.restype = c_int
527
+
528
+ ffi.lib.LLVMPY_SetLinkage.argtypes = [ffi.LLVMValueRef, c_int]
529
+
530
+ ffi.lib.LLVMPY_GetVisibility.argtypes = [ffi.LLVMValueRef]
531
+ ffi.lib.LLVMPY_GetVisibility.restype = c_int
532
+
533
+ ffi.lib.LLVMPY_SetVisibility.argtypes = [ffi.LLVMValueRef, c_int]
534
+
535
+ ffi.lib.LLVMPY_GetDLLStorageClass.argtypes = [ffi.LLVMValueRef]
536
+ ffi.lib.LLVMPY_GetDLLStorageClass.restype = c_int
537
+
538
+ ffi.lib.LLVMPY_SetDLLStorageClass.argtypes = [ffi.LLVMValueRef, c_int]
539
+
540
+ ffi.lib.LLVMPY_GetEnumAttributeKindForName.argtypes = [c_char_p, c_size_t]
541
+ ffi.lib.LLVMPY_GetEnumAttributeKindForName.restype = c_uint
542
+
543
+ ffi.lib.LLVMPY_AddFunctionAttr.argtypes = [ffi.LLVMValueRef, c_uint]
544
+
545
+ ffi.lib.LLVMPY_IsDeclaration.argtypes = [ffi.LLVMValueRef]
546
+ ffi.lib.LLVMPY_IsDeclaration.restype = c_int
547
+
548
+ ffi.lib.LLVMPY_FunctionAttributesIter.argtypes = [ffi.LLVMValueRef]
549
+ ffi.lib.LLVMPY_FunctionAttributesIter.restype = ffi.LLVMAttributeListIterator
550
+
551
+ ffi.lib.LLVMPY_CallInstAttributesIter.argtypes = [ffi.LLVMValueRef]
552
+ ffi.lib.LLVMPY_CallInstAttributesIter.restype = ffi.LLVMAttributeListIterator
553
+
554
+ ffi.lib.LLVMPY_InvokeInstAttributesIter.argtypes = [ffi.LLVMValueRef]
555
+ ffi.lib.LLVMPY_InvokeInstAttributesIter.restype = ffi.LLVMAttributeListIterator
556
+
557
+ ffi.lib.LLVMPY_GlobalAttributesIter.argtypes = [ffi.LLVMValueRef]
558
+ ffi.lib.LLVMPY_GlobalAttributesIter.restype = ffi.LLVMAttributeSetIterator
559
+
560
+ ffi.lib.LLVMPY_ArgumentAttributesIter.argtypes = [ffi.LLVMValueRef]
561
+ ffi.lib.LLVMPY_ArgumentAttributesIter.restype = ffi.LLVMAttributeSetIterator
562
+
563
+ ffi.lib.LLVMPY_FunctionBlocksIter.argtypes = [ffi.LLVMValueRef]
564
+ ffi.lib.LLVMPY_FunctionBlocksIter.restype = ffi.LLVMBlocksIterator
565
+
566
+ ffi.lib.LLVMPY_FunctionArgumentsIter.argtypes = [ffi.LLVMValueRef]
567
+ ffi.lib.LLVMPY_FunctionArgumentsIter.restype = ffi.LLVMArgumentsIterator
568
+
569
+ ffi.lib.LLVMPY_BlockInstructionsIter.argtypes = [ffi.LLVMValueRef]
570
+ ffi.lib.LLVMPY_BlockInstructionsIter.restype = ffi.LLVMInstructionsIterator
571
+
572
+ ffi.lib.LLVMPY_InstructionOperandsIter.argtypes = [ffi.LLVMValueRef]
573
+ ffi.lib.LLVMPY_InstructionOperandsIter.restype = ffi.LLVMOperandsIterator
574
+
575
+ ffi.lib.LLVMPY_PhiIncomingBlocksIter.argtypes = [ffi.LLVMValueRef]
576
+ ffi.lib.LLVMPY_PhiIncomingBlocksIter.restype = ffi.LLVMIncomingBlocksIterator
577
+
578
+ ffi.lib.LLVMPY_DisposeAttributeListIter.argtypes = [
579
+ ffi.LLVMAttributeListIterator]
580
+
581
+ ffi.lib.LLVMPY_DisposeAttributeSetIter.argtypes = [ffi.LLVMAttributeSetIterator]
582
+
583
+ ffi.lib.LLVMPY_DisposeBlocksIter.argtypes = [ffi.LLVMBlocksIterator]
584
+
585
+ ffi.lib.LLVMPY_DisposeInstructionsIter.argtypes = [ffi.LLVMInstructionsIterator]
586
+
587
+ ffi.lib.LLVMPY_DisposeOperandsIter.argtypes = [ffi.LLVMOperandsIterator]
588
+
589
+ ffi.lib.LLVMPY_DisposeIncomingBlocksIter.argtypes = [
590
+ ffi.LLVMIncomingBlocksIterator]
591
+
592
+ ffi.lib.LLVMPY_AttributeListIterNext.argtypes = [ffi.LLVMAttributeListIterator]
593
+ ffi.lib.LLVMPY_AttributeListIterNext.restype = c_void_p
594
+
595
+ ffi.lib.LLVMPY_AttributeSetIterNext.argtypes = [ffi.LLVMAttributeSetIterator]
596
+ ffi.lib.LLVMPY_AttributeSetIterNext.restype = c_void_p
597
+
598
+ ffi.lib.LLVMPY_BlocksIterNext.argtypes = [ffi.LLVMBlocksIterator]
599
+ ffi.lib.LLVMPY_BlocksIterNext.restype = ffi.LLVMValueRef
600
+
601
+ ffi.lib.LLVMPY_ArgumentsIterNext.argtypes = [ffi.LLVMArgumentsIterator]
602
+ ffi.lib.LLVMPY_ArgumentsIterNext.restype = ffi.LLVMValueRef
603
+
604
+ ffi.lib.LLVMPY_InstructionsIterNext.argtypes = [ffi.LLVMInstructionsIterator]
605
+ ffi.lib.LLVMPY_InstructionsIterNext.restype = ffi.LLVMValueRef
606
+
607
+ ffi.lib.LLVMPY_OperandsIterNext.argtypes = [ffi.LLVMOperandsIterator]
608
+ ffi.lib.LLVMPY_OperandsIterNext.restype = ffi.LLVMValueRef
609
+
610
+ ffi.lib.LLVMPY_IncomingBlocksIterNext.argtypes = [
611
+ ffi.LLVMIncomingBlocksIterator]
612
+ ffi.lib.LLVMPY_IncomingBlocksIterNext.restype = ffi.LLVMValueRef
613
+
614
+ ffi.lib.LLVMPY_GetOpcodeName.argtypes = [ffi.LLVMValueRef]
615
+ ffi.lib.LLVMPY_GetOpcodeName.restype = c_void_p
616
+
617
+ ffi.lib.LLVMPY_IsConstant.argtypes = [ffi.LLVMValueRef]
618
+ ffi.lib.LLVMPY_IsConstant.restype = c_bool
619
+
620
+ ffi.lib.LLVMPY_GetValueKind.argtypes = [ffi.LLVMValueRef]
621
+ ffi.lib.LLVMPY_GetValueKind.restype = c_int
622
+
623
+ ffi.lib.LLVMPY_GetConstantIntRawValue.argtypes = [ffi.LLVMValueRef,
624
+ POINTER(c_bool)]
625
+ ffi.lib.LLVMPY_GetConstantIntRawValue.restype = POINTER(c_uint64)
626
+
627
+ ffi.lib.LLVMPY_GetConstantIntNumWords.argtypes = [ffi.LLVMValueRef]
628
+ ffi.lib.LLVMPY_GetConstantIntNumWords.restype = c_uint
629
+
630
+ ffi.lib.LLVMPY_GetConstantFPValue.argtypes = [ffi.LLVMValueRef,
631
+ POINTER(c_bool)]
632
+ ffi.lib.LLVMPY_GetConstantFPValue.restype = c_double
@@ -0,0 +1,11 @@
1
+ """
2
+ This subpackage implements the LLVM IR classes in pure python
3
+ """
4
+
5
+ from .types import *
6
+ from .values import *
7
+ from .module import *
8
+ from .builder import *
9
+ from .instructions import *
10
+ from .transforms import *
11
+ from .context import Context, global_context