use isl_space_params_alloc
[pet.git] / pet_scop_cmp.c
blobc11fca19a25b430bc692986427204639d837ccc0
1 #include <assert.h>
2 #include <stdio.h>
3 #include <isl/arg.h>
5 #include "scop.h"
6 #include "scop_yaml.h"
8 struct options {
9 char *scop1;
10 char *scop2;
13 struct isl_arg options_arg[] = {
14 ISL_ARG_ARG(struct options, scop1, "scop1", NULL)
15 ISL_ARG_ARG(struct options, scop2, "scop2", NULL)
16 ISL_ARG_END
19 ISL_ARG_DEF(options, struct options, options_arg)
21 /* Given two YAML descriptions of pet_scops, check whether they
22 * represent equivalent scops.
23 * If so, return 0. Otherwise, return 1.
25 int main(int argc, char **argv)
27 isl_ctx *ctx;
28 struct options *options;
29 struct pet_scop *scop1, *scop2;
30 FILE *file1, *file2;
31 int equal;
33 options = options_new_with_defaults();
34 assert(options);
35 argc = options_parse(options, argc, argv, ISL_ARG_ALL);
36 ctx = isl_ctx_alloc_with_options(options_arg, options);
38 file1 = fopen(options->scop1, "r");
39 assert(file1);
40 file2 = fopen(options->scop2, "r");
41 assert(file2);
43 scop1 = pet_scop_parse(ctx, file1);
44 scop2 = pet_scop_parse(ctx, file2);
46 equal = pet_scop_is_equal(scop1, scop2);
48 pet_scop_free(scop2);
49 pet_scop_free(scop1);
51 fclose(file2);
52 fclose(file1);
53 isl_ctx_free(ctx);
55 return equal ? 0 : 1;