llvmlite 0.42.0__cp310-cp310-win_amd64.whl → 0.43.0rc1__cp310-cp310-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.

Files changed (46) hide show
  1. llvmlite/__init__.py +3 -3
  2. llvmlite/_version.py +2 -2
  3. llvmlite/binding/__init__.py +18 -18
  4. llvmlite/binding/analysis.py +69 -69
  5. llvmlite/binding/common.py +34 -34
  6. llvmlite/binding/context.py +29 -29
  7. llvmlite/binding/dylib.py +45 -45
  8. llvmlite/binding/executionengine.py +330 -330
  9. llvmlite/binding/ffi.py +390 -390
  10. llvmlite/binding/initfini.py +73 -73
  11. llvmlite/binding/linker.py +20 -20
  12. llvmlite/binding/llvmlite.dll +0 -0
  13. llvmlite/binding/module.py +349 -349
  14. llvmlite/binding/object_file.py +82 -82
  15. llvmlite/binding/options.py +17 -17
  16. llvmlite/binding/orcjit.py +342 -342
  17. llvmlite/binding/passmanagers.py +939 -932
  18. llvmlite/binding/targets.py +450 -450
  19. llvmlite/binding/transforms.py +151 -151
  20. llvmlite/binding/typeref.py +198 -198
  21. llvmlite/binding/value.py +618 -618
  22. llvmlite/ir/__init__.py +11 -11
  23. llvmlite/ir/_utils.py +80 -80
  24. llvmlite/ir/builder.py +1119 -1119
  25. llvmlite/ir/context.py +20 -20
  26. llvmlite/ir/instructions.py +893 -893
  27. llvmlite/ir/module.py +246 -246
  28. llvmlite/ir/transforms.py +64 -64
  29. llvmlite/ir/types.py +614 -614
  30. llvmlite/ir/values.py +1217 -1217
  31. llvmlite/tests/__init__.py +57 -57
  32. llvmlite/tests/__main__.py +3 -3
  33. llvmlite/tests/customize.py +407 -407
  34. llvmlite/tests/refprune_proto.py +329 -329
  35. llvmlite/tests/test_binding.py +2585 -2582
  36. llvmlite/tests/test_ir.py +2729 -2729
  37. llvmlite/tests/test_refprune.py +557 -526
  38. llvmlite/tests/test_valuerepr.py +60 -60
  39. llvmlite/utils.py +29 -29
  40. {llvmlite-0.42.0.dist-info → llvmlite-0.43.0rc1.dist-info}/LICENSE +24 -24
  41. {llvmlite-0.42.0.dist-info → llvmlite-0.43.0rc1.dist-info}/LICENSE.thirdparty +225 -225
  42. {llvmlite-0.42.0.dist-info → llvmlite-0.43.0rc1.dist-info}/METADATA +1 -1
  43. llvmlite-0.43.0rc1.dist-info/RECORD +45 -0
  44. {llvmlite-0.42.0.dist-info → llvmlite-0.43.0rc1.dist-info}/WHEEL +1 -1
  45. llvmlite-0.42.0.dist-info/RECORD +0 -45
  46. {llvmlite-0.42.0.dist-info → llvmlite-0.43.0rc1.dist-info}/top_level.txt +0 -0
