diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-15 18:15:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-15 18:15:27 +0000 |
commit | 1e23ed7c653bb73984766cd3868da4d372ac47f8 (patch) | |
tree | 6eae47934e94ea7432fc865ac898615b63b1263e /lib/CodeGen | |
parent | 18fc812a1b47100f773e48fdd7392d1c22876e88 (diff) |
Output to cerr rather than cout so that debug info doesn't mess up assembly generation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@840 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/RegAlloc/InterferenceGraph.cpp | 28 | ||||
-rw-r--r-- | lib/CodeGen/RegAlloc/LiveRangeInfo.cpp | 44 | ||||
-rw-r--r-- | lib/CodeGen/RegAlloc/PhyRegAlloc.cpp | 76 | ||||
-rw-r--r-- | lib/CodeGen/RegAlloc/RegClass.cpp | 22 |
4 files changed, 85 insertions, 85 deletions
diff --git a/lib/CodeGen/RegAlloc/InterferenceGraph.cpp b/lib/CodeGen/RegAlloc/InterferenceGraph.cpp index d8ec2470aa..4efe30e9e0 100644 --- a/lib/CodeGen/RegAlloc/InterferenceGraph.cpp +++ b/lib/CodeGen/RegAlloc/InterferenceGraph.cpp @@ -7,7 +7,7 @@ InterferenceGraph::InterferenceGraph(RegClass *const RC) : RegCl(RC), IG = NULL; Size = 0; if( DEBUG_RA) { - cout << "Interference graph created!" << endl; + cerr << "Interference graph created!" << endl; } } @@ -65,7 +65,7 @@ void InterferenceGraph::setInterference(const LiveRange *const LR1, char *val; if( DEBUG_RA > 1) - cout << "setting intf for: [" << row << "][" << col << "]" << endl; + cerr << "setting intf for: [" << row << "][" << col << "]" << endl; ( row > col) ? val = &IG[row][col]: val = &IG[col][row]; @@ -118,9 +118,9 @@ void InterferenceGraph::mergeIGNodesOfLRs(const LiveRange *const LR1, assertIGNode( SrcNode ); if( DEBUG_RA > 1) { - cout << "Merging LRs: \""; LR1->printSet(); - cout << "\" and \""; LR2->printSet(); - cout << "\"" << endl; + cerr << "Merging LRs: \""; LR1->printSet(); + cerr << "\" and \""; LR2->printSet(); + cerr << "\"" << endl; } unsigned SrcDegree = SrcNode->getNumOfNeighbors(); @@ -147,10 +147,10 @@ void InterferenceGraph::mergeIGNodesOfLRs(const LiveRange *const LR1, setInterference(LR1, LROfNeigh ); } - //cout<< " #Neighs - Neigh: ["<< NeighNode->getIndex()<< "] "; - //cout << NeighNode->getNumOfNeighbors(); - //cout << " Dest: [" << DestNode->getIndex() << "] "; - //cout << DestNode->getNumOfNeighbors() << endl; + //cerr<< " #Neighs - Neigh: ["<< NeighNode->getIndex()<< "] "; + //cerr << NeighNode->getNumOfNeighbors(); + //cerr << " Dest: [" << DestNode->getIndex() << "] "; + //cerr << DestNode->getNumOfNeighbors() << endl; } @@ -193,13 +193,13 @@ void InterferenceGraph::printIG() const if( ! Node ) continue; // skip empty rows - cout << " [" << i << "] "; + cerr << " [" << i << "] "; for( unsigned int j=0; j < Size; j++) { if( j >= i) break; - if( IG[i][j] ) cout << "(" << i << "," << j << ") "; + if( IG[i][j] ) cerr << "(" << i << "," << j << ") "; } - cout << endl; + cerr << endl; } } @@ -215,10 +215,10 @@ void InterferenceGraph::printIGNodeList() const if( ! Node ) continue; - cout << " [" << Node->getIndex() << "] "; + cerr << " [" << Node->getIndex() << "] "; (Node->getParentLR())->printSet(); //int Deg = Node->getCurDegree(); - cout << "\t <# of Neighs: " << Node->getNumOfNeighbors() << ">" << endl; + cerr << "\t <# of Neighs: " << Node->getNumOfNeighbors() << ">" << endl; } } diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp index c137e676b1..1989240ab5 100644 --- a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp +++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp @@ -46,7 +46,7 @@ void LiveRangeInfo::constructLiveRanges() { if( DEBUG_RA) - cout << "Consturcting Live Ranges ..." << endl; + cerr << "Consturcting Live Ranges ..." << endl; // first find the live ranges for all incoming args of the method since // those LRs start from the start of the method @@ -75,8 +75,8 @@ void LiveRangeInfo::constructLiveRanges() if( DEBUG_RA > 1) { - cout << " adding LiveRange for argument "; - printValue( (const Value *) *ArgIt); cout << endl; + cerr << " adding LiveRange for argument "; + printValue( (const Value *) *ArgIt); cerr << endl; } } @@ -124,9 +124,9 @@ void LiveRangeInfo::constructLiveRanges() OpI.getMachineOperand().getOperandType(); if ( OpTyp == MachineOperand::MO_CCRegister) { - cout << "\n**CC reg found. Is Def=" << OpI.isDef() << " Val:"; + cerr << "\n**CC reg found. Is Def=" << OpI.isDef() << " Val:"; printValue( OpI.getMachineOperand().getVRegValue() ); - cout << endl; + cerr << endl; } } @@ -139,8 +139,8 @@ void LiveRangeInfo::constructLiveRanges() // Only instruction values are accepted for live ranges here if( Def->getValueType() != Value::InstructionVal ) { - cout << "\n**%%Error: Def is not an instruction val. Def="; - printValue( Def ); cout << endl; + cerr << "\n**%%Error: Def is not an instruction val. Def="; + printValue( Def ); cerr << endl; continue; } @@ -156,8 +156,8 @@ void LiveRangeInfo::constructLiveRanges() LiveRangeMap[ Def ] = DefRange; // update the map if( DEBUG_RA > 1) { - cout << " creating a LR for def: "; - printValue(Def); cout << endl; + cerr << " creating a LR for def: "; + printValue(Def); cerr << endl; } // set the register class of the new live range @@ -171,7 +171,7 @@ void LiveRangeInfo::constructLiveRanges() if(isCC && DEBUG_RA) { - cout << "\a**created a LR for a CC reg:"; + cerr << "\a**created a LR for a CC reg:"; printValue( OpI.getMachineOperand().getVRegValue() ); } @@ -185,8 +185,8 @@ void LiveRangeInfo::constructLiveRanges() LiveRangeMap[ Def ] = DefRange; if( DEBUG_RA > 1) { - cout << " added to an existing LR for def: "; - printValue( Def ); cout << endl; + cerr << " added to an existing LR for def: "; + printValue( Def ); cerr << endl; } } @@ -206,7 +206,7 @@ void LiveRangeInfo::constructLiveRanges() suggestRegs4CallRets(); if( DEBUG_RA) - cout << "Initial Live Ranges constructed!" << endl; + cerr << "Initial Live Ranges constructed!" << endl; } @@ -257,7 +257,7 @@ void LiveRangeInfo::coalesceLRs() */ if( DEBUG_RA) - cout << endl << "Coalscing LRs ..." << endl; + cerr << endl << "Coalscing LRs ..." << endl; Method::const_iterator BBI = Meth->begin(); // random iterator for BBs @@ -274,9 +274,9 @@ void LiveRangeInfo::coalesceLRs() const MachineInstr * MInst = *MInstIterator; if( DEBUG_RA > 1) { - cout << " *Iterating over machine instr "; + cerr << " *Iterating over machine instr "; MInst->dump(); - cout << endl; + cerr << endl; } @@ -298,8 +298,8 @@ void LiveRangeInfo::coalesceLRs() //don't warn about labels if (!((*UseI)->getType())->isLabelType() && DEBUG_RA) { - cout<<" !! Warning: No LR for use "; printValue(*UseI); - cout << endl; + cerr<<" !! Warning: No LR for use "; printValue(*UseI); + cerr << endl; } continue; // ignore and continue } @@ -345,7 +345,7 @@ void LiveRangeInfo::coalesceLRs() } // for all BBs if( DEBUG_RA) - cout << endl << "Coalscing Done!" << endl; + cerr << endl << "Coalscing Done!" << endl; } @@ -359,11 +359,11 @@ void LiveRangeInfo::coalesceLRs() void LiveRangeInfo::printLiveRanges() { LiveRangeMapType::iterator HMI = LiveRangeMap.begin(); // hash map iterator - cout << endl << "Printing Live Ranges from Hash Map:" << endl; + cerr << endl << "Printing Live Ranges from Hash Map:" << endl; for( ; HMI != LiveRangeMap.end() ; HMI ++ ) { if( (*HMI).first && (*HMI).second ) { - cout <<" "; printValue((*HMI).first); cout << "\t: "; - ((*HMI).second)->printSet(); cout << endl; + cerr <<" "; printValue((*HMI).first); cerr << "\t: "; + ((*HMI).second)->printSet(); cerr << endl; } } } diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp index e0b55db509..c00bd3dd60 100644 --- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp +++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp @@ -36,7 +36,7 @@ PhyRegAlloc::PhyRegAlloc(const Method *const M, void PhyRegAlloc::createIGNodeListsAndIGs() { - if(DEBUG_RA ) cout << "Creating LR lists ..." << endl; + if(DEBUG_RA ) cerr << "Creating LR lists ..." << endl; // hash map iterator LiveRangeMapType::const_iterator HMI = (LRI.getLiveRangeMap())->begin(); @@ -52,8 +52,8 @@ void PhyRegAlloc::createIGNodeListsAndIGs() if( !L) { if( DEBUG_RA) { - cout << "\n*?!?Warning: Null liver range found for: "; - printValue( (*HMI).first) ; cout << endl; + cerr << "\n*?!?Warning: Null liver range found for: "; + printValue( (*HMI).first) ; cerr << endl; } continue; } @@ -75,7 +75,7 @@ void PhyRegAlloc::createIGNodeListsAndIGs() RegClassList[ rc ]->createInterferenceGraph(); if( DEBUG_RA) - cout << "LRLists Created!" << endl; + cerr << "LRLists Created!" << endl; } @@ -105,8 +105,8 @@ void PhyRegAlloc::addInterference(const Value *const Def, for( ; LIt != LVSet->end(); ++LIt) { if( DEBUG_RA > 1) { - cout << "< Def="; printValue(Def); - cout << ", Lvar="; printValue( *LIt); cout << "> "; + cerr << "< Def="; printValue(Def); + cerr << ", Lvar="; printValue( *LIt); cerr << "> "; } // get the live range corresponding to live var @@ -133,8 +133,8 @@ void PhyRegAlloc::addInterference(const Value *const Def, else if(DEBUG_RA > 1) { // we will not have LRs for values not explicitly allocated in the // instruction stream (e.g., constants) - cout << " warning: no live range for " ; - printValue( *LIt); cout << endl; } + cerr << " warning: no live range for " ; + printValue( *LIt); cerr << endl; } } @@ -148,7 +148,7 @@ void PhyRegAlloc::addInterference(const Value *const Def, void PhyRegAlloc::buildInterferenceGraphs() { - if(DEBUG_RA) cout << "Creating interference graphs ..." << endl; + if(DEBUG_RA) cerr << "Creating interference graphs ..." << endl; Method::const_iterator BBI = Meth->begin(); // random iterator for BBs @@ -215,7 +215,7 @@ void PhyRegAlloc::buildInterferenceGraphs() addInterferencesForArgs(); // add interference for method args if( DEBUG_RA) - cout << "Interference graphs calculted!" << endl; + cerr << "Interference graphs calculted!" << endl; } @@ -241,8 +241,8 @@ void PhyRegAlloc::addInterferencesForArgs() addInterference( *ArgIt, InSet, false ); // add interferences between // args and LVars at start if( DEBUG_RA > 1) { - cout << " - %% adding interference for argument "; - printValue( (const Value *) *ArgIt); cout << endl; + cerr << " - %% adding interference for argument "; + printValue( (const Value *) *ArgIt); cerr << endl; } } } @@ -326,7 +326,7 @@ void PhyRegAlloc::insertCallerSavingCode(const MachineInstr *MInst, PushedRegSet.insert( Reg ); StackOff += 4; // ****TODO: Correct ?????? - cout << "Inserted caller saving instr"); + cerr << "Inserted caller saving instr"); } // if not already pushed @@ -378,9 +378,9 @@ void PhyRegAlloc::updateMachineCode() for( AdIt = IBef.begin(); AdIt != IBef.end() ; ++AdIt ) { - cout << "*ADDED instr opcode: "; - cout << TargetInstrDescriptors[(*AdIt)->getOpCode()].opCodeString; - cout << endl; + cerr << "*ADDED instr opcode: "; + cerr << TargetInstrDescriptors[(*AdIt)->getOpCode()].opCodeString; + cerr << endl; MInstIterator = MIVec.insert( MInstIterator, *AdIt ); ++MInstIterator; @@ -409,7 +409,7 @@ void PhyRegAlloc::updateMachineCode() // delete this condition checking later (must assert if Val is null) if( !Val) { if (DEBUG_RA) - cout << "Warning: NULL Value found for operand" << endl; + cerr << "Warning: NULL Value found for operand" << endl; continue; } assert( Val && "Value is NULL"); @@ -421,8 +421,8 @@ void PhyRegAlloc::updateMachineCode() // nothing to worry if it's a const or a label if (DEBUG_RA) { - cout << "*NO LR for inst opcode: "; - cout << TargetInstrDescriptors[MInst->getOpCode()].opCodeString; + cerr << "*NO LR for inst opcode: "; + cerr << TargetInstrDescriptors[MInst->getOpCode()].opCodeString; } if( Op.getAllocatedRegNum() == -1) @@ -442,16 +442,16 @@ void PhyRegAlloc::updateMachineCode() //TM.getInstrInfo().isReturn(MInst->getOpCode()) else if(TM.getInstrInfo().isReturn(MInst->getOpCode()) ) { - if (DEBUG_RA) cout << endl << "RETURN found" << endl; + if (DEBUG_RA) cerr << endl << "RETURN found" << endl; Op.setRegForValue( MRI.getReturnAddressReg() ); } if (Val->getValueType() == Value::InstructionVal) { - cout << "!Warning: No LiveRange for: "; - printValue( Val); cout << " Type: " << Val->getValueType(); - cout << " RegVal=" << Op.getAllocatedRegNum() << endl; + cerr << "!Warning: No LiveRange for: "; + printValue( Val); cerr << " Type: " << Val->getValueType(); + cerr << " RegVal=" << Op.getAllocatedRegNum() << endl; } #endif @@ -483,14 +483,14 @@ void PhyRegAlloc::updateMachineCode() void PhyRegAlloc::printMachineCode() { - cout << endl << ";************** Method "; - cout << Meth->getName() << " *****************" << endl; + cerr << endl << ";************** Method "; + cerr << Meth->getName() << " *****************" << endl; Method::const_iterator BBI = Meth->begin(); // random iterator for BBs for( ; BBI != Meth->end(); ++BBI) { // traverse BBs in random order - cout << endl ; printLabel( *BBI); cout << ": "; + cerr << endl ; printLabel( *BBI); cerr << ": "; // get the iterator for machine instructions MachineCodeForBasicBlock& MIVec = (*BBI)->getMachineInstrVec(); @@ -502,8 +502,8 @@ void PhyRegAlloc::printMachineCode() MachineInstr *const MInst = *MInstIterator; - cout << endl << "\t"; - cout << TargetInstrDescriptors[MInst->getOpCode()].opCodeString; + cerr << endl << "\t"; + cerr << TargetInstrDescriptors[MInst->getOpCode()].opCodeString; //for(MachineInstr::val_op_const_iterator OpI(MInst);!OpI.done();++OpI) { @@ -519,14 +519,14 @@ void PhyRegAlloc::printMachineCode() const Value *const Val = Op.getVRegValue () ; // ****this code is temporary till NULL Values are fixed if( ! Val ) { - cout << "\t<*NULL*>"; + cerr << "\t<*NULL*>"; continue; } // if a label or a constant if( (Val->getValueType() == Value::BasicBlockVal) ) { - cout << "\t"; printLabel( Op.getVRegValue () ); + cerr << "\t"; printLabel( Op.getVRegValue () ); } else { // else it must be a register value @@ -534,27 +534,27 @@ void PhyRegAlloc::printMachineCode() //if( RegNum != 1000) - cout << "\t" << "%" << MRI.getUnifiedRegName( RegNum ); - // else cout << "\t<*NoReg*>"; + cerr << "\t" << "%" << MRI.getUnifiedRegName( RegNum ); + // else cerr << "\t<*NoReg*>"; } } else if(Op.getOperandType() == MachineOperand::MO_MachineRegister) { - cout << "\t" << "%" << MRI.getUnifiedRegName(Op.getMachineRegNum()); + cerr << "\t" << "%" << MRI.getUnifiedRegName(Op.getMachineRegNum()); } else - cout << "\t" << Op; // use dump field + cerr << "\t" << Op; // use dump field } } - cout << endl; + cerr << endl; } - cout << endl; + cerr << endl; } @@ -617,9 +617,9 @@ void PhyRegAlloc::colorIncomingArgs() void PhyRegAlloc::printLabel(const Value *const Val) { if( Val->hasName() ) - cout << Val->getName(); + cerr << Val->getName(); else - cout << "Label" << Val; + cerr << "Label" << Val; } diff --git a/lib/CodeGen/RegAlloc/RegClass.cpp b/lib/CodeGen/RegAlloc/RegClass.cpp index 9c3e08c294..a37d82de6a 100644 --- a/lib/CodeGen/RegAlloc/RegClass.cpp +++ b/lib/CodeGen/RegAlloc/RegClass.cpp @@ -9,7 +9,7 @@ RegClass::RegClass(const Method *const M, IG(this), IGNodeStack(), ReservedColorList(RCL) { if( DEBUG_RA) - cout << "Created Reg Class: " << RegClassID << endl; + cerr << "Created Reg Class: " << RegClassID << endl; // This constructor inits IG. The actual matrix is created by a call to // createInterferenceGraph() above. @@ -21,7 +21,7 @@ RegClass::RegClass(const Method *const M, void RegClass::colorAllRegs() { - if(DEBUG_RA) cout << "Coloring IGs ..." << endl; + if(DEBUG_RA) cerr << "Coloring IGs ..." << endl; //preColorIGNodes(); // pre-color IGNodes pushAllIGNodes(); // push all IG Nodes @@ -55,9 +55,9 @@ void RegClass::pushAllIGNodes() bool PushedAll = pushUnconstrainedIGNodes(); if( DEBUG_RA) { - cout << " Puhsed all-unconstrained IGNodes. "; - if( PushedAll ) cout << " No constrained nodes left."; - cout << endl; + cerr << " Puhsed all-unconstrained IGNodes. "; + if( PushedAll ) cerr << " No constrained nodes left."; + cerr << endl; } if( PushedAll ) // if NO constrained nodes left @@ -112,8 +112,8 @@ bool RegClass::pushUnconstrainedIGNodes() IGNode->pushOnStack(); // set OnStack and dec deg of neighs if (DEBUG_RA > 1) { - cout << " pushed un-constrained IGNode " << IGNode->getIndex() ; - cout << " on to stack" << endl; + cerr << " pushed un-constrained IGNode " << IGNode->getIndex() ; + cerr << " on to stack" << endl; } } else pushedall = false; // we didn't push all live ranges @@ -170,16 +170,16 @@ void RegClass::colorIGNode(IGNode *const Node) } else { if( DEBUG_RA ) { - cout << " Node " << Node->getIndex(); - cout << " already colored with color " << Node->getColor() << endl; + cerr << " Node " << Node->getIndex(); + cerr << " already colored with color " << Node->getColor() << endl; } } if( !Node->hasColor() ) { if( DEBUG_RA ) { - cout << " Node " << Node->getIndex(); - cout << " - could not find a color (needs spilling)" << endl; + cerr << " Node " << Node->getIndex(); + cerr << " - could not find a color (needs spilling)" << endl; } } |