[llvm-commits] CVS: llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Sat May 29 18:12:01 PDT 2004
Changes in directory llvm/lib/Target/SparcV9/InstrSelection:
InstrSelection.cpp updated: 1.75 -> 1.76
---
Log message:
Add comments.
---
Diffs of the changes: (+6 -6)
Index: llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
diff -u llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp:1.75 llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp:1.76
--- llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp:1.75 Sat May 29 17:49:51 2004
+++ llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp Sat May 29 18:10:20 2004
@@ -209,15 +209,15 @@
for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) {
for (BasicBlock::const_iterator IIt = BB->getBasicBlock()->begin();
const PHINode *PN = dyn_cast<PHINode>(IIt); ++IIt) {
- Value *PhiCpRes = new PHINode(PN->getType(), PN->getName() + ":PhiCp");
-
+ // Create a new temporary register to hold the result of the Phi copy.
// The leak detector shouldn't track these nodes. They are not garbage,
// even though their parent field is never filled in.
+ Value *PhiCpRes = new PHINode(PN->getType(), PN->getName() + ":PhiCp");
LeakDetector::removeGarbageObject(PhiCpRes);
- // for each incoming value of the phi, insert phi elimination
+ // For each of PN's incoming values, insert a copy in the corresponding
+ // predecessor block.
for (unsigned i = 0; i < PN->getNumIncomingValues(); ++i) {
- // insert the copy instruction to the predecessor BB
std::vector<MachineInstr*> mvec, CpVec;
Target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes,
mvec);
@@ -228,10 +228,10 @@
CpVec2.push_back(*MI);
CpVec.insert(CpVec.end(), CpVec2.begin(), CpVec2.end());
}
-
+ // Insert the copy instructions into the predecessor BB.
InsertPhiElimInstructions(PN->getIncomingBlock(i), CpVec);
}
-
+ // Insert a copy instruction from PhiCpRes to PN.
std::vector<MachineInstr*> mvec;
Target.getRegInfo().cpValue2Value(PhiCpRes, const_cast<PHINode*>(PN),
mvec);
More information about the llvm-commits
mailing list