Handle '*' and '#' asm constraint modifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166924 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index b89b18b..3257526 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -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.
     }
 
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 5c1fea4..3548dba 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -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;
diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c
index b009736..670c244 100644
--- a/test/CodeGen/asm.c
+++ b/test/CodeGen/asm.c
@@ -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)
+}
+