[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Dominators.cpp SymbolTable.cpp Type.cpp Value.cpp ValueSymbolTable.cpp

Bill Wendling isanbard at gmail.com
Fri Nov 17 00:04:02 PST 2006



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.170 -> 1.171
Dominators.cpp updated: 1.77 -> 1.78
SymbolTable.cpp updated: 1.62 -> 1.63
Type.cpp updated: 1.149 -> 1.150
Value.cpp updated: 1.58 -> 1.59
ValueSymbolTable.cpp updated: 1.2 -> 1.3
---
Log message:

Removed iostream #includes. Replaced std::cerr with DOUT.


---
Diffs of the changes:  (+71 -74)

 Constants.cpp        |   12 +++++-----
 Dominators.cpp       |    1 
 SymbolTable.cpp      |   58 +++++++++++++++++++++++++--------------------------
 Type.cpp             |   47 ++++++++++++++++++++---------------------
 Value.cpp            |    8 +++----
 ValueSymbolTable.cpp |   19 +++++++---------
 6 files changed, 71 insertions(+), 74 deletions(-)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.170 llvm/lib/VMCore/Constants.cpp:1.171
--- llvm/lib/VMCore/Constants.cpp:1.170	Wed Nov  8 00:47:33 2006
+++ llvm/lib/VMCore/Constants.cpp	Fri Nov 17 02:03:48 2006
@@ -19,11 +19,11 @@
 #include "llvm/SymbolTable.h"
 #include "llvm/Module.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/MathExtras.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -42,9 +42,9 @@
     Value *V = use_back();
 #ifndef NDEBUG      // Only in -g mode...
     if (!isa<Constant>(V))
-      std::cerr << "While deleting: " << *this
-                << "\n\nUse still stuck around after Def is destroyed: "
-                << *V << "\n\n";
+      DOUT << "While deleting: " << *this
+           << "\n\nUse still stuck around after Def is destroyed: "
+           << *V << "\n\n";
 #endif
     assert(isa<Constant>(V) && "References remain to Constant being destroyed");
     Constant *CV = cast<Constant>(V);
@@ -870,7 +870,7 @@
     }
 
     void dump() const {
-      std::cerr << "Constant.cpp: ValueMap\n";
+      DOUT << "Constant.cpp: ValueMap\n";
     }
   };
 }


Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.77 llvm/lib/VMCore/Dominators.cpp:1.78
--- llvm/lib/VMCore/Dominators.cpp:1.77	Thu Sep 21 20:07:57 2006
+++ llvm/lib/VMCore/Dominators.cpp	Fri Nov 17 02:03:48 2006
@@ -20,7 +20,6 @@
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/SetOperations.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//


Index: llvm/lib/VMCore/SymbolTable.cpp
diff -u llvm/lib/VMCore/SymbolTable.cpp:1.62 llvm/lib/VMCore/SymbolTable.cpp:1.63
--- llvm/lib/VMCore/SymbolTable.cpp:1.62	Mon May 29 07:54:52 2006
+++ llvm/lib/VMCore/SymbolTable.cpp	Fri Nov 17 02:03:48 2006
@@ -16,9 +16,8 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Debug.h"
 #include <algorithm>
-#include <iostream>
-
 using namespace llvm;
 
 #define DEBUG_SYMBOL_TABLE 0
@@ -39,9 +38,9 @@
   for (plane_iterator PI = pmap.begin(); PI != pmap.end(); ++PI) {
     for (value_iterator VI = PI->second.begin(); VI != PI->second.end(); ++VI)
       if (!isa<Constant>(VI->second) ) {
-        std::cerr << "Value still in symbol table! Type = '"
-                  << PI->first->getDescription() << "' Name = '"
-                  << VI->first << "'\n";
+        DOUT << "Value still in symbol table! Type = '"
+             << PI->first->getDescription() << "' Name = '"
+             << VI->first << "'\n";
         LeftoverValues = false;
       }
   }
