From 42112b4a0930faeb96755be64b1d20214221c033 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Sat, 29 May 2004 23:10:20 +0000 Subject: [PATCH] Add comments. llvm-svn: 13898 --- .../Target/SparcV9/InstrSelection/InstrSelection.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp index 70b5dbc57b05..8c3dd5d859e5 100644 --- a/llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp +++ b/llvm/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp @@ -209,15 +209,15 @@ void InstructionSelection::InsertCodeForPhis(Function &F) { for (MachineFunction::iterator BB = MF.begin(); BB != MF.end(); ++BB) { for (BasicBlock::const_iterator IIt = BB->getBasicBlock()->begin(); const PHINode *PN = dyn_cast(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 mvec, CpVec; Target.getRegInfo().cpValue2Value(PN->getIncomingValue(i), PhiCpRes, mvec); @@ -228,10 +228,10 @@ void InstructionSelection::InsertCodeForPhis(Function &F) { 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 mvec; Target.getRegInfo().cpValue2Value(PhiCpRes, const_cast(PN), mvec);