diff options
Diffstat (limited to 'polly/lib/CodeGen/IslCodeGeneration.cpp')
| -rw-r--r-- | polly/lib/CodeGen/IslCodeGeneration.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index bf9a81ed9cb..bb1991511b3 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -86,6 +86,15 @@ private: // ivs. IslExprBuilder::IDToValueTy IDToValue; + /// Generate code for a given SCEV* + /// + /// This function generates code for a given SCEV expression. It generated + /// code is emmitted at the end of the basic block our Builder currently + /// points to and the resulting value is returned. + /// + /// @param Expr The expression to code generate. + Value *generateSCEV(const SCEV *Expr); + // Extract the upper bound of this loop // // The isl code generation can generate arbitrary expressions to check if the @@ -542,16 +551,9 @@ void IslNodeBuilder::addParameters(__isl_take isl_set *Context) { for (unsigned i = 0; i < isl_set_dim(Context, isl_dim_param); ++i) { isl_id *Id; - const SCEV *Scev; - IntegerType *T; - Instruction *InsertLocation; Id = isl_set_get_dim_id(Context, isl_dim_param, i); - Scev = (const SCEV *)isl_id_get_user(Id); - T = dyn_cast<IntegerType>(Scev->getType()); - InsertLocation = --(Builder.GetInsertBlock()->end()); - Value *V = Rewriter->expandCodeFor(Scev, T, InsertLocation); - IDToValue[Id] = V; + IDToValue[Id] = generateSCEV((const SCEV *)isl_id_get_user(Id)); isl_id_free(Id); } @@ -559,6 +561,12 @@ void IslNodeBuilder::addParameters(__isl_take isl_set *Context) { isl_set_free(Context); } +Value *IslNodeBuilder::generateSCEV(const SCEV *Expr) { + Instruction *InsertLocation = --(Builder.GetInsertBlock()->end()); + return Rewriter->expandCodeFor(Expr, cast<IntegerType>(Expr->getType()), + InsertLocation); +} + namespace { class IslCodeGeneration : public ScopPass { public: |

