[PATCH] D108876: [AsmParser] Support %ty* in force-opaque-pointers mode
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 30 10:05:12 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG881677b58a1f: [AsmParser] Support %ty* in force-opaque-pointers mode (authored by nikic).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108876/new/
https://reviews.llvm.org/D108876
Files:
llvm/lib/AsmParser/LLParser.cpp
llvm/test/Other/force-opaque-ptrs.ll
Index: llvm/test/Other/force-opaque-ptrs.ll
===================================================================
--- llvm/test/Other/force-opaque-ptrs.ll
+++ llvm/test/Other/force-opaque-ptrs.ll
@@ -3,6 +3,8 @@
; RUN: llvm-as < %s | llvm-dis --force-opaque-pointers | FileCheck %s
; RUN: opt --force-opaque-pointers < %s -S | FileCheck %s
+%ty = type i32*
+
; CHECK: @g = external global i16
@g = external global i16
@@ -49,6 +51,14 @@
unreachable
}
+define void @f4(%ty* %p) {
+; CHECK-LABEL: define {{[^@]+}}@f4
+; CHECK-SAME: (ptr [[P:%.*]]) {
+; CHECK-NEXT: unreachable
+;
+ unreachable
+}
+
define void @remangle_intrinsic() {
; CHECK-LABEL: define {{[^@]+}}@remangle_intrinsic() {
; CHECK-NEXT: [[A:%.*]] = alloca ptr, align 8
Index: llvm/lib/AsmParser/LLParser.cpp
===================================================================
--- llvm/lib/AsmParser/LLParser.cpp
+++ llvm/lib/AsmParser/LLParser.cpp
@@ -2217,6 +2217,26 @@
// Type ::= 'float' | 'void' (etc)
Result = Lex.getTyVal();
Lex.Lex();
+
+ // Handle (explicit) opaque pointer types (not --force-opaque-pointers).
+ //
+ // Type ::= ptr ('addrspace' '(' uint32 ')')?
+ if (Result->isOpaquePointerTy()) {
+ unsigned AddrSpace;
+ if (parseOptionalAddrSpace(AddrSpace))
+ return true;
+ Result = PointerType::get(getContext(), AddrSpace);
+
+ // Give a nice error for 'ptr*'.
+ if (Lex.getKind() == lltok::star)
+ return tokError("ptr* is invalid - use ptr instead");
+
+ // Fall through to parsing the type suffixes only if this 'ptr' is a
+ // function return. Otherwise, return success, implicitly rejecting other
+ // suffixes.
+ if (Lex.getKind() != lltok::lparen)
+ return false;
+ }
break;
case lltok::lbrace:
// Type ::= StructType
@@ -2270,26 +2290,6 @@
}
}
- // Handle (explicit) opaque pointer types (not --force-opaque-pointers).
- //
- // Type ::= ptr ('addrspace' '(' uint32 ')')?
- if (Result->isOpaquePointerTy()) {
- unsigned AddrSpace;
- if (parseOptionalAddrSpace(AddrSpace))
- return true;
- Result = PointerType::get(getContext(), AddrSpace);
-
- // Give a nice error for 'ptr*'.
- if (Lex.getKind() == lltok::star)
- return tokError("ptr* is invalid - use ptr instead");
-
- // Fall through to parsing the type suffixes only if this 'ptr' is a
- // function return. Otherwise, return success, implicitly rejecting other
- // suffixes.
- if (Lex.getKind() != lltok::lparen)
- return false;
- }
-
// parse the type suffixes.
while (true) {
switch (Lex.getKind()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108876.369478.patch
Type: text/x-patch
Size: 2649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210830/2118639a/attachment.bin>
More information about the llvm-commits
mailing list