[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 15:01:17 PST 2023


nickdesaulniers updated this revision to Diff 502822.
nickdesaulniers added a comment.

- rebase, additional unit test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145430/new/

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,8 +7,6 @@
   // Ensure we accept pointer and non-pointer arguments to "p" constrained
   // inputs.
   asm (""::"p"(t), "p"(p), "p"(&t));
-  // 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)); // expected-error{{invalid output constraint '=p' in asm}}
+  asm ("":"=p"(t), "=p"(p));
+  asm ("":"=p"(&t)); // expected-error{{invalid lvalue in asm output}}
 }
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.502822.patch
Type: text/x-patch
Size: 1182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230306/d044e42c/attachment.bin>


More information about the cfe-commits mailing list