cl::desc("Dump the computed GPU Schedule"),
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
+/// Create the ast expressions for a ScopStmt.
+///
+/// This function is a callback for to generate the ast expressions for each
+/// of the scheduled ScopStmts.
+static __isl_give isl_id_to_ast_expr *pollyBuildAstExprForStmt(
+ void *Stmt, isl_ast_build *Build,
+ isl_multi_pw_aff *(*FunctionIndex)(__isl_take isl_multi_pw_aff *MPA,
+ isl_id *Id, void *User),
+ void *UserIndex,
+ isl_ast_expr *(*FunctionExpr)(isl_ast_expr *Expr, isl_id *Id, void *User),
+ void *User_expr) {
+
+ // TODO: Implement the AST expression generation. For now we just return a
+ // nullptr to ensure that we do not free uninitialized pointers.
+
+ return nullptr;
+}
namespace {
class PPCGCodeGeneration : public ScopPass {
PPCGGen->options = PPCGScop->options;
PPCGGen->print = nullptr;
PPCGGen->print_user = nullptr;
+ PPCGGen->build_ast_expr = &pollyBuildAstExprForStmt;
PPCGGen->prog = PPCGProg;
PPCGGen->tree = nullptr;
PPCGGen->types.n = 0;
* to the current kernel.
*/
struct ppcg_transform_data {
+ struct ppcg_options *options;
struct ppcg_kernel *kernel;
struct gpu_stmt_access *accesses;
isl_pw_multi_aff *iterator_map;
*/
static __isl_give isl_ast_node *create_domain_leaf(
struct ppcg_kernel *kernel, __isl_take isl_ast_node *node,
- __isl_keep isl_ast_build *build, struct gpu_stmt *gpu_stmt)
+ __isl_keep isl_ast_build *build, struct gpu_stmt *gpu_stmt,
+ struct gpu_gen *gen)
{
struct ppcg_transform_data data;
struct ppcg_kernel_stmt *stmt;
data.accesses = stmt->u.d.stmt->accesses;
data.iterator_map = iterator_map;
data.sched2shared = sched2shared;
- stmt->u.d.ref2expr = pet_stmt_build_ast_exprs(stmt->u.d.stmt->stmt,
+ stmt->u.d.ref2expr = gen->build_ast_expr(stmt->u.d.stmt->stmt,
build, &transform_index, &data,
&transform_expr, &data);
-
isl_pw_multi_aff_free(iterator_map);
isl_pw_multi_aff_free(sched2shared);
*/
struct ppcg_at_domain_data {
struct gpu_prog *prog;
+ struct gpu_gen *gen;
struct ppcg_kernel *kernel;
};
isl_id_free(id);
if (gpu_stmt)
- return create_domain_leaf(data->kernel, node, build, gpu_stmt);
+ return create_domain_leaf(data->kernel, node, build, gpu_stmt,
+ data->gen);
if (!prefixcmp(name, "to_device_") || !prefixcmp(name, "from_device_"))
return node;
int depth;
data.prog = gen->prog;
+ data.gen = gen;
data.kernel = NULL;
depth = 0;
struct gpu_types *types, void *user);
void *print_user;
+ isl_id_to_ast_expr *(*build_ast_expr)(void *stmt,
+ isl_ast_build *build,
+ isl_multi_pw_aff *(*fn_index)(
+ __isl_take isl_multi_pw_aff *mpa, isl_id *id,
+ void *user),
+ void *user_index,
+ isl_ast_expr *(*fn_expr)(isl_ast_expr *expr,
+ isl_id *id, void *user),
+ void *user_expr);
+
+
struct gpu_prog *prog;
/* The generated AST. */
isl_ast_node *tree;