PR other/18555
[official-gcc.git] / gcc / graphite-cloog-compat.h
blobc39b18ea3bcbabeb838355d96347ae972b72cc76
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 #ifdef CLOOG_ORG
33 #define cloog_initialize()
34 #define cloog_finalize()
35 #endif
37 #ifndef CLOOG_ORG
39 /* CloogOptions compatibility. */
40 #define build_cloog_prog(SCOP, PROG, OPT, STATE)\
41 build_cloog_prog (SCOP, PROG, STATE)
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)
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
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)
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
76 #endif
78 /* Adapt CLooG accessors from CLooG legacy to
79 newer CLooG versions. */
81 #ifdef CLOOG_ORG
83 static inline void *
84 cloog_statement_usr (CloogStatement *cs)
86 return cs->usr;
89 static inline CloogScattering *
90 cloog_scattering (CloogScatteringList *sl)
92 return sl->scatt;
95 static inline void
96 cloog_set_scattering (CloogScatteringList *sl, CloogScattering *scatt)
98 sl->scatt = scatt;
101 static inline CloogScatteringList *
102 cloog_next_scattering (CloogScatteringList *sl)
104 return sl->next;
107 static inline void
108 cloog_set_next_scattering (CloogScatteringList *sl, CloogScatteringList *next)
110 sl->next = next;
113 static inline int
114 cloog_program_nb_scattdims (CloogProgram *prog)
116 return prog->nb_scattdims;
119 static inline void
120 cloog_program_set_nb_scattdims (CloogProgram *prog, int nb_scattdims)
122 prog->nb_scattdims = nb_scattdims;
125 static inline CloogNames *
126 cloog_program_names (CloogProgram *prog)
128 return prog->names;
131 static inline void
132 cloog_program_set_names (CloogProgram *prog, CloogNames *names)
134 prog->names = names;
137 static inline void
138 cloog_program_set_context (CloogProgram *prog, CloogDomain *domain)
140 prog->context = domain;
143 static inline void
144 cloog_program_set_loop (CloogProgram *prog, CloogLoop *loop)
146 prog->loop = loop;
149 static inline CloogBlockList *
150 cloog_program_blocklist (CloogProgram *prog)
152 return prog->blocklist;
155 static inline void
156 cloog_program_set_blocklist (CloogProgram *prog, CloogBlockList *bl)
158 prog->blocklist = bl;
161 static inline int *
162 cloog_program_scaldims (CloogProgram *prog)
164 return prog->scaldims;
167 static inline void
168 cloog_program_set_scaldims (CloogProgram *prog, int *s)
170 prog->scaldims = s;
173 static inline int
174 cloog_names_nb_parameters (CloogNames *names)
176 return names->nb_parameters;
179 static inline void
180 cloog_names_set_nb_parameters (CloogNames *names, int nb_parameters)
182 names->nb_parameters = nb_parameters;
185 static inline char **
186 cloog_names_parameters (CloogNames *names)
188 return names->parameters;
191 static inline void
192 cloog_names_set_parameters (CloogNames *names, char **parameters)
194 names->parameters = parameters;
197 static inline void
198 cloog_names_set_nb_iterators (CloogNames *names, int nb_iterators)
200 names->nb_iterators = nb_iterators;
203 static inline void
204 cloog_names_set_iterators (CloogNames *names, char **iterators)
206 names->iterators = iterators;
209 static inline void
210 cloog_names_set_nb_scattering (CloogNames *names, int nb_scattering)
212 names->nb_scattering = nb_scattering;
215 static inline void
216 cloog_names_set_scattering (CloogNames *names, char **scattering)
218 names->scattering = scattering;
221 static inline void
222 cloog_statement_set_usr (CloogStatement *cs, void *u)
224 cs->usr = u;
227 static inline void
228 cloog_loop_set_next (CloogLoop *loop, CloogLoop *next)
230 loop->next = next;
233 static inline void
234 cloog_loop_set_domain (CloogLoop *loop, CloogDomain *domain)
236 loop->domain = domain;
239 static inline void
240 cloog_loop_set_block (CloogLoop *loop, CloogBlock *block)
242 loop->block = block;
245 static inline CloogBlockList *
246 cloog_block_list_next (CloogBlockList *bl)
248 return bl->next;
251 static inline void
252 cloog_block_list_set_next (CloogBlockList *bl, CloogBlockList *next)
254 bl->next = next;
257 static inline void
258 cloog_block_list_set_block (CloogBlockList *bl, CloogBlock *block)
260 bl->block = block;
262 #endif /* CLOOG_ORG */
263 #endif /* GRAPHITE_CLOOG_COMPAT_H */