[llvm-commits] [llvm] r100308 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Sat Apr 3 22:07:45 PDT 2010


Author: lattner
Date: Sun Apr  4 00:07:45 2010
New Revision: 100308

URL: http://llvm.org/viewvc/llvm-project?rev=100308&view=rev
Log:
MMI is always available, rename O -> OS in printInlineAsm.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=100308&r1=100307&r2=100308&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sun Apr  4 00:07:45 2010
@@ -101,7 +101,7 @@
 }
 
 bool AsmPrinter::doInitialization(Module &M) {
-  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
+  MMI = &getAnalysis<MachineModuleInfo>();
   MMI->AnalyzeModule(M);
 
   // Initialize TargetLoweringObjectFile.
@@ -1413,10 +1413,11 @@
   // EmitInlineAsm.
 #if 0
   SmallString<256> StringData;
-  raw_svector_ostream O(StringData);
+  raw_svector_ostream OS(StringData);
 #endif
+  raw_ostream &OS = O;
   
-  O << '\t';
+  OS << '\t';
 
   // The variant of the current asmprinter.
   int AsmPrinterVariant = MAI->getAssemblerDialect();
@@ -1433,13 +1434,13 @@
              *LiteralEnd != '}' && *LiteralEnd != '$' && *LiteralEnd != '\n')
         ++LiteralEnd;
       if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
-        O.write(LastEmitted, LiteralEnd-LastEmitted);
+        OS.write(LastEmitted, LiteralEnd-LastEmitted);
       LastEmitted = LiteralEnd;
       break;
     }
     case '\n':
       ++LastEmitted;   // Consume newline character.
-      O << '\n';       // Indent code with newline.
+      OS << '\n';       // Indent code with newline.
       break;
     case '$': {
       ++LastEmitted;   // Consume '$' character.
@@ -1450,7 +1451,7 @@
       default: Done = false; break;
       case '$':     // $$ -> $
         if (CurVariant == -1 || CurVariant == AsmPrinterVariant)
-          O << '$';
+          OS << '$';
         ++LastEmitted;  // Consume second '$' character.
         break;
       case '(':             // $( -> same as GCC's { character.
@@ -1464,14 +1465,14 @@
       case '|':
         ++LastEmitted;  // consume '|' character.
         if (CurVariant == -1)
-          O << '|';       // this is gcc's behavior for | outside a variant
+          OS << '|';       // this is gcc's behavior for | outside a variant
         else
           ++CurVariant;   // We're in the next variant.
         break;
       case ')':         // $) -> same as GCC's } char.
         ++LastEmitted;  // consume ')' character.
         if (CurVariant == -1)
-          O << '}';     // this is gcc's behavior for } outside a variant
+          OS << '}';     // this is gcc's behavior for } outside a variant
         else 
           CurVariant = -1;
         break;
@@ -1491,13 +1492,12 @@
         ++LastEmitted;
         const char *StrStart = LastEmitted;
         const char *StrEnd = strchr(StrStart, '}');
-        if (StrEnd == 0) {
-          llvm_report_error("Unterminated ${:foo} operand in inline asm string: '" 
-                            + std::string(AsmStr) + "'");
-        }
+        if (StrEnd == 0)
+          llvm_report_error(Twine("Unterminated ${:foo} operand in inline asm"
+                                  " string: '") + Twine(AsmStr_ + "'"));
         
         std::string Val(StrStart, StrEnd);
-        PrintSpecial(MI, O, Val.c_str());
+        PrintSpecial(MI, OS, Val.c_str());
         LastEmitted = StrEnd+1;
         break;
       }
@@ -1561,7 +1561,7 @@
           ++OpNo;  // Skip over the ID number.
 
           if (Modifier[0] == 'l')  // labels are target independent
-            O << *MI->getOperand(OpNo).getMBB()->getSymbol();
+            OS << *MI->getOperand(OpNo).getMBB()->getSymbol();
           else {
             AsmPrinter *AP = const_cast<AsmPrinter*>(this);
             if ((OpFlags & 7) == 4) {
@@ -1585,10 +1585,10 @@
     }
     }
   }
-  O << "\n";
+  OS << "\n";
   
 #if 0
-  EmitInlineAsm(O.str());
+  EmitInlineAsm(OS.str());
 #endif
   
   // Emit the #NOAPP end marker.  This has to happen even if verbose-asm isn't





More information about the llvm-commits mailing list