OSDN Git Service

56b6bb382cd46648ab35108eb8fb26148ba76cf8
[pf3gnuchains/gcc-fork.git] / gcc / graphite-cloog-compat.h
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>.
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 #ifndef CLOOG_ORG
33
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)
41
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
47
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
62 /* CloogScatteringList compatibility.  */
63 #define CloogScatteringList CloogDomainList
64 #define CloogScattering CloogDomain
65 #define cloog_set_next_scattering cloog_set_next_domain
66 #define cloog_set_scattering cloog_set_domain
67 #define cloog_scattering cloog_domain
68 #define cloog_next_scattering cloog_next_domain
69 #define cloog_scattering_free cloog_domain_free
70
71 #endif
72
73 /* Adapt CLooG accessors from CLooG legacy to
74    newer CLooG versions.  */
75
76 #ifdef CLOOG_ORG
77
78 static inline void *
79 cloog_statement_usr (CloogStatement *cs)
80 {
81   return cs->usr;
82 }
83
84 static inline CloogScattering *
85 cloog_scattering (CloogScatteringList *sl)
86 {
87   return sl->scatt;
88 }
89
90 static inline void
91 cloog_set_scattering (CloogScatteringList *sl, CloogScattering *scatt)
92 {
93   sl->scatt = scatt;
94 }
95
96 static inline CloogScatteringList *
97 cloog_next_scattering (CloogScatteringList *sl)
98 {
99   return sl->next;
100 }
101
102 static inline void
103 cloog_set_next_scattering (CloogScatteringList *sl, CloogScatteringList *next)
104 {
105   sl->next = next;
106 }
107
108 static inline int
109 cloog_program_nb_scattdims (CloogProgram *prog)
110 {
111   return prog->nb_scattdims;
112 }
113
114 static inline void
115 cloog_program_set_nb_scattdims (CloogProgram *prog, int nb_scattdims)
116 {
117   prog->nb_scattdims = nb_scattdims;
118 }
119
120 static inline CloogNames *
121 cloog_program_names (CloogProgram *prog)
122 {
123   return prog->names;
124 }
125
126 static inline void
127 cloog_program_set_names (CloogProgram *prog, CloogNames *names)
128 {
129   prog->names = names;
130 }
131
132 static inline void
133 cloog_program_set_context (CloogProgram *prog, CloogDomain *domain)
134 {
135   prog->context = domain;
136 }
137
138 static inline void
139 cloog_program_set_loop (CloogProgram *prog, CloogLoop *loop)
140 {
141   prog->loop = loop;
142 }
143
144 static inline CloogBlockList *
145 cloog_program_blocklist (CloogProgram *prog)
146 {
147   return prog->blocklist;
148 }
149
150 static inline void
151 cloog_program_set_blocklist (CloogProgram *prog, CloogBlockList *bl)
152 {
153   prog->blocklist = bl;
154 }
155
156 static inline int *
157 cloog_program_scaldims (CloogProgram *prog)
158 {
159   return prog->scaldims;
160 }
161
162 static inline void
163 cloog_program_set_scaldims (CloogProgram *prog, int *s)
164 {
165   prog->scaldims = s;
166 }
167
168 static inline int
169 cloog_names_nb_parameters (CloogNames *names)
170 {
171   return names->nb_parameters;
172 }
173
174 static inline void
175 cloog_names_set_nb_parameters (CloogNames *names, int nb_parameters)
176 {
177   names->nb_parameters = nb_parameters;
178 }
179
180 static inline char **
181 cloog_names_parameters (CloogNames *names)
182 {
183   return names->parameters;
184 }
185
186 static inline void
187 cloog_names_set_parameters (CloogNames *names, char **parameters)
188 {
189   names->parameters = parameters;
190 }
191
192 static inline void
193 cloog_names_set_nb_iterators (CloogNames *names, int nb_iterators)
194 {
195   names->nb_iterators = nb_iterators;
196 }
197
198 static inline void
199 cloog_names_set_iterators (CloogNames *names, char **iterators)
200 {
201   names->iterators = iterators;
202 }
203
204 static inline void
205 cloog_names_set_nb_scattering (CloogNames *names, int nb_scattering)
206 {
207   names->nb_scattering = nb_scattering;
208 }
209
210 static inline void
211 cloog_names_set_scattering (CloogNames *names, char **scattering)
212 {
213   names->scattering = scattering;
214 }
215
216 static inline void
217 cloog_statement_set_usr (CloogStatement *cs, void *u)
218 {
219   cs->usr = u;
220 }
221
222 static inline void
223 cloog_loop_set_next (CloogLoop *loop, CloogLoop *next)
224 {
225   loop->next = next;
226 }
227
228 static inline void
229 cloog_loop_set_domain (CloogLoop *loop, CloogDomain *domain)
230 {
231   loop->domain = domain;
232 }
233
234 static inline void
235 cloog_loop_set_block (CloogLoop *loop, CloogBlock *block)
236 {
237   loop->block = block;
238 }
239
240 static inline CloogBlockList *
241 cloog_block_list_next (CloogBlockList *bl)
242 {
243   return bl->next;
244 }
245
246 static inline void
247 cloog_block_list_set_next (CloogBlockList *bl, CloogBlockList *next)
248 {
249   bl->next = next;
250 }
251
252 static inline void
253 cloog_block_list_set_block (CloogBlockList *bl, CloogBlock *block)
254 {
255   bl->block = block;
256 }
257 #endif /* CLOOG_ORG  */
258 #endif /* GRAPHITE_CLOOG_COMPAT_H  */