diff options
author | Chris Lattner <sabre@nondot.org> | 2002-01-20 22:54:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-01-20 22:54:45 +0000 |
commit | 697954c15da58bd8b186dbafdedd8b06db770201 (patch) | |
tree | e119a71f09b5c2513c8c270161ae2a858c6f3b96 /lib/CodeGen/InstrSelection | |
parent | 13c4659220bc78a0a3529f4d9e57546e898088e3 (diff) |
Changes to build successfully with GCC 3.02
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/InstrSelection')
-rw-r--r-- | lib/CodeGen/InstrSelection/InstrForest.cpp | 37 | ||||
-rw-r--r-- | lib/CodeGen/InstrSelection/InstrSelection.cpp | 32 | ||||
-rw-r--r-- | lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp | 2 |
3 files changed, 32 insertions, 39 deletions
diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp index ce3e2c3a3f..20cbe8d71b 100644 --- a/lib/CodeGen/InstrSelection/InstrForest.cpp +++ b/lib/CodeGen/InstrSelection/InstrForest.cpp @@ -31,6 +31,9 @@ #include "llvm/BasicBlock.h" #include "llvm/CodeGen/MachineInstr.h" #include "Support/STLExtras.h" +#include <iostream> +using std::cerr; +using std::vector; //------------------------------------------------------------------------ // class InstrTreeNode @@ -119,21 +122,21 @@ void InstructionNode::dumpNode(int indent) const { for (int i=0; i < indent; i++) - cout << " "; + cerr << " "; - cout << getInstruction()->getOpcodeName(); + cerr << getInstruction()->getOpcodeName(); const vector<MachineInstr*> &mvec = getInstruction()->getMachineInstrVec(); if (mvec.size() > 0) - cout << "\tMachine Instructions: "; + cerr << "\tMachine Instructions: "; for (unsigned int i=0; i < mvec.size(); i++) { mvec[i]->dump(0); if (i < mvec.size() - 1) - cout << "; "; + cerr << "; "; } - cout << endl; + cerr << "\n"; } @@ -141,9 +144,9 @@ void VRegListNode::dumpNode(int indent) const { for (int i=0; i < indent; i++) - cout << " "; + cerr << " "; - cout << "List" << endl; + cerr << "List" << "\n"; } @@ -151,29 +154,29 @@ void VRegNode::dumpNode(int indent) const { for (int i=0; i < indent; i++) - cout << " "; + cerr << " "; - cout << "VReg " << getValue() << "\t(type " - << (int) getValue()->getValueType() << ")" << endl; + cerr << "VReg " << getValue() << "\t(type " + << (int) getValue()->getValueType() << ")" << "\n"; } void ConstantNode::dumpNode(int indent) const { for (int i=0; i < indent; i++) - cout << " "; + cerr << " "; - cout << "Constant " << getValue() << "\t(type " - << (int) getValue()->getValueType() << ")" << endl; + cerr << "Constant " << getValue() << "\t(type " + << (int) getValue()->getValueType() << ")" << "\n"; } void LabelNode::dumpNode(int indent) const { for (int i=0; i < indent; i++) - cout << " "; + cerr << " "; - cout << "Label " << getValue() << endl; + cerr << "Label " << getValue() << "\n"; } //------------------------------------------------------------------------ @@ -190,7 +193,7 @@ InstrForest::InstrForest(Method *M) InstrForest::~InstrForest() { - for (hash_map<const Instruction*, InstructionNode*>:: iterator I = begin(); + for (std::hash_map<const Instruction*,InstructionNode*>::iterator I = begin(); I != end(); ++I) delete (*I).second; } @@ -198,7 +201,7 @@ InstrForest::~InstrForest() void InstrForest::dump() const { - for (hash_set<InstructionNode*>::const_iterator I = treeRoots.begin(); + for (std::hash_set<InstructionNode*>::const_iterator I = treeRoots.begin(); I != treeRoots.end(); ++I) (*I)->dump(/*dumpChildren*/ 1, /*indent*/ 0); } diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp index b959c90ca3..ab489c507e 100644 --- a/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp @@ -23,8 +23,8 @@ #include "llvm/iPHINode.h" #include "llvm/Target/MachineRegInfo.h" #include "Support/CommandLine.h" -#include <string.h> - +#include <iostream> +using std::cerr; //******************** Internal Data Declarations ************************/ @@ -84,17 +84,17 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target) if (SelectDebugLevel >= Select_DebugInstTrees) { - cout << "\n\n*** Instruction trees for method " + cerr << "\n\n*** Instruction trees for method " << (method->hasName()? method->getName() : "") - << endl << endl; + << "\n\n"; instrForest.dump(); } // // Invoke BURG instruction selection for each tree // - const hash_set<InstructionNode*> &treeRoots = instrForest.getRootSet(); - for (hash_set<InstructionNode*>::const_iterator + const std::hash_set<InstructionNode*> &treeRoots = instrForest.getRootSet(); + for (std::hash_set<InstructionNode*>::const_iterator treeRootIter = treeRoots.begin(); treeRootIter != treeRoots.end(); ++treeRootIter) { @@ -138,8 +138,7 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target) if (SelectDebugLevel >= Select_PrintMachineCode) { - cout << endl - << "*** Machine instructions after INSTRUCTION SELECTION" << endl; + cerr << "\n*** Machine instructions after INSTRUCTION SELECTION\n"; MachineCodeForMethod::get(method).dump(); } @@ -210,7 +209,7 @@ void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target) { // insert the copy instruction to the predecessor BB - vector<MachineInstr*> CopyInstVec; + std::vector<MachineInstr*> CopyInstVec; MachineInstr *CpMI = target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PN); @@ -250,25 +249,18 @@ void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target) { PHINode *PN = (PHINode *) (*IIt); - Value *PhiCpRes = new Value(PN->getType(), PN->getValueType()); - - string *Name = new string("PhiCp:"); - (*Name) += (int) PhiCpRes; - PhiCpRes->setName( *Name ); - + Value *PhiCpRes = new Value(PN->getType(), PN->getValueType(),"PhiCp:"); // for each incoming value of the phi, insert phi elimination // for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) { // insert the copy instruction to the predecessor BB - MachineInstr *CpMI = target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes); InsertPhiElimInst(PN->getIncomingBlock(i), CpMI); - } @@ -279,8 +271,6 @@ void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target) { MachineCodeForBasicBlock& bbMvec = BB->getMachineInstrVec(); bbMvec.insert( bbMvec.begin(), CpMI2); - - } else break; // since PHI nodes can only be at the top @@ -338,7 +328,7 @@ PostprocessMachineCodeForTree(InstructionNode* instrNode, MachineCodeForVMInstr& mvec = vmInstr->getMachineInstrVec(); for (int i = (int) mvec.size()-1; i >= 0; i--) { - vector<MachineInstr*> loadConstVec = + std::vector<MachineInstr*> loadConstVec = FixConstantOperandsForInstr(vmInstr, mvec[i], target); if (loadConstVec.size() > 0) @@ -372,7 +362,7 @@ SelectInstructionsForTree(InstrTreeNode* treeRoot, int goalnt, if (ruleForNode == 0) { - cerr << "Could not match instruction tree for instr selection" << endl; + cerr << "Could not match instruction tree for instr selection\n"; assert(0); return true; } diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp index 30d9c7eb78..34dd83b49e 100644 --- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp +++ b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp @@ -22,7 +22,7 @@ #include "llvm/Instruction.h" #include "llvm/Type.h" #include "llvm/iMemory.h" - +using std::vector; //*************************** Local Functions ******************************/ |