Add --with-host-libstdcxx configure switch.
[cloog-ppl.git] / source / cloog.c
blob204c6aa6183d44130d18ce3748b5ed0d118810e5
2 /**-------------------------------------------------------------------**
3 ** CLooG **
4 **-------------------------------------------------------------------**
5 ** cloog.c **
6 **-------------------------------------------------------------------**
7 ** First version: october 25th 2001, CLooG's birth date ! **
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 # include <stdlib.h>
38 # include <stdio.h>
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 cloog_initialize ();
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) ;
74 fclose(input) ;
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. */
84 if (options->leaks)
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 /* Cloog should never print to stderr. */
100 /* Inform the user in case of a problem with the allocation statistics.
101 if ((cloog_matrix_allocated != cloog_matrix_freed) ||
102 (cloog_domain_allocated != cloog_domain_freed) ||
103 (cloog_loop_allocated != cloog_loop_freed) ||
104 (cloog_statement_allocated != cloog_statement_freed) ||
105 (cloog_block_allocated != cloog_block_freed) ||
106 (cloog_value_allocated != cloog_value_freed))
107 { fprintf(stderr,
108 "[CLooG]INFO: an internal problem has been detected (it should have"
109 " no\n consequence on the correctness of the output)."
110 " Please send (if\n you can) your input file, the first line "
111 "given by typing 'cloog -v'\n and your full command ") ;
112 fprintf(stderr,
113 "line call to CLooG including options to\n <cedric.bastoul"
114 "@inria.fr>. Thank you for your participation to get\n"
115 " CLooG better and safer.\n") ;
116 } */
118 cloog_options_free(options) ;
119 cloog_finalize ();
120 fclose(output) ;
121 return 0;