/* 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, 2007, 2008
+ 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.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
/* Generate basic block profile instrumentation and auxiliary files.
Profile generation is optimized, so that not all arcs in the basic
t = GCOV_COUNTER_V_DELTA;
break;
+ case HIST_TYPE_INDIR_CALL:
+ t = GCOV_COUNTER_V_INDIR;
+ break;
+
+ case HIST_TYPE_AVERAGE:
+ t = GCOV_COUNTER_AVERAGE;
+ break;
+
+ case HIST_TYPE_IOR:
+ t = GCOV_COUNTER_IOR;
+ break;
+
default:
gcc_unreachable ();
}
(profile_hooks->gen_const_delta_profiler) (hist, t, 0);
break;
+ case HIST_TYPE_INDIR_CALL:
+ (profile_hooks->gen_ic_profiler) (hist, t, 0);
+ break;
+
+ case HIST_TYPE_AVERAGE:
+ (profile_hooks->gen_average_profiler) (hist, t, 0);
+ break;
+
+ case HIST_TYPE_IOR:
+ (profile_hooks->gen_ior_profiler) (hist, t, 0);
+ break;
+
default:
gcc_unreachable ();
}
}
- VEC_free (histogram_value, heap, values);
}
\f
{
histogram_value hist = VEC_index (histogram_value, values, i);
tree stmt = hist->hvalue.stmt;
- stmt_ann_t ann = get_stmt_ann (stmt);
t = (int) hist->type;
aact_count = act_count[t];
act_count[t] += hist->n_counters;
- hist->hvalue.next = ann->histograms;
- ann->histograms = hist;
+ gimple_add_histogram_value (cfun, stmt, hist);
hist->hvalue.counters = XNEWVEC (gcov_type, hist->n_counters);
for (j = 0; j < hist->n_counters; j++)
hist->hvalue.counters[j] = aact_count[j];
if (last && EXPR_LOCUS (last)
&& e->goto_locus
&& !single_succ_p (bb)
-#ifdef USE_MAPPED_LOCATION
&& (LOCATION_FILE (e->goto_locus)
!= LOCATION_FILE (EXPR_LOCATION (last))
|| (LOCATION_LINE (e->goto_locus)
!= LOCATION_LINE (EXPR_LOCATION (last)))))
-#else
- && (e->goto_locus->file != EXPR_LOCUS (last)->file
- || (e->goto_locus->line != EXPR_LOCUS (last)->line)))
-#endif
{
basic_block new = split_edge (e);
single_succ_edge (new)->goto_locus = e->goto_locus;
if (EXPR_HAS_LOCATION (stmt))
output_location (EXPR_FILENAME (stmt), EXPR_LINENO (stmt),
&offset, bb);
+ /* Take into account modify statements nested in return
+ produced by C++ NRV transformation. */
+ if (TREE_CODE (stmt) == RETURN_EXPR
+ && TREE_OPERAND (stmt, 0)
+ && TREE_CODE (TREE_OPERAND (stmt, 0)) == MODIFY_EXPR
+ && EXPR_HAS_LOCATION (TREE_OPERAND (stmt, 0)))
+ output_location (EXPR_FILENAME (TREE_OPERAND (stmt, 0)),
+ EXPR_LINENO (TREE_OPERAND (stmt, 0)),
+ &offset, bb);
}
/* Notice GOTO expressions we eliminated while constructing the
CFG. */
if (single_succ_p (bb) && single_succ_edge (bb)->goto_locus)
{
- /* ??? source_locus type is marked deprecated in input.h. */
- source_locus curr_location = single_succ_edge (bb)->goto_locus;
+ location_t curr_location = single_succ_edge (bb)->goto_locus;
/* ??? The FILE/LINE API is inconsistent for these cases. */
-#ifdef USE_MAPPED_LOCATION
output_location (LOCATION_FILE (curr_location),
LOCATION_LINE (curr_location), &offset, bb);
-#else
- output_location (curr_location->file, curr_location->line,
- &offset, bb);
-#endif
}
if (offset)
free_aux_for_edges ();
+ VEC_free (histogram_value, heap, values);
free_edge_list (el);
if (flag_branch_probabilities)
profile_status = PROFILE_READ;
void
tree_register_profile_hooks (void)
{
- gcc_assert (ir_type ());
+ gcc_assert (current_ir_type () == IR_GIMPLE);
profile_hooks = &tree_profile_hooks;
}