-
Notifications
You must be signed in to change notification settings - Fork 340
Add IR layer typed pointers mode #1159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b261919
ff60f61
dba9682
d8d6fe6
16c1b48
be48e7b
eca2f5e
fac2b28
01e1669
02097b8
a563953
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,9 @@ | |
|
||
import struct | ||
|
||
from llvmlite import ir_layer_typed_pointers_enabled | ||
from llvmlite.ir._utils import _StrCaching | ||
|
||
# FIXME: Remove me once typed pointers are no longer supported. | ||
from llvmlite import opaque_pointers_enabled | ||
|
||
|
||
def _wrapname(x): | ||
return '"{0}"'.format(x.replace('\\', '\\5c').replace('"', '\\22')) | ||
|
@@ -145,8 +143,6 @@ def from_llvm(cls, typeref, ir_ctx): | |
""" | ||
Create from a llvmlite.binding.TypeRef | ||
""" | ||
if not opaque_pointers_enabled: | ||
return _TypedPointerType.from_llvm(typeref, ir_ctx) | ||
return cls() | ||
|
||
|
||
|
@@ -163,7 +159,7 @@ def __init__(self, pointee, addrspace=0): | |
self.is_opaque = False | ||
|
||
def _to_string(self): | ||
if not opaque_pointers_enabled: | ||
if ir_layer_typed_pointers_enabled: | ||
return "{0}*".format(self.pointee) if self.addrspace == 0 else \ | ||
"{0} addrspace({1})*".format(self.pointee, self.addrspace) | ||
return super(_TypedPointerType, self)._to_string() | ||
|
@@ -190,17 +186,6 @@ def gep(self, i): | |
def intrinsic_name(self): | ||
return 'p%d%s' % (self.addrspace, self.pointee.intrinsic_name) | ||
|
||
@classmethod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The opaque pointer version of this shouldn't be affected by this patch (which is why the tests aren't affected either). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok to remove. |
||
def from_llvm(cls, typeref, ir_ctx): | ||
""" | ||
Create from a llvmlite.binding.TypeRef | ||
""" | ||
assert not opaque_pointers_enabled | ||
# opaque pointer will change this | ||
[pointee] = typeref.elements | ||
# addrspace is not handled | ||
return cls(pointee.as_ir(ir_ctx=ir_ctx)) | ||
|
||
|
||
class VoidType(Type): | ||
""" | ||
|
Uh oh!
There was an error while loading. Please reload this page.