never use ->scaldims
[cloog-ppl.git] / include / cloog / program.h
blob8f4a4a552444f97cc8926ca89ed5245bb8df954c
2 /**-------------------------------------------------------------------**
3 ** CLooG **
4 **-------------------------------------------------------------------**
5 ** program.h **
6 **-------------------------------------------------------------------**
7 ** First version: october 25th 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_PROGRAM_H
38 #define CLOOG_PROGRAM_H
39 #if defined(__cplusplus)
40 extern "C"
42 #endif
45 # define MAX_STRING 1024
46 # define MEGA 1000000 /* One million. */
49 /**
50 * CloogProgram structure:
51 * this structure contains all the informations of a program generated or to be
52 * generated.
54 struct cloogprogram
55 { /* Basic program description fields. */
56 char _language ; /**< The language of the program. */
57 int _nb_scattdims ; /**< Scattering dimension number. */
58 CloogDomain * _context ; /**< The context of the program. */
59 CloogLoop * _loop ; /**< The loops of the program. */
60 CloogNames * _names ; /**< Iterators and parameters names. */
61 CloogBlockList * _blocklist ; /**< The statement block list. */
63 /* Internal service fields, filled up by cloog_program_scatter function. */
64 int * _scaldims ; /**< Boolean array saying whether a given
65 * scattering dimension is scalar or not.
67 /* Library user reserved field. */
68 void * usr; /**< User field, for library user convenience.
69 * This pointer is not freed when the
70 * CloogProgram structure is freed.
72 } ;
73 typedef struct cloogprogram CloogProgram ;
76 static inline char cloog_program_language (CloogProgram *p)
78 return p->_language;
81 static inline void cloog_program_set_language (CloogProgram *p, char c)
83 p->_language = c;
86 static inline int cloog_program_nb_scattdims (CloogProgram *p)
88 return p->_nb_scattdims;
91 static inline void cloog_program_set_nb_scattdims (CloogProgram *p, int n)
93 p->_nb_scattdims = n;
96 static inline CloogDomain *cloog_program_context (CloogProgram *p)
98 return p->_context;
101 static inline void cloog_program_set_context (CloogProgram *p, CloogDomain *c)
103 p->_context = c;
106 static inline CloogLoop *cloog_program_loop (CloogProgram *p)
108 return p->_loop;
111 static inline void cloog_program_set_loop (CloogProgram *p, CloogLoop *l)
113 p->_loop = l;
116 static inline CloogNames *cloog_program_names (CloogProgram *p)
118 return p->_names;
121 static inline void cloog_program_set_names (CloogProgram *p, CloogNames *n)
123 p->_names = n;
126 static inline CloogBlockList *cloog_program_blocklist (CloogProgram *p)
128 return p->_blocklist;
131 static inline void cloog_program_set_blocklist (CloogProgram *p, CloogBlockList *b)
133 p->_blocklist = b;
136 static inline int *cloog_program_scaldims (CloogProgram *p)
138 return p->_scaldims;
141 static inline void cloog_program_set_scaldims (CloogProgram *p, int *s)
143 p->_scaldims = s;
146 static inline int cloog_program_scaldim (CloogProgram *p, int i)
148 return p->_scaldims[i];
151 static inline void cloog_program_set_scaldim (CloogProgram *p, int i, int k)
153 p->_scaldims[i] = k;
156 /******************************************************************************
157 * Structure display function *
158 ******************************************************************************/
159 void cloog_program_print_structure(FILE *, CloogProgram *, int) ;
160 void cloog_program_print(FILE *, CloogProgram *) ;
161 void cloog_program_pprint(FILE *, CloogProgram *, CloogOptions *) ;
162 void cloog_program_dump_cloog(FILE *, CloogProgram *) ;
165 /******************************************************************************
166 * Memory deallocation function *
167 ******************************************************************************/
168 void cloog_program_free(CloogProgram *) ;
171 /******************************************************************************
172 * Reading function *
173 ******************************************************************************/
174 CloogProgram * cloog_program_read(FILE *, CloogOptions *) ;
177 /******************************************************************************
178 * Processing functions *
179 ******************************************************************************/
180 CloogProgram * cloog_program_malloc(void);
181 CloogProgram * cloog_program_generate(CloogProgram *, CloogOptions *) ;
182 void cloog_program_block(CloogProgram *, CloogDomainList *) ;
183 void cloog_program_extract_scalars(CloogProgram *program, CloogDomainList *) ;
184 void cloog_program_scatter(CloogProgram *, CloogDomainList *) ;
186 #if defined(__cplusplus)
188 #endif
189 #endif /* define _H */