1 /* Compatibility layer for using upstream CLooG versions with 2 CLooG legacy code. 3 Copyright (C) 2010, 2011 Free Software Foundation, Inc. 4 Contributed by Andreas Simbuerger <simbuerg@fim.uni-passau.de>. 5 6 This file is part of GCC. 7 8 GCC is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3, or (at your option) 11 any later version. 12 13 GCC is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with GCC; see the file COPYING3. If not see 20 <http://www.gnu.org/licenses/>. */ 21 22 #ifndef GRAPHITE_CLOOG_COMPAT_H 23 #define GRAPHITE_CLOOG_COMPAT_H 24 25 /* Restore compatibility to CLooG Legacy. */ 26 #ifdef CLOOG_ORG 27 typedef const struct clast_expr *clast_name_p; 28 #else 29 typedef const char *clast_name_p; 30 #endif 31 32 #ifdef CLOOG_ORG 33 #define cloog_initialize() 34 #define cloog_finalize() 35 #endif 36 37 #ifndef CLOOG_ORG 38 39 /* CloogOptions compatibility. */ 40 #define build_cloog_prog(SCOP, PROG, OPT)\ 41 build_cloog_prog (SCOP, PROG) 42 #define cloog_program_extract_scalars(PROG, SCATT, OPT)\ 43 cloog_program_extract_scalars (PROG, SCATT) 44 #define cloog_program_scatter(PROG, SCATT, OPT)\ 45 cloog_program_scatter (PROG, SCATT) 46 47 /* CLAST compatibility. */ 48 #define clast_expr_term expr_term 49 #define clast_expr_red expr_red 50 #define clast_expr_bin expr_bin 51 #define clast_pprint pprint 52 53 /* CloogState compatibility. */ 54 #define CloogState void 55 #define cloog_state_malloc() NULL 56 #define cloog_state_free(STATE) 57 #define cloog_loop_malloc(STATE) cloog_loop_malloc () 58 #define cloog_options_malloc(STATE) cloog_options_malloc () 59 #define cloog_statement_alloc(STATE, INDEX) cloog_statement_alloc (INDEX) 60 #define new_Cloog_Domain_from_ppl_Pointset_Powerset(PSPS, NB, STATE)\ 61 new_Cloog_Domain_from_ppl_Pointset_Powerset (PSPS) 62 #define new_Cloog_Domain_from_ppl_Polyhedron(POLY, NB, STATE)\ 63 new_Cloog_Domain_from_ppl_Polyhedron (POLY) 64 #define cloog_domain_from_cloog_matrix(STATE, MAT, NB)\ 65 cloog_domain_matrix2domain (MAT) 66 67 /* CloogScatteringList compatibility. */ 68 #define CloogScatteringList CloogDomainList 69 #define CloogScattering CloogDomain 70 #define cloog_set_next_scattering cloog_set_next_domain 71 #define cloog_set_scattering cloog_set_domain 72 #define cloog_scattering cloog_domain 73 #define cloog_next_scattering cloog_next_domain 74 #define cloog_scattering_free cloog_domain_free 75 #define cloog_program_dump_cloog(DUMPFILE, PROGRAM, SCATTERINGLIST)\ 76 cloog_program_dump_cloog (DUMPFILE, PROGRAM) 77 78 #endif 79 80 /* Adapt CLooG accessors from CLooG legacy to 81 newer CLooG versions. */ 82 83 #ifdef CLOOG_ORG 84 85 static inline void * 86 cloog_statement_usr (CloogStatement *cs) 87 { 88 return cs->usr; 89 } 90 91 static inline CloogScattering * 92 cloog_scattering (CloogScatteringList *sl) 93 { 94 return sl->scatt; 95 } 96 97 static inline void 98 cloog_set_scattering (CloogScatteringList *sl, CloogScattering *scatt) 99 { 100 sl->scatt = scatt; 101 } 102 103 static inline CloogScatteringList * 104 cloog_next_scattering (CloogScatteringList *sl) 105 { 106 return sl->next; 107 } 108 109 static inline void 110 cloog_set_next_scattering (CloogScatteringList *sl, CloogScatteringList *next) 111 { 112 sl->next = next; 113 } 114 115 static inline int 116 cloog_program_nb_scattdims (CloogProgram *prog) 117 { 118 return prog->nb_scattdims; 119 } 120 121 static inline void 122 cloog_program_set_nb_scattdims (CloogProgram *prog, int nb_scattdims) 123 { 124 prog->nb_scattdims = nb_scattdims; 125 } 126 127 static inline CloogNames * 128 cloog_program_names (CloogProgram *prog) 129 { 130 return prog->names; 131 } 132 133 static inline void 134 cloog_program_set_names (CloogProgram *prog, CloogNames *names) 135 { 136 prog->names = names; 137 } 138 139 static inline void 140 cloog_program_set_context (CloogProgram *prog, CloogDomain *domain) 141 { 142 prog->context = domain; 143 } 144 145 static inline void 146 cloog_program_set_loop (CloogProgram *prog, CloogLoop *loop) 147 { 148 prog->loop = loop; 149 } 150 151 static inline CloogBlockList * 152 cloog_program_blocklist (CloogProgram *prog) 153 { 154 return prog->blocklist; 155 } 156 157 static inline void 158 cloog_program_set_blocklist (CloogProgram *prog, CloogBlockList *bl) 159 { 160 prog->blocklist = bl; 161 } 162 163 static inline int * 164 cloog_program_scaldims (CloogProgram *prog) 165 { 166 return prog->scaldims; 167 } 168 169 static inline void 170 cloog_program_set_scaldims (CloogProgram *prog, int *s) 171 { 172 prog->scaldims = s; 173 } 174 175 static inline int 176 cloog_names_nb_parameters (CloogNames *names) 177 { 178 return names->nb_parameters; 179 } 180 181 static inline void 182 cloog_names_set_nb_parameters (CloogNames *names, int nb_parameters) 183 { 184 names->nb_parameters = nb_parameters; 185 } 186 187 static inline char ** 188 cloog_names_parameters (CloogNames *names) 189 { 190 return names->parameters; 191 } 192 193 static inline void 194 cloog_names_set_parameters (CloogNames *names, char **parameters) 195 { 196 names->parameters = parameters; 197 } 198 199 static inline void 200 cloog_names_set_nb_iterators (CloogNames *names, int nb_iterators) 201 { 202 names->nb_iterators = nb_iterators; 203 } 204 205 static inline void 206 cloog_names_set_iterators (CloogNames *names, char **iterators) 207 { 208 names->iterators = iterators; 209 } 210 211 static inline void 212 cloog_names_set_nb_scattering (CloogNames *names, int nb_scattering) 213 { 214 names->nb_scattering = nb_scattering; 215 } 216 217 static inline void 218 cloog_names_set_scattering (CloogNames *names, char **scattering) 219 { 220 names->scattering = scattering; 221 } 222 223 static inline void 224 cloog_statement_set_usr (CloogStatement *cs, void *u) 225 { 226 cs->usr = u; 227 } 228 229 static inline void 230 cloog_loop_set_next (CloogLoop *loop, CloogLoop *next) 231 { 232 loop->next = next; 233 } 234 235 static inline void 236 cloog_loop_set_domain (CloogLoop *loop, CloogDomain *domain) 237 { 238 loop->domain = domain; 239 } 240 241 static inline void 242 cloog_loop_set_block (CloogLoop *loop, CloogBlock *block) 243 { 244 loop->block = block; 245 } 246 247 static inline CloogBlockList * 248 cloog_block_list_next (CloogBlockList *bl) 249 { 250 return bl->next; 251 } 252 253 static inline void 254 cloog_block_list_set_next (CloogBlockList *bl, CloogBlockList *next) 255 { 256 bl->next = next; 257 } 258 259 static inline void 260 cloog_block_list_set_block (CloogBlockList *bl, CloogBlock *block) 261 { 262 bl->block = block; 263 } 264 265 static inline int cloog_matrix_ncolumns (CloogMatrix * m) 266 { 267 return m->NbColumns; 268 } 269 270 static inline int cloog_matrix_nrows (CloogMatrix * m) 271 { 272 return m->NbRows; 273 } 274 #endif /* CLOOG_ORG */ 275 #endif /* GRAPHITE_CLOOG_COMPAT_H */ 276