Move SCEVExpander::visitAddExpr out-of-line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52464 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-06-18 16:37:11 +00:00
parent cfeb6a4506
commit e24fa64d52
2 changed files with 11 additions and 9 deletions

View File

@ -111,15 +111,7 @@ namespace llvm {
return CastInst::CreateSExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
}
Value *visitAddExpr(SCEVAddExpr *S) {
Value *V = expand(S->getOperand(S->getNumOperands()-1));
// Emit a bunch of add instructions
for (int i = S->getNumOperands()-2; i >= 0; --i)
V = InsertBinop(Instruction::Add, V, expand(S->getOperand(i)),
InsertPt);
return V;
}
Value *visitAddExpr(SCEVAddExpr *S);
Value *visitMulExpr(SCEVMulExpr *S);

View File

@ -99,6 +99,16 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
return BinaryOperator::Create(Opcode, LHS, RHS, "tmp", InsertPt);
}
Value *SCEVExpander::visitAddExpr(SCEVAddExpr *S) {
Value *V = expand(S->getOperand(S->getNumOperands()-1));
// Emit a bunch of add instructions
for (int i = S->getNumOperands()-2; i >= 0; --i)
V = InsertBinop(Instruction::Add, V, expand(S->getOperand(i)),
InsertPt);
return V;
}
Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) {
int FirstOp = 0; // Set if we should emit a subtract.
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getOperand(0)))