Introduce compatibility to newer CLooG's CloogState and mask the use with macros...
[official-gcc/graphite-test-results.git] / gcc / graphite-cloog-compat.h
blobf27ee5a1228977fee224ceccfcf9c9c077c3afe1
1 /* Compatibility layer for using upstream CLooG versions with
2 CLooG legacy code.
3 Copyright (C) 2010 Free Software Foundation, Inc.
4 Contributed by Andreas Simbuerger <simbuerg@fim.uni-passau.de>.
6 This file is part of GCC.
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.
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.
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/>. */
22 #ifndef GRAPHITE_CLOOG_COMPAT_H
23 #define GRAPHITE_CLOOG_COMPAT_H
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
32 #ifndef CLOOG_ORG
34 /* CloogOptions compatibility. */
35 #define build_cloog_prog(SCOP, PROG, OPT, STATE)\
36 build_cloog_prog (SCOP, PROG, STATE)
37 #define cloog_program_extract_scalars(PROG, SCATT, OPT)\
38 cloog_program_extract_scalars (PROG, SCATT)
39 #define cloog_program_scatter(PROG, SCATT, OPT)\
40 cloog_program_scatter (PROG, SCATT)
42 /* CLAST compatibility. */
43 #define clast_expr_term expr_term
44 #define clast_expr_red expr_red
45 #define clast_expr_bin expr_bin
46 #define clast_pprint pprint
48 /* CloogState compatibility. */
49 #define CloogState void
50 #define cloog_state_malloc() NULL
51 #define cloog_state_free(STATE)
52 #define cloog_loop_malloc(STATE) cloog_loop_malloc ()
53 #define cloog_options_malloc(STATE) cloog_options_malloc ()
54 #define cloog_statement_alloc(STATE, INDEX) cloog_statement_alloc (INDEX)
55 #define new_Cloog_Domain_from_ppl_Pointset_Powerset(PSPS, NB, STATE)\
56 new_Cloog_Domain_from_ppl_Pointset_Powerset (PSPS)
57 #define new_Cloog_Domain_from_ppl_Polyhedron(POLY, NB, STATE)\
58 new_Cloog_Domain_from_ppl_Polyhedron (POLY)
59 #define cloog_domain_from_cloog_matrix(STATE, MAT, NB)\
60 cloog_domain_matrix2domain (MAT)
61 #endif
63 /* Adapt CLooG accessors from CLooG legacy to
64 newer CLooG versions. */
66 #ifdef CLOOG_ORG
68 static inline void *
69 cloog_statement_usr (CloogStatement *cs)
71 return cs->usr;
74 static inline CloogDomain *
75 cloog_domain (CloogDomainList *dl)
77 return dl->domain;
80 static inline void
81 cloog_set_domain (CloogDomainList *dl, CloogDomain *domain)
83 dl->domain = domain;
86 static inline CloogDomainList *
87 cloog_next_domain (CloogDomainList *dl)
89 return dl->next;
92 static inline void
93 cloog_set_next_domain (CloogDomainList *dl, CloogDomainList *next)
95 dl->next = next;
98 static inline int
99 cloog_program_nb_scattdims (CloogProgram *prog)
101 return prog->nb_scattdims;
104 static inline void
105 cloog_program_set_nb_scattdims (CloogProgram *prog, int nb_scattdims)
107 prog->nb_scattdims = nb_scattdims;
110 static inline CloogNames *
111 cloog_program_names (CloogProgram *prog)
113 return prog->names;
116 static inline void
117 cloog_program_set_names (CloogProgram *prog, CloogNames *names)
119 prog->names = names;
122 static inline void
123 cloog_program_set_context (CloogProgram *prog, CloogDomain *domain)
125 prog->context = domain;
128 static inline void
129 cloog_program_set_loop (CloogProgram *prog, CloogLoop *loop)
131 prog->loop = loop;
134 static inline CloogBlockList *
135 cloog_program_blocklist (CloogProgram *prog)
137 return prog->blocklist;
140 static inline void
141 cloog_program_set_blocklist (CloogProgram *prog, CloogBlockList *bl)
143 prog->blocklist = bl;
146 static inline int *
147 cloog_program_scaldims (CloogProgram *prog)
149 return prog->scaldims;
152 static inline void
153 cloog_program_set_scaldims (CloogProgram *prog, int *s)
155 prog->scaldims = s;
158 static inline int
159 cloog_names_nb_parameters (CloogNames *names)
161 return names->nb_parameters;
164 static inline void
165 cloog_names_set_nb_parameters (CloogNames *names, int nb_parameters)
167 names->nb_parameters = nb_parameters;
170 static inline char **
171 cloog_names_parameters (CloogNames *names)
173 return names->parameters;
176 static inline void
177 cloog_names_set_parameters (CloogNames *names, char **parameters)
179 names->parameters = parameters;
182 static inline void
183 cloog_names_set_nb_iterators (CloogNames *names, int nb_iterators)
185 names->nb_iterators = nb_iterators;
188 static inline void
189 cloog_names_set_iterators (CloogNames *names, char **iterators)
191 names->iterators = iterators;
194 static inline void
195 cloog_names_set_nb_scattering (CloogNames *names, int nb_scattering)
197 names->nb_scattering = nb_scattering;
200 static inline void
201 cloog_names_set_scattering (CloogNames *names, char **scattering)
203 names->scattering = scattering;
206 static inline void
207 cloog_statement_set_usr (CloogStatement *cs, void *u)
209 cs->usr = u;
212 static inline void
213 cloog_loop_set_next (CloogLoop *loop, CloogLoop *next)
215 loop->next = next;
218 static inline void
219 cloog_loop_set_domain (CloogLoop *loop, CloogDomain *domain)
221 loop->domain = domain;
224 static inline void
225 cloog_loop_set_block (CloogLoop *loop, CloogBlock *block)
227 loop->block = block;
230 static inline CloogBlockList *
231 cloog_block_list_next (CloogBlockList *bl)
233 return bl->next;
236 static inline void
237 cloog_block_list_set_next (CloogBlockList *bl, CloogBlockList *next)
239 bl->next = next;
242 static inline void
243 cloog_block_list_set_block (CloogBlockList *bl, CloogBlock *block)
245 bl->block = block;
247 #endif /* CLOOG_ORG */
248 #endif /* GRAPHITE_CLOOG_COMPAT_H */