1 2 /**-------------------------------------------------------------------** 3 ** CLooG ** 4 **-------------------------------------------------------------------** 5 ** domain.h ** 6 **-------------------------------------------------------------------** 7 ** First version: october 28th 2001 ** 8 **-------------------------------------------------------------------**/ 9 10 11 /****************************************************************************** 12 * CLooG : the Chunky Loop Generator (experimental) * 13 ****************************************************************************** 14 * * 15 * Copyright (C) 2001-2005 Cedric Bastoul * 16 * * 17 * This library is free software; you can redistribute it and/or * 18 * modify it under the terms of the GNU Lesser General Public * 19 * License as published by the Free Software Foundation; either * 20 * version 2.1 of the License, or (at your option) any later version. * 21 * * 22 * This library is distributed in the hope that it will be useful, * 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 25 * Lesser General Public License for more details. * 26 * * 27 * You should have received a copy of the GNU Lesser General Public * 28 * License along with this library; if not, write to the Free Software * 29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 30 * Boston, MA 02110-1301 USA * 31 * * 32 * CLooG, the Chunky Loop Generator * 33 * Written by Cedric Bastoul, Cedric.Bastoul (at) inria.fr * 34 * * 35 ******************************************************************************/ 36 37 38 #ifndef CLOOG_DOMAIN_H 39 #define CLOOG_DOMAIN_H 40 #if defined(__cplusplus) 41 extern "C" 42 { 43 #endif 44 45 46 struct cloogdomain; 47 typedef struct cloogdomain CloogDomain ; 48 struct cloogscattering; 49 typedef struct cloogscattering CloogScattering; 50 struct osl_relation; 51 52 53 /** 54 * CloogDomainList structure: 55 * this structure reprensents a node of a linked list of CloogDomain structures. 56 */ 57 struct cloogdomainlist { 58 CloogDomain *domain; /**< An element of the list. */ 59 struct cloogdomainlist *next;/**< Pointer to the next element of the list.*/ 60 } ; 61 typedef struct cloogdomainlist CloogDomainList; 62 63 64 /** 65 * CloogScatteringList structure: 66 * this structure reprensents a node of a linked list of CloogScattering structures. 67 */ 68 struct cloogscatteringlist { 69 CloogScattering *scatt; /**< An element of the list. */ 70 struct cloogscatteringlist *next;/**< Pointer to the next element of the list.*/ 71 } ; 72 typedef struct cloogscatteringlist CloogScatteringList; 73 74 75 /****************************************************************************** 76 * PolyLib interface * 77 ******************************************************************************/ 78 void cloog_domain_print_constraints(FILE *, CloogDomain *, 79 int print_number); 80 void cloog_scattering_print_constraints(FILE *, CloogScattering *); 81 void cloog_domain_free(CloogDomain *) ; 82 void cloog_scattering_free(CloogScattering *); 83 CloogDomain * cloog_domain_copy(CloogDomain *) ; 84 CloogDomain * cloog_domain_convex(CloogDomain * Pol) ; 85 CloogDomain * cloog_domain_simple_convex(CloogDomain * domain); 86 CloogDomain * cloog_domain_simplify(CloogDomain *, CloogDomain *) ; 87 CloogDomain * cloog_domain_union(CloogDomain *, CloogDomain *) ; 88 CloogDomain * cloog_domain_intersection(CloogDomain *, CloogDomain *) ; 89 CloogDomain * cloog_domain_difference(CloogDomain *, CloogDomain *) ; 90 void cloog_domain_sort(CloogDomain**,unsigned,unsigned,int *); 91 int cloog_domain_follows(CloogDomain *dom1, CloogDomain *dom2, unsigned level); 92 CloogDomain * cloog_domain_empty(CloogDomain *model); 93 int cloog_domain_is_bounded(CloogDomain *dim, unsigned level); 94 CloogDomain *cloog_domain_bound_splitter(CloogDomain *dom, int level); 95 96 97 /****************************************************************************** 98 * Structure display function * 99 ******************************************************************************/ 100 void cloog_domain_print_structure(FILE *file, CloogDomain *domain, int level, 101 const char *name); 102 103 104 /****************************************************************************** 105 * Memory deallocation function * 106 ******************************************************************************/ 107 void cloog_domain_list_free(CloogDomainList *); 108 void cloog_scattering_list_free(CloogScatteringList *); 109 110 111 /*+**************************************************************************** 112 * Reading function * 113 ******************************************************************************/ 114 CloogDomain * cloog_domain_read_context(CloogState *state, FILE * foo); 115 CloogDomain * cloog_domain_union_read(CloogState *state, FILE *foo, int nb_par); 116 CloogScattering *cloog_domain_read_scattering(CloogDomain *domain, FILE *foo); 117 118 CloogDomain * cloog_domain_from_cloog_matrix(CloogState *state, 119 CloogMatrix *matrix, int nb_par); 120 CloogScattering * cloog_scattering_from_cloog_matrix(CloogState *state, 121 CloogMatrix *matrix, int nb_scat, int nb_par); 122 123 124 /****************************************************************************** 125 * Processing functions * 126 ******************************************************************************/ 127 CloogDomain *cloog_domain_from_osl_relation(CloogState *, 128 struct osl_relation *); 129 CloogScattering *cloog_scattering_from_osl_relation(CloogState *, 130 struct osl_relation *); 131 CloogConstraintSet *cloog_domain_constraints(CloogDomain *); 132 int cloog_domain_isempty(CloogDomain *) ; 133 CloogDomain * cloog_domain_universe(CloogState *state, unsigned dim); 134 CloogDomain * cloog_domain_project(CloogDomain *, int); 135 CloogDomain * cloog_domain_extend(CloogDomain *, int); 136 int cloog_domain_never_integral(CloogDomain *) ; 137 void cloog_domain_stride(CloogDomain *, int, cloog_int_t *, cloog_int_t *); 138 int cloog_domain_can_stride(CloogDomain *domain, int level); 139 int cloog_domain_is_otl(CloogDomain *domain, int level); 140 CloogDomain * cloog_domain_stride_lower_bound(CloogDomain *domain, int level, 141 CloogStride *stride); 142 CloogDomain * cloog_domain_add_stride_constraint(CloogDomain *domain, 143 CloogStride *stride); 144 int cloog_domain_can_unroll(CloogDomain *domain, int level, 145 cloog_int_t *n, CloogConstraint **lb); 146 CloogDomain * cloog_domain_fixed_offset(CloogDomain *domain, int level, 147 CloogConstraint *lb, cloog_int_t offset); 148 int cloog_domain_lazy_disjoint(CloogDomain *, CloogDomain *) ; 149 int cloog_domain_lazy_equal(CloogDomain *, CloogDomain *) ; 150 int cloog_scattering_lazy_block(CloogScattering *, CloogScattering *, 151 CloogScatteringList *, int); 152 int cloog_scattering_lazy_isscalar(CloogScattering *, int, 153 cloog_int_t *); 154 int cloog_domain_lazy_isconstant(CloogDomain *domain, int dimension, 155 cloog_int_t *value); 156 int cloog_scattering_list_lazy_same(CloogScatteringList *); 157 CloogDomain * cloog_domain_cut_first(CloogDomain *domain, CloogDomain **rest); 158 CloogDomain * cloog_domain_simplify_union(CloogDomain *domain); 159 CloogScattering * cloog_scattering_erase_dimension(CloogScattering *, int); 160 161 int cloog_domain_dimension(CloogDomain *) ; 162 int cloog_domain_parameter_dimension(CloogDomain *domain); 163 int cloog_scattering_dimension(CloogScattering *, CloogDomain *); 164 int cloog_domain_isconvex(CloogDomain *) ; 165 CloogDomain * cloog_domain_cube(CloogState *state, 166 int dim, cloog_int_t min, cloog_int_t max); 167 CloogDomain * cloog_domain_from_context(CloogDomain *context); 168 CloogDomain * cloog_domain_scatter(CloogDomain *domain, CloogScattering *scatt); 169 int cloog_scattering_fully_specified(CloogScattering *scattering, 170 CloogDomain *domain); 171 172 CloogStride *cloog_domain_list_stride(CloogDomainList *list, int level); 173 174 #if defined(__cplusplus) 175 } 176 #endif 177 #endif /* define _H */ 178