Parse the %*# constraint modifiers
authorChris Lattner <sabre@nondot.org>
Thu, 23 Feb 2006 23:36:53 +0000 (23:36 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 23 Feb 2006 23:36:53 +0000 (23:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26341 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/InlineAsm.cpp

index cdb8c46e95fa53697197af6a5cbd84355b961833..b36d2128a61e9521841e11eb903de1971de93473 100644 (file)
@@ -51,6 +51,7 @@ bool InlineAsm::ConstraintInfo::Parse(const std::string &Str,
   isEarlyClobber = false;
   isIndirectOutput = false;
   hasMatchingInput = false;
+  isCommutative = false;
   
   // Parse the prefix.
   if (*I == '~') {
@@ -74,12 +75,21 @@ bool InlineAsm::ConstraintInfo::Parse(const std::string &Str,
     default:
       DoneWithModifiers = true;
       break;
-    case '&':
+    case '&':     // Early clobber.
       if (Type != isOutput ||      // Cannot early clobber anything but output.
           isEarlyClobber)          // Reject &&&&&&
         return true;
       isEarlyClobber = true;
       break;
+    case '%':     // Commutative.
+      if (Type == isClobber ||     // Cannot commute clobbers.
+          isCommutative)           // Reject %%%%%
+        return true;
+      isCommutative = true;
+      break;
+    case '#':     // Comment.
+    case '*':     // Register preferencing.
+      return true;     // Not supported.
     }
     
     if (!DoneWithModifiers) {