never use loop->usr
[cloog-ppl.git] / include / cloog / loop.h
blob96f75b9fce57a0da7a367b724010b18abf2ff910
2 /**-------------------------------------------------------------------**
3 ** CLooG **
4 **-------------------------------------------------------------------**
5 ** loop.h **
6 **-------------------------------------------------------------------**
7 ** First version: october 26th 2001 **
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 ******************************************************************************/
37 #ifndef CLOOG_LOOP_H
38 #define CLOOG_LOOP_H
39 #if defined(__cplusplus)
40 extern "C"
42 #endif
44 /**
45 * CloogLoop structure:
46 * this structure contains all the informations of a loop generated or to be
47 * generated.
48 * - if the loop has not been processed yet (it is not a result of a call to
49 * cloog_loop_generate), the domain is the whole iteration domain of a given
50 * block, the stride is 1 (i.e. there is no stride), block is necessarily not
51 * NULL and inner is NULL.
52 * - if the loop comes as a result of a cloog_loop_generate call, the domain
53 * describes the constraints (guards and loop bounds) for only one dimension
54 * (the last one: outer dimensions being considered as parameters), the stride
55 * may differ from one (this means that on the considered dimension, a step of
56 * 'stride' must be considered between integral point, the first integral
57 * point to be considered being the lower bound of the loop), inner may differ
58 * from NULL, meaning that there are further dimensions and nesting levels in
59 * the loop.
61 struct cloogloop
62 { CloogDomain * _domain ; /**< The iteration domain. */
63 Value _stride ; /**< The stride for the corresponding iterator
64 * (filled only after loop generation).
66 CloogBlock * _block ; /**< The included statement block, NULL if none.*/
67 void * _usr; /**< User field, for library user convenience.
68 * This pointer is not freed when the
69 * CloogLoop structure is freed.
71 struct cloogloop * inner ; /**< Loops at the next level. */
72 struct cloogloop * next ; /**< Next loop at the same level. */
73 } ;
74 typedef struct cloogloop CloogLoop ;
77 static inline CloogDomain *cloog_loop_domain (CloogLoop *l)
79 return l->_domain;
82 static inline void cloog_loop_set_domain (CloogLoop *l, CloogDomain *d)
84 l->_domain = d;
87 static inline Value cloog_loop_stride (CloogLoop *l)
89 return l->_stride;
92 static inline void cloog_loop_set_stride (CloogLoop *l, Value v)
94 value_assign (l->_stride, v);
97 static inline void cloog_loop_clear_stride (CloogLoop *l)
99 value_clear_c (l->_stride);
102 static inline void cloog_loop_init_stride (CloogLoop *l)
104 value_init_c (l->_stride);
107 static inline void cloog_loop_set_si_stride (CloogLoop *l, int i)
109 value_set_si (l->_stride, i);
112 static inline CloogBlock *cloog_loop_block (CloogLoop *l)
114 return l->_block;
117 static inline void cloog_loop_set_block (CloogLoop *l, CloogBlock *b)
119 l->_block = b;
122 static inline void *cloog_loop_usr (CloogLoop *l)
124 return l->_usr;
127 static inline void cloog_loop_set_usr (CloogLoop *l, void *u)
129 l->_usr = u;
133 /******************************************************************************
134 * Structure display function *
135 ******************************************************************************/
136 void cloog_loop_print_structure(FILE *, CloogLoop *, int) ;
137 void cloog_loop_print(FILE *, CloogLoop *) ;
140 /******************************************************************************
141 * Memory deallocation function *
142 ******************************************************************************/
143 void cloog_loop_free(CloogLoop *) ;
146 /******************************************************************************
147 * Reading functions *
148 ******************************************************************************/
149 CloogLoop * cloog_loop_read(FILE *, int, int) ;
152 /******************************************************************************
153 * Processing functions *
154 ******************************************************************************/
155 CloogLoop * cloog_loop_malloc(void);
156 CloogLoop * cloog_loop_generate(CloogLoop *, CloogDomain *, int, int,
157 int *, int, int, CloogOptions *) ;
158 CloogLoop * cloog_loop_simplify(CloogLoop *, CloogDomain *, int, int) ;
159 void cloog_loop_scatter(CloogLoop *, CloogDomain *) ;
162 #if defined(__cplusplus)
164 #endif
165 #endif /* define _H */