-
Notifications
You must be signed in to change notification settings - Fork 350
Drop binding layer typed pointer support. #1160
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
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 |
|---|---|---|
|
|
@@ -193,7 +193,9 @@ def gep(self, i): | |
|
|
||
| @property | ||
| def intrinsic_name(self): | ||
| return 'p%d%s' % (self.addrspace, self.pointee.intrinsic_name) | ||
| if ir_layer_typed_pointers_enabled: | ||
|
Member
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. I think this is a fix for an error that was previously un-noticed / un-addressed - is that correct?
Contributor
Author
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. Yep, it fixes an inconsistent behaviour in how pointer intrinsic names are printed. Previously, even if we enabled IR layer typed pointers, the pointer's intrinsic name would still reflect its "true" underlying type. This is probably not the desired behaviour, so I've changed this to follow the same logic we have for the "_to_string" method. I should have done this when we added IR layer typed pointers, but I think this got lost with the opaque pointer fixes (which in practice came after IR layer typed pointers, but I had initially thought them to come before). |
||
| return 'p%d%s' % (self.addrspace, self.pointee.intrinsic_name) | ||
| return super(_TypedPointerType, self).intrinsic_name | ||
|
|
||
|
|
||
| class VoidType(Type): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -281,9 +281,9 @@ def test_declare_intrinsics(self): | |
| declare double @"llvm.powi.f64"(double %".1", i32 %".2")""") | ||
| if not ir_layer_typed_pointers_enabled: | ||
| self.check_descr(self.descr(memset).strip(), """\ | ||
| declare void @"llvm.memset.p0i8.i32"(ptr %".1", i8 %".2", i32 %".3", i1 %".4")""") # noqa E501 | ||
| declare void @"llvm.memset.p0.i32"(ptr %".1", i8 %".2", i32 %".3", i1 %".4")""") # noqa E501 | ||
| self.check_descr(self.descr(memcpy).strip(), """\ | ||
| declare void @"llvm.memcpy.p0i8.p0i8.i32"(ptr %".1", ptr %".2", i32 %".3", i1 %".4")""") # noqa E501 | ||
| declare void @"llvm.memcpy.p0.p0.i32"(ptr %".1", ptr %".2", i32 %".3", i1 %".4")""") # noqa E501 | ||
| else: | ||
| self.check_descr(self.descr(memset).strip(), """\ | ||
| declare void @"llvm.memset.p0i8.i32"(i8* %".1", i8 %".2", i32 %".3", i1 %".4")""") # noqa E501 | ||
|
|
@@ -2451,9 +2451,12 @@ def assert_ne(ptr1, ptr2): | |
| def test_ptr_intrinsic_name(self): | ||
| self.assertEqual(ir.PointerType().intrinsic_name, 'p0') | ||
| self.assertEqual(ir.PointerType(addrspace=1).intrinsic_name, 'p1') | ||
| # Note: Should this be adjusted based on the pointer mode? | ||
| self.assertEqual(ir.PointerType(int1).intrinsic_name, 'p0i1') | ||
| self.assertEqual(ir.PointerType(int1, 1).intrinsic_name, 'p1i1') | ||
| if not ir_layer_typed_pointers_enabled: | ||
|
Member
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. I think the changes here pertain to the fix I asked about above. Is that right?
Contributor
Author
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. Exactly, I wasn't sure if we should remove intrinsic names from typed pointers entirely (such that we would always print them in opaque pointer format), but then I thought we should probably keep consistency with |
||
| self.assertEqual(ir.PointerType(int1).intrinsic_name, 'p0') | ||
| self.assertEqual(ir.PointerType(int1, 1).intrinsic_name, 'p1') | ||
| else: | ||
| self.assertEqual(ir.PointerType(int1).intrinsic_name, 'p0i1') | ||
| self.assertEqual(ir.PointerType(int1, 1).intrinsic_name, 'p1i1') | ||
|
|
||
| def test_str(self): | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note on this change:
getFixedSize()returedgetFixedValue()anyway, andgetFixedSize()is deprecated / removed in later LLVM versions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I believe these are just API renames.