1 /* Calculate branch probabilities, and basic block execution counts.
2 Copyright (C) 1990-2015 Free Software Foundation, Inc.
3 Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
4 based on some ideas from Dain Samples of UC Berkeley.
5 Further mangling by Bob Manson, Cygnus Support.
6 Converted to use trees by Dale Johannesen, Apple Computer.
8 This file is part of GCC.
10 GCC is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation; either version 3, or (at your option) any later
15 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 You should have received a copy of the GNU General Public License
21 along with GCC; see the file COPYING3. If not see
22 <http://www.gnu.org/licenses/>. */
24 /* Generate basic block profile instrumentation and auxiliary files.
25 Tree-based version. See profile.c for overview. */
29 #include "coretypes.h"
32 #include "hard-reg-set.h"
35 #include "dominance.h"
37 #include "basic-block.h"
38 #include "diagnostic-core.h"
43 #include "fold-const.h"
44 #include "tree-ssa-alias.h"
45 #include "internal-fn.h"
46 #include "gimple-expr.h"
49 #include "tree-nested.h"
51 #include "gimple-iterator.h"
52 #include "gimplify-me.h"
53 #include "gimple-ssa.h"
54 #include "plugin-api.h"
58 #include "stringpool.h"
59 #include "tree-ssanames.h"
60 #include "tree-into-ssa.h"
61 #include "tree-pass.h"
62 #include "value-prof.h"
65 #include "tree-cfgcleanup.h"
66 #include "tree-nested.h"
69 static GTY(()) tree gcov_type_node
;
70 static GTY(()) tree tree_interval_profiler_fn
;
71 static GTY(()) tree tree_pow2_profiler_fn
;
72 static GTY(()) tree tree_one_value_profiler_fn
;
73 static GTY(()) tree tree_indirect_call_profiler_fn
;
74 static GTY(()) tree tree_time_profiler_fn
;
75 static GTY(()) tree tree_average_profiler_fn
;
76 static GTY(()) tree tree_ior_profiler_fn
;
79 static GTY(()) tree ic_void_ptr_var
;
80 static GTY(()) tree ic_gcov_type_ptr_var
;
81 static GTY(()) tree ptr_void
;
83 /* Do initialization work for the edge profiler. */
86 __thread gcov* __gcov_indirect_call_counters; // pointer to actual counter
87 __thread void* __gcov_indirect_call_callee; // actual callee address
88 __thread int __gcov_function_counter; // time profiler function counter
91 init_ic_make_global_vars (void)
95 ptr_void
= build_pointer_type (void_type_node
);
98 = build_decl (UNKNOWN_LOCATION
, VAR_DECL
,
100 (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE
) ?
101 "__gcov_indirect_call_topn_callee" :
102 "__gcov_indirect_call_callee")),
104 TREE_PUBLIC (ic_void_ptr_var
) = 1;
105 DECL_EXTERNAL (ic_void_ptr_var
) = 1;
106 TREE_STATIC (ic_void_ptr_var
) = 1;
107 DECL_ARTIFICIAL (ic_void_ptr_var
) = 1;
108 DECL_INITIAL (ic_void_ptr_var
) = NULL
;
109 if (targetm
.have_tls
)
110 set_decl_tls_model (ic_void_ptr_var
, decl_default_tls_model (ic_void_ptr_var
));
112 varpool_node::finalize_decl (ic_void_ptr_var
);
114 gcov_type_ptr
= build_pointer_type (get_gcov_type ());
117 = build_decl (UNKNOWN_LOCATION
, VAR_DECL
,
119 (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE
) ?
120 "__gcov_indirect_call_topn_counters" :
121 "__gcov_indirect_call_counters")),
123 TREE_PUBLIC (ic_gcov_type_ptr_var
) = 1;
124 DECL_EXTERNAL (ic_gcov_type_ptr_var
) = 1;
125 TREE_STATIC (ic_gcov_type_ptr_var
) = 1;
126 DECL_ARTIFICIAL (ic_gcov_type_ptr_var
) = 1;
127 DECL_INITIAL (ic_gcov_type_ptr_var
) = NULL
;
128 if (targetm
.have_tls
)
129 set_decl_tls_model (ic_gcov_type_ptr_var
, decl_default_tls_model (ic_gcov_type_ptr_var
));
131 varpool_node::finalize_decl (ic_gcov_type_ptr_var
);
134 /* Create the type and function decls for the interface with gcov. */
137 gimple_init_edge_profiler (void)
139 tree interval_profiler_fn_type
;
140 tree pow2_profiler_fn_type
;
141 tree one_value_profiler_fn_type
;
143 tree ic_profiler_fn_type
;
144 tree average_profiler_fn_type
;
145 tree time_profiler_fn_type
;
149 gcov_type_node
= get_gcov_type ();
150 gcov_type_ptr
= build_pointer_type (gcov_type_node
);
152 /* void (*) (gcov_type *, gcov_type, int, unsigned) */
153 interval_profiler_fn_type
154 = build_function_type_list (void_type_node
,
155 gcov_type_ptr
, gcov_type_node
,
157 unsigned_type_node
, NULL_TREE
);
158 tree_interval_profiler_fn
159 = build_fn_decl ("__gcov_interval_profiler",
160 interval_profiler_fn_type
);
161 TREE_NOTHROW (tree_interval_profiler_fn
) = 1;
162 DECL_ATTRIBUTES (tree_interval_profiler_fn
)
163 = tree_cons (get_identifier ("leaf"), NULL
,
164 DECL_ATTRIBUTES (tree_interval_profiler_fn
));
166 /* void (*) (gcov_type *, gcov_type) */
167 pow2_profiler_fn_type
168 = build_function_type_list (void_type_node
,
169 gcov_type_ptr
, gcov_type_node
,
171 tree_pow2_profiler_fn
= build_fn_decl ("__gcov_pow2_profiler",
172 pow2_profiler_fn_type
);
173 TREE_NOTHROW (tree_pow2_profiler_fn
) = 1;
174 DECL_ATTRIBUTES (tree_pow2_profiler_fn
)
175 = tree_cons (get_identifier ("leaf"), NULL
,
176 DECL_ATTRIBUTES (tree_pow2_profiler_fn
));
178 /* void (*) (gcov_type *, gcov_type) */
179 one_value_profiler_fn_type
180 = build_function_type_list (void_type_node
,
181 gcov_type_ptr
, gcov_type_node
,
183 tree_one_value_profiler_fn
184 = build_fn_decl ("__gcov_one_value_profiler",
185 one_value_profiler_fn_type
);
186 TREE_NOTHROW (tree_one_value_profiler_fn
) = 1;
187 DECL_ATTRIBUTES (tree_one_value_profiler_fn
)
188 = tree_cons (get_identifier ("leaf"), NULL
,
189 DECL_ATTRIBUTES (tree_one_value_profiler_fn
));
191 init_ic_make_global_vars ();
193 /* void (*) (gcov_type, void *) */
195 = build_function_type_list (void_type_node
,
199 tree_indirect_call_profiler_fn
200 = build_fn_decl ( (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE
) ?
201 "__gcov_indirect_call_topn_profiler":
202 "__gcov_indirect_call_profiler_v2"),
203 ic_profiler_fn_type
);
205 TREE_NOTHROW (tree_indirect_call_profiler_fn
) = 1;
206 DECL_ATTRIBUTES (tree_indirect_call_profiler_fn
)
207 = tree_cons (get_identifier ("leaf"), NULL
,
208 DECL_ATTRIBUTES (tree_indirect_call_profiler_fn
));
210 /* void (*) (gcov_type *, gcov_type, void *) */
211 time_profiler_fn_type
212 = build_function_type_list (void_type_node
,
213 gcov_type_ptr
, NULL_TREE
);
214 tree_time_profiler_fn
215 = build_fn_decl ("__gcov_time_profiler",
216 time_profiler_fn_type
);
217 TREE_NOTHROW (tree_time_profiler_fn
) = 1;
218 DECL_ATTRIBUTES (tree_time_profiler_fn
)
219 = tree_cons (get_identifier ("leaf"), NULL
,
220 DECL_ATTRIBUTES (tree_time_profiler_fn
));
222 /* void (*) (gcov_type *, gcov_type) */
223 average_profiler_fn_type
224 = build_function_type_list (void_type_node
,
225 gcov_type_ptr
, gcov_type_node
, NULL_TREE
);
226 tree_average_profiler_fn
227 = build_fn_decl ("__gcov_average_profiler",
228 average_profiler_fn_type
);
229 TREE_NOTHROW (tree_average_profiler_fn
) = 1;
230 DECL_ATTRIBUTES (tree_average_profiler_fn
)
231 = tree_cons (get_identifier ("leaf"), NULL
,
232 DECL_ATTRIBUTES (tree_average_profiler_fn
));
234 = build_fn_decl ("__gcov_ior_profiler",
235 average_profiler_fn_type
);
236 TREE_NOTHROW (tree_ior_profiler_fn
) = 1;
237 DECL_ATTRIBUTES (tree_ior_profiler_fn
)
238 = tree_cons (get_identifier ("leaf"), NULL
,
239 DECL_ATTRIBUTES (tree_ior_profiler_fn
));
241 /* LTO streamer needs assembler names. Because we create these decls
242 late, we need to initialize them by hand. */
243 DECL_ASSEMBLER_NAME (tree_interval_profiler_fn
);
244 DECL_ASSEMBLER_NAME (tree_pow2_profiler_fn
);
245 DECL_ASSEMBLER_NAME (tree_one_value_profiler_fn
);
246 DECL_ASSEMBLER_NAME (tree_indirect_call_profiler_fn
);
247 DECL_ASSEMBLER_NAME (tree_time_profiler_fn
);
248 DECL_ASSEMBLER_NAME (tree_average_profiler_fn
);
249 DECL_ASSEMBLER_NAME (tree_ior_profiler_fn
);
253 /* Output instructions as GIMPLE trees to increment the edge
254 execution count, and insert them on E. We rely on
255 gsi_insert_on_edge to preserve the order. */
258 gimple_gen_edge_profiler (int edgeno
, edge e
)
260 tree ref
, one
, gcov_type_tmp_var
;
261 gassign
*stmt1
, *stmt2
, *stmt3
;
263 ref
= tree_coverage_counter_ref (GCOV_COUNTER_ARCS
, edgeno
);
264 one
= build_int_cst (gcov_type_node
, 1);
265 gcov_type_tmp_var
= make_temp_ssa_name (gcov_type_node
,
266 NULL
, "PROF_edge_counter");
267 stmt1
= gimple_build_assign (gcov_type_tmp_var
, ref
);
268 gcov_type_tmp_var
= make_temp_ssa_name (gcov_type_node
,
269 NULL
, "PROF_edge_counter");
270 stmt2
= gimple_build_assign (gcov_type_tmp_var
, PLUS_EXPR
,
271 gimple_assign_lhs (stmt1
), one
);
272 stmt3
= gimple_build_assign (unshare_expr (ref
), gimple_assign_lhs (stmt2
));
273 gsi_insert_on_edge (e
, stmt1
);
274 gsi_insert_on_edge (e
, stmt2
);
275 gsi_insert_on_edge (e
, stmt3
);
278 /* Emits code to get VALUE to instrument at GSI, and returns the
279 variable containing the value. */
282 prepare_instrumented_value (gimple_stmt_iterator
*gsi
, histogram_value value
)
284 tree val
= value
->hvalue
.value
;
285 if (POINTER_TYPE_P (TREE_TYPE (val
)))
286 val
= fold_convert (build_nonstandard_integer_type
287 (TYPE_PRECISION (TREE_TYPE (val
)), 1), val
);
288 return force_gimple_operand_gsi (gsi
, fold_convert (gcov_type_node
, val
),
289 true, NULL_TREE
, true, GSI_SAME_STMT
);
292 /* Output instructions as GIMPLE trees to increment the interval histogram
293 counter. VALUE is the expression whose value is profiled. TAG is the
294 tag of the section for counters, BASE is offset of the counter position. */
297 gimple_gen_interval_profiler (histogram_value value
, unsigned tag
, unsigned base
)
299 gimple stmt
= value
->hvalue
.stmt
;
300 gimple_stmt_iterator gsi
= gsi_for_stmt (stmt
);
301 tree ref
= tree_coverage_counter_ref (tag
, base
), ref_ptr
;
304 tree start
= build_int_cst_type (integer_type_node
,
305 value
->hdata
.intvl
.int_start
);
306 tree steps
= build_int_cst_type (unsigned_type_node
,
307 value
->hdata
.intvl
.steps
);
309 ref_ptr
= force_gimple_operand_gsi (&gsi
,
310 build_addr (ref
, current_function_decl
),
311 true, NULL_TREE
, true, GSI_SAME_STMT
);
312 val
= prepare_instrumented_value (&gsi
, value
);
313 call
= gimple_build_call (tree_interval_profiler_fn
, 4,
314 ref_ptr
, val
, start
, steps
);
315 gsi_insert_before (&gsi
, call
, GSI_NEW_STMT
);
318 /* Output instructions as GIMPLE trees to increment the power of two histogram
319 counter. VALUE is the expression whose value is profiled. TAG is the tag
320 of the section for counters, BASE is offset of the counter position. */
323 gimple_gen_pow2_profiler (histogram_value value
, unsigned tag
, unsigned base
)
325 gimple stmt
= value
->hvalue
.stmt
;
326 gimple_stmt_iterator gsi
= gsi_for_stmt (stmt
);
327 tree ref_ptr
= tree_coverage_counter_addr (tag
, base
);
331 ref_ptr
= force_gimple_operand_gsi (&gsi
, ref_ptr
,
332 true, NULL_TREE
, true, GSI_SAME_STMT
);
333 val
= prepare_instrumented_value (&gsi
, value
);
334 call
= gimple_build_call (tree_pow2_profiler_fn
, 2, ref_ptr
, val
);
335 gsi_insert_before (&gsi
, call
, GSI_NEW_STMT
);
338 /* Output instructions as GIMPLE trees for code to find the most common value.
339 VALUE is the expression whose value is profiled. TAG is the tag of the
340 section for counters, BASE is offset of the counter position. */
343 gimple_gen_one_value_profiler (histogram_value value
, unsigned tag
, unsigned base
)
345 gimple stmt
= value
->hvalue
.stmt
;
346 gimple_stmt_iterator gsi
= gsi_for_stmt (stmt
);
347 tree ref_ptr
= tree_coverage_counter_addr (tag
, base
);
351 ref_ptr
= force_gimple_operand_gsi (&gsi
, ref_ptr
,
352 true, NULL_TREE
, true, GSI_SAME_STMT
);
353 val
= prepare_instrumented_value (&gsi
, value
);
354 call
= gimple_build_call (tree_one_value_profiler_fn
, 2, ref_ptr
, val
);
355 gsi_insert_before (&gsi
, call
, GSI_NEW_STMT
);
359 /* Output instructions as GIMPLE trees for code to find the most
360 common called function in indirect call.
361 VALUE is the call expression whose indirect callee is profiled.
362 TAG is the tag of the section for counters, BASE is offset of the
366 gimple_gen_ic_profiler (histogram_value value
, unsigned tag
, unsigned base
)
369 gassign
*stmt1
, *stmt2
, *stmt3
;
370 gimple stmt
= value
->hvalue
.stmt
;
371 gimple_stmt_iterator gsi
= gsi_for_stmt (stmt
);
372 tree ref_ptr
= tree_coverage_counter_addr (tag
, base
);
374 if ( (PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE
) &&
375 tag
== GCOV_COUNTER_V_INDIR
) ||
376 (!PARAM_VALUE (PARAM_INDIR_CALL_TOPN_PROFILE
) &&
377 tag
== GCOV_COUNTER_ICALL_TOPNV
))
380 ref_ptr
= force_gimple_operand_gsi (&gsi
, ref_ptr
,
381 true, NULL_TREE
, true, GSI_SAME_STMT
);
385 stmt1: __gcov_indirect_call_counters = get_relevant_counter_ptr ();
386 stmt2: tmp1 = (void *) (indirect call argument value)
387 stmt3: __gcov_indirect_call_callee = tmp1;
390 stmt1
= gimple_build_assign (ic_gcov_type_ptr_var
, ref_ptr
);
391 tmp1
= make_temp_ssa_name (ptr_void
, NULL
, "PROF");
392 stmt2
= gimple_build_assign (tmp1
, unshare_expr (value
->hvalue
.value
));
393 stmt3
= gimple_build_assign (ic_void_ptr_var
, gimple_assign_lhs (stmt2
));
395 gsi_insert_before (&gsi
, stmt1
, GSI_SAME_STMT
);
396 gsi_insert_before (&gsi
, stmt2
, GSI_SAME_STMT
);
397 gsi_insert_before (&gsi
, stmt3
, GSI_SAME_STMT
);
401 /* Output instructions as GIMPLE trees for code to find the most
402 common called function in indirect call. Insert instructions at the
403 beginning of every possible called function.
407 gimple_gen_ic_func_profiler (void)
409 struct cgraph_node
* c_node
= cgraph_node::get (current_function_decl
);
410 gimple_stmt_iterator gsi
;
413 tree tree_uid
, cur_func
, void0
;
415 if (c_node
->only_called_directly_p ())
418 gimple_init_edge_profiler ();
422 stmt1: __gcov_indirect_call_profiler_v2 (profile_id,
423 ¤t_function_decl)
425 gsi
= gsi_after_labels (split_edge (single_succ_edge
426 (ENTRY_BLOCK_PTR_FOR_FN (cfun
))));
428 cur_func
= force_gimple_operand_gsi (&gsi
,
429 build_addr (current_function_decl
,
430 current_function_decl
),
432 true, GSI_SAME_STMT
);
433 tree_uid
= build_int_cst
435 cgraph_node::get (current_function_decl
)->profile_id
);
436 stmt1
= gimple_build_call (tree_indirect_call_profiler_fn
, 2,
438 gsi_insert_before (&gsi
, stmt1
, GSI_SAME_STMT
);
440 /* Set __gcov_indirect_call_callee to 0,
441 so that calls from other modules won't get misattributed
442 to the last caller of the current callee. */
443 void0
= build_int_cst (build_pointer_type (void_type_node
), 0);
444 stmt2
= gimple_build_assign (ic_void_ptr_var
, void0
);
445 gsi_insert_before (&gsi
, stmt2
, GSI_SAME_STMT
);
448 /* Output instructions as GIMPLE tree at the beginning for each function.
449 TAG is the tag of the section for counters, BASE is offset of the
450 counter position and GSI is the iterator we place the counter. */
453 gimple_gen_time_profiler (unsigned tag
, unsigned base
,
454 gimple_stmt_iterator
&gsi
)
456 tree ref_ptr
= tree_coverage_counter_addr (tag
, base
);
459 ref_ptr
= force_gimple_operand_gsi (&gsi
, ref_ptr
,
460 true, NULL_TREE
, true, GSI_SAME_STMT
);
461 call
= gimple_build_call (tree_time_profiler_fn
, 1, ref_ptr
);
462 gsi_insert_before (&gsi
, call
, GSI_NEW_STMT
);
465 /* Output instructions as GIMPLE trees for code to find the most common value
466 of a difference between two evaluations of an expression.
467 VALUE is the expression whose value is profiled. TAG is the tag of the
468 section for counters, BASE is offset of the counter position. */
471 gimple_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED
,
472 unsigned tag ATTRIBUTE_UNUSED
,
473 unsigned base ATTRIBUTE_UNUSED
)
475 /* FIXME implement this. */
476 #ifdef ENABLE_CHECKING
477 internal_error ("unimplemented functionality");
482 /* Output instructions as GIMPLE trees to increment the average histogram
483 counter. VALUE is the expression whose value is profiled. TAG is the
484 tag of the section for counters, BASE is offset of the counter position. */
487 gimple_gen_average_profiler (histogram_value value
, unsigned tag
, unsigned base
)
489 gimple stmt
= value
->hvalue
.stmt
;
490 gimple_stmt_iterator gsi
= gsi_for_stmt (stmt
);
491 tree ref_ptr
= tree_coverage_counter_addr (tag
, base
);
495 ref_ptr
= force_gimple_operand_gsi (&gsi
, ref_ptr
,
497 true, GSI_SAME_STMT
);
498 val
= prepare_instrumented_value (&gsi
, value
);
499 call
= gimple_build_call (tree_average_profiler_fn
, 2, ref_ptr
, val
);
500 gsi_insert_before (&gsi
, call
, GSI_NEW_STMT
);
503 /* Output instructions as GIMPLE trees to increment the ior histogram
504 counter. VALUE is the expression whose value is profiled. TAG is the
505 tag of the section for counters, BASE is offset of the counter position. */
508 gimple_gen_ior_profiler (histogram_value value
, unsigned tag
, unsigned base
)
510 gimple stmt
= value
->hvalue
.stmt
;
511 gimple_stmt_iterator gsi
= gsi_for_stmt (stmt
);
512 tree ref_ptr
= tree_coverage_counter_addr (tag
, base
);
516 ref_ptr
= force_gimple_operand_gsi (&gsi
, ref_ptr
,
517 true, NULL_TREE
, true, GSI_SAME_STMT
);
518 val
= prepare_instrumented_value (&gsi
, value
);
519 call
= gimple_build_call (tree_ior_profiler_fn
, 2, ref_ptr
, val
);
520 gsi_insert_before (&gsi
, call
, GSI_NEW_STMT
);
523 /* Profile all functions in the callgraph. */
526 tree_profiling (void)
528 struct cgraph_node
*node
;
530 /* This is a small-ipa pass that gets called only once, from
531 cgraphunit.c:ipa_passes(). */
532 gcc_assert (symtab
->state
== IPA_SSA
);
534 init_node_map (true);
536 FOR_EACH_DEFINED_FUNCTION (node
)
538 if (!gimple_has_body_p (node
->decl
))
541 /* Don't profile functions produced for builtin stuff. */
542 if (DECL_SOURCE_LOCATION (node
->decl
) == BUILTINS_LOCATION
)
545 /* Do not instrument extern inline functions when testing coverage.
546 While this is not perfectly consistent (early inlined extern inlines
547 will get acocunted), testsuite expects that. */
548 if (DECL_EXTERNAL (node
->decl
)
549 && flag_test_coverage
)
552 push_cfun (DECL_STRUCT_FUNCTION (node
->decl
));
554 /* Local pure-const may imply need to fixup the cfg. */
555 if (execute_fixup_cfg () & TODO_cleanup_cfg
)
560 if (! flag_branch_probabilities
561 && flag_profile_values
)
562 gimple_gen_ic_func_profiler ();
564 if (flag_branch_probabilities
565 && flag_profile_values
566 && flag_value_profile_transformations
)
567 gimple_value_profile_transformations ();
569 /* The above could hose dominator info. Currently there is
570 none coming in, this is a safety valve. It should be
571 easy to adjust it, if and when there is some. */
572 free_dominance_info (CDI_DOMINATORS
);
573 free_dominance_info (CDI_POST_DOMINATORS
);
577 /* Drop pure/const flags from instrumented functions. */
578 FOR_EACH_DEFINED_FUNCTION (node
)
580 if (!gimple_has_body_p (node
->decl
)
582 || node
->decl
!= node
->clone_of
->decl
))
585 /* Don't profile functions produced for builtin stuff. */
586 if (DECL_SOURCE_LOCATION (node
->decl
) == BUILTINS_LOCATION
)
589 node
->set_const_flag (false, false);
590 node
->set_pure_flag (false, false);
593 /* Update call statements and rebuild the cgraph. */
594 FOR_EACH_DEFINED_FUNCTION (node
)
598 if (!gimple_has_body_p (node
->decl
)
600 || node
->decl
!= node
->clone_of
->decl
))
603 /* Don't profile functions produced for builtin stuff. */
604 if (DECL_SOURCE_LOCATION (node
->decl
) == BUILTINS_LOCATION
)
607 push_cfun (DECL_STRUCT_FUNCTION (node
->decl
));
609 FOR_EACH_BB_FN (bb
, cfun
)
611 gimple_stmt_iterator gsi
;
612 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
614 gimple stmt
= gsi_stmt (gsi
);
615 if (is_gimple_call (stmt
))
620 /* re-merge split blocks. */
622 update_ssa (TODO_update_ssa
);
624 cgraph_edge::rebuild_edges ();
629 handle_missing_profiles ();
637 const pass_data pass_data_ipa_tree_profile
=
639 SIMPLE_IPA_PASS
, /* type */
640 "profile", /* name */
641 OPTGROUP_NONE
, /* optinfo_flags */
642 TV_IPA_PROFILE
, /* tv_id */
643 0, /* properties_required */
644 0, /* properties_provided */
645 0, /* properties_destroyed */
646 0, /* todo_flags_start */
647 0, /* todo_flags_finish */
650 class pass_ipa_tree_profile
: public simple_ipa_opt_pass
653 pass_ipa_tree_profile (gcc::context
*ctxt
)
654 : simple_ipa_opt_pass (pass_data_ipa_tree_profile
, ctxt
)
657 /* opt_pass methods: */
658 virtual bool gate (function
*);
659 virtual unsigned int execute (function
*) { return tree_profiling (); }
661 }; // class pass_ipa_tree_profile
664 pass_ipa_tree_profile::gate (function
*)
666 /* When profile instrumentation, use or test coverage shall be performed.
667 But for AutoFDO, this there is no instrumentation, thus this pass is
669 return (!in_lto_p
&& !flag_auto_profile
670 && (flag_branch_probabilities
|| flag_test_coverage
671 || profile_arc_flag
));
676 simple_ipa_opt_pass
*
677 make_pass_ipa_tree_profile (gcc::context
*ctxt
)
679 return new pass_ipa_tree_profile (ctxt
);
682 #include "gt-tree-profile.h"