]> granicus.if.org Git - clang/commitdiff
Handle '*' and '#' asm constraint modifiers.
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 29 Oct 2012 12:20:54 +0000 (12:20 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 29 Oct 2012 12:20:54 +0000 (12:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166924 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/TargetInfo.cpp
lib/CodeGen/CGStmt.cpp
test/CodeGen/asm.c

index b89b18b3aeae96f08ac439660bbff90cd4a8b144..3257526289e027487466d8c6c5c33e2e91b8f282 100644 (file)
@@ -364,6 +364,8 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
       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 @@ bool TargetInfo::validateInputConstraint(ConstraintInfo *OutputConstraints,
       break;
     case '?': // Disparage slightly code.
     case '!': // Disparage severely.
+    case '#': // Ignore as constraint.
+    case '*': // Ignore for choosing register preferences.
       break;  // Pass them.
     }
 
index 5c1fea4472fb1dc1709111144e4d1ed338dcb24c..3548dbac6fc1e56b617cf223baedfe5826c3f4ac 100644 (file)
@@ -1280,6 +1280,10 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
     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;
index b0097368ec28a7c9a64d4fa71543767af09f35b9..670c24405d336c5b2679aeb16e6162a2776193e3 100644 (file)
@@ -230,3 +230,12 @@ void t27(void) {
 // 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)
+}
+