[llvm-commits] [llvm] r52612 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolutionExpander.h lib/Analysis/ScalarEvolutionExpander.cpp
Dan Gohman
gohman at apple.com
Sun Jun 22 12:09:18 PDT 2008
Author: djg
Date: Sun Jun 22 14:09:18 2008
New Revision: 52612
URL: http://llvm.org/viewvc/llvm-project?rev=52612&view=rev
Log:
Move a few more SCEVExpander methods out-of-line.
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h
llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=52612&r1=52611&r2=52612&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h Sun Jun 22 14:09:18 2008
@@ -75,11 +75,7 @@
/// expandCodeFor - Insert code to directly compute the specified SCEV
/// expression into the program. The inserted code is inserted into the
/// specified block.
- Value *expandCodeFor(SCEVHandle SH, Instruction *IP) {
- // Expand the code for this SCEV.
- this->InsertPt = IP;
- return expand(SH);
- }
+ Value *expandCodeFor(SCEVHandle SH, Instruction *IP);
/// InsertCastOfTo - Insert a cast of V to the specified type, doing what
/// we can to share the casts.
@@ -96,20 +92,11 @@
return S->getValue();
}
- Value *visitTruncateExpr(SCEVTruncateExpr *S) {
- Value *V = expand(S->getOperand());
- return CastInst::CreateTruncOrBitCast(V, S->getType(), "tmp.", InsertPt);
- }
+ Value *visitTruncateExpr(SCEVTruncateExpr *S);
- Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
- Value *V = expand(S->getOperand());
- return CastInst::CreateZExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
- }
+ Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S);
- Value *visitSignExtendExpr(SCEVSignExtendExpr *S) {
- Value *V = expand(S->getOperand());
- return CastInst::CreateSExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
- }
+ Value *visitSignExtendExpr(SCEVSignExtendExpr *S);
Value *visitAddExpr(SCEVAddExpr *S);
Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=52612&r1=52611&r2=52612&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Sun Jun 22 14:09:18 2008
@@ -226,6 +226,21 @@
return expand(V);
}
+Value *SCEVExpander::visitTruncateExpr(SCEVTruncateExpr *S) {
+ Value *V = expand(S->getOperand());
+ return CastInst::createTruncOrBitCast(V, S->getType(), "tmp.", InsertPt);
+}
+
+Value *SCEVExpander::visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
+ Value *V = expand(S->getOperand());
+ return CastInst::createZExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
+}
+
+Value *SCEVExpander::visitSignExtendExpr(SCEVSignExtendExpr *S) {
+ Value *V = expand(S->getOperand());
+ return CastInst::createSExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
+}
+
Value *SCEVExpander::visitSMaxExpr(SCEVSMaxExpr *S) {
Value *LHS = expand(S->getOperand(0));
for (unsigned i = 1; i < S->getNumOperands(); ++i) {
@@ -246,6 +261,12 @@
return LHS;
}
+Value *SCEVExpander::expandCodeFor(SCEVHandle SH, Instruction *IP) {
+ // Expand the code for this SCEV.
+ this->InsertPt = IP;
+ return expand(SH);
+}
+
Value *SCEVExpander::expand(SCEV *S) {
// Check to see if we already expanded this.
std::map<SCEVHandle, Value*>::iterator I = InsertedExpressions.find(S);
More information about the llvm-commits
mailing list