From 912699d740ce63fbe2110090d64b34742af9dda0 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 18 Sep 2008 20:37:49 +0200 Subject: [PATCH] Treat parameter domains differently For the PolyLib backend, the representation of n-dimensional domain with no parameters and 0-dimensional domain with n parameters are the same, but this may not be the case for all backends. --- include/cloog/domain.h | 3 ++- include/cloog/polylib/domain.h | 7 +++++++ source/polylib/domain.c | 22 ++++++++++++++++++++++ source/program.c | 2 +- test/generate_test.c | 2 +- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/include/cloog/domain.h b/include/cloog/domain.h index 660c1b3..a16226d 100644 --- a/include/cloog/domain.h +++ b/include/cloog/domain.h @@ -99,7 +99,7 @@ void cloog_scattering_list_free(CloogScatteringList *); /*+**************************************************************************** * Reading function * ******************************************************************************/ -CloogDomain * cloog_domain_read(FILE *foo, int nb_par, CloogOptions *options); +CloogDomain * cloog_domain_read_context(FILE * foo, CloogOptions *options); CloogDomain * cloog_domain_union_read(FILE *foo, int nb_par, CloogOptions *options); CloogScattering *cloog_scattering_read(FILE *foo, @@ -133,6 +133,7 @@ int cloog_scattering_dimension(CloogScattering *, CloogDomain *); int cloog_domain_isconvex(CloogDomain *) ; CloogDomain * cloog_domain_cube(int dim, cloog_int_t min, cloog_int_t max, CloogOptions *options); +CloogDomain * cloog_domain_from_context(CloogDomain *context); CloogDomain * cloog_domain_scatter(CloogDomain *domain, CloogScattering *scatt); int cloog_scattering_fully_specified(CloogScattering *scattering, CloogDomain *domain); diff --git a/include/cloog/polylib/domain.h b/include/cloog/polylib/domain.h index e5f3c9f..3c4790b 100644 --- a/include/cloog/polylib/domain.h +++ b/include/cloog/polylib/domain.h @@ -51,6 +51,13 @@ CloogDomain * cloog_domain_preimage(CloogDomain *, Matrix *) ; void cloog_polyhedron_print(FILE *, Polyhedron *) ; CloogDomain * cloog_domain_addconstraints(CloogDomain *, CloogDomain *) ; + +/****************************************************************************** + * Reading function * + ******************************************************************************/ +CloogDomain * cloog_domain_read(FILE *foo, int nb_par, CloogOptions *options); + + /****************************************************************************** * Processing functions * ******************************************************************************/ diff --git a/source/polylib/domain.c b/source/polylib/domain.c index 997536d..b6a1b2b 100644 --- a/source/polylib/domain.c +++ b/source/polylib/domain.c @@ -669,6 +669,28 @@ CloogDomain * cloog_domain_read(FILE * foo, int nb_parameters, /** + * cloog_domain_read_context: + * Read parameter domain. For the PolyLib backend, a parameter domain + * is indistinguishable from a parametric domain. + */ +CloogDomain *cloog_domain_read_context(FILE * foo, CloogOptions *options) +{ + return cloog_domain_read(foo, 0, options); +} + + +/** + * cloog_domain_from_context + * Reinterpret context by turning parameters into variables. + * For the PolyLib backend, this has no effect. + */ +CloogDomain *cloog_domain_from_context(CloogDomain *context) +{ + return context; +} + + +/** * cloog_domain_union_read function: * This function reads a union of polyhedra into a file (foo, posibly stdin) and * returns a pointer to a Polyhedron containing the read information. diff --git a/source/program.c b/source/program.c index bc6bf61..3f0658b 100644 --- a/source/program.c +++ b/source/program.c @@ -569,7 +569,7 @@ CloogProgram * cloog_program_read(FILE * file, CloogOptions * options) p->language = language ; /* We then read the context data. */ - p->context = cloog_domain_read(file, 0, options); + p->context = cloog_domain_read_context(file, options); nb_parameters = cloog_domain_dimension(p->context) ; /* First part of the CloogNames structure: reading of the parameter names. */ diff --git a/test/generate_test.c b/test/generate_test.c index 6cf79ff..520e2bb 100644 --- a/test/generate_test.c +++ b/test/generate_test.c @@ -22,7 +22,7 @@ CloogDomain *get_param_domain(CloogOptions *options) cloog_program_free(program); - return domain; + return cloog_domain_from_context(domain); } static const char preamble[] = -- 2.11.4.GIT