@@ -136,7 +135,7 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Removing Value: " << Entry->second->getName() << "\n";
+  DOUT << " Removing Value: " << Entry->second->getName() << "\n";
 #endif
 
   // Remove the value from the plane...
@@ -149,8 +148,8 @@
     //
     if (N->getType()->isAbstract()) {
 #if DEBUG_ABSTYPE
-      std::cerr << "Plane Empty: Removing type: "
-                << N->getType()->getDescription() << "\n";
+      DOUT << "Plane Empty: Removing type: "
+           << N->getType()->getDescription() << "\n";
 #endif
       cast<DerivedType>(N->getType())->removeAbstractTypeUser(this);
     }
@@ -167,7 +166,7 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Removing type: " << Entry->first << "\n";
+  DOUT << " Removing type: " << Entry->first << "\n";
 #endif
 
   tmap.erase(Entry);
@@ -176,7 +175,8 @@
   // list...
   if (Result->isAbstract()) {
 #if DEBUG_ABSTYPE
-    std::cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n";
+    DOUT  << "Removing abstract type from symtab"
+          << Result->getDescription() << "\n";
 #endif
     cast<DerivedType>(Result)->removeAbstractTypeUser(this);
   }
@@ -194,8 +194,8 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Inserting definition: " << Name << ": "
-            << VTy->getDescription() << "\n";
+  DOUT << " Inserting definition: " << Name << ": "
+       << VTy->getDescription() << "\n";
 #endif
 
   if (PI == pmap.end()) {      // Not in collection yet... insert dummy entry
@@ -210,8 +210,8 @@
     if (VTy->isAbstract()) {
       cast<DerivedType>(VTy)->addAbstractTypeUser(this);
 #if DEBUG_ABSTYPE
-      std::cerr << "Added abstract type value: " << VTy->getDescription()
-                << "\n";
+      DOUT << "Added abstract type value: " << VTy->getDescription()
+           << "\n";
 #endif
     }
 
@@ -243,8 +243,8 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Inserting type: " << UniqueName << ": "
-            << T->getDescription() << "\n";
+  DOUT << " Inserting type: " << UniqueName << ": "
+       << T->getDescription() << "\n";
 #endif
 
   // Insert the tmap entry
@@ -254,7 +254,7 @@
   if (T->isAbstract()) {
     cast<DerivedType>(T)->addAbstractTypeUser(this);
 #if DEBUG_ABSTYPE
-    std::cerr << "Added abstract type to ST: " << T->getDescription() << "\n";
+    DOUT << "Added abstract type to ST: " << T->getDescription() << "\n";
 #endif
   }
 }
@@ -303,8 +303,8 @@
       if (NewType->isAbstract()) {
         cast<DerivedType>(NewType)->addAbstractTypeUser(this);
 #if DEBUG_ABSTYPE
-        std::cerr << "[Added] refined to abstype: " << NewType->getDescription()
-                  << "\n";
+        DOUT << "[Added] refined to abstype: " << NewType->getDescription()
+             << "\n";
 #endif
       }
     }
@@ -368,7 +368,7 @@
     // Ok, now we are not referencing the type anymore... take me off your user
     // list please!
 #if DEBUG_ABSTYPE
-    std::cerr << "Removing type " << OldType->getDescription() << "\n";
+    DOUT << "Removing type " << OldType->getDescription() << "\n";
 #endif
     OldType->removeAbstractTypeUser(this);
 
