[PATCH] D145430: [clang] accept inline asm 'p' constraint on outputs

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 14:34:17 PST 2023


nickdesaulniers created this revision.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

GCC allows this; we reject it.

Link: https://reviews.llvm.org/D145416#inline-1404524


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145430

Files:
  clang/lib/Basic/TargetInfo.cpp
  clang/test/Sema/inline-asm-validate.c


Index: clang/test/Sema/inline-asm-validate.c
===================================================================
--- clang/test/Sema/inline-asm-validate.c
+++ clang/test/Sema/inline-asm-validate.c
@@ -7,7 +7,6 @@
   // Ensure we accept pointer and non-pointer arguments to "p" constrained
   // inputs.
   asm (""::"p"(t), "p"(p));
-  // TODO: Ensure we accept p output constraints.
-  asm ("":"=p"(t)); // expected-error{{invalid output constraint '=p' in asm}}
-  asm ("":"=p"(p)); // expected-error{{invalid output constraint '=p' in asm}}
+  asm ("":"=p"(t));
+  asm ("":"=p"(p));
 }
Index: clang/lib/Basic/TargetInfo.cpp
===================================================================
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -745,6 +745,7 @@
       Info.setAllowsMemory();
       break;
     case 'g': // general register, memory operand or immediate integer.
+    case 'p': // address operand.
     case 'X': // any operand.
       Info.setAllowsRegister();
       Info.setAllowsMemory();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145430.502809.patch
Type: text/x-patch
Size: 1032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230306/0df0a5ff/attachment-0001.bin>


More information about the cfe-commits mailing list