aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/InstrSelection/InstrSelection.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-01-20 22:54:45 +0000
committerChris Lattner <sabre@nondot.org>2002-01-20 22:54:45 +0000
commit697954c15da58bd8b186dbafdedd8b06db770201 (patch)
treee119a71f09b5c2513c8c270161ae2a858c6f3b96 /lib/CodeGen/InstrSelection/InstrSelection.cpp
parent13c4659220bc78a0a3529f4d9e57546e898088e3 (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/InstrSelection.cpp')
-rw-r--r--lib/CodeGen/InstrSelection/InstrSelection.cpp32
1 files changed, 11 insertions, 21 deletions
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;
}