@@ -384,14 +384,14 @@
   for (type_iterator I = type_begin(), E = type_end(); I != E; ++I) {
     if (I->second == (Type*)OldType) {  // FIXME when Types aren't const.
 #if DEBUG_ABSTYPE
-      std::cerr << "Removing type " << OldType->getDescription() << "\n";
+      DOUT << "Removing type " << OldType->getDescription() << "\n";
 #endif
       OldType->removeAbstractTypeUser(this);
 
       I->second = (Type*)NewType;  // TODO FIXME when types aren't const
       if (NewType->isAbstract()) {
 #if DEBUG_ABSTYPE
-        std::cerr << "Added type " << NewType->getDescription() << "\n";
+        DOUT << "Added type " << NewType->getDescription() << "\n";
 #endif
         cast<DerivedType>(NewType)->addAbstractTypeUser(this);
       }
@@ -418,28 +418,28 @@
 }
 
 static void DumpVal(const std::pair<const std::string, Value *> &V) {
-  std::cerr << "  '" << V.first << "' = ";
+  DOUT << "  '" << V.first << "' = ";
   V.second->dump();
-  std::cerr << "\n";
+  DOUT << "\n";
 }
 
 static void DumpPlane(const std::pair<const Type *,
                                       std::map<const std::string, Value *> >&P){
   P.first->dump();
-  std::cerr << "\n";
+  DOUT << "\n";
   for_each(P.second.begin(), P.second.end(), DumpVal);
 }
 
 static void DumpTypes(const std::pair<const std::string, const Type*>& T ) {
-  std::cerr << "  '" << T.first << "' = ";
+  DOUT << "  '" << T.first << "' = ";
   T.second->dump();
-  std::cerr << "\n";
+  DOUT << "\n";
 }
 
 void SymbolTable::dump() const {
-  std::cerr << "Symbol table dump:\n  Plane:";
+  DOUT << "Symbol table dump:\n  Plane:";
   for_each(pmap.begin(), pmap.end(), DumpPlane);
-  std::cerr << "  Types: ";
+  DOUT << "  Types: ";
   for_each(tmap.begin(), tmap.end(), DumpTypes);
 }
 


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.149 llvm/lib/VMCore/Type.cpp:1.150
--- llvm/lib/VMCore/Type.cpp:1.149	Thu Oct 26 13:22:45 2006
+++ llvm/lib/VMCore/Type.cpp	Fri Nov 17 02:03:48 2006
@@ -23,7 +23,6 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ManagedStatic.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 // DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are
@@ -487,7 +486,7 @@
 OpaqueType::OpaqueType() : DerivedType(OpaqueTyID) {
   setAbstract(true);
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "Derived new type: " << *this << "\n";
+  DOUT << "Derived new type: " << *this << "\n";
 #endif
 }
 
@@ -831,8 +830,8 @@
   void RefineAbstractType(TypeClass *Ty, const DerivedType *OldType,
                         const Type *NewType) {
 #ifdef DEBUG_MERGE_TYPES
-    std::cerr << "RefineAbstractType(" << (void*)OldType << "[" << *OldType
-    << "], " << (void*)NewType << " [" << *NewType << "])\n";
+    DOUT << "RefineAbstractType(" << (void*)OldType << "[" << *OldType
+         << "], " << (void*)NewType << " [" << *NewType << "])\n";
 #endif
     
     // Otherwise, we are changing one subelement type into another.  Clearly the
@@ -937,12 +936,12 @@
 
   void print(const char *Arg) const {
 #ifdef DEBUG_MERGE_TYPES
-    std::cerr << "TypeMap<>::" << Arg << " table contents:\n";
+    DOUT << "TypeMap<>::" << Arg << " table contents:\n";
     unsigned i = 0;
     for (typename std::map<ValType, PATypeHolder>::const_iterator I
            = Map.begin(), E = Map.end(); I != E; ++I)
-      std::cerr << " " << (++i) << ". " << (void*)I->second.get() << " "
-                << *I->second.get() << "\n";
+      DOUT << " " << (++i) << ". " << (void*)I->second.get() << " "
+           << *I->second.get() << "\n";
 #endif
   }
 
@@ -1016,7 +1015,7 @@
   FunctionTypes->add(VT, MT = new FunctionType(ReturnType, Params, isVarArg));
 
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "Derived new type: " << MT << "\n";
+  DOUT << "Derived new type: " << MT << "\n";
 #endif
   return MT;
 }
@@ -1065,7 +1064,7 @@
   ArrayTypes->add(AVT, AT = new ArrayType(ElementType, NumElements));
 
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "Derived new type: " << *AT << "\n";
+  DOUT << "Derived new type: " << *AT << "\n";
 #endif
   return AT;
 }
