[cfe-commits] r46784 - in /cfe/trunk: Basic/TargetInfo.cpp CodeGen/CGStmt.cpp

Anders Carlsson andersca at mac.com
Tue Feb 5 16:11:32 PST 2008


Author: andersca
Date: Tue Feb  5 18:11:32 2008
New Revision: 46784

URL: http://llvm.org/viewvc/llvm-project?rev=46784&view=rev
Log:
Even more inline asm codegen fixes.

Modified:
    cfe/trunk/Basic/TargetInfo.cpp
    cfe/trunk/CodeGen/CGStmt.cpp

Modified: cfe/trunk/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/TargetInfo.cpp?rev=46784&r1=46783&r2=46784&view=diff

==============================================================================
--- cfe/trunk/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/Basic/TargetInfo.cpp Tue Feb  5 18:11:32 2008
@@ -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;

Modified: cfe/trunk/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGStmt.cpp?rev=46784&r1=46783&r2=46784&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/CodeGen/CGStmt.cpp Tue Feb  5 18:11:32 2008
@@ -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





More information about the cfe-commits mailing list