First commit : 0.14.0 version (with roadmap in doc instead of
[cloog.git] / include / cloog / cloog.h.in
blob931816ab8fc43427bc58786feff8f409dedaf090
2 /**-------------------------------------------------------------------**
3 ** CLooG **
4 **-------------------------------------------------------------------**
5 ** cloog.h **
6 **-------------------------------------------------------------------**
7 ** First version: july 25th 2002 **
8 **-------------------------------------------------------------------**/
11 /******************************************************************************
12 * CLooG : the Chunky Loop Generator (experimental) *
13 ******************************************************************************
14 * *
15 * Copyright (C) 2001-2005 Cedric Bastoul *
16 * *
17 * This is free software; you can redistribute it and/or modify it under the *
18 * terms of the GNU General Public License as published by the Free Software *
19 * Foundation; either version 2 of the License, or (at your option) any later *
20 * version. *
21 * *
22 * This software is distributed in the hope that it will be useful, but *
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
25 * for more details. *
26 * *
27 * You should have received a copy of the GNU General Public License along *
28 * with software; if not, write to the Free Software Foundation, Inc., *
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
30 * *
31 * CLooG, the Chunky Loop Generator *
32 * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
33 * *
34 ******************************************************************************/
36 /******************************************************************************
37 * THIS FILE HAS BEEN AUTOMATICALLY GENERATED FROM clooh.h.in BY configure *
38 ******************************************************************************/
40 # define CLOOG_RELEASE "@RELEASE@"
41 # define CLOOG_VERSION "@VERSION@"
43 # include <polylib/@cl_cv_polylib@.h>
44 # include "./options.h"
45 # include "./matrix.h"
46 # include "./domain.h"
47 # include "./statement.h"
48 # include "./block.h"
49 # include "./names.h"
50 # include "./loop.h"
51 # include "./program.h"
52 # include "./pprint.h"
55 /******************************************************************************
56 * CLOOG GMP MACROS *
57 ******************************************************************************/
58 #ifdef GNUMP
59 #define value_init_c(val) { mpz_init((val)) ; \
60 cloog_value_leak_up() ; \
62 #define value_clear_c(val) { mpz_clear((val)) ; \
63 cloog_value_leak_down() ; \
65 #define value_sprint(Dst,fmt,val) { char * str ; \
66 str = mpz_get_str(0,10,(val)) ; \
67 sprintf((Dst),(fmt),str) ; \
68 free(str) ; \
70 #define value_eq_si(v1,i2) (mpz_cmp_si((v1),(i2)) == 0)
71 #define value_ne_si(v1,i2) (mpz_cmp_si((v1),(i2)) != 0)
72 #define value_gt_si(v1,i2) (mpz_cmp_si((v1),(i2)) > 0)
73 #define value_lt_si(v1,i2) (mpz_cmp_si((v1),(i2)) < 0)
74 #define value_multiply_si(ref,v1,i2) (mpz_mul_si((ref),(v1),(i2)))
77 /******************************************************************************
78 * CLOOG BASIC TYPES MACROS *
79 ******************************************************************************/
80 #else
81 #define value_init_c(val) ((val) = 0)
82 #define value_clear_c(val) ((val) = 0)
83 #define value_sprint(Dst,fmt,val) (sprintf((Dst),(fmt),(val)))
84 #define value_eq_si(v1,i2) ((v1) == (i2))
85 #define value_ne_si(v1,i2) ((v1) != (i2))
86 #define value_gt_si(v1,i2) ((v1) > (i2))
87 #define value_lt_si(v1,i2) ((v1) < (i2))
88 #define value_multiply_si(ref,v1,i2) ((ref) = value_mult((v1),(i2)))
89 #endif
92 /******************************************************************************
93 * POLYLIB MACROS *
94 ******************************************************************************
95 * Because I was tired to look in polylib/include/polylib/arithmetique.h for *
96 * the existing macros, here is a copy ! *
97 ******************************************************************************/
98 #if 0
100 /******************************************************************************
101 * POLYLIB GMP MACROS *
102 ******************************************************************************/
103 #if defined(GNUMP)
105 /* Basic macros */
107 #define value_init(val) (mpz_init((val)))
108 #define value_assign(v1,v2) (mpz_set((v1),(v2)))
109 #define value_set_si(val,i) (mpz_set_si((val),(i)))
110 #define value_set_double(val,d) (mpz_set_d((val),(d)))
111 #define value_clear(val) (mpz_clear((val)))
112 #define value_read(val,str) (mpz_set_str((val),(str),10))
113 #define value_print(Dst,fmt,val) {char *str; \
114 str = mpz_get_str(0,10,(val)); \
115 fprintf((Dst),(fmt),str); free(str); \
117 #define value_swap(val1,val2) {mpz_t tmp; mpz_init_set(tmp,(val1)); \
118 mpz_set((val1),(val2)); \
119 mpz_set((val2),tmp); \
120 mpz_clear(tmp); \
123 /* Boolean operators on 'Value' */
125 #define value_eq(v1,v2) (mpz_cmp((v1),(v2)) == 0)
126 #define value_ne(v1,v2) (mpz_cmp((v1),(v2)) != 0)
127 #define value_gt(v1,v2) (mpz_cmp((v1),(v2)) > 0)
128 #define value_ge(v1,v2) (mpz_cmp((v1),(v2)) >= 0)
129 #define value_lt(v1,v2) (mpz_cmp((v1),(v2)) < 0)
130 #define value_le(v1,v2) (mpz_cmp((v1),(v2)) <= 0)
132 /* Trian operators on 'Value' */
134 #define value_sign(val) (mpz_sgn(val))
135 #define value_compare(v1,v2) (mpz_cmp((v1),(v2)))
137 /* Binary operations on 'Value' */
139 #define value_addto(ref,val1,val2) (mpz_add((ref),(val1),(val2)))
140 #define value_add_int(ref,val,vint) (mpz_add_ui((ref),(val),(long)(vint)))
141 #define value_increment(ref,val) (mpz_add_ui((ref),(val),1))
142 #define value_multiply(ref,val1,val2) (mpz_mul((ref),(val1),(val2)))
143 #define value_substract(ref,val1,val2) (mpz_sub((ref),(val1),(val2)))
144 #define value_sub_int(ref,val,vint) (mpz_sub_ui((ref),(val),(long)(vint)))
145 #define value_decrement(ref,val) (mpz_sub_ui((ref),(val),1))
146 #define value_division(ref,val1,val2) (mpz_tdiv_q((ref),(val1),(val2)))
147 #define value_modulus(ref,val1,val2) (mpz_tdiv_r((ref),(val1),(val2)))
148 #define value_pdivision(ref,val1,val2) (mpz_fdiv_q((ref),(val1),(val2)))
149 #define value_oppose(ref,val) (mpz_neg((ref),(val)))
150 #define value_absolute(ref,val) (mpz_abs((ref),(val)))
151 #define value_minimum(ref,val1,val2) (value_le((val1),(val2)) ? \
152 mpz_set((ref),(val1)) : \
153 mpz_set((ref),(val2)))
154 #define value_maximum(ref,val1,val2) (value_ge((val1),(val2)) ? \
155 mpz_set((ref),(val1)) : \
156 mpz_set((ref),(val2)))
157 #define value_orto(ref,val1,val2) (mpz_ior((ref),(val1),(val2)))
158 #define value_andto(ref,val1,val2) (mpz_and((ref),(val1),(val2)))
160 /* Conditional operations on 'Value' */
162 #define value_pos_p(val) (mpz_sgn(val) > 0)
163 #define value_neg_p(val) (mpz_sgn(val) < 0)
164 #define value_posz_p(val) (mpz_sgn(val) >= 0)
165 #define value_negz_p(val) (mpz_sgn(val) <= 0)
166 #define value_zero_p(val) (mpz_sgn(val) == 0)
167 #define value_notzero_p(val) (mpz_sgn(val) != 0)
168 #define value_one_p(val) (mpz_cmp_si(val,1) == 0)
169 #define value_notone_p(val) (mpz_cmp_si(val,1) != 0)
170 #define value_mone_p(val) (mpz_cmp_si(val,-1) ==0)
171 #define value_notmone_p(val) (mpz_cmp_si(val,-1) !=0)
174 /******************************************************************************
175 * POLYLIB BASIC TYPES MACROS *
176 ******************************************************************************/
177 #else /* 'Value' set to longlong|long|float|char *|int */
179 /* Basic Macros */
181 #define value_init(val) ((val) = 0)
182 #define value_assign(v1,v2) ((v1) = (v2))
183 #define value_set_si(val,i) ((val) = (Value)(i))
184 #define value_set_double(val,d) ((val) = (Value)(d))
185 #define value_clear(val) ((val) = 0)
186 #define value_read(val,str) (sscanf((str),VALUE_FMT,&(val)))
187 #define value_print(Dst,fmt,val) (fprintf((Dst),(fmt),(val)))
188 #define value_swap(v1,v2) {Value tmp; tmp = v2; \
189 v2 = v1; v1 = tmp; \
191 /* Cast to 'Value' */
193 #define int_to_value(i) ((Value)(i))
194 #define long_to_value(l) ((Value)(l))
195 #define float_to_value(f) ((Value)(f))
196 #define double_to_value(d) ((Value)(d))
198 /* Boolean operators on 'Value' */
200 #define value_eq(v1,v2) ((v1)==(v2))
201 #define value_ne(v1,v2) ((v1)!=(v2))
202 #define value_gt(v1,v2) ((v1)>(v2))
203 #define value_ge(v1,v2) ((v1)>=(v2))
204 #define value_lt(v1,v2) ((v1)<(v2))
205 #define value_le(v1,v2) ((v1)<=(v2))
207 /* Trian operators on 'Value' */
209 #define value_sign(v) (value_eq(v,VALUE_ZERO) ? \
210 0: \
211 value_lt(v,VALUE_ZERO)?-1:1)
212 #define value_compare(v1,v2) (value_eq(v1,v2)? \
213 0: \
214 value_lt(v1,v2)?-1:1)
216 /* Binary operators on 'Value' */
218 #define value_plus(v1,v2) ((v1)+(v2))
219 #define value_div(v1,v2) ((v1)/(v2))
220 #define value_mod(v1,v2) ((v1)%(v2))
221 #define value_direct_multiply(v1,v2) ((v1)*(v2)) /* direct! */
222 #define value_minus(v1,v2) ((v1)-(v2))
223 #define value_pdiv(v1,v2) (divide((v1),(v2)))
224 #define value_pmod(v1,v2) (modulo((v1),(v2)))
225 #define value_min(v1,v2) (value_le((v1),(v2))? (v1): (v2))
226 #define value_max(v1,v2) (value_ge((v1),(v2))? (v1): (v2))
227 #define value_or(v1,v2) ((v1)|(v2))
228 #define value_and(v1,v2) ((v1)&(v2))
229 #define value_lshift(v1,v2) ((v1)<<(v2))
230 #define value_rshift(v1,v2) ((v1)>>(v2))
232 /* Binary operations on 'Value' */
234 #define value_addto(ref,val1,val2) ((ref) = (val1)+(val2))
235 #define value_add_int(ref,val,vint) ((ref) = (val)+(Value)(vint))
236 #define value_increment(ref,val) ((ref) = (val)+VALUE_ONE)
237 #define value_direct_product(ref,val1,val2) ((ref) = (val1)*(val2)) /* direct */
238 #define value_multiply(ref,val1,val2) ((ref) = value_mult((val1),(val2)))
239 #define value_substract(ref,val1,val2) ((ref) = (val1)-(val2))
240 #define value_sub_int(ref,val,vint) ((ref) = (val)-(Value)(vint))
241 #define value_decrement(ref,val) ((ref) = (val)-VALUE_ONE)
242 #define value_division(ref,val1,val2) ((ref) = (val1)/(val2))
243 #define value_modulus(ref,val1,val2) ((ref) = (val1)%(val2))
244 #define value_pdivision(ref,val1,val2) ((ref) = value_pdiv((val1),(val2)))
245 #define value_oppose(ref,val) ((ref) = value_uminus((val)))
246 #define value_absolute(ref,val) ((ref) = value_abs((val)))
247 #define value_minimum(ref,val1,val2) ((ref) = value_min((val1),(val2)))
248 #define value_maximum(ref,val1,val2) ((ref) = value_max((val1),(val2)))
249 #define value_orto(ref,val1,val2) ((ref) = (val1)|(val2))
250 #define value_andto(ref,val1,val2) ((ref) = (val1)&(val2))
252 /* Unary operators on 'Value' */
254 #define value_uminus(val) (-(val))
255 #define value_not(val) (~(val))
256 #define value_abs(val) (value_posz_p(val)? \
257 (val) : \
258 (value_ne((val), VALUE_NAN) ? \
259 value_uminus(val) : \
260 (THROW (overflow_error), VALUE_NAN )))
262 /* Conditional operations on 'Value' */
264 #define value_pos_p(val) value_gt(val,VALUE_ZERO)
265 #define value_neg_p(val) value_lt(val,VALUE_ZERO)
266 #define value_posz_p(val) value_ge(val,VALUE_ZERO)
267 #define value_negz_p(val) value_le(val,VALUE_ZERO)
268 #define value_zero_p(val) value_eq(val,VALUE_ZERO)
269 #define value_notzero_p(val) value_ne(val,VALUE_ZERO)
270 #define value_one_p(val) value_eq(val,VALUE_ONE)
271 #define value_notone_p(val) value_ne(val,VALUE_ONE)
272 #define value_mone_p(val) value_eq(val,VALUE_MONE)
273 #define value_notmone_p(val) value_ne(val,VALUE_MONE)
274 #define value_min_p(val) value_eq(val,VALUE_MIN)
275 #define value_max_p(val) value_eq(val,VALUE_MAX)
276 #define value_notmin_p(val) value_ne(val,VALUE_MIN)
277 #define value_notmax_p(val) value_ne(val,VALUE_MAX)
279 #endif /* 'Value' set to |longlong|long|float|char *|int */
280 #endif