llvmlite 0.44.0rc2__cp312-cp312-macosx_11_0_arm64.whl → 0.45.0rc1__cp312-cp312-macosx_11_0_arm64.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.

@@ -7,9 +7,9 @@ from llvmlite.binding.initfini import llvm_version_info
7
7
  from llvmlite.binding.common import _decode_string, _encode_string
8
8
  from collections import namedtuple
9
9
 
10
- # FIXME: Remove `opaque_pointers_enabled` once typed pointers are no longer
11
- # supported.
12
- from llvmlite import opaque_pointers_enabled
10
+ # import for backward compatible API, `has_svml` is now in config module.
11
+ from llvmlite.binding.config import _has_svml as has_svml # noqa: F401
12
+
13
13
 
14
14
  Triple = namedtuple('Triple', ['Arch', 'SubArch', 'Vendor',
15
15
  'OS', 'Env', 'ObjectFormat'])
@@ -119,28 +119,17 @@ def get_host_cpu_name():
119
119
  llvm_version_major = llvm_version_info[0]
120
120
 
121
121
 
122
- if llvm_version_major >= 15:
123
- _object_formats = {
124
- 0: "Unknown",
125
- 1: "COFF",
126
- 2: "DXContainer",
127
- 3: "ELF",
128
- 4: "GOFF",
129
- 5: "MachO",
130
- 6: "SPIRV",
131
- 7: "Wasm",
132
- 8: "XCOFF",
133
- }
134
- else:
135
- _object_formats = {
136
- 0: "Unknown",
137
- 1: "COFF",
138
- 2: "ELF",
139
- 3: "GOFF",
140
- 4: "MachO",
141
- 5: "Wasm",
142
- 6: "XCOFF",
143
- }
122
+ _object_formats = {
123
+ 0: "Unknown",
124
+ 1: "COFF",
125
+ 2: "DXContainer",
126
+ 3: "ELF",
127
+ 4: "GOFF",
128
+ 5: "MachO",
129
+ 6: "SPIRV",
130
+ 7: "Wasm",
131
+ 8: "XCOFF",
132
+ }
144
133
 
145
134
 
146
135
  def get_object_format(triple=None):
