summaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-29 11:45:51 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-29 11:45:51 +0000
commitd297148788686526bc4f9a4b8b1bbaf0c8c96dc9 (patch)
tree06715d5d420f0cc621f0ca883cf604ecc6862320 /gcc/profile.c
parentcb09492adbe1e4187a6b9f80afdb8bc9637543b1 (diff)
downloadgcc-d297148788686526bc4f9a4b8b1bbaf0c8c96dc9.tar.gz
* Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H)
$(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97156 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index b1dc941b39e..25d14713408 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -224,6 +224,7 @@ instrument_values (histogram_values values)
abort ();
}
}
+ VEC_free (histogram_value, values);
}
@@ -641,7 +642,7 @@ compute_branch_probabilities (void)
}
/* Load value histograms values whose description is stored in VALUES array
- from .da file. */
+ from .gcda file. */
static void
compute_value_histograms (histogram_values values)
@@ -688,21 +689,32 @@ compute_value_histograms (histogram_values values)
hist = VEC_index (histogram_value, values, i);
t = (int) hist->type;
- /* FIXME: make this work for trees. */
+ aact_count = act_count[t];
+ act_count[t] += hist->n_counters;
+
if (!ir_type ())
{
- aact_count = act_count[t];
- act_count[t] += hist->n_counters;
for (j = hist->n_counters; j > 0; j--)
hist_list = alloc_EXPR_LIST (0, GEN_INT (aact_count[j - 1]),
hist_list);
- hist_list = alloc_EXPR_LIST (0,
- copy_rtx ((rtx) hist->value), hist_list);
+ hist_list = alloc_EXPR_LIST (0,
+ copy_rtx (hist->hvalue.rtl.value), hist_list);
hist_list = alloc_EXPR_LIST (0, GEN_INT (hist->type), hist_list);
- REG_NOTES ((rtx) hist->insn) =
- alloc_EXPR_LIST (REG_VALUE_PROFILE, hist_list,
- REG_NOTES ((rtx) hist->insn));
+ REG_NOTES (hist->hvalue.rtl.insn) =
+ alloc_EXPR_LIST (REG_VALUE_PROFILE, hist_list,
+ REG_NOTES (hist->hvalue.rtl.insn));
}
+ else
+ {
+ tree stmt = hist->hvalue.tree.stmt;
+ stmt_ann_t ann = get_stmt_ann (stmt);
+ hist->hvalue.tree.next = ann->histograms;
+ ann->histograms = hist;
+ hist->hvalue.tree.counters =
+ xmalloc (sizeof (gcov_type) * hist->n_counters);
+ for (j = 0; j < hist->n_counters; j++)
+ hist->hvalue.tree.counters[j] = aact_count[j];
+ }
}
for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++)