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 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 *
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 *
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 *
31 * CLooG, the Chunky Loop Generator *
32 * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
34 ******************************************************************************/
39 # include "../include/cloog/cloog.h"
41 /** Extern global variables for memory leak hunt. */
42 extern int cloog_domain_allocated
;
43 extern int cloog_domain_freed
;
44 extern int cloog_domain_max
;
45 extern int cloog_loop_allocated
;
46 extern int cloog_loop_freed
;
47 extern int cloog_loop_max
;
48 extern int cloog_statement_allocated
;
49 extern int cloog_statement_freed
;
50 extern int cloog_statement_max
;
51 extern int cloog_matrix_allocated
;
52 extern int cloog_matrix_freed
;
53 extern int cloog_matrix_max
;
54 extern int cloog_block_allocated
;
55 extern int cloog_block_freed
;
56 extern int cloog_block_max
;
57 extern int cloog_value_allocated
;
58 extern int cloog_value_freed
;
59 extern int cloog_value_max
;
62 int main(int argv
, char * argc
[])
63 { CloogProgram
* program
;
64 CloogOptions
* options
;
65 FILE * input
, * output
;
67 /* Options and input/output file setting. */
68 cloog_options_read(argv
,argc
,&input
,&output
,&options
) ;
70 /* Reading the program informations. */
71 program
= cloog_program_read(input
,options
) ;
74 /* Generating and printing the code. */
75 program
= cloog_program_generate(program
,options
) ;
76 if (options
->structure
)
77 cloog_program_print(stdout
,program
) ;
78 cloog_program_pprint(output
,program
,options
) ;
79 cloog_program_free(program
) ;
81 /* Printing the allocation statistics if asked. */
83 { fprintf(output
,"/* Matrices : allocated=%5d, freed=%5d, max=%5d. */\n",
84 cloog_matrix_allocated
,cloog_matrix_freed
,cloog_matrix_max
) ;
85 fprintf(output
,"/* Domains : allocated=%5d, freed=%5d, max=%5d. */\n",
86 cloog_domain_allocated
,cloog_domain_freed
,cloog_domain_max
);
87 fprintf(output
,"/* Loops : allocated=%5d, freed=%5d, max=%5d. */\n",
88 cloog_loop_allocated
,cloog_loop_freed
,cloog_loop_max
) ;
89 fprintf(output
,"/* Statements : allocated=%5d, freed=%5d, max=%5d. */\n",
90 cloog_statement_allocated
,cloog_statement_freed
,cloog_statement_max
);
91 fprintf(output
,"/* Blocks : allocated=%5d, freed=%5d, max=%5d. */\n",
92 cloog_block_allocated
,cloog_block_freed
,cloog_block_max
) ;
93 fprintf(output
,"/* Value (GMP): allocated=%5d, freed=%5d, max=%5d. */\n",
94 cloog_value_allocated
,cloog_value_freed
,cloog_value_max
) ;
97 /* Inform the user in case of a problem with the allocation statistics. */
98 if ((cloog_matrix_allocated
!= cloog_matrix_freed
) ||
99 (cloog_domain_allocated
!= cloog_domain_freed
) ||
100 (cloog_loop_allocated
!= cloog_loop_freed
) ||
101 (cloog_statement_allocated
!= cloog_statement_freed
) ||
102 (cloog_block_allocated
!= cloog_block_freed
) ||
103 (cloog_value_allocated
!= cloog_value_freed
))
105 "[CLooG]INFO: an internal problem has been detected (it should have"
106 " no\n consequence on the correctness of the output)."
107 " Please send (if\n you can) your input file, the first line "
108 "given by typing 'cloog -v'\n and your full command ") ;
110 "line call to CLooG including options to\n <cedric.bastoul"
111 "@inria.fr>. Thank you for your participation to get\n"
112 " CLooG better and safer.\n") ;
115 cloog_options_free(options
) ;