[llvm-commits] [llvm] r78865 - in /llvm/trunk: lib/VMCore/AsmWriter.cpp test/Integer/a15.ll.out test/Integer/a17.ll.out test/Integer/a31.ll.out test/Integer/a33.ll.out test/Integer/a63.ll.out test/Integer/a7.ll.out test/Integer/a9.ll.out

Dan Gohman gohman at apple.com
Wed Aug 12 16:54:22 PDT 2009


Author: djg
Date: Wed Aug 12 18:54:22 2009
New Revision: 78865

URL: http://llvm.org/viewvc/llvm-project?rev=78865&view=rev
Log:
Now that numbered types have their number printed, it's no longer
interesting to print the number in a comment. Numbered instructions
don't need their number in a comment either.

Also, tidy up newline printing.

Modified:
    llvm/trunk/lib/VMCore/AsmWriter.cpp
    llvm/trunk/test/Integer/a15.ll.out
    llvm/trunk/test/Integer/a17.ll.out
    llvm/trunk/test/Integer/a31.ll.out
    llvm/trunk/test/Integer/a33.ll.out
    llvm/trunk/test/Integer/a63.ll.out
    llvm/trunk/test/Integer/a7.ll.out
    llvm/trunk/test/Integer/a9.ll.out

Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Wed Aug 12 18:54:22 2009
@@ -521,7 +521,8 @@
   /// MDNode map iterators.
   ValueMap::iterator mdnBegin() { return mdnMap.begin(); }
   ValueMap::iterator mdnEnd() { return mdnMap.end(); }
-  unsigned mdnSize() { return mdnMap.size(); }
+  unsigned mdnSize() const { return mdnMap.size(); }
+  bool mdnEmpty() const { return mdnMap.empty(); }
 
   /// This function does the actual initialization.
   inline void initialize();
@@ -1343,6 +1344,7 @@
     std::string Asm = M->getModuleInlineAsm();
     size_t CurPos = 0;
     size_t NewLine = Asm.find_first_of('\n', CurPos);
+    Out << '\n';
     while (NewLine != std::string::npos) {
       // We found a newline, print the portion of the asm string from the
       // last newline up to this newline.
@@ -1362,6 +1364,7 @@
   Module::lib_iterator LI = M->lib_begin();
   Module::lib_iterator LE = M->lib_end();
   if (LI != LE) {
+    Out << '\n';
     Out << "deplibs = [ ";
     while (LI != LE) {
       Out << '"' << *LI << '"';
@@ -1369,12 +1372,15 @@
       if (LI != LE)
         Out << ", ";
     }
-    Out << " ]\n";
+    Out << " ]";
   }
 
   // Loop over the symbol table, emitting all id'd types.
+  if (!M->getTypeSymbolTable().empty() || !NumberedTypes.empty()) Out << '\n';
   printTypeSymbolTable(M->getTypeSymbolTable());
 
+  // Output all globals.
+  if (!M->global_empty()) Out << '\n';
   for (Module::const_global_iterator I = M->global_begin(), E = M->global_end();
        I != E; ++I)
     printGlobal(I);
@@ -1390,6 +1396,7 @@
     printFunction(I);
 
   // Output named metadata.
+  if (!M->named_metadata_empty()) Out << '\n';
   for (Module::const_named_metadata_iterator I = M->named_metadata_begin(),
          E = M->named_metadata_end(); I != E; ++I) {
     const NamedMDNode *NMD = I;
@@ -1403,6 +1410,7 @@
   }
 
   // Output metadata.
+  if (!Machine.mdnEmpty()) Out << '\n';
   WriteMDNodes(Out, TypePrinter, Machine);
 }
 
@@ -1521,8 +1529,7 @@
     // Make sure we print out at least one level of the type structure, so
     // that we do not get %2 = type %2
     TypePrinter.printAtLeastOneLevel(NumberedTypes[i], Out);
-    Out.PadToColumn(50);
-    Out << "; type %" << i << '\n';
+    Out << '\n';
   }
   
   // Print the named types.
@@ -1713,20 +1720,7 @@
     Out.PadToColumn(50);
     Out << "; <";
     TypePrinter.print(V.getType(), Out);
