OSDN Git Service

* gcc.dg/vect/vect-116.c: Add vect_int target requirement.
[pf3gnuchains/gcc-fork.git] / gcc / tree-profile.c
index b8e54d4..ee2748b 100644 (file)
@@ -1,6 +1,7 @@
 /* Calculate branch probabilities, and basic block execution counts.
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
    based on some ideas from Dain Samples of UC Berkeley.
    Further mangling by Bob Manson, Cygnus Support.
@@ -171,11 +172,12 @@ tree_gen_edge_profiler (int edgeno, edge e)
   tree tmp1 = create_tmp_var (gcov_type_node, "PROF");
   tree tmp2 = create_tmp_var (gcov_type_node, "PROF");
   tree ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
-  tree stmt1 = build2 (GIMPLE_MODIFY_STMT, gcov_type_node, tmp1, ref);
-  tree stmt2 = build2 (GIMPLE_MODIFY_STMT, gcov_type_node, tmp2,
-                      build2 (PLUS_EXPR, gcov_type_node, 
-                             tmp1, integer_one_node));
-  tree stmt3 = build2 (GIMPLE_MODIFY_STMT, gcov_type_node, ref, tmp2);
+  tree one = build_int_cst (gcov_type_node, 1);
+  tree stmt1 = build_gimple_modify_stmt (tmp1, ref);
+  tree stmt2 = build_gimple_modify_stmt (tmp2,
+                                        build2 (PLUS_EXPR, gcov_type_node,
+                                                tmp1, one));
+  tree stmt3 = build_gimple_modify_stmt (ref, tmp2);
   bsi_insert_on_edge (e, stmt1);
   bsi_insert_on_edge (e, stmt2);
   bsi_insert_on_edge (e, stmt3);
@@ -190,7 +192,7 @@ prepare_instrumented_value (block_stmt_iterator *bsi,
 {
   tree val = value->hvalue.value;
   return force_gimple_operand_bsi (bsi, fold_convert (gcov_type_node, val),
-                                  true, NULL_TREE);
+                                  true, NULL_TREE, true, BSI_SAME_STMT);
 }
 
 /* Output instructions as GIMPLE trees to increment the interval histogram 
@@ -209,7 +211,7 @@ tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_interval_profiler_fn, 4,
                          ref_ptr, val, start, steps);
@@ -230,7 +232,7 @@ tree_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_pow2_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);
@@ -250,7 +252,7 @@ tree_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_one_value_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);
@@ -273,7 +275,7 @@ tree_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
 
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
 
   /* Insert code:
     
@@ -282,13 +284,9 @@ tree_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base)
    */
 
   tmp1 = create_tmp_var (ptr_void, "PROF");
-  stmt1 = build2 (GIMPLE_MODIFY_STMT, 
-                 build_pointer_type (get_gcov_type ()), 
-                 ic_gcov_type_ptr_var, ref_ptr);
-  stmt2 = build2 (GIMPLE_MODIFY_STMT, ptr_void, tmp1, 
-                 unshare_expr (value->hvalue.value));
-  stmt3 = build2 (GIMPLE_MODIFY_STMT, ptr_void, 
-                 ic_void_ptr_var, tmp1);
+  stmt1 = build_gimple_modify_stmt (ic_gcov_type_ptr_var, ref_ptr);
+  stmt2 = build_gimple_modify_stmt (tmp1, unshare_expr (value->hvalue.value));
+  stmt3 = build_gimple_modify_stmt (ic_void_ptr_var, tmp1);
 
   bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
   bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
@@ -327,14 +325,15 @@ tree_gen_ic_func_profiler (void)
       cur_func = force_gimple_operand_bsi (&bsi,
                                           build_addr (current_function_decl, 
                                                       current_function_decl),
-                                          true, NULL_TREE);
+                                          true, NULL_TREE,
+                                          true, BSI_SAME_STMT);
       tree_uid = build_int_cst (gcov_type_node, c_node->pid);
       stmt1 = build_call_expr (tree_indirect_call_profiler_fn, 4,
                               ic_gcov_type_ptr_var,
                               tree_uid,
                               cur_func,
                               ic_void_ptr_var);
-      bsi_insert_after (&bsi, stmt1, BSI_SAME_STMT);
+      bsi_insert_after (&bsi, stmt1, BSI_NEW_STMT);
     }
 }
 
@@ -369,7 +368,8 @@ tree_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE,
+                                     true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_average_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);
@@ -389,7 +389,7 @@ tree_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base)
   
   ref_ptr = force_gimple_operand_bsi (&bsi,
                                      build_addr (ref, current_function_decl),
-                                     true, NULL_TREE);
+                                     true, NULL_TREE, true, BSI_SAME_STMT);
   val = prepare_instrumented_value (&bsi, value);
   call = build_call_expr (tree_ior_profiler_fn, 2, ref_ptr, val);
   bsi_insert_before (&bsi, call, BSI_SAME_STMT);