comparison gcc/graphite.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
33 the functions that are used for transforming the code. */ 33 the functions that are used for transforming the code. */
34 34
35 #include "config.h" 35 #include "config.h"
36 #include "system.h" 36 #include "system.h"
37 #include "coretypes.h" 37 #include "coretypes.h"
38 #include "tm.h" 38 #include "diagnostic-core.h"
39 #include "ggc.h"
40 #include "tree.h"
41 #include "rtl.h"
42 #include "basic-block.h"
43 #include "diagnostic.h"
44 #include "tree-flow.h" 39 #include "tree-flow.h"
45 #include "toplev.h"
46 #include "tree-dump.h" 40 #include "tree-dump.h"
47 #include "timevar.h"
48 #include "cfgloop.h" 41 #include "cfgloop.h"
49 #include "tree-chrec.h" 42 #include "tree-chrec.h"
50 #include "tree-data-ref.h" 43 #include "tree-data-ref.h"
51 #include "tree-scalar-evolution.h" 44 #include "tree-scalar-evolution.h"
52 #include "tree-pass.h"
53 #include "value-prof.h"
54 #include "pointer-set.h"
55 #include "gimple.h"
56 #include "sese.h" 45 #include "sese.h"
57 #include "predict.h" 46 #include "dbgcnt.h"
58 47
59 #ifdef HAVE_cloog 48 #ifdef HAVE_cloog
60 49
61 #include "cloog/cloog.h"
62 #include "ppl_c.h" 50 #include "ppl_c.h"
63 #include "graphite-ppl.h" 51 #include "graphite-ppl.h"
64 #include "graphite.h"
65 #include "graphite-poly.h" 52 #include "graphite-poly.h"
66 #include "graphite-scop-detection.h" 53 #include "graphite-scop-detection.h"
67 #include "graphite-clast-to-gimple.h" 54 #include "graphite-clast-to-gimple.h"
68 #include "graphite-sese-to-poly.h" 55 #include "graphite-sese-to-poly.h"
56
57 CloogState *cloog_state;
69 58
70 /* Print global statistics to FILE. */ 59 /* Print global statistics to FILE. */
71 60
72 static void 61 static void
73 print_global_statistics (FILE* file) 62 print_global_statistics (FILE* file)
188 { 177 {
189 int i; 178 int i;
190 179
191 scop_p scop; 180 scop_p scop;
192 181
193 for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++) 182 FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
194 print_graphite_scop_statistics (file, scop); 183 print_graphite_scop_statistics (file, scop);
195 } 184 }
196 185
197 /* Initialize graphite: when there are no loops returns false. */ 186 /* Initialize graphite: when there are no loops returns false. */
198 187
199 static bool 188 static bool
200 graphite_initialize (void) 189 graphite_initialize (void)
201 { 190 {
191 int ppl_initialized;
192
202 if (number_of_loops () <= 1 193 if (number_of_loops () <= 1
203 /* FIXME: This limit on the number of basic blocks of a function 194 /* FIXME: This limit on the number of basic blocks of a function
204 should be removed when the SCOP detection is faster. */ 195 should be removed when the SCOP detection is faster. */
205 || n_basic_blocks > PARAM_VALUE (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION)) 196 || n_basic_blocks > PARAM_VALUE (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION))
206 { 197 {
208 print_global_statistics (dump_file); 199 print_global_statistics (dump_file);
209 200
210 return false; 201 return false;
211 } 202 }
212 203
204 scev_reset ();
213 recompute_all_dominators (); 205 recompute_all_dominators ();
214 initialize_original_copy_tables (); 206 initialize_original_copy_tables ();
207
208 ppl_initialized = ppl_initialize ();
209 gcc_assert (ppl_initialized == 0);
210
211 cloog_state = cloog_state_malloc ();
215 cloog_initialize (); 212 cloog_initialize ();
216 213
217 if (dump_file && dump_flags) 214 if (dump_file && dump_flags)
218 dump_function_to_file (current_function_decl, dump_file, dump_flags); 215 dump_function_to_file (current_function_decl, dump_file, dump_flags);
219 216
233 profile_status = PROFILE_ABSENT; 230 profile_status = PROFILE_ABSENT;
234 release_recorded_exits (); 231 release_recorded_exits ();
235 tree_estimate_probability (); 232 tree_estimate_probability ();
236 } 233 }
237 234
235 cloog_state_free (cloog_state);
238 cloog_finalize (); 236 cloog_finalize ();
237 ppl_finalize ();
239 free_original_copy_tables (); 238 free_original_copy_tables ();
240 239
241 if (dump_file && dump_flags) 240 if (dump_file && dump_flags)
242 print_loops (dump_file, 3); 241 print_loops (dump_file, 3);
243 } 242 }
265 print_global_statistics (dump_file); 264 print_global_statistics (dump_file);
266 } 265 }
267 266
268 bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free); 267 bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free);
269 268
270 for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++) 269 FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
271 build_poly_scop (scop); 270 if (dbg_cnt (graphite_scop))
272 271 {
273 for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++) 272 build_poly_scop (scop);
274 if (POLY_SCOP_P (scop) 273
275 && apply_poly_transforms (scop) 274 if (POLY_SCOP_P (scop)
276 && gloog (scop, scops, bb_pbb_mapping)) 275 && apply_poly_transforms (scop)
277 need_cfg_cleanup_p = true; 276 && gloog (scop, bb_pbb_mapping))
277 need_cfg_cleanup_p = true;
278 }
278 279
279 htab_delete (bb_pbb_mapping); 280 htab_delete (bb_pbb_mapping);
280 free_scops (scops); 281 free_scops (scops);
281 graphite_finalize (need_cfg_cleanup_p); 282 graphite_finalize (need_cfg_cleanup_p);
282 } 283 }