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
;
69 /* Options and input/output file setting. */
70 cloog_options_read(argv
,argc
,&input
,&output
,&options
) ;
72 /* Reading the program informations. */
73 program
= cloog_program_read(input
,options
) ;
76 /* Generating and printing the code. */
77 program
= cloog_program_generate(program
,options
) ;
78 if (options
->structure
)
79 cloog_program_print(stdout
,program
) ;
80 cloog_program_pprint(output
,program
,options
) ;
81 cloog_program_free(program
) ;
83 /* Printing the allocation statistics if asked. */
85 { fprintf(output
,"/* Matrices : allocated=%5d, freed=%5d, max=%5d. */\n",
86 cloog_matrix_allocated
,cloog_matrix_freed
,cloog_matrix_max
) ;
87 fprintf(output
,"/* Domains : allocated=%5d, freed=%5d, max=%5d. */\n",
88 cloog_domain_allocated
,cloog_domain_freed
,cloog_domain_max
);
89 fprintf(output
,"/* Loops : allocated=%5d, freed=%5d, max=%5d. */\n",
90 cloog_loop_allocated
,cloog_loop_freed
,cloog_loop_max
) ;
91 fprintf(output
,"/* Statements : allocated=%5d, freed=%5d, max=%5d. */\n",
92 cloog_statement_allocated
,cloog_statement_freed
,cloog_statement_max
);
93 fprintf(output
,"/* Blocks : allocated=%5d, freed=%5d, max=%5d. */\n",
94 cloog_block_allocated
,cloog_block_freed
,cloog_block_max
) ;
95 fprintf(output
,"/* Value (GMP): allocated=%5d, freed=%5d, max=%5d. */\n",
96 cloog_value_allocated
,cloog_value_freed
,cloog_value_max
) ;
99 /* Inform the user in case of a problem with the allocation statistics. */
100 if ((cloog_matrix_allocated
!= cloog_matrix_freed
) ||
101 (cloog_domain_allocated
!= cloog_domain_freed
) ||
102 (cloog_loop_allocated
!= cloog_loop_freed
) ||
103 (cloog_statement_allocated
!= cloog_statement_freed
) ||
104 (cloog_block_allocated
!= cloog_block_freed
) ||
105 (cloog_value_allocated
!= cloog_value_freed
))
107 "[CLooG]INFO: an internal problem has been detected (it should have"
108 " no\n consequence on the correctness of the output)."
109 " Please send (if\n you can) your input file, the first line "
110 "given by typing 'cloog -v'\n and your full command ") ;
112 "line call to CLooG including options to\n <cedric.bastoul"
113 "@inria.fr>. Thank you for your participation to get\n"
114 " CLooG better and safer.\n") ;
117 cloog_options_free(options
) ;