OSDN Git Service

2009-09-14 Sebastian Pop <sebastian.pop@amd.com>
[pf3gnuchains/gcc-fork.git] / gcc / tree-profile.c
index 4467668..2b75461 100644 (file)
@@ -75,25 +75,25 @@ tree_init_ic_make_global_vars (void)
   ptr_void = build_pointer_type (void_type_node);
   
   ic_void_ptr_var 
-    = build_decl (VAR_DECL, 
+    = build_decl (UNKNOWN_LOCATION, VAR_DECL, 
                  get_identifier ("__gcov_indirect_call_callee"), 
                  ptr_void);
   TREE_STATIC (ic_void_ptr_var) = 1;
   TREE_PUBLIC (ic_void_ptr_var) = 0;
   DECL_ARTIFICIAL (ic_void_ptr_var) = 1;
   DECL_INITIAL (ic_void_ptr_var) = NULL;
-  assemble_variable (ic_void_ptr_var, 0, 0, 0);
+  varpool_finalize_decl (ic_void_ptr_var);
 
   gcov_type_ptr = build_pointer_type (get_gcov_type ());
   ic_gcov_type_ptr_var 
-    = build_decl (VAR_DECL, 
+    = build_decl (UNKNOWN_LOCATION, VAR_DECL, 
                  get_identifier ("__gcov_indirect_call_counters"), 
                  gcov_type_ptr);
   TREE_STATIC (ic_gcov_type_ptr_var) = 1;
   TREE_PUBLIC (ic_gcov_type_ptr_var) = 0;
   DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1;
   DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
-  assemble_variable (ic_gcov_type_ptr_var, 0, 0, 0);
+  varpool_finalize_decl (ic_gcov_type_ptr_var);
 }
 
 static void
@@ -159,6 +159,14 @@ tree_init_edge_profiler (void)
       tree_ior_profiler_fn
              = build_fn_decl ("__gcov_ior_profiler",
                                     average_profiler_fn_type);
+      /* LTO streamer needs assembler names.  Because we create these decls
+         late, we need to initialize them by hand.  */
+      DECL_ASSEMBLER_NAME (tree_interval_profiler_fn);
+      DECL_ASSEMBLER_NAME (tree_pow2_profiler_fn);
+      DECL_ASSEMBLER_NAME (tree_one_value_profiler_fn);
+      DECL_ASSEMBLER_NAME (tree_indirect_call_profiler_fn);
+      DECL_ASSEMBLER_NAME (tree_average_profiler_fn);
+      DECL_ASSEMBLER_NAME (tree_ior_profiler_fn);
     }
 }
 
@@ -208,6 +216,8 @@ static tree
 prepare_instrumented_value (gimple_stmt_iterator *gsi, histogram_value value)
 {
   tree val = value->hvalue.value;
+  if (POINTER_TYPE_P (TREE_TYPE (val)))
+    val = fold_convert (sizetype, val);
   return force_gimple_operand_gsi (gsi, fold_convert (gcov_type_node, val),
                                   true, NULL_TREE, true, GSI_SAME_STMT);
 }
@@ -492,7 +502,7 @@ struct gimple_opt_pass pass_tree_profile =
   0,                                   /* static_pass_number */
   TV_BRANCH_PROB,                      /* tv_id */
   PROP_gimple_leh | PROP_cfg,          /* properties_required */
-  PROP_gimple_leh | PROP_cfg,          /* properties_provided */
+  0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
   TODO_verify_stmts | TODO_dump_func   /* todo_flags_finish */