aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuchira Sasanka <sasanka@students.uiuc.edu>2001-11-12 19:42:27 +0000
committerRuchira Sasanka <sasanka@students.uiuc.edu>2001-11-12 19:42:27 +0000
commit7130938f94726af4c69bcce4d959c91ef024bdb8 (patch)
tree356e6afee88dd81e1885a5598d34aa02adf25601
parent061b8edb27891b02fd2bae72d05d9c518ed1774f (diff)
For phi elimination, now we are generating only one instruction
using cpValue2Value instead of passing vector to createCopyInstructionByType. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1272 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/InstrSelection/InstrSelection.cpp20
-rw-r--r--lib/Target/SparcV9/InstrSelection/InstrSelection.cpp20
2 files changed, 10 insertions, 30 deletions
diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp
index b749873c4c..909f2410ef 100644
--- a/lib/CodeGen/InstrSelection/InstrSelection.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp
@@ -154,7 +154,7 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target)
// of phi elimination.
//-------------------------------------------------------------------------
-void InsertPhiElimInst(BasicBlock *BB, vector<MachineInstr*>& CopyInstVec) { // bak
+void InsertPhiElimInst(BasicBlock *BB, MachineInstr *CpMI) {
TerminatorInst *TermInst = BB->getTerminator();
MachineCodeForVMInstr &MC4Term = TermInst->getMachineInstrVec();
@@ -171,13 +171,12 @@ void InsertPhiElimInst(BasicBlock *BB, vector<MachineInstr*>& CopyInstVec) { //
for( ; (MCIt != bbMvec.end()) && (*MCIt != FirstMIOfTerm) ; ++MCIt ) ;
assert( MCIt != bbMvec.end() && "Start inst of terminator not found");
- assert( (CopyInstVec.size()==1) && "Must be only one copy instr");
// insert the copy instruction just before the first machine instruction
// generated for the terminator
- bbMvec.insert( MCIt , CopyInstVec[0] );
+ bbMvec.insert( MCIt , CpMI );
- cerr << "\nPhiElimination copy inst: " << *CopyInstVec[0];
+ //cerr << "\nPhiElimination copy inst: " << *CopyInstVec[0];
}
@@ -212,19 +211,10 @@ void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target) {
vector<MachineInstr*> CopyInstVec;
- // target.getInstrInfo().CreateCopyInstructionsByType(
- // target, PN->getIncomingValue(i), PN, CopyInstVec );
-
- MachineInstr *MI =
+ MachineInstr *CpMI =
target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PN);
- CopyInstVec.push_back( MI );
-
- InsertPhiElimInst( PN->getIncomingBlock(i), CopyInstVec);
-
- // Map the generated copy instruction in pred BB to this phi
- // (PN->getMachineInstrVec()).push_back( CopyInstVec[0] );
-
+ InsertPhiElimInst( PN->getIncomingBlock(i), CpMI);
}
}
else break; // since PHI nodes can only be at the top
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
index b749873c4c..909f2410ef 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
@@ -154,7 +154,7 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target)
// of phi elimination.
//-------------------------------------------------------------------------
-void InsertPhiElimInst(BasicBlock *BB, vector<MachineInstr*>& CopyInstVec) { // bak
+void InsertPhiElimInst(BasicBlock *BB, MachineInstr *CpMI) {
TerminatorInst *TermInst = BB->getTerminator();
MachineCodeForVMInstr &MC4Term = TermInst->getMachineInstrVec();
@@ -171,13 +171,12 @@ void InsertPhiElimInst(BasicBlock *BB, vector<MachineInstr*>& CopyInstVec) { //
for( ; (MCIt != bbMvec.end()) && (*MCIt != FirstMIOfTerm) ; ++MCIt ) ;
assert( MCIt != bbMvec.end() && "Start inst of terminator not found");
- assert( (CopyInstVec.size()==1) && "Must be only one copy instr");
// insert the copy instruction just before the first machine instruction
// generated for the terminator
- bbMvec.insert( MCIt , CopyInstVec[0] );
+ bbMvec.insert( MCIt , CpMI );
- cerr << "\nPhiElimination copy inst: " << *CopyInstVec[0];
+ //cerr << "\nPhiElimination copy inst: " << *CopyInstVec[0];
}
@@ -212,19 +211,10 @@ void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target) {
vector<MachineInstr*> CopyInstVec;
- // target.getInstrInfo().CreateCopyInstructionsByType(
- // target, PN->getIncomingValue(i), PN, CopyInstVec );
-
- MachineInstr *MI =
+ MachineInstr *CpMI =
target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PN);
- CopyInstVec.push_back( MI );
-
- InsertPhiElimInst( PN->getIncomingBlock(i), CopyInstVec);
-
- // Map the generated copy instruction in pred BB to this phi
- // (PN->getMachineInstrVec()).push_back( CopyInstVec[0] );
-
+ InsertPhiElimInst( PN->getIncomingBlock(i), CpMI);
}
}
else break; // since PHI nodes can only be at the top