Print Debug Code to stderr instead of stdout so that it doesn't mess up the assembly...
authorChris Lattner <sabre@nondot.org>
Mon, 15 Oct 2001 18:30:06 +0000 (18:30 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 15 Oct 2001 18:30:06 +0000 (18:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@841 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
include/llvm/CodeGen/MachineRegInfo.h
include/llvm/CodeGen/RegClass.h
lib/Analysis/LiveVar/BBLiveVar.cpp
lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp
lib/Analysis/LiveVar/ValueSet.cpp
lib/CodeGen/RegAlloc/LiveRange.h
lib/CodeGen/RegAlloc/RegClass.h
lib/Target/SparcV9/LiveVar/BBLiveVar.cpp
lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
lib/Target/SparcV9/LiveVar/ValueSet.cpp
lib/Target/SparcV9/RegAlloc/LiveRange.h
lib/Target/SparcV9/RegAlloc/RegClass.h

index 64fd29eee51efa0b091d4c565faec13322b57324..fbc32f03106761d3bbba5778068face2a8de341d 100644 (file)
@@ -79,7 +79,7 @@ class MachineRegInfo
     // RegClassArr.pushback( new SparcFloatCCRegClass(2) );
 
     if(DEBUG_RA)
-      cout << "Created machine register classes." << endl;
+      cerr << "Created machine register classes." << endl;
 
   }
 
index d08ed3a6594cd2bba6366b5898a3ce6272a8bd41..9f5a46902ac18cf0e7178c8290c8099b123ae3ce 100644 (file)
@@ -101,12 +101,12 @@ class RegClass
 
 
   inline void printIGNodeList() const {
-    cout << "IG Nodes for Register Class " << RegClassID << ":" << endl;
+    cerr << "IG Nodes for Register Class " << RegClassID << ":" << endl;
     IG.printIGNodeList(); 
   }
 
   inline void printIG() {  
-    cout << "IG for Register Class " << RegClassID << ":" << endl;
+    cerr << "IG for Register Class " << RegClassID << ":" << endl;
     IG.printIG(); 
   }
 
index 638e000cc7dd72ad14c8438922202b4e0ea4de89..09beb12b0885ab514713792ea038b47b8f84a549 100644 (file)
@@ -33,9 +33,9 @@ void BBLiveVar::calcDefUseSets()
     assert(MInst);
     
     if( DEBUG_LV > 1) {                            // debug msg
-      cout << " *Iterating over machine instr ";
+      cerr << " *Iterating over machine instr ";
       MInst->dump();
-      cout << endl;
+      cerr << endl;
     }
 
     // iterate over  MI operands to find defs
@@ -79,11 +79,11 @@ void BBLiveVar::calcDefUseSets()
          assert( PhiArgMap[ ArgVal ] );
          
          if( DEBUG_LV > 1) {   // debug msg of level 2
-           cout << "   - phi operand "; 
+           cerr << "   - phi operand "; 
            printValue( ArgVal ); 
-           cout  << " came from BB "; 
+           cerr  << " came from BB "; 
            printValue( PhiArgMap[ ArgVal ]); 
-           cout<<endl;
+           cerr<<endl;
          }
 
        } // if( IsPhi )
@@ -117,7 +117,7 @@ void  BBLiveVar::addDef(const Value *Op)
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   
-    cout << "  +Def: "; printValue( Op ); cout << endl;
+    cerr << "  +Def: "; printValue( Op ); cerr << endl;
   }
 }
 
@@ -130,7 +130,7 @@ void  BBLiveVar::addUse(const Value *Op)
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   // debug msg of level 2
-    cout << "   Use: "; printValue( Op ); cout << endl;
+    cerr << "   Use: "; printValue( Op ); cerr << endl;
   }
 
 }
