-
-/* Helper function for debug_rename_map. */
-
-bool
-debug_rename_map_1 (tree_node *const &old_name, tree_node *const &expr,
- void *)
-{
- fprintf (stderr, "(");
- print_generic_expr (stderr, old_name, 0);
- fprintf (stderr, ", ");
- print_generic_expr (stderr, expr, 0);
- fprintf (stderr, ")\n");
- return true;
-}
-\f
-
-/* Hashtable helpers. */
-
-struct rename_map_hasher : default_hashmap_traits
-{
- static inline hashval_t hash (tree);
-};
-
-/* Computes a hash function for database element ELT. */
-
-inline hashval_t
-rename_map_hasher::hash (tree old_name)
-{
- return SSA_NAME_VERSION (old_name);
-}
-
-typedef hash_map<tree, tree, rename_map_hasher> rename_map_type;
-\f
-
-/* Print to stderr all the elements of RENAME_MAP. */
-
-DEBUG_FUNCTION void
-debug_rename_map (rename_map_type *rename_map)
-{
- rename_map->traverse <void *, debug_rename_map_1> (NULL);
-}
-\f
-
-/* Record LOOP as occurring in REGION. */
-
-static void
-sese_record_loop (sese region, loop_p loop)
-{
- if (sese_contains_loop (region, loop))
- return;
-
- bitmap_set_bit (SESE_LOOPS (region), loop->num);
- SESE_LOOP_NEST (region).safe_push (loop);
-}
-
-/* Build the loop nests contained in REGION. Returns true when the
- operation was successful. */
-
-void
-build_sese_loop_nests (sese region)
-{
- unsigned i;
- basic_block bb;
- struct loop *loop0, *loop1;
-
- FOR_EACH_BB_FN (bb, cfun)
- if (bb_in_sese_p (bb, region))
- {
- struct loop *loop = bb->loop_father;
-
- /* Only add loops if they are completely contained in the SCoP. */
- if (loop->header == bb
- && bb_in_sese_p (loop->latch, region))
- sese_record_loop (region, loop);
- }
-
- /* Make sure that the loops in the SESE_LOOP_NEST are ordered. It
- can be the case that an inner loop is inserted before an outer
- loop. To avoid this, semi-sort once. */
- FOR_EACH_VEC_ELT (SESE_LOOP_NEST (region), i, loop0)
- {
- if (SESE_LOOP_NEST (region).length () == i + 1)
- break;
-
- loop1 = SESE_LOOP_NEST (region)[i + 1];
- if (loop0->num > loop1->num)
- {
- SESE_LOOP_NEST (region)[i] = loop1;
- SESE_LOOP_NEST (region)[i + 1] = loop0;
- }
- }
-}