@@ -1116,7 +1115,7 @@
   PackedTypes->add(PVT, PT = new PackedType(ElementType, NumElements));
 
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "Derived new type: " << *PT << "\n";
+  DOUT << "Derived new type: " << *PT << "\n";
 #endif
   return PT;
 }
@@ -1169,7 +1168,7 @@
   StructTypes->add(STV, ST = new StructType(ETypes));
 
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "Derived new type: " << *ST << "\n";
+  DOUT << "Derived new type: " << *ST << "\n";
 #endif
   return ST;
 }
@@ -1224,7 +1223,7 @@
   PointerTypes->add(PVT, PT = new PointerType(ValueType));
 
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "Derived new type: " << *PT << "\n";
+  DOUT << "Derived new type: " << *PT << "\n";
 #endif
   return PT;
 }
@@ -1253,14 +1252,14 @@
   AbstractTypeUsers.erase(AbstractTypeUsers.begin()+i);
 
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "  remAbstractTypeUser[" << (void*)this << ", "
-            << *this << "][" << i << "] User = " << U << "\n";
+  DOUT << "  remAbstractTypeUser[" << (void*)this << ", "
+       << *this << "][" << i << "] User = " << U << "\n";
 #endif
 
   if (AbstractTypeUsers.empty() && getRefCount() == 0 && isAbstract()) {
 #ifdef DEBUG_MERGE_TYPES
-    std::cerr << "DELETEing unused abstract type: <" << *this
-              << ">[" << (void*)this << "]" << "\n";
+    DOUT << "DELETEing unused abstract type: <" << *this
+         << ">[" << (void*)this << "]" << "\n";
 #endif
     delete this;                  // No users of this abstract type!
   }
@@ -1281,9 +1280,9 @@
   AbstractTypeDescriptions->clear();
 
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "REFINING abstract type [" << (void*)this << " "
-            << *this << "] to [" << (void*)NewType << " "
-            << *NewType << "]!\n";
+  DOUT << "REFINING abstract type [" << (void*)this << " "
+       << *this << "] to [" << (void*)NewType << " "
+       << *NewType << "]!\n";
 #endif
 
   // Make sure to put the type to be refined to into a holder so that if IT gets
@@ -1319,10 +1318,10 @@
 
     unsigned OldSize = AbstractTypeUsers.size();
 #ifdef DEBUG_MERGE_TYPES
-    std::cerr << " REFINING user " << OldSize-1 << "[" << (void*)User
-              << "] of abstract type [" << (void*)this << " "
-              << *this << "] to [" << (void*)NewTy.get() << " "
-              << *NewTy << "]!\n";
+    DOUT << " REFINING user " << OldSize-1 << "[" << (void*)User
+         << "] of abstract type [" << (void*)this << " "
+         << *this << "] to [" << (void*)NewTy.get() << " "
+         << *NewTy << "]!\n";
 #endif
     User->refineAbstractType(this, NewTy);
 
