1 
2    /**-------------------------------------------------------------------**
3     **                               CLooG                               **
4     **-------------------------------------------------------------------**
5     **                             options.h                             **
6     **-------------------------------------------------------------------**
7     **                  First version: april 19th 2003                   **
8     **-------------------------------------------------------------------**/
9 
10 
11 /******************************************************************************
12  *               CLooG : the Chunky Loop Generator (experimental)             *
13  ******************************************************************************
14  *                                                                            *
15  * Copyright (C) 2001-2005 Cedric Bastoul                                     *
16  *                                                                            *
17  * This library is free software; you can redistribute it and/or              *
18  * modify it under the terms of the GNU Lesser General Public                 *
19  * License as published by the Free Software Foundation; either               *
20  * version 2.1 of the License, or (at your option) any later version.         *
21  *                                                                            *
22  * This library is distributed in the hope that it will be useful,            *
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          *
25  * Lesser General Public License for more details.                            *
26  *                                                                            *
27  * You should have received a copy of the GNU Lesser General Public           *
28  * License along with this library; if not, write to the Free Software        *
29  * Foundation, Inc., 51 Franklin Street, Fifth Floor,                         *
30  * Boston, MA  02110-1301  USA                                                *
31  *                                                                            *
32  * CLooG, the Chunky Loop Generator                                           *
33  * Written by Cedric Bastoul, [email protected]                         *
34  *                                                                            *
35  ******************************************************************************/
36 
37 #include <stdio.h>
38 
39 #ifndef CLOOG_OPTIONS_H
40 #define CLOOG_OPTIONS_H
41 #if defined(__cplusplus)
42 extern "C"
43   {
44 #endif
45 
46 
47 /* Uncomment the following line if you want some information about
48  * maximum total allocated memory for code generation.
49 #define CLOOG_MEMORY
50  */
51 #define CLOOG_SCALARS
52 
53 struct osl_scop;
54 
55 struct cloogoptions;
56 typedef struct cloogoptions CloogOptions;
57 struct osl_scop;
58 
59 struct cloogoptions
60 {
61   CloogState *state; /* State. */
62   /* OPTIONS FOR LOOP GENERATION */
63   int l ;           /* Last level to optimize. */
64   int f ;           /* First level to optimize. */
65 
66   int *ls;         /* Last level to optimize (statement-wise). */
67   int *fs;         /* First level to optimize (statement-wise). */
68   int fs_ls_size;  /* Size of the fs and ls arrays (same size) */
69   int stop ;        /* Level to stop code generation. */
70   int strides ;     /* 1 if user wants to handle non-unit strides (then loop
71                      * increment can be something else than one), 0 otherwise.
72                      */
73   int sh;	    /* 1 for computing simple hulls */
74   int first_unroll; /* The first dimension to unroll */
75 
76   /* OPTIONS FOR PRETTY PRINTING */
77   int esp ;       /* 1 if user wants to spread all equalities, i.e. when there
78                    * is something like "i = 3*j + 1 ; A[i] = 0 ;" the generator
79                    * will write "A[3*j + 1] = 0 ;", 0 otherwise.
80                    */
81   int fsp ;       /* The iteration level where equalities spreading can begin
82                    * (it might happen that the user wants not to spread values
83                    * of scattering iterators).
84                    */
85   int otl ;       /* 1 for eliminate loops running just one time and write them
86                    * as an affectation of the iterator, 0 otherwise.
87                    */
88   int block ;     /* 1 to make one new block {...} per new dimension,
89                    * 0 otherwise.
90                    */
91   int compilable; /* 1 to generate a compilable code by using
92                    * preprocessing, 0 otherwise.
93                    */
94   int callable;   /* 1 to generate callable code by using
95                    * preprocessing, 0 otherwise.
96                    */
97   int language;   /* 1 to generate FORTRAN, 0 for C otherwise. */
98 
99   int save_domains;/* Save unsimplified copy of domain. */
100 
101   /* MISC OPTIONS */
102   char * name ;   /* Name of the input file. */
103   float time ;    /* Time spent for code generation in seconds. */
104   int openscop;   /* 1 if the input file has OpenScop format, 0 otherwise. */
105   struct osl_scop *scop; /* Input OpenScop scop if any, NULL otherwise. */
106 #ifdef CLOOG_MEMORY
107   int memory ;    /* Memory spent for code generation in kilobytes. */
108 #endif
109   int quiet;      /* Don't print any informational messages. */
110   /* UNDOCUMENTED OPTIONS FOR THE AUTHOR ONLY */
111   int leaks ;     /* 1 if I want to print the allocation statistics,
112                    * 0 otherwise.
113 		   */
114   int backtrack;  /* 1 to perform backtracking in
115                    * Quillere's algorithm, 0 otherwise.
116 		   */
117   int override ;  /* 1 if I want to bypass CLooG decisions on option correctness
118                    * (generated code may be incorrect), 0 otherwise.
119 		   */
120   int structure ; /* 1 if I want to print the CloogProgram structure before the
121                    * pretty printed code, 0 otherwise.
122 		   */
123   int noblocks ;  /* 1 if I don't want to make statement blocks, 0 otherwise. */
124   int noscalars ; /* 1 if I don't want to use scalar dimensions, 0 otherwise. */
125   int nosimplify; /* 1 if I don't want to simplify polyhedra, 0 otherwise. */
126 } ;
127 
128 
129 /******************************************************************************
130  *                          Error reporting functions                         *
131  ******************************************************************************/
132 
133 enum cloog_msg_type { CLOOG_ERROR, CLOOG_WARNING, CLOOG_INFO };
134 
135 void cloog_msg(CloogOptions *options, enum cloog_msg_type type,
136 		const char *msg, ...);
137 void cloog_die(const char *msg, ...);
138 
139 
140 /******************************************************************************
141  *                          Structure display function                        *
142  ******************************************************************************/
143 void cloog_options_print(FILE *, CloogOptions *) ;
144 
145 
146 /******************************************************************************
147  *                         Memory deallocation function                       *
148  ******************************************************************************/
149 void cloog_options_free(CloogOptions *) ;
150 
151 
152 /******************************************************************************
153  *                               Reading function                             *
154  ******************************************************************************/
155 void cloog_options_read(CloogState *state, int argc, char **argv,
156 			FILE **input, FILE **output, CloogOptions **options);
157 
158 
159 /******************************************************************************
160  *                            Processing functions                            *
161  ******************************************************************************/
162 CloogOptions *cloog_options_malloc(CloogState *state);
163 void cloog_options_copy_from_osl_scop(struct osl_scop *, CloogOptions *);
164 
165 
166 #if defined(__cplusplus)
167   }
168 #endif
169 #endif /* define _H */
170