@@ -202,30 +191,6 @@ class TargetData(ffi.ObjectRef):
202
191
  """
203
192
  return ffi.lib.LLVMPY_ABIAlignmentOfType(self, ty)
204
193
 
205
- def get_pointee_abi_size(self, ty):
206
- """
207
- Get ABI size of pointee type of LLVM pointer type *ty*.
208
- """
209
- if opaque_pointers_enabled:
210
- raise RuntimeError("Cannot get pointee type in opaque pointer "
211
- "mode.")
212
- size = ffi.lib.LLVMPY_ABISizeOfElementType(self, ty)
213
- if size == -1:
214
- raise RuntimeError("Not a pointer type: %s" % (ty,))
215
- return size
216
-
217
- def get_pointee_abi_alignment(self, ty):
218
- """
219
- Get minimum ABI alignment of pointee type of LLVM pointer type *ty*.
220
- """
221
- if opaque_pointers_enabled:
222
- raise RuntimeError("Cannot get pointee type in opaque pointer "
223
- "mode.")
224
- size = ffi.lib.LLVMPY_ABIAlignmentOfElementType(self, ty)
225
- if size == -1:
226
- raise RuntimeError("Not a pointer type: %s" % (ty,))
227
- return size
228
-
229
194
 
230
195
  RELOC = frozenset(['default', 'static', 'pic', 'dynamicnopic'])
231
196
  CODEMODEL = frozenset(['default', 'jitdefault', 'small', 'kernel', 'medium',
@@ -387,16 +352,6 @@ class TargetMachine(ffi.ObjectRef):
387
352
  return str(out)
388
353
 
389
354
 
390
- def has_svml():
391
- """
392
- Returns True if SVML was enabled at FFI support compile time.
393
- """
394
- if ffi.lib.LLVMPY_HasSVMLSupport() == 0:
395
- return False
396
- else:
397
- return True
398
-
399
-
400
355
  # ============================================================================
401
356
  # FFI
402
357
 
@@ -440,16 +395,6 @@ ffi.lib.LLVMPY_ABIAlignmentOfType.argtypes = [ffi.LLVMTargetDataRef,
440
395
  ffi.LLVMTypeRef]
441
396
  ffi.lib.LLVMPY_ABIAlignmentOfType.restype = c_longlong
442
397
 
443
- # FIXME: Remove me once typed pointers are no longer supported.
444
- ffi.lib.LLVMPY_ABISizeOfElementType.argtypes = [ffi.LLVMTargetDataRef,
445
- ffi.LLVMTypeRef]
446
- ffi.lib.LLVMPY_ABISizeOfElementType.restype = c_longlong
447
-
448
- # FIXME: Remove me once typed pointers are no longer supported.
449
- ffi.lib.LLVMPY_ABIAlignmentOfElementType.argtypes = [ffi.LLVMTargetDataRef,
450
- ffi.LLVMTypeRef]
451
- ffi.lib.LLVMPY_ABIAlignmentOfElementType.restype = c_longlong
452
-
453
398
  ffi.lib.LLVMPY_GetTargetFromTriple.argtypes = [c_char_p, POINTER(c_char_p)]
454
399
  ffi.lib.LLVMPY_GetTargetFromTriple.restype = ffi.LLVMTargetRef
455
400
 
@@ -515,6 +460,3 @@ ffi.lib.LLVMPY_CreateTargetMachineData.argtypes = [
515
460
  ffi.LLVMTargetMachineRef,
516
461
  ]
517
462
  ffi.lib.LLVMPY_CreateTargetMachineData.restype = ffi.LLVMTargetDataRef
518
-
519
- ffi.lib.LLVMPY_HasSVMLSupport.argtypes = []
520
- ffi.lib.LLVMPY_HasSVMLSupport.restype = c_int
@@ -4,9 +4,6 @@ import enum
4
4
  from llvmlite import ir
5
5
  from llvmlite.binding import ffi
6
6
 
7
- # FIXME: Remove `opaque_pointers_enabled' when TP's are removed.
8
- from llvmlite import opaque_pointers_enabled
9
-
10
7
 
11
8
  class TypeKind(enum.IntEnum):
12
9
  # The LLVMTypeKind enum from llvm-c/Core.h
@@ -108,21 +105,10 @@ class TypeRef(ffi.ObjectRef):
108
105
  """
109
106
  Returns iterator over enclosing types
110
107
  """
111
- if self.is_pointer and opaque_pointers_enabled:
108
+ if self.is_pointer:
112
109
  raise ValueError("Type {} doesn't contain elements.".format(self))
113
110
  return _TypeListIterator(ffi.lib.LLVMPY_ElementIter(self))
114
111
 
115
- # FIXME: Remove me once typed pointers support is removed.
116
- @property
117
- def element_type(self):
118
- """
119
- Returns the pointed-to type. When the type is not a pointer,
120
- raises exception.
121
- """
122
- if not self.is_pointer:
123
- raise ValueError("Type {} is not a pointer".format(self))
124
- return TypeRef(ffi.lib.LLVMPY_GetElementType(self))
125
-
126
112
  @property
127
113
  def element_count(self):
128
114
  """
@@ -226,10 +212,6 @@ class _TypeListIterator(_TypeIterator):
226
212
  ffi.lib.LLVMPY_PrintType.argtypes = [ffi.LLVMTypeRef]
227
213
  ffi.lib.LLVMPY_PrintType.restype = c_void_p
228
214
 
229
- # FIXME: Remove me once typed pointers support is removed.
230
- ffi.lib.LLVMPY_GetElementType.argtypes = [ffi.LLVMTypeRef]
231
- ffi.lib.LLVMPY_GetElementType.restype = ffi.LLVMTypeRef
232
-
233
215
  ffi.lib.LLVMPY_TypeIsPointer.argtypes = [ffi.LLVMTypeRef]
234
216
  ffi.lib.LLVMPY_TypeIsPointer.restype = c_bool
235
217
 
llvmlite/ir/module.py CHANGED
@@ -42,6 +42,15 @@ class Module(object):
42
42
  fixed_ops.append((name, op))
43
43
  return fixed_ops
44
44
 
45
+ def str_ditok_operands(self, operands):
46
+ str_ops = []
47
+ for name, op in operands:
48
+ if name == 'encoding' and isinstance(op, values.DIToken):
49
+ # use string value instead of address of object
50
+ op = op.value
51
+ str_ops.append((name, op))
52
+ return str_ops
53
+
45
54
  def add_metadata(self, operands):
