llvm.org GIT mirror llvm / d48a1d7
The lastOp operand is never used git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9331 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
1 changed file(s) with 11 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
8080 //
8181 // visitOneOperand() does all the work for one operand.
8282 //
83 void visitOperands(Instruction &I, int firstOp=0, int lastOp=0);
83 void visitOperands(Instruction &I, int firstOp=0);
8484 void visitOneOperand(Instruction &I, Value* Op, unsigned opNum,
8585 Instruction& insertBefore);
8686 };
207207 // firstOp and lastOp can be used to skip leading and trailing operands.
208208 // If lastOp is 0, it defaults to #operands or #incoming Phi values.
209209 //
210 inline void
211 PreSelection::visitOperands(Instruction &I, int firstOp, int lastOp)
212 {
210 inline void PreSelection::visitOperands(Instruction &I, int firstOp) {
213211 // For any instruction other than PHI, copies go just before the instr.
214212 // For a PHI, operand copies must be before the terminator of the
215213 // appropriate predecessor basic block. Remaining logic is simple
216214 // so just handle PHIs and other instructions separately.
217215 //
218 if (PHINode* phi = dyn_cast(&I))
219 {
220 if (lastOp == 0)
221 lastOp = phi->getNumIncomingValues();
222 for (unsigned i=firstOp, N=lastOp; i < N; ++i)
223 this->visitOneOperand(I, phi->getIncomingValue(i),
224 phi->getOperandNumForIncomingValue(i),
225 * phi->getIncomingBlock(i)->getTerminator());
226 }
227 else
228 {
229 if (lastOp == 0)
230 lastOp = I.getNumOperands();
231 for (unsigned i=firstOp, N=lastOp; i < N; ++i)
232 this->visitOneOperand(I, I.getOperand(i), i, I);
233 }
216 if (PHINode* phi = dyn_cast(&I)) {
217 for (unsigned i=firstOp, N=phi->getNumIncomingValues(); i != N; ++i)
218 visitOneOperand(I, phi->getIncomingValue(i),
219 phi->getOperandNumForIncomingValue(i),
220 * phi->getIncomingBlock(i)->getTerminator());
221 } else {
222 for (unsigned i=firstOp, N=lastOp; i != I.getNumOperands(); ++i)
223 visitOneOperand(I, I.getOperand(i), i, I);
224 }
234225 }
235226
236227