Add VEC_WIDEN_MULT_EVEN/ODD_EXPR
[platform/upstream/gcc.git] / gcc / matrix-reorg.c
index fbeb164..8395dd2 100644 (file)
@@ -446,7 +446,7 @@ may_flatten_matrices (struct cgraph_node *node)
   basic_block bb;
   gimple_stmt_iterator gsi;
 
-  decl = node->decl;
+  decl = node->symbol.decl;
   if (node->analyzed)
     {
       func = DECL_STRUCT_FUNCTION (decl);
@@ -548,9 +548,9 @@ find_matrices_decl (void)
 
   /* For every global variable in the program:
      Check to see if it's of a candidate type and record it.  */
-  for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed)
+  FOR_EACH_DEFINED_VARIABLE (vnode)
     {
-      tree var_decl = vnode->decl;
+      tree var_decl = vnode->symbol.decl;
 
       if (!var_decl || TREE_CODE (var_decl) != VAR_DECL)
        continue;
@@ -1914,7 +1914,6 @@ transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
              num_elements =
                fold_build2 (MULT_EXPR, sizetype, fold_convert (sizetype, acc_info->index),
                            fold_convert (sizetype, d_size));
-             add_referenced_var (d_size);
              gsi = gsi_for_stmt (acc_info->stmt);
              tmp1 = force_gimple_operand_gsi (&gsi, num_elements, true,
                                               NULL, true, GSI_SAME_STMT);
@@ -2159,7 +2158,6 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
                                           true, GSI_SAME_STMT);
       /* GLOBAL_HOLDING_THE_SIZE = DIM_SIZE.  */
       stmt = gimple_build_assign (dim_var, dim_size);
-      mark_symbols_for_renaming (stmt);
       gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
 
       prev_dim_size = mi->dimension_size[i] = dim_var;
@@ -2266,100 +2264,98 @@ matrix_reorg (void)
   else
     check_transpose_p = false;
   /* If there are hand written vectors, we skip this optimization.  */
-  for (node = cgraph_nodes; node; node = node->next)
+  FOR_EACH_FUNCTION (node)
     if (!may_flatten_matrices (node))
       return 0;
   matrices_to_reorg = htab_create (37, mtt_info_hash, mtt_info_eq, mat_free);
   /* Find and record all potential matrices in the program.  */
   find_matrices_decl ();
   /* Analyze the accesses of the matrices (escaping analysis).  */
-  for (node = cgraph_nodes; node; node = node->next)
-    if (node->analyzed)
-      {
-       tree temp_fn;
+  FOR_EACH_DEFINED_FUNCTION (node)
+    {
+      tree temp_fn;
 
-       temp_fn = current_function_decl;
-       current_function_decl = node->decl;
-       push_cfun (DECL_STRUCT_FUNCTION (node->decl));
-       bitmap_obstack_initialize (NULL);
-       gimple_register_cfg_hooks ();
+      temp_fn = current_function_decl;
+      current_function_decl = node->symbol.decl;
+      push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl));
+      bitmap_obstack_initialize (NULL);
+      gimple_register_cfg_hooks ();
 
-       if (!gimple_in_ssa_p (cfun))
-         {
-           free_dominance_info (CDI_DOMINATORS);
-           free_dominance_info (CDI_POST_DOMINATORS);
-           pop_cfun ();
-           current_function_decl = temp_fn;
-           bitmap_obstack_release (NULL);
+      if (!gimple_in_ssa_p (cfun))
+       {
+         free_dominance_info (CDI_DOMINATORS);
+         free_dominance_info (CDI_POST_DOMINATORS);
+         pop_cfun ();
+         current_function_decl = temp_fn;
+         bitmap_obstack_release (NULL);
 
-           return 0;
-         }
+         return 0;
+       }
 
 #ifdef ENABLE_CHECKING
-       verify_flow_info ();
+      verify_flow_info ();
 #endif
 
-       if (!matrices_to_reorg)
-         {
-           free_dominance_info (CDI_DOMINATORS);
-           free_dominance_info (CDI_POST_DOMINATORS);
-           pop_cfun ();
-           current_function_decl = temp_fn;
-           bitmap_obstack_release (NULL);
+      if (!matrices_to_reorg)
+       {
+         free_dominance_info (CDI_DOMINATORS);
+         free_dominance_info (CDI_POST_DOMINATORS);
+         pop_cfun ();
+         current_function_decl = temp_fn;
+         bitmap_obstack_release (NULL);
 
-           return 0;
-         }
+         return 0;
+       }
 
