2 /**-------------------------------------------------------------------**
4 **-------------------------------------------------------------------**
6 **-------------------------------------------------------------------**
7 ** First version: october 25th 2001, CLooG's birth date ! **
8 **-------------------------------------------------------------------**/
11 /******************************************************************************
12 * CLooG : the Chunky Loop Generator (experimental) *
13 ******************************************************************************
15 * Copyright (C) 2001-2005 Cedric Bastoul *
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. *
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. *
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 *
32 * CLooG, the Chunky Loop Generator *
33 * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
35 ******************************************************************************/
40 # include "../include/cloog/cloog.h"
43 int main(int argv
, char * argc
[])
44 { CloogProgram
* program
;
45 CloogOptions
* options
;
47 FILE * input
, * output
;
49 state
= cloog_state_malloc();
51 /* Options and input/output file setting. */
52 cloog_options_read(state
, argv
, argc
, &input
, &output
, &options
);
54 /* Reading the program informations. */
55 program
= cloog_program_read(input
,options
) ;
58 /* Generating and printing the code. */
59 program
= cloog_program_generate(program
,options
) ;
60 if (options
->structure
)
61 cloog_program_print(stdout
,program
) ;
62 cloog_program_pprint(output
,program
,options
) ;
63 cloog_program_free(program
) ;
65 /* Printing the allocation statistics if asked. */
67 fprintf(output
,"/* Domains : allocated=%5d, freed=%5d, max=%5d. */\n",
68 state
->domain_allocated
, state
->domain_freed
, state
->domain_max
);
69 fprintf(output
,"/* Loops : allocated=%5d, freed=%5d, max=%5d. */\n",
70 state
->loop_allocated
, state
->loop_freed
, state
->loop_max
);
71 fprintf(output
,"/* Statements : allocated=%5d, freed=%5d, max=%5d. */\n",
72 state
->statement_allocated
, state
->statement_freed
, state
->statement_max
);
73 fprintf(output
,"/* Blocks : allocated=%5d, freed=%5d, max=%5d. */\n",
74 state
->block_allocated
, state
->block_freed
, state
->block_max
);
77 /* Inform the user in case of a problem with the allocation statistics. */
78 if ((state
->domain_allocated
!= state
->domain_freed
) ||
79 (state
->loop_allocated
!= state
->loop_freed
) ||
80 (state
->statement_allocated
!= state
->statement_freed
) ||
81 (state
->block_allocated
!= state
->block_freed
))
83 cloog_msg(options
, CLOOG_INFO
,
84 "an internal problem has been detected (it should have"
85 " no\n consequence on the correctness of the output)."
86 " Please send (if\n you can) your input file, the first line "
87 "given by typing 'cloog -v'\n and your full command "
88 "line call to CLooG including options to\n <cedric.bastoul"
89 "@inria.fr>. Thank you for your participation to get\n"
90 " CLooG better and safer.\n") ;
93 cloog_options_free(options
) ;
94 cloog_state_free(state
);