void IslNodeBuilder::createSubstitutions( __isl_take isl_pw_multi_aff *PMA, __isl_take isl_ast_build *Context, ScopStmt *Stmt, ValueMapT &VMap, LoopToScevMapT <S) { for (unsigned i = 0; i < isl_pw_multi_aff_dim(PMA, isl_dim_out); ++i) { isl_pw_aff *Aff; isl_ast_expr *Expr; const Value *OldIV; Value *V; Aff = isl_pw_multi_aff_get_pw_aff(PMA, i); Expr = isl_ast_build_expr_from_pw_aff(Context, Aff); OldIV = Stmt->getInductionVariableForDimension(i); V = ExprBuilder.create(Expr); // CreateIntCast can introduce trunc expressions. This is correct, as the // result will always fit into the type of the original induction variable // (because we calculate a value of the original induction variable). V = Builder.CreateIntCast(V, OldIV->getType(), true); VMap[OldIV] = V; ScalarEvolution *SE = Stmt->getParent()->getSE(); LTS[Stmt->getLoopForDimension(i)] = SE->getUnknown(V); } isl_pw_multi_aff_free(PMA); isl_ast_build_free(Context); }
void IslNodeBuilder::createSubstitutions(isl_ast_expr *Expr, ScopStmt *Stmt, ValueMapT &VMap, LoopToScevMapT <S) { assert(isl_ast_expr_get_type(Expr) == isl_ast_expr_op && "Expression of type 'op' expected"); assert(isl_ast_expr_get_op_type(Expr) == isl_ast_op_call && "Opertation of type 'call' expected"); for (int i = 0; i < isl_ast_expr_get_op_n_arg(Expr) - 1; ++i) { isl_ast_expr *SubExpr; Value *V; SubExpr = isl_ast_expr_get_op_arg(Expr, i + 1); V = ExprBuilder.create(SubExpr); ScalarEvolution *SE = Stmt->getParent()->getSE(); LTS[Stmt->getLoopForDimension(i)] = SE->getUnknown(V); // CreateIntCast can introduce trunc expressions. This is correct, as the // result will always fit into the type of the original induction variable // (because we calculate a value of the original induction variable). const Value *OldIV = Stmt->getInductionVariableForDimension(i); if (OldIV) { V = Builder.CreateIntCast(V, OldIV->getType(), true); VMap[OldIV] = V; } } isl_ast_expr_free(Expr); }