-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IR] Introduce the opaque pointer type
The opaque pointer type is essentially just a normal pointer type with a null pointee type. This also adds support for the opaque pointer type to the bitcode reader/writer, as well as to textual IR. To avoid confusion with existing pointer types, we disallow creating a pointer to an opaque pointer. Opaque pointer types should not be widely used at this point since many parts of LLVM still do not support them. The next steps are to add some very simple use cases of opaque pointers to make sure they work, then start pretending that all pointers are opaque pointers and see what breaks. https://lists.llvm.org/pipermail/llvm-dev/2021-May/150359.html Reviewed By: dblaikie, dexonsmith, pcc Differential Revision: https://reviews.llvm.org/D101704
- Loading branch information
Showing
13 changed files
with
132 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s | ||
|
||
; CHECK: pointer to this type is invalid | ||
define void @f(ptr %a) { | ||
%b = bitcast ptr %a to ptr* | ||
ret void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s | ||
; RUN: verify-uselistorder %s | ||
|
||
; CHECK: define ptr @f(ptr %a) { | ||
; CHECK: %b = bitcast ptr %a to ptr | ||
; CHECK: ret ptr %b | ||
define ptr @f(ptr %a) { | ||
%b = bitcast ptr %a to ptr | ||
ret ptr %b | ||
} | ||
|
||
; CHECK: define ptr @g(ptr addrspace(2) %a) { | ||
; CHECK: %b = addrspacecast ptr addrspace(2) %a to ptr | ||
; CHECK: ret ptr %b | ||
define ptr @g(ptr addrspace(2) %a) { | ||
%b = addrspacecast ptr addrspace(2) %a to ptr addrspace(0) | ||
ret ptr addrspace(0) %b | ||
} | ||
|
||
; CHECK: define ptr addrspace(2) @g2(ptr %a) { | ||
; CHECK: %b = addrspacecast ptr %a to ptr addrspace(2) | ||
; CHECK: ret ptr addrspace(2) %b | ||
define ptr addrspace(2) @g2(ptr addrspace(0) %a) { | ||
%b = addrspacecast ptr addrspace(0) %a to ptr addrspace(2) | ||
ret ptr addrspace(2) %b | ||
} |