Mercurial > hg > CbC > CbC_gcc
comparison gcc/cfghooks.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Hooks for cfg representation specific functions. | 1 /* Hooks for cfg representation specific functions. |
2 Copyright (C) 2003-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2003-2020 Free Software Foundation, Inc. |
3 Contributed by Sebastian Pop <s.pop@laposte.net> | 3 Contributed by Sebastian Pop <s.pop@laposte.net> |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify | 7 GCC is free software; you can redistribute it and/or modify |
36 and one CFG hook per CFG mode. */ | 36 and one CFG hook per CFG mode. */ |
37 struct profile_record | 37 struct profile_record |
38 { | 38 { |
39 /* The number of basic blocks where sum(freq) of the block's predecessors | 39 /* The number of basic blocks where sum(freq) of the block's predecessors |
40 doesn't match reasonably well with the incoming frequency. */ | 40 doesn't match reasonably well with the incoming frequency. */ |
41 int num_mismatched_freq_in[2]; | 41 int num_mismatched_freq_in; |
42 /* Likewise for a basic block's successors. */ | 42 /* Likewise for a basic block's successors. */ |
43 int num_mismatched_freq_out[2]; | 43 int num_mismatched_freq_out; |
44 /* The number of basic blocks where sum(count) of the block's predecessors | 44 /* The number of basic blocks where sum(count) of the block's predecessors |
45 doesn't match reasonably well with the incoming frequency. */ | 45 doesn't match reasonably well with the incoming frequency. */ |
46 int num_mismatched_count_in[2]; | 46 int num_mismatched_count_in; |
47 /* Likewise for a basic block's successors. */ | 47 /* Likewise for a basic block's successors. */ |
48 int num_mismatched_count_out[2]; | 48 int num_mismatched_count_out; |
49 /* A weighted cost of the run-time of the function body. */ | 49 /* A weighted cost of the run-time of the function body. */ |
50 gcov_type time[2]; | 50 gcov_type_unsigned time; |
51 /* A weighted cost of the size of the function body. */ | 51 /* A weighted cost of the size of the function body. */ |
52 int size[2]; | 52 int size; |
53 /* True iff this pass actually was run. */ | 53 /* True iff this pass actually was run. */ |
54 bool run; | 54 bool run; |
55 }; | 55 }; |
56 | 56 |
57 typedef int_hash <unsigned short, 0> dependence_hash; | |
58 | |
59 /* Optional data for duplicate_block. */ | |
60 | |
61 class copy_bb_data | |
62 { | |
63 public: | |
64 copy_bb_data() : dependence_map (NULL) {} | |
65 ~copy_bb_data () { delete dependence_map; } | |
66 | |
67 /* A map from the copied BBs dependence info cliques to | |
68 equivalents in the BBs duplicated to. */ | |
69 hash_map<dependence_hash, unsigned short> *dependence_map; | |
70 }; | |
57 | 71 |
58 struct cfg_hooks | 72 struct cfg_hooks |
59 { | 73 { |
60 /* Name of the corresponding ir. */ | 74 /* Name of the corresponding ir. */ |
61 const char *name; | 75 const char *name; |
110 | 124 |
111 /* Return true when block A can be duplicated. */ | 125 /* Return true when block A can be duplicated. */ |
112 bool (*can_duplicate_block_p) (const_basic_block a); | 126 bool (*can_duplicate_block_p) (const_basic_block a); |
113 | 127 |
114 /* Duplicate block A. */ | 128 /* Duplicate block A. */ |
115 basic_block (*duplicate_block) (basic_block a); | 129 basic_block (*duplicate_block) (basic_block a, copy_bb_data *); |
116 | 130 |
117 /* Higher level functions representable by primitive operations above if | 131 /* Higher level functions representable by primitive operations above if |
118 we didn't have some oddities in RTL and Tree representations. */ | 132 we didn't have some oddities in RTL and Tree representations. */ |
119 basic_block (*split_edge) (edge); | 133 basic_block (*split_edge) (edge); |
120 void (*make_forwarder_block) (edge); | 134 void (*make_forwarder_block) (edge); |
150 the edge vector E->dest->preds. */ | 164 the edge vector E->dest->preds. */ |
151 void (*execute_on_shrinking_pred) (edge); | 165 void (*execute_on_shrinking_pred) (edge); |
152 | 166 |
153 /* A hook for duplicating loop in CFG, currently this is used | 167 /* A hook for duplicating loop in CFG, currently this is used |
154 in loop versioning. */ | 168 in loop versioning. */ |
155 bool (*cfg_hook_duplicate_loop_to_header_edge) (struct loop *, edge, | 169 bool (*cfg_hook_duplicate_loop_to_header_edge) (class loop *, edge, |
156 unsigned, sbitmap, | 170 unsigned, sbitmap, |
157 edge, vec<edge> *, | 171 edge, vec<edge> *, |
158 int); | 172 int); |
159 | 173 |
160 /* Add condition to new basic block and update CFG used in loop | 174 /* Add condition to new basic block and update CFG used in loop |
180 /* Split a basic block if it ends with a conditional branch and if | 194 /* Split a basic block if it ends with a conditional branch and if |
181 the other part of the block is not empty. */ | 195 the other part of the block is not empty. */ |
182 basic_block (*split_block_before_cond_jump) (basic_block); | 196 basic_block (*split_block_before_cond_jump) (basic_block); |
183 | 197 |
184 /* Do book-keeping of a basic block for the profile consistency checker. */ | 198 /* Do book-keeping of a basic block for the profile consistency checker. */ |
185 void (*account_profile_record) (basic_block, int, struct profile_record *); | 199 void (*account_profile_record) (basic_block, struct profile_record *); |
186 }; | 200 }; |
187 | 201 |
188 extern void verify_flow_info (void); | 202 extern void verify_flow_info (void); |
189 | 203 |
190 /* Check control flow invariants, if internal consistency checks are | 204 /* Check control flow invariants, if internal consistency checks are |
225 extern void tidy_fallthru_edge (edge); | 239 extern void tidy_fallthru_edge (edge); |
226 extern void tidy_fallthru_edges (void); | 240 extern void tidy_fallthru_edges (void); |
227 extern void predict_edge (edge e, enum br_predictor predictor, int probability); | 241 extern void predict_edge (edge e, enum br_predictor predictor, int probability); |
228 extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor); | 242 extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor); |
229 extern bool can_duplicate_block_p (const_basic_block); | 243 extern bool can_duplicate_block_p (const_basic_block); |
230 extern basic_block duplicate_block (basic_block, edge, basic_block); | 244 extern basic_block duplicate_block (basic_block, edge, basic_block, |
245 copy_bb_data * = NULL); | |
231 extern bool block_ends_with_call_p (basic_block bb); | 246 extern bool block_ends_with_call_p (basic_block bb); |
232 extern bool empty_block_p (basic_block); | 247 extern bool empty_block_p (basic_block); |
233 extern basic_block split_block_before_cond_jump (basic_block); | 248 extern basic_block split_block_before_cond_jump (basic_block); |
234 extern bool block_ends_with_condjump_p (const_basic_block bb); | 249 extern bool block_ends_with_condjump_p (const_basic_block bb); |
235 extern int flow_call_edges_add (sbitmap); | 250 extern int flow_call_edges_add (sbitmap); |
236 extern void execute_on_growing_pred (edge); | 251 extern void execute_on_growing_pred (edge); |
237 extern void execute_on_shrinking_pred (edge); | 252 extern void execute_on_shrinking_pred (edge); |
238 extern bool cfg_hook_duplicate_loop_to_header_edge (struct loop *loop, edge, | 253 extern bool cfg_hook_duplicate_loop_to_header_edge (class loop *loop, edge, |
239 unsigned int ndupl, | 254 unsigned int ndupl, |
240 sbitmap wont_exit, | 255 sbitmap wont_exit, |
241 edge orig, | 256 edge orig, |
242 vec<edge> *to_remove, | 257 vec<edge> *to_remove, |
243 int flags); | 258 int flags); |
249 extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block, | 264 extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block, |
250 void *); | 265 void *); |
251 | 266 |
252 extern bool can_copy_bbs_p (basic_block *, unsigned); | 267 extern bool can_copy_bbs_p (basic_block *, unsigned); |
253 extern void copy_bbs (basic_block *, unsigned, basic_block *, | 268 extern void copy_bbs (basic_block *, unsigned, basic_block *, |
254 edge *, unsigned, edge *, struct loop *, | 269 edge *, unsigned, edge *, class loop *, |
255 basic_block, bool); | 270 basic_block, bool); |
256 | 271 |
257 void account_profile_record (struct profile_record *, int); | 272 void profile_record_check_consistency (profile_record *); |
273 void profile_record_account_profile (profile_record *); | |
258 | 274 |
259 /* Hooks containers. */ | 275 /* Hooks containers. */ |
260 extern struct cfg_hooks gimple_cfg_hooks; | 276 extern struct cfg_hooks gimple_cfg_hooks; |
261 extern struct cfg_hooks rtl_cfg_hooks; | 277 extern struct cfg_hooks rtl_cfg_hooks; |
262 extern struct cfg_hooks cfg_layout_rtl_cfg_hooks; | 278 extern struct cfg_hooks cfg_layout_rtl_cfg_hooks; |