From 5a46417d0d802307541ea0a60055a9f07651e66f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 9 Oct 2015 12:07:58 +0200 Subject: [PATCH] cpu.c: print_scop: take schedule as input This allows the caller to insert the context node, such that it will be included in the final schedule dump. Signed-off-by: Sven Verdoolaege --- cpu.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cpu.c b/cpu.c index e3c7074..d11d063 100644 --- a/cpu.c +++ b/cpu.c @@ -437,14 +437,14 @@ static isl_bool update_depth(__isl_keep isl_schedule_node *node, void *user) return isl_bool_false; } -/* Code generate the scop 'scop' and print the corresponding C code to 'p'. +/* Code generate the scop 'scop' using "schedule" + * and print the corresponding C code to 'p'. */ static __isl_give isl_printer *print_scop(struct ppcg_scop *scop, - __isl_take isl_printer *p, struct ppcg_options *options) + __isl_take isl_schedule *schedule, __isl_take isl_printer *p, + struct ppcg_options *options) { isl_ctx *ctx = isl_printer_get_ctx(p); - isl_set *context; - isl_schedule *schedule; isl_ast_build *build; isl_ast_print_options *print_options; isl_ast_node *tree; @@ -452,11 +452,6 @@ static __isl_give isl_printer *print_scop(struct ppcg_scop *scop, struct ast_build_userinfo build_info; int depth; - context = isl_set_copy(scop->context); - context = isl_set_from_params(context); - schedule = isl_schedule_copy(scop->schedule); - schedule = isl_schedule_insert_context(schedule, context); - depth = 0; if (isl_schedule_foreach_schedule_node_top_down(schedule, &update_depth, &depth) < 0) @@ -508,6 +503,8 @@ __isl_give isl_printer *print_cpu(__isl_take isl_printer *p, struct ppcg_scop *ps, struct ppcg_options *options) { int hidden; + isl_set *context; + isl_schedule *schedule; p = isl_printer_start_line(p); p = isl_printer_print_str(p, "/* ppcg generated CPU code */"); @@ -523,9 +520,14 @@ __isl_give isl_printer *print_cpu(__isl_take isl_printer *p, p = ppcg_start_block(p); p = ppcg_print_hidden_declarations(p, ps); } + + schedule = isl_schedule_copy(ps->schedule); + context = isl_set_copy(ps->context); + context = isl_set_from_params(context); + schedule = isl_schedule_insert_context(schedule, context); if (options->debug->dump_final_schedule) - isl_schedule_dump(ps->schedule); - p = print_scop(ps, p, options); + isl_schedule_dump(schedule); + p = print_scop(ps, schedule, p, options); if (hidden) p = ppcg_end_block(p); -- 2.11.4.GIT