-    Out << '>';
-
-    if (!V.hasName() && !isa<Instruction>(V)) {
-      int SlotNum;
-      if (const GlobalValue *GV = dyn_cast<GlobalValue>(&V))
-        SlotNum = Machine.getGlobalSlot(GV);
-      else
-        SlotNum = Machine.getLocalSlot(&V);
-      if (SlotNum == -1)
-        Out << ":<badref>";
-      else
-        Out << ':' << SlotNum; // Print out the def slot taken.
-    }
-    Out << " [#uses=" << V.getNumUses() << ']';  // Output # uses
+    Out << "> [#uses=" << V.getNumUses() << ']';  // Output # uses
   }
 }
 

Modified: llvm/trunk/test/Integer/a15.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Integer/a15.ll.out?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/test/Integer/a15.ll.out (original)
+++ llvm/trunk/test/Integer/a15.ll.out Wed Aug 12 18:54:22 2009
@@ -1,4 +1,5 @@
 ; ModuleID = '<stdin>'
+
 @b = constant i15 0                               ; <i15*> [#uses=0]
 @c = constant i15 -2                              ; <i15*> [#uses=0]
 @d = constant i15 0                               ; <i15*> [#uses=0]

Modified: llvm/trunk/test/Integer/a17.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Integer/a17.ll.out?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/test/Integer/a17.ll.out (original)
+++ llvm/trunk/test/Integer/a17.ll.out Wed Aug 12 18:54:22 2009
@@ -1,4 +1,5 @@
 ; ModuleID = '<stdin>'
+
 @b = constant i17 0                               ; <i17*> [#uses=0]
 @c = constant i17 -2                              ; <i17*> [#uses=0]
 @d = constant i17 0                               ; <i17*> [#uses=0]

Modified: llvm/trunk/test/Integer/a31.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Integer/a31.ll.out?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/test/Integer/a31.ll.out (original)
+++ llvm/trunk/test/Integer/a31.ll.out Wed Aug 12 18:54:22 2009
@@ -1,4 +1,5 @@
 ; ModuleID = '<stdin>'
+
 @b = constant i31 0                               ; <i31*> [#uses=0]
 @c = constant i31 -2                              ; <i31*> [#uses=0]
 @d = constant i31 0                               ; <i31*> [#uses=0]

Modified: llvm/trunk/test/Integer/a33.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Integer/a33.ll.out?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/test/Integer/a33.ll.out (original)
+++ llvm/trunk/test/Integer/a33.ll.out Wed Aug 12 18:54:22 2009
@@ -1,4 +1,5 @@
 ; ModuleID = '<stdin>'
+
 @b = constant i33 0                               ; <i33*> [#uses=0]
 @c = constant i33 -2                              ; <i33*> [#uses=0]
 @d = constant i33 0                               ; <i33*> [#uses=0]

Modified: llvm/trunk/test/Integer/a63.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Integer/a63.ll.out?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/test/Integer/a63.ll.out (original)
+++ llvm/trunk/test/Integer/a63.ll.out Wed Aug 12 18:54:22 2009
@@ -1,4 +1,5 @@
 ; ModuleID = '<stdin>'
+
 @b = constant i63 0                               ; <i63*> [#uses=0]
 @c = constant i63 -2                              ; <i63*> [#uses=0]
 @d = constant i63 0                               ; <i63*> [#uses=0]

Modified: llvm/trunk/test/Integer/a7.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Integer/a7.ll.out?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/test/Integer/a7.ll.out (original)
+++ llvm/trunk/test/Integer/a7.ll.out Wed Aug 12 18:54:22 2009
@@ -1,4 +1,5 @@
 ; ModuleID = '<stdin>'
+
 @b = constant i7 0                                ; <i7*> [#uses=0]
 @q = constant i7 63                               ; <i7*> [#uses=0]
 @c = constant i7 -2                               ; <i7*> [#uses=0]

Modified: llvm/trunk/test/Integer/a9.ll.out
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Integer/a9.ll.out?rev=78865&r1=78864&r2=78865&view=diff

==============================================================================
--- llvm/trunk/test/Integer/a9.ll.out (original)
+++ llvm/trunk/test/Integer/a9.ll.out Wed Aug 12 18:54:22 2009
@@ -1,4 +1,5 @@
 ; ModuleID = '<stdin>'
+
 @b = constant i9 0                                ; <i9*> [#uses=0]
 @c = constant i9 -2                               ; <i9*> [#uses=0]
 @d = constant i9 0                                ; <i9*> [#uses=0]





More information about the llvm-commits mailing list