[cfe-commits] r166924 - in /cfe/trunk: lib/Basic/TargetInfo.cpp lib/CodeGen/CGStmt.cpp test/CodeGen/asm.c

Ulrich Weigand ulrich.weigand at de.ibm.com
Mon Oct 29 05:20:55 PDT 2012


Author: uweigand
Date: Mon Oct 29 07:20:54 2012
New Revision: 166924

URL: http://llvm.org/viewvc/llvm-project?rev=166924&view=rev
Log:
Handle '*' and '#' asm constraint modifiers.

Modified:
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/test/CodeGen/asm.c

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=166924&r1=166923&r2=166924&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Mon Oct 29 07:20:54 2012
@@ -364,6 +364,8 @@
       break;
     case '?': // Disparage slightly code.
     case '!': // Disparage severely.
+    case '#': // Ignore as constraint.
+    case '*': // Ignore for choosing register preferences.
       break;  // Pass them.
     }
 
@@ -483,6 +485,8 @@
       break;
     case '?': // Disparage slightly code.
     case '!': // Disparage severely.
+    case '#': // Ignore as constraint.
+    case '*': // Ignore for choosing register preferences.
       break;  // Pass them.
     }
 

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=166924&r1=166923&r2=166924&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Oct 29 07:20:54 2012
@@ -1280,6 +1280,10 @@
     case '=': // Will see this and the following in mult-alt constraints.
     case '+':
       break;
+    case '#': // Ignore the rest of the constraint alternative.
+      while (Constraint[1] && Constraint[1] != ',')
+	Constraint++;
+      break;
     case ',':
       Result += "|";
       break;

Modified: cfe/trunk/test/CodeGen/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm.c?rev=166924&r1=166923&r2=166924&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/asm.c (original)
+++ cfe/trunk/test/CodeGen/asm.c Mon Oct 29 07:20:54 2012
@@ -230,3 +230,12 @@
 // CHECK-NOT: ia_nsdialect
 // CHECK: ret void
 }
+
+// Check handling of '*' and '#' constraint modifiers.
+void t28(void)
+{
+  asm volatile ("/* %0 */" : : "i#*X,*r" (1));
+// CHECK: @t28
+// CHECK: call void asm sideeffect "/* $0 */", "i|r,~{dirflag},~{fpsr},~{flags}"(i32 1)
+}
+





More information about the cfe-commits mailing list