@@ -220,15 +220,15 @@ bool BBLiveVar::applyFlowFunc(BBToBBLiveVarMapType LVMap)
 
 void BBLiveVar::printAllSets() const
 {
-  cout << "  Defs: ";   DefSet.printSet();  cout << endl;
-  cout << "  In: ";   InSet.printSet();  cout << endl;
-  cout << "  Out: ";   OutSet.printSet();  cout << endl;
+  cerr << "  Defs: ";   DefSet.printSet();  cerr << endl;
+  cerr << "  In: ";   InSet.printSet();  cerr << endl;
+  cerr << "  Out: ";   OutSet.printSet();  cerr << endl;
 }
 
 void BBLiveVar::printInOutSets() const
 {
-  cout << "  In: ";   InSet.printSet();  cout << endl;
-  cout << "  Out: ";   OutSet.printSet();  cout << endl;
+  cerr << "  In: ";   InSet.printSet();  cerr << endl;
+  cerr << "  Out: ";   OutSet.printSet();  cerr << endl;
 }
 
 
index 40ebf1e6bd38656267555ce563f163230ec9c1bf..5c1aa8213507f87e659ac2c931b17ec1b7611ec0 100644 (file)
@@ -54,7 +54,7 @@ void MethodLiveVarInfo::constructBBs()
 
     const BasicBlock *BB = *BBI;        // get the current BB 
 
-    if(DEBUG_LV) { cout << " For BB "; printValue(BB); cout << ":" << endl; }
+    if(DEBUG_LV) { cerr << " For BB "; printValue(BB); cerr << ":" << endl; }
 
                                         // create a new BBLiveVar
     BBLiveVar * LVBB = new BBLiveVar( BB, POId );  
@@ -92,7 +92,7 @@ bool MethodLiveVarInfo::doSingleBackwardPass()
   bool ResultFlow, NeedAnotherIteration = false;
 
   if(DEBUG_LV) 
-    cout << endl <<  " After Backward Pass ..." << endl;
+    cerr << endl <<  " After Backward Pass ..." << endl;
 
   po_iterator<const Method*> BBI = po_begin(Meth);
 
@@ -102,8 +102,8 @@ bool MethodLiveVarInfo::doSingleBackwardPass()
     BBLiveVar* LVBB = BB2BBLVMap[*BBI];
     assert( LVBB );
 
-    if(DEBUG_LV) cout << " For BB " << (*BBI)->getName() << ":"  << endl;
-    // cout << " (POId=" << LVBB->getPOId() << ")" << endl ;
+    if(DEBUG_LV) cerr << " For BB " << (*BBI)->getName() << ":"  << endl;
+    // cerr << " (POId=" << LVBB->getPOId() << ")" << endl ;
 
     ResultFlow = false;
 
@@ -136,7 +136,7 @@ void MethodLiveVarInfo::analyze()
   if (HasAnalyzed)
     return;
   
-  if( DEBUG_LV) cout << "Analysing live variables ..." << endl;
+  if( DEBUG_LV) cerr << "Analysing live variables ..." << endl;
 
   // create and initialize all the BBLiveVars of the CFG
   constructBBs();        
@@ -149,7 +149,7 @@ void MethodLiveVarInfo::analyze()
   
   HasAnalyzed  = true;                // finished analysing
 
-  if( DEBUG_LV) cout << "Live Variable Analysis complete!" << endl;
+  if( DEBUG_LV) cerr << "Live Variable Analysis complete!" << endl;
 }
 
 
index 8cfe6fb289ea723e2aeb8b4a890db16b85296147..c93bc2028cb6c7583450fee62327213652f5bd53 100644 (file)
@@ -6,12 +6,12 @@
 void printValue( const Value *const v)  // func to print a Value 
 {
   
-  if( (*v).hasName() ) 
-    cout << v << "(" << ((*v).getName()) << ") ";
+  if (v->hasName())
+    cerr << v << "(" << ((*v).getName()) << ") ";
   else if (v->getValueType() == Value::ConstantVal)         // if const
-    cout << v << "(" << ((ConstPoolVal *) v)->getStrValue() << ") ";
+    cerr << v << "(" << ((ConstPoolVal *) v)->getStrValue() << ") ";
   else
-      cout << v  << " ";
+    cerr << v  << " ";
 }
 
 
index 9c4d45088052a3c9ded6d2cce0e3933fe4b2da04..28e0712283917592977a7d6df90d1856ab93f1cc 100644 (file)
@@ -101,7 +101,7 @@ class LiveRange : public ValueSet
     if(SuggestedColor == -1 )
       SuggestedColor = Col;
     else if (DEBUG_RA) 
