Mercurial > hg > CbC > CbC_gcc
comparison gcc/graphite.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Gimple Represented as Polyhedra. | 1 /* Gimple Represented as Polyhedra. |
2 Copyright (C) 2006-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2006-2020 Free Software Foundation, Inc. |
3 Contributed by Sebastian Pop <sebastian.pop@inria.fr>. | 3 Contributed by Sebastian Pop <sebastian.pop@inria.fr>. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify | 7 GCC is free software; you can redistribute it and/or modify |
34 #include "coretypes.h" | 34 #include "coretypes.h" |
35 #include "backend.h" | 35 #include "backend.h" |
36 #include "diagnostic-core.h" | 36 #include "diagnostic-core.h" |
37 #include "cfgloop.h" | 37 #include "cfgloop.h" |
38 #include "tree-pass.h" | 38 #include "tree-pass.h" |
39 #include "params.h" | |
40 #include "pretty-print.h" | 39 #include "pretty-print.h" |
41 #include "cfganal.h" | 40 #include "cfganal.h" |
42 | 41 |
43 #ifdef HAVE_isl | 42 #ifdef HAVE_isl |
44 #include "cfghooks.h" | 43 #include "cfghooks.h" |
208 | 207 |
209 FOR_EACH_VEC_ELT (scops, i, scop) | 208 FOR_EACH_VEC_ELT (scops, i, scop) |
210 print_graphite_scop_statistics (file, scop); | 209 print_graphite_scop_statistics (file, scop); |
211 } | 210 } |
212 | 211 |
212 struct seir_cache_key | |
213 { | |
214 hashval_t hash; | |
215 int entry_dest; | |
216 int exit_src; | |
217 int loop_num; | |
218 tree expr; | |
219 }; | |
220 | |
221 struct sese_scev_hash : typed_noop_remove <seir_cache_key> | |
222 { | |
223 typedef seir_cache_key value_type; | |
224 typedef seir_cache_key compare_type; | |
225 static hashval_t hash (const seir_cache_key &key) { return key.hash; } | |
226 static bool | |
227 equal (const seir_cache_key &key1, const seir_cache_key &key2) | |
228 { | |
229 return (key1.hash == key2.hash | |
230 && key1.entry_dest == key2.entry_dest | |
231 && key1.exit_src == key2.exit_src | |
232 && key1.loop_num == key2.loop_num | |
233 && operand_equal_p (key1.expr, key2.expr, 0)); | |
234 } | |
235 static void mark_deleted (seir_cache_key &key) { key.expr = NULL_TREE; } | |
236 static const bool empty_zero_p = false; | |
237 static void mark_empty (seir_cache_key &key) { key.entry_dest = 0; } | |
238 static bool is_deleted (const seir_cache_key &key) { return !key.expr; } | |
239 static bool is_empty (const seir_cache_key &key) { return key.entry_dest == 0; } | |
240 }; | |
241 | |
242 static hash_map<sese_scev_hash, tree> *seir_cache; | |
243 | |
244 /* Same as scalar_evolution_in_region but caches results so we avoid | |
245 re-computing evolutions during transform phase. */ | |
246 | |
247 tree | |
248 cached_scalar_evolution_in_region (const sese_l ®ion, loop_p loop, | |
249 tree expr) | |
250 { | |
251 seir_cache_key key; | |
252 key.entry_dest = region.entry->dest->index; | |
253 key.exit_src = region.exit->src->index; | |
254 key.loop_num = loop->num; | |
255 key.expr = expr; | |
256 inchash::hash hstate (0); | |
257 hstate.add_int (key.entry_dest); | |
258 hstate.add_int (key.exit_src); | |
259 hstate.add_int (key.loop_num); | |
260 inchash::add_expr (key.expr, hstate); | |
261 key.hash = hstate.end (); | |
262 | |
263 bool existed; | |
264 tree &chrec = seir_cache->get_or_insert (key, &existed); | |
265 if (!existed) | |
266 chrec = scalar_evolution_in_region (region, loop, expr); | |
267 return chrec; | |
268 } | |
269 | |
213 /* Deletes all scops in SCOPS. */ | 270 /* Deletes all scops in SCOPS. */ |
214 | 271 |
215 static void | 272 static void |
216 free_scops (vec<scop_p> scops) | 273 free_scops (vec<scop_p> scops) |
217 { | 274 { |
383 { | 440 { |
384 print_loops (dump_file, 2); | 441 print_loops (dump_file, 2); |
385 print_loops (dump_file, 3); | 442 print_loops (dump_file, 3); |
386 } | 443 } |
387 | 444 |
445 seir_cache = new hash_map<sese_scev_hash, tree>; | |
446 | |
388 calculate_dominance_info (CDI_POST_DOMINATORS); | 447 calculate_dominance_info (CDI_POST_DOMINATORS); |
389 build_scops (&scops); | 448 build_scops (&scops); |
390 free_dominance_info (CDI_POST_DOMINATORS); | 449 free_dominance_info (CDI_POST_DOMINATORS); |
391 | 450 |
392 /* Remove the fake exits before transform given they are not reflected | 451 /* Remove the fake exits before transform given they are not reflected |
408 | 467 |
409 if (!apply_poly_transforms (scop)) | 468 if (!apply_poly_transforms (scop)) |
410 continue; | 469 continue; |
411 | 470 |
412 changed = true; | 471 changed = true; |
413 if (graphite_regenerate_ast_isl (scop)) | 472 if (graphite_regenerate_ast_isl (scop) |
473 && dump_enabled_p ()) | |
414 { | 474 { |
415 dump_user_location_t loc = find_loop_location | 475 dump_user_location_t loc = find_loop_location |
416 (scops[i]->scop_info->region.entry->dest->loop_father); | 476 (scops[i]->scop_info->region.entry->dest->loop_father); |
417 dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, | 477 dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, |
418 "loop nest optimized\n"); | 478 "loop nest optimized\n"); |
419 } | 479 } |
420 } | 480 } |
481 | |
482 delete seir_cache; | |
483 seir_cache = NULL; | |
421 | 484 |
422 if (changed) | 485 if (changed) |
423 { | 486 { |
424 mark_virtual_operands_for_renaming (cfun); | 487 mark_virtual_operands_for_renaming (cfun); |
425 update_ssa (TODO_update_ssa); | 488 update_ssa (TODO_update_ssa); |