46
55
  """
47
56
  Add an unnamed metadata to the module with the given *operands*
@@ -73,7 +82,8 @@ class Module(object):
73
82
  an instruction.
74
83
  """
75
84
  operands = tuple(sorted(self._fix_di_operands(operands.items())))
76
- key = (kind, operands, is_distinct)
85
+ str_op_key = tuple(sorted(self.str_ditok_operands(operands)))
86
+ key = (kind, str_op_key, is_distinct)
77
87
  if key not in self._metadatacache:
78
88
  n = len(self.metadata)
79
89
  di = values.DIValue(self, is_distinct, kind, operands, name=str(n))
llvmlite/ir/types.py CHANGED
@@ -4,11 +4,9 @@ Classes that are LLVM types
4
4
 
5
5
  import struct
6
6
 
7
+ from llvmlite import ir_layer_typed_pointers_enabled
7
8
  from llvmlite.ir._utils import _StrCaching
8
9
 
9
- # FIXME: Remove me once typed pointers are no longer supported.
10
- from llvmlite import opaque_pointers_enabled
11
-
12
10
 
13
11
  def _wrapname(x):
14
12
  return '"{0}"'.format(x.replace('\\', '\\5c').replace('"', '\\22'))
@@ -137,16 +135,22 @@ class PointerType(Type):
137
135
  else:
138
136
  return "ptr"
139
137
 
138
+ def __eq__(self, other):
139
+ return (isinstance(other, PointerType) and
140
+ self.addrspace == other.addrspace)
141
+
140
142
  def __hash__(self):
141
143
  return hash(PointerType)
142
144
 
145
+ @property
146
+ def intrinsic_name(self):
147
+ return 'p%d' % self.addrspace
148
+
143
149
  @classmethod
144
150
  def from_llvm(cls, typeref, ir_ctx):
145
151
  """
146
152
  Create from a llvmlite.binding.TypeRef
147
153
  """
148
- if not opaque_pointers_enabled:
149
- return _TypedPointerType.from_llvm(typeref, ir_ctx)
150
154
  return cls()
151
155
 
152
156
 
@@ -163,7 +167,7 @@ class _TypedPointerType(PointerType):
163
167
  self.is_opaque = False
164
168
 
165
169
  def _to_string(self):
166
- if not opaque_pointers_enabled:
170
+ if ir_layer_typed_pointers_enabled:
167
171
  return "{0}*".format(self.pointee) if self.addrspace == 0 else \
168
172
  "{0} addrspace({1})*".format(self.pointee, self.addrspace)
169
173
  return super(_TypedPointerType, self)._to_string()
@@ -173,7 +177,8 @@ class _TypedPointerType(PointerType):
173
177
  if isinstance(other, _TypedPointerType):
174
178
  return (self.pointee, self.addrspace) == (other.pointee,
175
179
  other.addrspace)
176
- return isinstance(other, PointerType)
180
+ return (isinstance(other, PointerType) and
181
+ self.addrspace == other.addrspace)
177
182
 
178
183
  def __hash__(self):
179
184
  return hash(_TypedPointerType)
@@ -188,18 +193,9 @@ class _TypedPointerType(PointerType):
188
193
 
189
194
  @property
190
195
  def intrinsic_name(self):
191
- return 'p%d%s' % (self.addrspace, self.pointee.intrinsic_name)
192
-
193
- @classmethod
194
- def from_llvm(cls, typeref, ir_ctx):
195
- """
196
- Create from a llvmlite.binding.TypeRef
197
- """
198
- assert not opaque_pointers_enabled
199
- # opaque pointer will change this
200
- [pointee] = typeref.elements
201
- # addrspace is not handled
202
- return cls(pointee.as_ir(ir_ctx=ir_ctx))
196
+ if ir_layer_typed_pointers_enabled:
197
+ return 'p%d%s' % (self.addrspace, self.pointee.intrinsic_name)
198
+ return super(_TypedPointerType, self).intrinsic_name
203
199
 
204
200
 
205
201
  class VoidType(Type):
@@ -103,6 +103,7 @@ def case7():
103
103
 
104
104
  def case8():
105
105
  edges = {
106
+ "entry:": ["A"],
106
107
  "A": ["B", "C"],
107
108
  "B": ["C"],
108
109
  "C": [],