[PATCH] D54295: [RISCV] Add inline asm constraint A for RISC-V

Lewis Revill via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 06:30:58 PDT 2019


lewis-revill updated this revision to Diff 204512.
lewis-revill retitled this revision from "[WIP, RISCV] Add inline asm constraint A for RISC-V" to "[RISCV] Add inline asm constraint A for RISC-V".
Herald added subscribers: Jim, benna, psnobl.

Repository:
  rC Clang

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

https://reviews.llvm.org/D54295

Files:
  lib/Basic/Targets/RISCV.cpp
  test/CodeGen/riscv-inline-asm.c


Index: test/CodeGen/riscv-inline-asm.c
===================================================================
--- test/CodeGen/riscv-inline-asm.c
+++ test/CodeGen/riscv-inline-asm.c
@@ -26,3 +26,9 @@
 // CHECK: call void asm sideeffect "", "K"(i32 0)
   asm volatile ("" :: "K"(0));
 }
+
+void test_A(int *p) {
+// CHECK-LABEL: define void @test_A(i32* %p)
+// CHECK: call void asm sideeffect "", "*A"(i32* %p)
+  asm volatile("" :: "A"(*p));
+}
Index: lib/Basic/Targets/RISCV.cpp
===================================================================
--- lib/Basic/Targets/RISCV.cpp
+++ lib/Basic/Targets/RISCV.cpp
@@ -56,6 +56,10 @@
     // A 5-bit unsigned immediate for CSR access instructions.
     Info.setRequiresImmediate(0, 31);
     return true;
+  case 'A':
+    // An address that is held in a general-purpose register.
+    Info.setAllowsMemory();
+    return true;
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54295.204512.patch
Type: text/x-patch
Size: 883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190613/37c7f1b2/attachment-0001.bin>


More information about the cfe-commits mailing list