Mercurial > hg > CbC > CbC_gcc
annotate gcc/value-prof.h @ 127:4c56639505ff
fix function.c and add CbC-example Makefile
author | mir3636 |
---|---|
date | Wed, 11 Apr 2018 18:46:58 +0900 |
parents | 04ced10e8804 |
children | 84e7813d76e9 |
rev | line source |
---|---|
0 | 1 /* Definitions for transformations based on profile information for values. |
111 | 2 Copyright (C) 2003-2017 Free Software Foundation, Inc. |
0 | 3 |
4 This file is part of GCC. | |
5 | |
6 GCC is free software; you can redistribute it and/or modify it under | |
7 the terms of the GNU General Public License as published by the Free | |
8 Software Foundation; either version 3, or (at your option) any later | |
9 version. | |
10 | |
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GCC; see the file COPYING3. If not see | |
18 <http://www.gnu.org/licenses/>. */ | |
19 | |
20 #ifndef GCC_VALUE_PROF_H | |
21 #define GCC_VALUE_PROF_H | |
22 | |
23 /* Supported histogram types. */ | |
24 enum 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. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
31 HIST_TYPE_INDIR_CALL, /* Tries to identify the function that is (almost) |
0 | 32 called in indirect call */ |
33 HIST_TYPE_AVERAGE, /* Compute average value (sum of all values). */ | |
111 | 34 HIST_TYPE_IOR, /* Used to compute expected alignment. */ |
35 HIST_TYPE_TIME_PROFILE, /* Used for time profile */ | |
36 HIST_TYPE_INDIR_CALL_TOPN, /* Tries to identify the top N most frequently | |
37 called functions in indirect call. */ | |
38 HIST_TYPE_MAX | |
0 | 39 }; |
40 | |
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 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
45 |
0 | 46 /* The value to measure. */ |
47 struct histogram_value_t | |
48 { | |
49 struct | |
50 { | |
51 tree value; /* The value to profile. */ | |
111 | 52 gimple *stmt; /* Insn containing the value. */ |
0 | 53 gcov_type *counters; /* Pointer to first counter. */ |
54 struct histogram_value_t *next; /* Linked list pointer. */ | |
55 } hvalue; | |
56 enum hist_type type; /* Type of information to measure. */ | |
57 unsigned n_counters; /* Number of required counters. */ | |
111 | 58 struct function *fun; |
0 | 59 union |
60 { | |
61 struct | |
62 { | |
63 int int_start; /* First value in interval. */ | |
64 unsigned int steps; /* Number of values in it. */ | |
65 } intvl; /* Interval histogram data. */ | |
66 } hdata; /* Profiled information specific data. */ | |
67 }; | |
68 | |
69 typedef struct histogram_value_t *histogram_value; | |
70 typedef const struct histogram_value_t *const_histogram_value; | |
71 | |
72 | |
111 | 73 typedef vec<histogram_value> histogram_values; |
0 | 74 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
75 extern void gimple_find_values_to_profile (histogram_values *); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
76 extern bool gimple_value_profile_transformations (void); |
0 | 77 |
111 | 78 histogram_value gimple_alloc_histogram_value (struct function *, enum hist_type, |
79 gimple *stmt, tree); | |
80 histogram_value gimple_histogram_value (struct function *, gimple *); | |
81 histogram_value gimple_histogram_value_of_type (struct function *, gimple *, | |
0 | 82 enum hist_type); |
111 | 83 void gimple_add_histogram_value (struct function *, gimple *, histogram_value); |
84 void dump_histograms_for_stmt (struct function *, FILE *, gimple *); | |
85 void gimple_remove_histogram_value (struct function *, gimple *, histogram_value); | |
86 void gimple_remove_stmt_histograms (struct function *, gimple *); | |
87 void gimple_duplicate_stmt_histograms (struct function *, gimple *, | |
88 struct function *, gimple *); | |
89 void gimple_move_stmt_histograms (struct function *, gimple *, gimple *); | |
0 | 90 void verify_histograms (void); |
111 | 91 void free_histograms (function *); |
92 void stringop_block_profile (gimple *, unsigned int *, HOST_WIDE_INT *); | |
93 gcall *gimple_ic (gcall *, struct cgraph_node *, profile_probability, | |
94 profile_count, profile_count); | |
95 bool check_ic_target (gcall *, struct cgraph_node *); | |
96 | |
0 | 97 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
98 /* In tree-profile.c. */ |
111 | 99 extern void gimple_init_gcov_profiler (void); |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
100 extern void gimple_gen_edge_profiler (int, edge); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
101 extern void gimple_gen_interval_profiler (histogram_value, unsigned, unsigned); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
102 extern void gimple_gen_pow2_profiler (histogram_value, unsigned, unsigned); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
103 extern void gimple_gen_one_value_profiler (histogram_value, unsigned, unsigned); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
104 extern void gimple_gen_ic_profiler (histogram_value, unsigned, unsigned); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
105 extern void gimple_gen_ic_func_profiler (void); |
111 | 106 extern void gimple_gen_time_profiler (unsigned, unsigned); |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
107 extern void gimple_gen_average_profiler (histogram_value, unsigned, unsigned); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
108 extern void gimple_gen_ior_profiler (histogram_value, unsigned, unsigned); |
111 | 109 extern void stream_out_histogram_value (struct output_block *, histogram_value); |
110 extern void stream_in_histogram_value (struct lto_input_block *, gimple *); | |
111 extern struct cgraph_node* find_func_by_profile_id (int func_id); | |
112 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
113 |
0 | 114 /* In profile.c. */ |
115 extern void init_branch_prob (void); | |
116 extern void branch_prob (void); | |
117 extern void end_branch_prob (void); | |
118 | |
119 #endif /* GCC_VALUE_PROF_H */ | |
120 |