]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/value-prof.h
Update copyright years in gcc/
[thirdparty/gcc.git] / gcc / value-prof.h
CommitLineData
1c72f4ef 1/* Definitions for transformations based on profile information for values.
23a5b65a 2 Copyright (C) 2003-2014 Free Software Foundation, Inc.
1c72f4ef
ZD
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
1c72f4ef
ZD
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
1c72f4ef 19
6de9cd9a
DN
20#ifndef GCC_VALUE_PROF_H
21#define GCC_VALUE_PROF_H
22
1c72f4ef
ZD
23/* Supported histogram types. */
24enum hist_type
25{
26 HIST_TYPE_INTERVAL, /* Measures histogram of values inside a specified
27 interval. */
28 HIST_TYPE_POW2, /* Histogram of power of 2 values. */
29 HIST_TYPE_SINGLE_VALUE, /* Tries to identify the value that is (almost)
30 always constant. */
6bad2617 31 HIST_TYPE_CONST_DELTA, /* Tries to identify the (almost) always constant
1c72f4ef 32 difference between two evaluations of a value. */
b8698a0f 33 HIST_TYPE_INDIR_CALL, /* Tries to identify the function that is (almost)
6bad2617 34 called in indirect call */
079a182e 35 HIST_TYPE_AVERAGE, /* Compute average value (sum of all values). */
89ab31c1 36 HIST_TYPE_IOR, /* Used to compute expected alignment. */
86ce5d2f 37 HIST_TYPE_TIME_PROFILE, /* Used for time profile */
89ab31c1 38 HIST_TYPE_MAX
1c72f4ef
ZD
39};
40
6e885ee3
ZD
41#define COUNTER_FOR_HIST_TYPE(TYPE) ((int) (TYPE) + GCOV_FIRST_VALUE_COUNTER)
42#define HIST_TYPE_FOR_COUNTER(COUNTER) \
43 ((enum hist_type) ((COUNTER) - GCOV_FIRST_VALUE_COUNTER))
44
e0cb7e1e 45\f
1c72f4ef 46/* The value to measure. */
1f1e8527 47struct histogram_value_t
1c72f4ef 48{
8a76829c 49 struct
1f1e8527 50 {
8a76829c 51 tree value; /* The value to profile. */
726a989a 52 gimple stmt; /* Insn containing the value. */
8a76829c
JH
53 gcov_type *counters; /* Pointer to first counter. */
54 struct histogram_value_t *next; /* Linked list pointer. */
1f1e8527 55 } hvalue;
6d9901e7
ZD
56 enum hist_type type; /* Type of information to measure. */
57 unsigned n_counters; /* Number of required counters. */
86ce5d2f 58 struct function *fun;
1c72f4ef
ZD
59 union
60 {
61 struct
62 {
63 int int_start; /* First value in interval. */
1f1e8527 64 unsigned int steps; /* Number of values in it. */
1c72f4ef 65 } intvl; /* Interval histogram data. */
1c72f4ef
ZD
66 } hdata; /* Profiled information specific data. */
67};
68
6d9901e7 69typedef struct histogram_value_t *histogram_value;
5f754896 70typedef const struct histogram_value_t *const_histogram_value;
6d9901e7 71
6d9901e7 72
9771b263 73typedef vec<histogram_value> histogram_values;
6d9901e7 74
e0cb7e1e
SB
75extern void gimple_find_values_to_profile (histogram_values *);
76extern bool gimple_value_profile_transformations (void);
6de9cd9a 77
726a989a
RB
78histogram_value gimple_histogram_value (struct function *, gimple);
79histogram_value gimple_histogram_value_of_type (struct function *, gimple,
80 enum hist_type);
81void gimple_add_histogram_value (struct function *, gimple, histogram_value);
82void dump_histograms_for_stmt (struct function *, FILE *, gimple);
83void gimple_remove_histogram_value (struct function *, gimple, histogram_value);
84void gimple_remove_stmt_histograms (struct function *, gimple);
85void gimple_duplicate_stmt_histograms (struct function *, gimple,
86 struct function *, gimple);
87void gimple_move_stmt_histograms (struct function *, gimple, gimple);
6946b3f7
JH
88void verify_histograms (void);
89void free_histograms (void);
726a989a 90void stringop_block_profile (gimple, unsigned int *, HOST_WIDE_INT *);
042ae7d2
JH
91gimple gimple_ic (gimple, struct cgraph_node *, int, gcov_type, gcov_type);
92
6946b3f7 93
e0cb7e1e
SB
94/* In tree-profile.c. */
95extern void gimple_init_edge_profiler (void);
96extern void gimple_gen_edge_profiler (int, edge);
97extern void gimple_gen_interval_profiler (histogram_value, unsigned, unsigned);
98extern void gimple_gen_pow2_profiler (histogram_value, unsigned, unsigned);
99extern void gimple_gen_one_value_profiler (histogram_value, unsigned, unsigned);
100extern void gimple_gen_ic_profiler (histogram_value, unsigned, unsigned);
101extern void gimple_gen_ic_func_profiler (void);
86ce5d2f
ML
102extern void gimple_gen_time_profiler (unsigned, unsigned,
103 gimple_stmt_iterator &);
e0cb7e1e
SB
104extern void gimple_gen_const_delta_profiler (histogram_value,
105 unsigned, unsigned);
106extern void gimple_gen_average_profiler (histogram_value, unsigned, unsigned);
107extern void gimple_gen_ior_profiler (histogram_value, unsigned, unsigned);
89ab31c1
JH
108extern void stream_out_histogram_value (struct output_block *, histogram_value);
109extern void stream_in_histogram_value (struct lto_input_block *, gimple);
2fa3d31b
JH
110extern struct cgraph_node* find_func_by_profile_id (int func_id);
111
e0cb7e1e 112
6de9cd9a
DN
113/* In profile.c. */
114extern void init_branch_prob (void);
115extern void branch_prob (void);
116extern void end_branch_prob (void);
6de9cd9a 117
6de9cd9a
DN
118#endif /* GCC_VALUE_PROF_H */
119