-      cout << "Already has a suggested color " << Col << endl;
+      cerr << "Already has a suggested color " << Col << endl;
   }
 
   inline unsigned getSuggestedColor() const {
index d08ed3a6594cd2bba6366b5898a3ce6272a8bd41..9f5a46902ac18cf0e7178c8290c8099b123ae3ce 100644 (file)
@@ -101,12 +101,12 @@ class RegClass
 
 
   inline void printIGNodeList() const {
-    cout << "IG Nodes for Register Class " << RegClassID << ":" << endl;
+    cerr << "IG Nodes for Register Class " << RegClassID << ":" << endl;
     IG.printIGNodeList(); 
   }
 
   inline void printIG() {  
-    cout << "IG for Register Class " << RegClassID << ":" << endl;
+    cerr << "IG for Register Class " << RegClassID << ":" << endl;
     IG.printIG(); 
   }
 
index 638e000cc7dd72ad14c8438922202b4e0ea4de89..09beb12b0885ab514713792ea038b47b8f84a549 100644 (file)
@@ -33,9 +33,9 @@ void BBLiveVar::calcDefUseSets()
     assert(MInst);
     
     if( DEBUG_LV > 1) {                            // debug msg
-      cout << " *Iterating over machine instr ";
+      cerr << " *Iterating over machine instr ";
       MInst->dump();
-      cout << endl;
+      cerr << endl;
     }
 
     // iterate over  MI operands to find defs
@@ -79,11 +79,11 @@ void BBLiveVar::calcDefUseSets()
          assert( PhiArgMap[ ArgVal ] );
          
          if( DEBUG_LV > 1) {   // debug msg of level 2
-           cout << "   - phi operand "; 
+           cerr << "   - phi operand "; 
            printValue( ArgVal ); 
-           cout  << " came from BB "; 
+           cerr  << " came from BB "; 
            printValue( PhiArgMap[ ArgVal ]); 
-           cout<<endl;
+           cerr<<endl;
          }
 
        } // if( IsPhi )
@@ -117,7 +117,7 @@ void  BBLiveVar::addDef(const Value *Op)
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   
-    cout << "  +Def: "; printValue( Op ); cout << endl;
+    cerr << "  +Def: "; printValue( Op ); cerr << endl;
   }
 }
 
@@ -130,7 +130,7 @@ void  BBLiveVar::addUse(const Value *Op)
   InSetChanged = true; 
 
   if( DEBUG_LV > 1) {   // debug msg of level 2
-    cout << "   Use: "; printValue( Op ); cout << endl;
+    cerr << "   Use: "; printValue( Op ); cerr << endl;
   }
 
 }
@@ -220,15 +220,15 @@ bool BBLiveVar::applyFlowFunc(BBToBBLiveVarMapType LVMap)
 
 void BBLiveVar::printAllSets() const
 {
-  cout << "  Defs: ";   DefSet.printSet();  cout << endl;
-  cout << "  In: ";   InSet.printSet();  cout << endl;
-  cout << "  Out: ";   OutSet.printSet();  cout << endl;
+  cerr << "  Defs: ";   DefSet.printSet();  cerr << endl;
+  cerr << "  In: ";   InSet.printSet();  cerr << endl;
+  cerr << "  Out: ";   OutSet.printSet();  cerr << endl;
 }
 
 void BBLiveVar::printInOutSets() const
 {
-  cout << "  In: ";   InSet.printSet();  cout << endl;
-  cout << "  Out: ";   OutSet.printSet();  cout << endl;
+  cerr << "  In: ";   InSet.printSet();  cerr << endl;
+  cerr << "  Out: ";   OutSet.printSet();  cerr << endl;
 }
 
 
index 40ebf1e6bd38656267555ce563f163230ec9c1bf..5c1aa8213507f87e659ac2c931b17ec1b7611ec0 100644 (file)
@@ -54,7 +54,7 @@ void MethodLiveVarInfo::constructBBs()
 
     const BasicBlock *BB = *BBI;        // get the current BB 
 
