xref: /netbsd-src/external/mit/isl/dist/schedule.c (revision 5971e316fdea024efff6be8f03536623db06833e)
1*5971e316Smrg /*
2*5971e316Smrg  * Copyright 2016      Sven Verdoolaege
3*5971e316Smrg  *
4*5971e316Smrg  * Use of this software is governed by the MIT license
5*5971e316Smrg  *
6*5971e316Smrg  * Written by Sven Verdoolaege.
7*5971e316Smrg  */
8*5971e316Smrg 
9*5971e316Smrg /* This program takes an isl_schedule_constraints object as input and
10*5971e316Smrg  * prints a schedule that satisfies those constraints.
11*5971e316Smrg  */
12*5971e316Smrg 
13*5971e316Smrg #include <stdlib.h>
14*5971e316Smrg #include <isl/options.h>
15*5971e316Smrg #include <isl/schedule.h>
16*5971e316Smrg #include <isl/printer.h>
17*5971e316Smrg 
main(int argc,char ** argv)18*5971e316Smrg int main(int argc, char **argv)
19*5971e316Smrg {
20*5971e316Smrg 	isl_ctx *ctx;
21*5971e316Smrg 	isl_printer *p;
22*5971e316Smrg 	isl_schedule_constraints *sc;
23*5971e316Smrg 	isl_schedule *schedule;
24*5971e316Smrg 	struct isl_options *options;
25*5971e316Smrg 
26*5971e316Smrg 	options = isl_options_new_with_defaults();
27*5971e316Smrg 	argc = isl_options_parse(options, argc, argv, ISL_ARG_ALL);
28*5971e316Smrg 	ctx = isl_ctx_alloc_with_options(&isl_options_args, options);
29*5971e316Smrg 
30*5971e316Smrg 	sc = isl_schedule_constraints_read_from_file(ctx, stdin);
31*5971e316Smrg 	schedule = isl_schedule_constraints_compute_schedule(sc);
32*5971e316Smrg 
33*5971e316Smrg 	p = isl_printer_to_file(ctx, stdout);
34*5971e316Smrg 	p = isl_printer_set_yaml_style(p, ISL_YAML_STYLE_BLOCK);
35*5971e316Smrg 	p = isl_printer_print_schedule(p, schedule);
36*5971e316Smrg 	isl_printer_free(p);
37*5971e316Smrg 
38*5971e316Smrg 	isl_schedule_free(schedule);
39*5971e316Smrg 
40*5971e316Smrg 	isl_ctx_free(ctx);
41*5971e316Smrg 
42*5971e316Smrg 	return p ? EXIT_SUCCESS : EXIT_FAILURE;
43*5971e316Smrg }
44