@@ -1,198 +1,198 @@
1
- from ctypes import c_int, c_bool, c_void_p, c_uint64
2
- import enum
3
-
4
- from llvmlite.binding import ffi
5
-
6
-
7
- class TypeKind(enum.IntEnum):
8
- # The LLVMTypeKind enum from llvm-c/Core.h
9
-
10
- void = 0
11
- half = 1
12
- float = 2
13
- double = 3
14
- x86_fp80 = 4
15
- fp128 = 5
16
- ppc_fp128 = 6
17
- label = 7
18
- integer = 8
19
- function = 9
20
- struct = 10
21
- array = 11
22
- pointer = 12
23
- vector = 13
24
- metadata = 14
25
- x86_mmx = 15
26
- token = 16
27
- scalable_vector = 17
28
- bfloat = 18
29
- x86_amx = 19
30
-
31
-
32
- class TypeRef(ffi.ObjectRef):
33
- """A weak reference to a LLVM type
34
- """
35
- @property
36
- def name(self):
37
- """
38
- Get type name
39
- """
40
- return ffi.ret_string(ffi.lib.LLVMPY_GetTypeName(self))
41
-
42
- @property
43
- def is_struct(self):
44
- """
45
- Returns true if the type is a struct type.
46
- """
47
- return ffi.lib.LLVMPY_TypeIsStruct(self)
48
-
49
- @property
50
- def is_pointer(self):
51
- """
52
- Returns true if the type is a pointer type.
53
- """
54
- return ffi.lib.LLVMPY_TypeIsPointer(self)
55
-
56
- @property
57
- def is_array(self):
58
- """
59
- Returns true if the type is an array type.
60
- """
61
- return ffi.lib.LLVMPY_TypeIsArray(self)
62
-
63
- @property
64
- def is_vector(self):
65
- """
66
- Returns true if the type is a vector type.
67
- """
68
- return ffi.lib.LLVMPY_TypeIsVector(self)
69
-
70
- @property
71
- def is_function_vararg(self):
72
- """
73
- Returns true if a function type accepts a variable number of arguments.
74
- When the type is not a function, raises exception.
75
- """
76
- if self.type_kind != TypeKind.function:
77
- raise ValueError("Type {} is not a function".format(self))
78
- return ffi.lib.LLVMPY_IsFunctionVararg(self)
79
-
80
- @property
81
- def elements(self):
82
- """
83
- Returns iterator over enclosing types
84
- """
85
- return _TypeListIterator(ffi.lib.LLVMPY_ElementIter(self))
86
-
87
- @property
88
- def element_type(self):
89
- """
90
- Returns the pointed-to type. When the type is not a pointer,
91
- raises exception.
92
- """
93
- if not self.is_pointer:
94
- raise ValueError("Type {} is not a pointer".format(self))
95
- return TypeRef(ffi.lib.LLVMPY_GetElementType(self))
96
-
97
- @property
98
- def element_count(self):
99
- """
100
- Returns the number of elements in an array or a vector. For scalable
101
- vectors, returns minimum number of elements. When the type is neither
102
- an array nor a vector, raises exception.
103
- """
104
- if not self.is_array and not self.is_vector:
105
- raise ValueError("Type {} is not an array nor vector".format(self))
106
- return ffi.lib.LLVMPY_GetTypeElementCount(self)
107
-
108
- @property
109
- def type_width(self):
110
- """
111
- Return the basic size of this type if it is a primitive type. These are
112
- fixed by LLVM and are not target-dependent.
113
- This will return zero if the type does not have a size or is not a
114
- primitive type.
115
-
116
- If this is a scalable vector type, the scalable property will be set and
117
- the runtime size will be a positive integer multiple of the base size.
118
-
119
- Note that this may not reflect the size of memory allocated for an
120
- instance of the type or the number of bytes that are written when an
121
- instance of the type is stored to memory.
122
- """
123
- return ffi.lib.LLVMPY_GetTypeBitWidth(self)
124
-
125
- @property
126
- def type_kind(self):
127
- """
128
- Returns the LLVMTypeKind enumeration of this type.
129
- """
130
- return TypeKind(ffi.lib.LLVMPY_GetTypeKind(self))
131
-
132
- def __str__(self):
133
- return ffi.ret_string(ffi.lib.LLVMPY_PrintType(self))
134
-
135
-
136
- class _TypeIterator(ffi.ObjectRef):
137
-
138
- def __next__(self):
139
- vp = self._next()
140
- if vp:
141
- return TypeRef(vp)
142
- else:
143
- raise StopIteration
144
-
145
- next = __next__
146
-
147
- def __iter__(self):
148
- return self
149
-
150
-
151
- class _TypeListIterator(_TypeIterator):
152
-
153
- def _dispose(self):
154
- self._capi.LLVMPY_DisposeElementIter(self)
155
-
156
- def _next(self):
157
- return ffi.lib.LLVMPY_ElementIterNext(self)
158
-
159
-
160
- # FFI
161
-
162
- ffi.lib.LLVMPY_PrintType.argtypes = [ffi.LLVMTypeRef]
163
- ffi.lib.LLVMPY_PrintType.restype = c_void_p
164
-
165
- ffi.lib.LLVMPY_GetElementType.argtypes = [ffi.LLVMTypeRef]
166
- ffi.lib.LLVMPY_GetElementType.restype = ffi.LLVMTypeRef
167
-
168
- ffi.lib.LLVMPY_TypeIsPointer.argtypes = [ffi.LLVMTypeRef]
169
- ffi.lib.LLVMPY_TypeIsPointer.restype = c_bool
170
-
171
- ffi.lib.LLVMPY_TypeIsArray.argtypes = [ffi.LLVMTypeRef]
172
- ffi.lib.LLVMPY_TypeIsArray.restype = c_bool
173
-
174
- ffi.lib.LLVMPY_TypeIsVector.argtypes = [ffi.LLVMTypeRef]
175
- ffi.lib.LLVMPY_TypeIsVector.restype = c_bool
176
-
177
- ffi.lib.LLVMPY_TypeIsStruct.argtypes = [ffi.LLVMTypeRef]
178
- ffi.lib.LLVMPY_TypeIsStruct.restype = c_bool
179
-
180
- ffi.lib.LLVMPY_IsFunctionVararg.argtypes = [ffi.LLVMTypeRef]
181
- ffi.lib.LLVMPY_IsFunctionVararg.restype = c_bool
182
-
183
- ffi.lib.LLVMPY_GetTypeKind.argtypes = [ffi.LLVMTypeRef]
184
- ffi.lib.LLVMPY_GetTypeKind.restype = c_int
185
-
186
- ffi.lib.LLVMPY_GetTypeElementCount.argtypes = [ffi.LLVMTypeRef]
187
- ffi.lib.LLVMPY_GetTypeElementCount.restype = c_int
188
-
189
- ffi.lib.LLVMPY_GetTypeBitWidth.argtypes = [ffi.LLVMTypeRef]
190
- ffi.lib.LLVMPY_GetTypeBitWidth.restype = c_uint64
191
-
192
- ffi.lib.LLVMPY_ElementIter.argtypes = [ffi.LLVMTypeRef]
193
- ffi.lib.LLVMPY_ElementIter.restype = ffi.LLVMElementIterator
194
-
195
- ffi.lib.LLVMPY_ElementIterNext.argtypes = [ffi.LLVMElementIterator]
196
- ffi.lib.LLVMPY_ElementIterNext.restype = ffi.LLVMTypeRef
197
-
198
- ffi.lib.LLVMPY_DisposeElementIter.argtypes = [ffi.LLVMElementIterator]
1
+ from ctypes import c_int, c_bool, c_void_p, c_uint64
2
+ import enum
3
+
4
+ from llvmlite.binding import ffi
5
+
6
+
7
+ class TypeKind(enum.IntEnum):
8
+ # The LLVMTypeKind enum from llvm-c/Core.h
9
+
10
+ void = 0
11
+ half = 1
12
+ float = 2
13
+ double = 3
14
+ x86_fp80 = 4
15
+ fp128 = 5
16
+ ppc_fp128 = 6
17
+ label = 7
18
+ integer = 8
19
+ function = 9
20
+ struct = 10
21
+ array = 11
22
+ pointer = 12
23
+ vector = 13
24
+ metadata = 14
25
+ x86_mmx = 15
26
+ token = 16
27
+ scalable_vector = 17
28
+ bfloat = 18
29
+ x86_amx = 19
30
+
31
+
32
+ class TypeRef(ffi.ObjectRef):
33
+ """A weak reference to a LLVM type
34
+ """
35
+ @property
36
+ def name(self):
37
+ """
38
+ Get type name
39
+ """
40
+ return ffi.ret_string(ffi.lib.LLVMPY_GetTypeName(self))
41
+
42
+ @property
43
+ def is_struct(self):
44
+ """
45
+ Returns true if the type is a struct type.
46
+ """
47
+ return ffi.lib.LLVMPY_TypeIsStruct(self)
48
+
49
+ @property
50
+ def is_pointer(self):
51
+ """
52
+ Returns true if the type is a pointer type.
53
+ """
54
+ return ffi.lib.LLVMPY_TypeIsPointer(self)
55
+
56
+ @property
57
+ def is_array(self):
58
+ """
59
+ Returns true if the type is an array type.
60
+ """
61
+ return ffi.lib.LLVMPY_TypeIsArray(self)
62
+
63
+ @property
64
+ def is_vector(self):
65
+ """
66
+ Returns true if the type is a vector type.
67
+ """
68
+ return ffi.lib.LLVMPY_TypeIsVector(self)
69
+
70
+ @property
71
+ def is_function_vararg(self):
72
+ """
73
+ Returns true if a function type accepts a variable number of arguments.
74
+ When the type is not a function, raises exception.
75
+ """
76
+ if self.type_kind != TypeKind.function:
77
+ raise ValueError("Type {} is not a function".format(self))
78
+ return ffi.lib.LLVMPY_IsFunctionVararg(self)
79
+
80
+ @property
81
+ def elements(self):
82
+ """
83
+ Returns iterator over enclosing types
84
+ """
85
+ return _TypeListIterator(ffi.lib.LLVMPY_ElementIter(self))
86
+
87
+ @property
88
+ def element_type(self):
89
+ """
90
+ Returns the pointed-to type. When the type is not a pointer,
91
+ raises exception.
92
+ """
93
+ if not self.is_pointer:
94
+ raise ValueError("Type {} is not a pointer".format(self))
95
+ return TypeRef(ffi.lib.LLVMPY_GetElementType(self))
96
+
97
+ @property
98
+ def element_count(self):
99
+ """
100
+ Returns the number of elements in an array or a vector. For scalable
101
+ vectors, returns minimum number of elements. When the type is neither
102
+ an array nor a vector, raises exception.
103
+ """
104
+ if not self.is_array and not self.is_vector:
105
+ raise ValueError("Type {} is not an array nor vector".format(self))
106
+ return ffi.lib.LLVMPY_GetTypeElementCount(self)
107
+
108
+ @property
109
+ def type_width(self):
110
+ """
111
+ Return the basic size of this type if it is a primitive type. These are
112
+ fixed by LLVM and are not target-dependent.
113
+ This will return zero if the type does not have a size or is not a
114
+ primitive type.
115
+
116
+ If this is a scalable vector type, the scalable property will be set and
117
+ the runtime size will be a positive integer multiple of the base size.
118
+
119
+ Note that this may not reflect the size of memory allocated for an
120
+ instance of the type or the number of bytes that are written when an
121
+ instance of the type is stored to memory.
122
+ """
123
+ return ffi.lib.LLVMPY_GetTypeBitWidth(self)
124
+
125
+ @property
126
+ def type_kind(self):
127
+ """
128
+ Returns the LLVMTypeKind enumeration of this type.
129
+ """
130
+ return TypeKind(ffi.lib.LLVMPY_GetTypeKind(self))
131
+
132
+ def __str__(self):
133
+ return ffi.ret_string(ffi.lib.LLVMPY_PrintType(self))
134
+
135
+
136
+ class _TypeIterator(ffi.ObjectRef):
137
+
138
+ def __next__(self):
139
+ vp = self._next()
140
+ if vp:
141
+ return TypeRef(vp)
142
+ else:
143
+ raise StopIteration
144
+
145
+ next = __next__
146
+
147
+ def __iter__(self):
148
+ return self
149
+
150
+
151
+ class _TypeListIterator(_TypeIterator):
152
+
153
+ def _dispose(self):
154
+ self._capi.LLVMPY_DisposeElementIter(self)
155
+
156
+ def _next(self):
157
+ return ffi.lib.LLVMPY_ElementIterNext(self)
158
+
159
+
160
+ # FFI
161
+
162
+ ffi.lib.LLVMPY_PrintType.argtypes = [ffi.LLVMTypeRef]
163
+ ffi.lib.LLVMPY_PrintType.restype = c_void_p
164
+
165
+ ffi.lib.LLVMPY_GetElementType.argtypes = [ffi.LLVMTypeRef]
166
+ ffi.lib.LLVMPY_GetElementType.restype = ffi.LLVMTypeRef
167
+
168
+ ffi.lib.LLVMPY_TypeIsPointer.argtypes = [ffi.LLVMTypeRef]
169
+ ffi.lib.LLVMPY_TypeIsPointer.restype = c_bool
170
+
171
+ ffi.lib.LLVMPY_TypeIsArray.argtypes = [ffi.LLVMTypeRef]
172
+ ffi.lib.LLVMPY_TypeIsArray.restype = c_bool
173
+
174
+ ffi.lib.LLVMPY_TypeIsVector.argtypes = [ffi.LLVMTypeRef]
175
+ ffi.lib.LLVMPY_TypeIsVector.restype = c_bool
176
+
177
+ ffi.lib.LLVMPY_TypeIsStruct.argtypes = [ffi.LLVMTypeRef]
178
+ ffi.lib.LLVMPY_TypeIsStruct.restype = c_bool
179
+
180
+ ffi.lib.LLVMPY_IsFunctionVararg.argtypes = [ffi.LLVMTypeRef]
181
+ ffi.lib.LLVMPY_IsFunctionVararg.restype = c_bool
182
+
183
+ ffi.lib.LLVMPY_GetTypeKind.argtypes = [ffi.LLVMTypeRef]
184
+ ffi.lib.LLVMPY_GetTypeKind.restype = c_int
185
+
186
+ ffi.lib.LLVMPY_GetTypeElementCount.argtypes = [ffi.LLVMTypeRef]
187
+ ffi.lib.LLVMPY_GetTypeElementCount.restype = c_int
188
+
189
+ ffi.lib.LLVMPY_GetTypeBitWidth.argtypes = [ffi.LLVMTypeRef]
190
+ ffi.lib.LLVMPY_GetTypeBitWidth.restype = c_uint64
191
+
192
+ ffi.lib.LLVMPY_ElementIter.argtypes = [ffi.LLVMTypeRef]
193
+ ffi.lib.LLVMPY_ElementIter.restype = ffi.LLVMElementIterator
194
+
195
+ ffi.lib.LLVMPY_ElementIterNext.argtypes = [ffi.LLVMElementIterator]
196
+ ffi.lib.LLVMPY_ElementIterNext.restype = ffi.LLVMTypeRef
197
+
198
+ ffi.lib.LLVMPY_DisposeElementIter.argtypes = [ffi.LLVMElementIterator]