-    if(DEBUG_LV) { cout << " For BB "; printValue(BB); cout << ":" << endl; }
+    if(DEBUG_LV) { cerr << " For BB "; printValue(BB); cerr << ":" << endl; }
 
                                         // create a new BBLiveVar
     BBLiveVar * LVBB = new BBLiveVar( BB, POId );  
@@ -92,7 +92,7 @@ bool MethodLiveVarInfo::doSingleBackwardPass()
   bool ResultFlow, NeedAnotherIteration = false;
 
   if(DEBUG_LV) 
-    cout << endl <<  " After Backward Pass ..." << endl;
+    cerr << endl <<  " After Backward Pass ..." << endl;
 
   po_iterator<const Method*> BBI = po_begin(Meth);
 
@@ -102,8 +102,8 @@ bool MethodLiveVarInfo::doSingleBackwardPass()
     BBLiveVar* LVBB = BB2BBLVMap[*BBI];
     assert( LVBB );
 
-    if(DEBUG_LV) cout << " For BB " << (*BBI)->getName() << ":"  << endl;
-    // cout << " (POId=" << LVBB->getPOId() << ")" << endl ;
+    if(DEBUG_LV) cerr << " For BB " << (*BBI)->getName() << ":"  << endl;
+    // cerr << " (POId=" << LVBB->getPOId() << ")" << endl ;
 
     ResultFlow = false;
 
@@ -136,7 +136,7 @@ void MethodLiveVarInfo::analyze()
   if (HasAnalyzed)
     return;
   
-  if( DEBUG_LV) cout << "Analysing live variables ..." << endl;
+  if( DEBUG_LV) cerr << "Analysing live variables ..." << endl;
 
   // create and initialize all the BBLiveVars of the CFG
   constructBBs();        
@@ -149,7 +149,7 @@ void MethodLiveVarInfo::analyze()
   
   HasAnalyzed  = true;                // finished analysing
 
-  if( DEBUG_LV) cout << "Live Variable Analysis complete!" << endl;
+  if( DEBUG_LV) cerr << "Live Variable Analysis complete!" << endl;
 }
 
 
index 8cfe6fb289ea723e2aeb8b4a890db16b85296147..c93bc2028cb6c7583450fee62327213652f5bd53 100644 (file)
@@ -6,12 +6,12 @@
 void printValue( const Value *const v)  // func to print a Value 
 {
   
-  if( (*v).hasName() ) 
-    cout << v << "(" << ((*v).getName()) << ") ";
+  if (v->hasName())
+    cerr << v << "(" << ((*v).getName()) << ") ";
   else if (v->getValueType() == Value::ConstantVal)         // if const
-    cout << v << "(" << ((ConstPoolVal *) v)->getStrValue() << ") ";
+    cerr << v << "(" << ((ConstPoolVal *) v)->getStrValue() << ") ";
   else
-      cout << v  << " ";
+    cerr << v  << " ";
 }
 
 
index 9c4d45088052a3c9ded6d2cce0e3933fe4b2da04..28e0712283917592977a7d6df90d1856ab93f1cc 100644 (file)
@@ -101,7 +101,7 @@ class LiveRange : public ValueSet
     if(SuggestedColor == -1 )
       SuggestedColor = Col;
     else if (DEBUG_RA) 
-      cout << "Already has a suggested color " << Col << endl;
+      cerr << "Already has a suggested color " << Col << endl;
   }
 
   inline unsigned getSuggestedColor() const {
index d08ed3a6594cd2bba6366b5898a3ce6272a8bd41..9f5a46902ac18cf0e7178c8290c8099b123ae3ce 100644 (file)
@@ -101,12 +101,12 @@ class RegClass
 
 
   inline void printIGNodeList() const {
-    cout << "IG Nodes for Register Class " << RegClassID << ":" << endl;
+    cerr << "IG Nodes for Register Class " << RegClassID << ":" << endl;
     IG.printIGNodeList(); 
   }
 
   inline void printIG() {  
-    cout << "IG for Register Class " << RegClassID << ":" << endl;
+    cerr << "IG for Register Class " << RegClassID << ":" << endl;
     IG.printIG(); 
   }