Bump CLOOG_VERSION_REVISION to 5.
[cloog-ppl.git] / include / cloog / block.h
blobf1c805c6f36888d643b3b533d2a291019e8bdc29
2 /**-------------------------------------------------------------------**
3 ** CLooG **
4 **-------------------------------------------------------------------**
5 ** block.h **
6 **-------------------------------------------------------------------**
7 ** First version: June 11th 2005 **
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_BLOCK_H
38 #define CLOOG_BLOCK_H
39 #if defined(__cplusplus)
40 extern "C"
42 #endif
45 /**
46 * CloogBlock structure:
47 * this structure contains the informations of a statement block. It may happen
48 * that users are lazy enough to ask CLooG to generate the code for statements
49 * with exactly the same domain/scattering pair (possibly differing by only one
50 * constant) instead of giving only one pair. CLooG provides them a last chance
51 * to save time and memory by trying to find these blocks itself. The block
52 * contains the statement list and the common informations of the statements.
53 * This structure contains also the number of existing active references to it:
54 * because CLooG uses many copies of blocks there is no need to actually copy
55 * these blocks but just to return a pointer to them and to increment the number
56 * of active references. Each time a CloogBlock will be freed, we will decrement
57 * the active reference counter and actually free it if its value is zero.
59 struct cloogblock
60 { CloogStatement * _statement ; /**< The list of statements in the block. */
61 int _nb_scaldims ; /**< Number of scalar dimensions. */
62 Value * scaldims ; /**< Scalar dimension values. */
63 int _depth ; /**< Original block depth (outer loop number).*/
64 int _references ; /**< Number of references to this structure. */
65 void * _usr; /**< User field, for library user convenience.
66 * This pointer is not freed when the
67 * CloogBlock structure is freed.
69 } ;
70 typedef struct cloogblock CloogBlock ;
72 static inline CloogStatement *cloog_block_stmt (CloogBlock *b)
74 return b->_statement;
77 static inline void cloog_block_set_stmt (CloogBlock *b, CloogStatement *s)
79 b->_statement = s;
82 static inline int cloog_block_nb_scaldims (CloogBlock *b)
84 return b->_nb_scaldims;
87 static inline void cloog_block_set_nb_scaldims (CloogBlock *b, int n)
89 b->_nb_scaldims = n;
92 static inline Value *cloog_block_scaldims (CloogBlock *b)
94 return b->scaldims;
97 static inline void cloog_block_set_scaldims (CloogBlock *b, Value *s)
99 b->scaldims = s;
102 static inline int cloog_block_depth (CloogBlock *b)
104 return b->_depth;
107 static inline void cloog_block_set_depth (CloogBlock *b, int n)
109 b->_depth = n;
112 static inline void *cloog_block_usr (CloogBlock *b)
114 return b->_usr;
117 static inline void cloog_block_set_usr (CloogBlock *b, void *u)
119 b->_usr = u;
124 * CloogBlockList structure:
125 * this structure reprensents a node of a linked list of CloogBlock structures.
127 struct cloogblocklist
128 { CloogBlock * _block ; /**< An element of the list. */
129 struct cloogblocklist * _next ;/**< Pointer to the next element of the list.*/
131 typedef struct cloogblocklist CloogBlockList ;
133 static inline CloogBlockList *cloog_block_list_next (CloogBlockList *s)
135 return s->_next;
138 static inline void cloog_block_list_set_next (CloogBlockList *s, CloogBlockList *n)
140 s->_next = n;
143 static inline CloogBlock *cloog_block_list_block (CloogBlockList *s)
145 return s->_block;
148 static inline void cloog_block_list_set_block (CloogBlockList *s, CloogBlock *n)
150 s->_block = n;
154 /******************************************************************************
155 * Structure display function *
156 ******************************************************************************/
157 void cloog_block_print_structure(FILE *, CloogBlock *, int) ;
158 void cloog_block_print(FILE *, CloogBlock *) ;
159 void cloog_block_list_print(FILE *, CloogBlockList *) ;
162 /******************************************************************************
163 * Memory deallocation function *
164 ******************************************************************************/
165 void cloog_block_free(CloogBlock *) ;
166 void cloog_block_list_free(CloogBlockList *) ;
169 /******************************************************************************
170 * Processing functions *
171 ******************************************************************************/
172 CloogBlock * cloog_block_malloc(void);
173 CloogBlock * cloog_block_alloc(CloogStatement*,int,Value*,int);
174 CloogBlockList * cloog_block_list_malloc(void);
175 CloogBlockList * cloog_block_list_alloc(CloogBlock *) ;
176 CloogBlock * cloog_block_copy(CloogBlock * block) ;
177 void cloog_block_merge(CloogBlock *, CloogBlock *) ;
179 #if defined(__cplusplus)
181 #endif
182 #endif /* define _H */