Even more inline asm codegen fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46784 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Basic/TargetInfo.cpp b/Basic/TargetInfo.cpp
index fc6976a..e0a4642 100644
--- a/Basic/TargetInfo.cpp
+++ b/Basic/TargetInfo.cpp
@@ -276,6 +276,12 @@
   return PrimaryTarget->getVAListDeclaration();
 }
 
+static void removeGCCRegisterPrefix(const char *&Name)
+{
+  if (Name[0] == '%' || Name[0] == '#')
+    Name++;
+}
+
 /// isValidGCCRegisterName - Returns whether the passed in string
 /// is a valid register name according to GCC. This is used by Sema for
 /// inline asm statements.
@@ -284,8 +290,8 @@
   unsigned NumNames;
   
   // Get rid of any register prefix.
-  if (Name[0] == '%' || Name[0] == '#')
-    Name++;
+  removeGCCRegisterPrefix(Name);
+
   
   if (strcmp(Name, "memory") == 0 ||
       strcmp(Name, "cc") == 0)
@@ -328,8 +334,7 @@
 {
   assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
   
-  if (strcmp(Name, "memory") == 0)
-    return "~{memory}";
+  removeGCCRegisterPrefix(Name);
     
   const char * const *Names;
   unsigned NumNames;
diff --git a/CodeGen/CGStmt.cpp b/CodeGen/CGStmt.cpp
index 557588e..5ef8b96 100644
--- a/CodeGen/CGStmt.cpp
+++ b/CodeGen/CGStmt.cpp
@@ -749,9 +749,12 @@
 
     Clobber = Target.getNormalizedGCCRegisterName(Clobber.c_str());
     
-    if (i != 0)
+    if (i != 0 || NumConstraints != 0)
       Constraints += ',';
+    
+    Constraints += "~{";
     Constraints += Clobber;
+    Constraints += '}';
   }
   
   // Add machine specific clobbers