-       /* Create htap for phi nodes.  */
-       htab_mat_acc_phi_nodes = htab_create (37, mat_acc_phi_hash,
-                                             mat_acc_phi_eq, free);
-       if (!check_transpose_p)
-         find_sites_in_func (false);
-       else
-         {
-           find_sites_in_func (true);
-           loop_optimizer_init (LOOPS_NORMAL);
-           if (current_loops)
-             scev_initialize ();
-           htab_traverse (matrices_to_reorg, analyze_transpose, NULL);
-           if (current_loops)
-             {
-               scev_finalize ();
-               loop_optimizer_finalize ();
-               current_loops = NULL;
-             }
-         }
-       /* If the current function is the allocation function for any of
-          the matrices we check its allocation and the escaping level.  */
-       htab_traverse (matrices_to_reorg, check_allocation_function, NULL);
-       free_dominance_info (CDI_DOMINATORS);
-       free_dominance_info (CDI_POST_DOMINATORS);
-       pop_cfun ();
-       current_function_decl = temp_fn;
-       bitmap_obstack_release (NULL);
-      }
+      /* Create htap for phi nodes.  */
+      htab_mat_acc_phi_nodes = htab_create (37, mat_acc_phi_hash,
+                                           mat_acc_phi_eq, free);
+      if (!check_transpose_p)
+       find_sites_in_func (false);
+      else
+       {
+         find_sites_in_func (true);
+         loop_optimizer_init (LOOPS_NORMAL);
+         if (current_loops)
+           scev_initialize ();
+         htab_traverse (matrices_to_reorg, analyze_transpose, NULL);
+         if (current_loops)
+           {
+             scev_finalize ();
+             loop_optimizer_finalize ();
+             current_loops = NULL;
+           }
+       }
+      /* If the current function is the allocation function for any of
+        the matrices we check its allocation and the escaping level.  */
+      htab_traverse (matrices_to_reorg, check_allocation_function, NULL);
+      free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
+      pop_cfun ();
+      current_function_decl = temp_fn;
+      bitmap_obstack_release (NULL);
+    }
   htab_traverse (matrices_to_reorg, transform_allocation_sites, NULL);
   /* Now transform the accesses.  */
-  for (node = cgraph_nodes; node; node = node->next)
-    if (node->analyzed)
-      {
-       /* Remember that allocation sites have been handled.  */
-       tree temp_fn;
-
-       temp_fn = current_function_decl;
-       current_function_decl = node->decl;
-       push_cfun (DECL_STRUCT_FUNCTION (node->decl));
-       bitmap_obstack_initialize (NULL);
-       gimple_register_cfg_hooks ();
-       record_all_accesses_in_func ();
-       htab_traverse (matrices_to_reorg, transform_access_sites, NULL);
-        cgraph_rebuild_references ();
-       free_dominance_info (CDI_DOMINATORS);
-       free_dominance_info (CDI_POST_DOMINATORS);
-       pop_cfun ();
-       current_function_decl = temp_fn;
-       bitmap_obstack_release (NULL);
-      }
+  FOR_EACH_DEFINED_FUNCTION (node)
+    {
+      /* Remember that allocation sites have been handled.  */
+      tree temp_fn;
+
+      temp_fn = current_function_decl;
+      current_function_decl = node->symbol.decl;
+      push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl));
+      bitmap_obstack_initialize (NULL);
+      gimple_register_cfg_hooks ();
+      record_all_accesses_in_func ();
+      htab_traverse (matrices_to_reorg, transform_access_sites, NULL);
+      cgraph_rebuild_references ();
+      free_dominance_info (CDI_DOMINATORS);
+      free_dominance_info (CDI_POST_DOMINATORS);
+      pop_cfun ();
+      current_function_decl = temp_fn;
+      bitmap_obstack_release (NULL);
+    }
   htab_traverse (matrices_to_reorg, dump_matrix_reorg_analysis, NULL);
 
   current_function_decl = NULL;
@@ -2391,6 +2387,6 @@ struct simple_ipa_opt_pass pass_ipa_matrix_reorg =
   0,                           /* properties_provided */
   0,                           /* properties_destroyed */
   0,                           /* todo_flags_start */
-  TODO_dump_cgraph             /* todo_flags_finish */
+  TODO_dump_symtab             /* todo_flags_finish */
  }
 };