[cfe-commits] r62444 - /cfe/trunk/lib/CodeGen/CGStmt.cpp

Anders Carlsson andersca at mac.com
Sat Jan 17 18:06:20 PST 2009


Author: andersca
Date: Sat Jan 17 20:06:20 2009
New Revision: 62444

URL: http://llvm.org/viewvc/llvm-project?rev=62444&view=rev
Log:
CG support for inline asm constraints with symbolic names. Fixes PR3345

Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sat Jan 17 20:06:20 2009
@@ -837,7 +837,10 @@
 }
 
 static std::string SimplifyConstraint(const char* Constraint,
-                                      TargetInfo &Target) {
+                                      TargetInfo &Target,
+                                      const std::string *OutputNamesBegin = 0,
+                                      const std::string *OutputNamesEnd = 0)
+{
   std::string Result;
   
   while (*Constraint) {
@@ -853,6 +856,17 @@
     case 'g':
       Result += "imr";
       break;
+    case '[': {
+      assert(OutputNamesBegin && OutputNamesEnd &&
+             "Must pass output names to constraints with a symbolic name");
+      unsigned Index;
+      bool result = Target.resolveSymbolicName(Constraint, 
+                                               OutputNamesBegin,
+                                               OutputNamesEnd, Index);
+      assert(result && "Could not resolve symbolic name");
+      Result += llvm::utostr(Index);
+      break;
+    }
     }
     
     Constraint++;
@@ -986,7 +1000,9 @@
       Constraints += ',';
     
     // Simplify the input constraint.
-    InputConstraint = SimplifyConstraint(InputConstraint.c_str(), Target);
+    InputConstraint = SimplifyConstraint(InputConstraint.c_str(), Target,
+                                         S.begin_output_names(),
+                                         S.end_output_names());
 
     llvm::Value *Arg = EmitAsmInput(S, Info, InputExpr, Constraints);
     





More information about the cfe-commits mailing list