@@ -1341,7 +1340,7 @@
 //
 void DerivedType::notifyUsesThatTypeBecameConcrete() {
 #ifdef DEBUG_MERGE_TYPES
-  std::cerr << "typeIsREFINED type: " << (void*)this << " " << *this << "\n";
+  DOUT << "typeIsREFINED type: " << (void*)this << " " << *this << "\n";
 #endif
 
   unsigned OldSize = AbstractTypeUsers.size();


Index: llvm/lib/VMCore/Value.cpp
diff -u llvm/lib/VMCore/Value.cpp:1.58 llvm/lib/VMCore/Value.cpp:1.59
--- llvm/lib/VMCore/Value.cpp:1.58	Tue Oct  4 13:13:04 2005
+++ llvm/lib/VMCore/Value.cpp	Fri Nov 17 02:03:48 2006
@@ -16,9 +16,9 @@
 #include "llvm/InstrTypes.h"
 #include "llvm/Module.h"
 #include "llvm/SymbolTable.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/LeakDetector.h"
 #include <algorithm>
-#include <iostream>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -50,10 +50,10 @@
   // a <badref>
   //
   if (use_begin() != use_end()) {
-    std::cerr << "While deleting: " << *Ty << " %" << Name << "\n";
+    DOUT << "While deleting: " << *Ty << " %" << Name << "\n";
     for (use_iterator I = use_begin(), E = use_end(); I != E; ++I)
-      std::cerr << "Use still stuck around after Def is destroyed:"
-                << **I << "\n";
+      DOUT << "Use still stuck around after Def is destroyed:"
+           << **I << "\n";
   }
 #endif
   assert(use_begin() == use_end() && "Uses remain when a value is destroyed!");


Index: llvm/lib/VMCore/ValueSymbolTable.cpp
diff -u llvm/lib/VMCore/ValueSymbolTable.cpp:1.2 llvm/lib/VMCore/ValueSymbolTable.cpp:1.3
--- llvm/lib/VMCore/ValueSymbolTable.cpp:1.2	Tue Jan 10 23:39:45 2006
+++ llvm/lib/VMCore/ValueSymbolTable.cpp	Fri Nov 17 02:03:48 2006
@@ -15,9 +15,8 @@
 #include "llvm/Type.h"
 #include "llvm/ValueSymbolTable.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Debug.h"
 #include <algorithm>
-#include <iostream>
-
 using namespace llvm;
 
 #define DEBUG_SYMBOL_TABLE 0
@@ -29,9 +28,9 @@
   bool LeftoverValues = true;
   for (iterator VI = vmap.begin(), VE = vmap.end(); VI != VE; ++VI)
     if (!isa<Constant>(VI->second) ) {
-      std::cerr << "Value still in symbol table! Type = '"
-                << VI->second->getType()->getDescription() << "' Name = '"
-                << VI->first << "'\n";
+      DOUT << "Value still in symbol table! Type = '"
+           << VI->second->getType()->getDescription() << "' Name = '"
+           << VI->first << "'\n";
       LeftoverValues = false;
     }
   assert(LeftoverValues && "Values remain in symbol table!");
@@ -89,7 +88,7 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Inserting value: " << UniqueName << ": " << V->dump() << "\n";
+  DOUT << " Inserting value: " << UniqueName << ": " << V->dump() << "\n";
 #endif
 
   // Insert the vmap entry
@@ -105,7 +104,7 @@
 
 #if DEBUG_SYMBOL_TABLE
   dump();
-  std::cerr << " Removing Value: " << Entry->second->getName() << "\n";
+  DOUT << " Removing Value: " << Entry->second->getName() << "\n";
 #endif
 
   // Remove the value from the plane...
@@ -153,14 +152,14 @@
 // DumpVal - a std::for_each function for dumping a value
 //
 static void DumpVal(const std::pair<const std::string, Value *> &V) {
-  std::cerr << "  '" << V.first << "' = ";
+  DOUT << "  '" << V.first << "' = ";
   V.second->dump();
-  std::cerr << "\n";
+  DOUT << "\n";
 }
 
 // dump - print out the symbol table
 //
 void ValueSymbolTable::dump() const {
-  std::cerr << "ValueSymbolTable:\n";
+  DOUT << "ValueSymbolTable:\n";
   for_each(vmap.begin(), vmap.end(), DumpVal);
 }






More information about the llvm-commits mailing list