comparison gcc/tree-profile.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
1 /* Calculate branch probabilities, and basic block execution counts. 1 /* Calculate branch probabilities, and basic block execution counts.
2 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 Contributed by James E. Wilson, UC Berkeley/Cygnus Support; 5 Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
6 based on some ideas from Dain Samples of UC Berkeley. 6 based on some ideas from Dain Samples of UC Berkeley.
7 Further mangling by Bob Manson, Cygnus Support. 7 Further mangling by Bob Manson, Cygnus Support.
8 Converted to use trees by Dale Johannesen, Apple Computer. 8 Converted to use trees by Dale Johannesen, Apple Computer.
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "system.h" 30 #include "system.h"
31 #include "coretypes.h" 31 #include "coretypes.h"
32 #include "tm.h" 32 #include "tm.h"
33 #include "rtl.h"
34 #include "flags.h" 33 #include "flags.h"
35 #include "output.h"
36 #include "regs.h" 34 #include "regs.h"
37 #include "expr.h" 35 #include "expr.h"
38 #include "function.h" 36 #include "function.h"
39 #include "toplev.h" 37 #include "toplev.h"
40 #include "coverage.h" 38 #include "coverage.h"
42 #include "tree-flow.h" 40 #include "tree-flow.h"
43 #include "tree-dump.h" 41 #include "tree-dump.h"
44 #include "tree-pass.h" 42 #include "tree-pass.h"
45 #include "timevar.h" 43 #include "timevar.h"
46 #include "value-prof.h" 44 #include "value-prof.h"
47 #include "ggc.h"
48 #include "cgraph.h" 45 #include "cgraph.h"
49 46
50 static GTY(()) tree gcov_type_node; 47 static GTY(()) tree gcov_type_node;
51 static GTY(()) tree gcov_type_tmp_var; 48 static GTY(()) tree gcov_type_tmp_var;
52 static GTY(()) tree tree_interval_profiler_fn; 49 static GTY(()) tree tree_interval_profiler_fn;
81 TREE_STATIC (ic_void_ptr_var) = 1; 78 TREE_STATIC (ic_void_ptr_var) = 1;
82 TREE_PUBLIC (ic_void_ptr_var) = 0; 79 TREE_PUBLIC (ic_void_ptr_var) = 0;
83 DECL_ARTIFICIAL (ic_void_ptr_var) = 1; 80 DECL_ARTIFICIAL (ic_void_ptr_var) = 1;
84 DECL_INITIAL (ic_void_ptr_var) = NULL; 81 DECL_INITIAL (ic_void_ptr_var) = NULL;
85 varpool_finalize_decl (ic_void_ptr_var); 82 varpool_finalize_decl (ic_void_ptr_var);
83 varpool_mark_needed_node (varpool_node (ic_void_ptr_var));
86 84
87 gcov_type_ptr = build_pointer_type (get_gcov_type ()); 85 gcov_type_ptr = build_pointer_type (get_gcov_type ());
88 ic_gcov_type_ptr_var 86 ic_gcov_type_ptr_var
89 = build_decl (UNKNOWN_LOCATION, VAR_DECL, 87 = build_decl (UNKNOWN_LOCATION, VAR_DECL,
90 get_identifier ("__gcov_indirect_call_counters"), 88 get_identifier ("__gcov_indirect_call_counters"),
92 TREE_STATIC (ic_gcov_type_ptr_var) = 1; 90 TREE_STATIC (ic_gcov_type_ptr_var) = 1;
93 TREE_PUBLIC (ic_gcov_type_ptr_var) = 0; 91 TREE_PUBLIC (ic_gcov_type_ptr_var) = 0;
94 DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1; 92 DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1;
95 DECL_INITIAL (ic_gcov_type_ptr_var) = NULL; 93 DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
96 varpool_finalize_decl (ic_gcov_type_ptr_var); 94 varpool_finalize_decl (ic_gcov_type_ptr_var);
95 varpool_mark_needed_node (varpool_node (ic_gcov_type_ptr_var));
97 } 96 }
98 97
99 static void 98 static void
100 tree_init_edge_profiler (void) 99 tree_init_edge_profiler (void)
101 { 100 {
341 basic_block bb; 340 basic_block bb;
342 edge_iterator ei; 341 edge_iterator ei;
343 gimple stmt1, stmt2; 342 gimple stmt1, stmt2;
344 tree tree_uid, cur_func; 343 tree tree_uid, cur_func;
345 344
346 if (!c_node->needed) 345 if (cgraph_only_called_directly_p (c_node))
347 return; 346 return;
348 347
349 tree_init_edge_profiler (); 348 tree_init_edge_profiler ();
350 349
351 FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs) 350 FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs)