llvmlite 0.44.0rc2__cp310-cp310-win_amd64.whl → 0.45.0__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.
- 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/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 +169 -68
- llvmlite/tests/test_refprune.py +10 -166
- {llvmlite-0.44.0rc2.dist-info → llvmlite-0.45.0.dist-info}/METADATA +13 -8
- llvmlite-0.45.0.dist-info/RECORD +44 -0
- {llvmlite-0.44.0rc2.dist-info → llvmlite-0.45.0.dist-info}/WHEEL +1 -1
- llvmlite/binding/passmanagers.py +0 -946
- llvmlite/binding/transforms.py +0 -151
- llvmlite-0.44.0rc2.dist-info/LICENSE.thirdparty +0 -225
- llvmlite-0.44.0rc2.dist-info/RECORD +0 -46
- {llvmlite-0.44.0rc2.dist-info → llvmlite-0.45.0.dist-info/licenses}/LICENSE +0 -0
- {llvmlite-0.44.0rc2.dist-info → llvmlite-0.45.0.dist-info}/top_level.txt +0 -0
llvmlite/__init__.py
CHANGED
|
@@ -2,9 +2,10 @@ from ._version import get_versions
|
|
|
2
2
|
__version__ = get_versions()['version']
|
|
3
3
|
del get_versions
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
5
|
+
# We default to IR layer typed pointers being enabled, since they're needed in
|
|
6
|
+
# the most common usage scenarios with later LLVMs.
|
|
7
|
+
def _ir_layer_typed_pointers_enabled():
|
|
7
8
|
import os
|
|
8
|
-
return os.environ.get('
|
|
9
|
-
|
|
10
|
-
del
|
|
9
|
+
return os.environ.get('LLVMLITE_ENABLE_IR_LAYER_TYPED_POINTERS', '1') == '1'
|
|
10
|
+
ir_layer_typed_pointers_enabled = _ir_layer_typed_pointers_enabled()
|
|
11
|
+
del _ir_layer_typed_pointers_enabled
|
llvmlite/_version.py
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# unpacked source archive. Distribution tarballs contain a pre-generated copy
|
|
5
5
|
# of this file.
|
|
6
6
|
|
|
7
|
-
version_version = '0.
|
|
8
|
-
version_full = '
|
|
7
|
+
version_version = '0.45.0'
|
|
8
|
+
version_full = '2d479c9ce4259c94f388ead34f428a71be246ace'
|
|
9
9
|
def get_versions(default={}, verbose=False):
|
|
10
10
|
return {'version': version_version, 'full': version_full}
|
|
11
11
|
|
llvmlite/binding/__init__.py
CHANGED
|
@@ -8,12 +8,11 @@ from .linker import *
|
|
|
8
8
|
from .module import *
|
|
9
9
|
from .options import *
|
|
10
10
|
from .newpassmanagers import *
|
|
11
|
-
from .passmanagers import *
|
|
12
11
|
from .targets import *
|
|
13
|
-
from .transforms import *
|
|
14
12
|
from .value import *
|
|
15
13
|
from .typeref import *
|
|
16
14
|
from .analysis import *
|
|
17
15
|
from .object_file import *
|
|
18
16
|
from .context import *
|
|
19
17
|
from .orcjit import *
|
|
18
|
+
from .config import *
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import warnings
|
|
3
|
+
from functools import cache
|
|
4
|
+
from ctypes import c_int, c_char_p
|
|
5
|
+
from llvmlite.binding import ffi
|
|
6
|
+
|
|
7
|
+
# these are here as they cannot be lazy bound as the module globals make calls
|
|
8
|
+
# to the LLVMPY API functions
|
|
9
|
+
ffi.lib.LLVMPY_HasSVMLSupport.argtypes = ()
|
|
10
|
+
ffi.lib.LLVMPY_HasSVMLSupport.restype = c_int
|
|
11
|
+
|
|
12
|
+
ffi.lib.LLVMPY_IsStaticLibstdcxxLinkageBuild.argtypes = ()
|
|
13
|
+
ffi.lib.LLVMPY_IsStaticLibstdcxxLinkageBuild.restype = c_int
|
|
14
|
+
|
|
15
|
+
ffi.lib.LLVMPY_IsDynamicLLVMLinkageBuild.argtypes = ()
|
|
16
|
+
ffi.lib.LLVMPY_IsDynamicLLVMLinkageBuild.restype = c_int
|
|
17
|
+
|
|
18
|
+
ffi.lib.LLVMPY_PackageFormat.argtypes = ()
|
|
19
|
+
ffi.lib.LLVMPY_PackageFormat.restype = c_char_p
|
|
20
|
+
|
|
21
|
+
ffi.lib.LLVMPY_LlvmAssertionsState.argtypes = ()
|
|
22
|
+
ffi.lib.LLVMPY_LlvmAssertionsState.restype = c_char_p
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _has_svml():
|
|
26
|
+
"""
|
|
27
|
+
Returns True if SVML was enabled at FFI support compile time.
|
|
28
|
+
"""
|
|
29
|
+
if ffi.lib.LLVMPY_HasSVMLSupport() == 0:
|
|
30
|
+
return False
|
|
31
|
+
else:
|
|
32
|
+
return True
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
has_svml = _has_svml()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _build_llvm_linkage_type():
|
|
39
|
+
"""
|
|
40
|
+
Returns "static" if the FFI support is statically linked against LLVM,
|
|
41
|
+
returns "dynamic" otherwise.
|
|
42
|
+
"""
|
|
43
|
+
if ffi.lib.LLVMPY_IsDynamicLLVMLinkageBuild() == 0:
|
|
44
|
+
return "static"
|
|
45
|
+
else:
|
|
46
|
+
return "dynamic"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
build_llvm_linkage_type = _build_llvm_linkage_type()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _build_libstdcxx_linkage_type():
|
|
53
|
+
"""
|
|
54
|
+
Returns "static" if the FFI support is statically linked against libstdc++,
|
|
55
|
+
returns "dynamic" otherwise.
|
|
56
|
+
"""
|
|
57
|
+
if ffi.lib.LLVMPY_IsStaticLibstdcxxLinkageBuild() == 1:
|
|
58
|
+
return "static"
|
|
59
|
+
else:
|
|
60
|
+
return "dynamic"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
build_libstdcxx_linkage_type = _build_libstdcxx_linkage_type()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _package_format():
|
|
67
|
+
"""
|
|
68
|
+
Returns "wheel", "conda" or "unspecified"
|
|
69
|
+
"""
|
|
70
|
+
return ffi.lib.LLVMPY_PackageFormat().decode()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
package_format = _package_format()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _llvm_assertions_state():
|
|
77
|
+
"""
|
|
78
|
+
Returns one of "on", "off" or "unknown". Depending on whether it is
|
|
79
|
+
determined that LLVM was build with assertions on, off, or is not known.
|
|
80
|
+
"Is not known" is typically from a dynamic linkage against LLVM in which
|
|
81
|
+
case it's not easily identified whether LLVM was built with assertions.
|
|
82
|
+
"""
|
|
83
|
+
return ffi.lib.LLVMPY_LlvmAssertionsState().decode()
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
llvm_assertions_state = _llvm_assertions_state()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@cache
|
|
90
|
+
def get_sysinfo():
|
|
91
|
+
d = dict()
|
|
92
|
+
d["ffi_lib_location"] = ffi.lib._name
|
|
93
|
+
d["package_format"] = package_format
|
|
94
|
+
d["llvm_linkage_type"] = build_llvm_linkage_type
|
|
95
|
+
d["libstdcxx_linkage_type"] = build_libstdcxx_linkage_type
|
|
96
|
+
d["llvm_assertions_state"] = llvm_assertions_state
|
|
97
|
+
|
|
98
|
+
# import lief
|
|
99
|
+
HAVE_LIEF = False
|
|
100
|
+
try:
|
|
101
|
+
import lief
|
|
102
|
+
HAVE_LIEF = True
|
|
103
|
+
except ImportError:
|
|
104
|
+
msg = "py-lief package not found, sysinfo is limited as a result"
|
|
105
|
+
warnings.warn(msg)
|
|
106
|
+
|
|
107
|
+
d["lief_probe_status"] = HAVE_LIEF
|
|
108
|
+
d["linked_libraries"] = None
|
|
109
|
+
d["canonicalised_linked_libraries"] = None
|
|
110
|
+
|
|
111
|
+
def canonicalise_library_type(dso):
|
|
112
|
+
"""Canonicalises the representation of the binary::libraries as a
|
|
113
|
+
sequence of strings"""
|
|
114
|
+
# Note lief v16:
|
|
115
|
+
# Mach-O .libraries are DylibCommand instances.
|
|
116
|
+
# Windows PE and Linux ELF .libraries are strings.
|
|
117
|
+
return [getattr(x, "name", x) for x in dso.libraries]
|
|
118
|
+
|
|
119
|
+
def canonicalise_library_spelling(libs):
|
|
120
|
+
# This adjusts the library "spelling" so that it just contains the
|
|
121
|
+
# name given to the linker. e.g. `@rpath/somewhere/libfoo.so.1.3`
|
|
122
|
+
# would be canonicalised to "foo".
|
|
123
|
+
fixes = []
|
|
124
|
+
for lib in libs:
|
|
125
|
+
# some libraries, e.g. Mach-O have an @rpath or system path
|
|
126
|
+
# prefix in their name, remove it.
|
|
127
|
+
path_stripped = os.path.split(lib)[-1]
|
|
128
|
+
# Assume all library names contain at least one dot, even if they
|
|
129
|
+
# don't it's fine, the first part is the piece of interest.
|
|
130
|
+
prefix_libname = path_stripped.split(".")[0]
|
|
131
|
+
linker_name = prefix_libname.replace("lib", "").replace("LIB", "")
|
|
132
|
+
# further canonicalize by referring to all libraries in lower case.
|
|
133
|
+
fixes.append(linker_name.lower())
|
|
134
|
+
return fixes
|
|
135
|
+
|
|
136
|
+
if HAVE_LIEF:
|
|
137
|
+
dso = lief.parse(d["ffi_lib_location"])
|
|
138
|
+
link_libs = tuple(canonicalise_library_type(dso))
|
|
139
|
+
d["linked_libraries"] = link_libs
|
|
140
|
+
canonicalised_libs = canonicalise_library_spelling(link_libs)
|
|
141
|
+
d["canonicalised_linked_libraries"] = canonicalised_libs
|
|
142
|
+
|
|
143
|
+
return d
|
llvmlite/binding/context.py
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
from llvmlite.binding import ffi
|
|
2
2
|
|
|
3
|
-
# FIXME: Remove me once typed pointers are no longer supported.
|
|
4
|
-
from llvmlite import opaque_pointers_enabled
|
|
5
|
-
from ctypes import c_bool
|
|
6
|
-
|
|
7
3
|
|
|
8
4
|
def create_context():
|
|
9
5
|
return ContextRef(
|
|
10
|
-
ffi.lib.LLVMPY_ContextCreate(
|
|
6
|
+
ffi.lib.LLVMPY_ContextCreate())
|
|
11
7
|
|
|
12
8
|
|
|
13
9
|
def get_global_context():
|
|
14
10
|
return GlobalContextRef(
|
|
15
|
-
ffi.lib.LLVMPY_GetGlobalContext(
|
|
11
|
+
ffi.lib.LLVMPY_GetGlobalContext())
|
|
16
12
|
|
|
17
13
|
|
|
18
14
|
class ContextRef(ffi.ObjectRef):
|
|
@@ -28,12 +24,8 @@ class GlobalContextRef(ContextRef):
|
|
|
28
24
|
pass
|
|
29
25
|
|
|
30
26
|
|
|
31
|
-
# FIXME: Remove argtypes once typed pointers are no longer supported.
|
|
32
|
-
ffi.lib.LLVMPY_GetGlobalContext.argtypes = [c_bool]
|
|
33
27
|
ffi.lib.LLVMPY_GetGlobalContext.restype = ffi.LLVMContextRef
|
|
34
28
|
|
|
35
|
-
# FIXME: Remove argtypes once typed pointers are no longer supported.
|
|
36
|
-
ffi.lib.LLVMPY_ContextCreate.argtypes = [c_bool]
|
|
37
29
|
ffi.lib.LLVMPY_ContextCreate.restype = ffi.LLVMContextRef
|
|
38
30
|
|
|
39
31
|
ffi.lib.LLVMPY_ContextDispose.argtypes = [ffi.LLVMContextRef]
|
llvmlite/binding/ffi.py
CHANGED
|
@@ -40,7 +40,7 @@ LLVMObjectFileRef = _make_opaque_ref("LLVMObjectFile")
|
|
|
40
40
|
LLVMSectionIteratorRef = _make_opaque_ref("LLVMSectionIterator")
|
|
41
41
|
LLVMOrcLLJITRef = _make_opaque_ref("LLVMOrcLLJITRef")
|
|
42
42
|
LLVMOrcDylibTrackerRef = _make_opaque_ref("LLVMOrcDylibTrackerRef")
|
|
43
|
-
|
|
43
|
+
LLVMTimePassesHandlerRef = _make_opaque_ref("LLVMTimePassesHandler")
|
|
44
44
|
LLVMPipelineTuningOptionsRef = _make_opaque_ref("LLVMPipeLineTuningOptions")
|
|
45
45
|
LLVMModulePassManagerRef = _make_opaque_ref("LLVMModulePassManager")
|
|
46
46
|
LLVMFunctionPassManagerRef = _make_opaque_ref("LLVMFunctionPassManager")
|
llvmlite/binding/initfini.py
CHANGED
|
@@ -5,9 +5,21 @@ from llvmlite.binding import ffi
|
|
|
5
5
|
|
|
6
6
|
def initialize():
|
|
7
7
|
"""
|
|
8
|
-
Initialize the LLVM core.
|
|
8
|
+
Initialize the LLVM core (deprecated).
|
|
9
|
+
|
|
10
|
+
This function is deprecated and will raise an error when called.
|
|
11
|
+
LLVM initialization is now handled automatically and no longer
|
|
12
|
+
requires explicit initialization calls.
|
|
13
|
+
|
|
14
|
+
Raises:
|
|
15
|
+
RuntimeError: Always raised as this function is no longer needed.
|
|
9
16
|
"""
|
|
10
|
-
|
|
17
|
+
raise RuntimeError(
|
|
18
|
+
"llvmlite.binding.initialize() is deprecated and will be removed. "
|
|
19
|
+
"LLVM initialization is now handled automatically. "
|
|
20
|
+
"Please remove calls to this function from your code and check for "
|
|
21
|
+
"other behavioral changes that may have occurred due to LLVM updates."
|
|
22
|
+
)
|
|
11
23
|
|
|
12
24
|
|
|
13
25
|
def initialize_all_targets():
|
llvmlite/binding/llvmlite.dll
CHANGED
|
Binary file
|