annotate gcc/cfghooks.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Hooks for cfg representation specific functions.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2003-2020 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 Contributed by Sebastian Pop <s.pop@laposte.net>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #ifndef GCC_CFGHOOKS_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #define GCC_CFGHOOKS_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
111
kono
parents: 55
diff changeset
24 #include "predict.h"
kono
parents: 55
diff changeset
25
kono
parents: 55
diff changeset
26 /* Structure to gather statistic about profile consistency, per pass.
kono
parents: 55
diff changeset
27 An array of this structure, indexed by pass static number, is allocated
kono
parents: 55
diff changeset
28 in passes.c. The structure is defined here so that different CFG modes
kono
parents: 55
diff changeset
29 can do their book-keeping via CFG hooks.
kono
parents: 55
diff changeset
30
kono
parents: 55
diff changeset
31 For every field[2], field[0] is the count before the pass runs, and
kono
parents: 55
diff changeset
32 field[1] is the post-pass count. This allows us to monitor the effect
kono
parents: 55
diff changeset
33 of each individual pass on the profile consistency.
kono
parents: 55
diff changeset
34
kono
parents: 55
diff changeset
35 This structure is not supposed to be used by anything other than passes.c
kono
parents: 55
diff changeset
36 and one CFG hook per CFG mode. */
kono
parents: 55
diff changeset
37 struct profile_record
kono
parents: 55
diff changeset
38 {
kono
parents: 55
diff changeset
39 /* The number of basic blocks where sum(freq) of the block's predecessors
kono
parents: 55
diff changeset
40 doesn't match reasonably well with the incoming frequency. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
41 int num_mismatched_freq_in;
111
kono
parents: 55
diff changeset
42 /* Likewise for a basic block's successors. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
43 int num_mismatched_freq_out;
111
kono
parents: 55
diff changeset
44 /* The number of basic blocks where sum(count) of the block's predecessors
kono
parents: 55
diff changeset
45 doesn't match reasonably well with the incoming frequency. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
46 int num_mismatched_count_in;
111
kono
parents: 55
diff changeset
47 /* Likewise for a basic block's successors. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
48 int num_mismatched_count_out;
111
kono
parents: 55
diff changeset
49 /* A weighted cost of the run-time of the function body. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
50 gcov_type_unsigned time;
111
kono
parents: 55
diff changeset
51 /* A weighted cost of the size of the function body. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
52 int size;
111
kono
parents: 55
diff changeset
53 /* True iff this pass actually was run. */
kono
parents: 55
diff changeset
54 bool run;
kono
parents: 55
diff changeset
55 };
kono
parents: 55
diff changeset
56
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
57 typedef int_hash <unsigned short, 0> dependence_hash;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
58
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
59 /* Optional data for duplicate_block. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
60
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
61 class copy_bb_data
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
62 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
63 public:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
64 copy_bb_data() : dependence_map (NULL) {}
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
65 ~copy_bb_data () { delete dependence_map; }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
66
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
67 /* A map from the copied BBs dependence info cliques to
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
68 equivalents in the BBs duplicated to. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
69 hash_map<dependence_hash, unsigned short> *dependence_map;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
70 };
111
kono
parents: 55
diff changeset
71
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 struct cfg_hooks
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 /* Name of the corresponding ir. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 const char *name;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 /* Debugging. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 int (*verify_flow_info) (void);
111
kono
parents: 55
diff changeset
79 void (*dump_bb) (FILE *, basic_block, int, dump_flags_t);
kono
parents: 55
diff changeset
80 void (*dump_bb_for_graph) (pretty_printer *, basic_block);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 /* Basic CFG manipulation. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 /* Return new basic block. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 basic_block (*create_basic_block) (void *head, void *end, basic_block after);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 /* Redirect edge E to the given basic block B and update underlying program
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 representation. Returns edge representing redirected branch (that may not
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 be equivalent to E in the case of duplicate edges being removed) or NULL
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 if edge is not easily redirectable for whatever reason. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 edge (*redirect_edge_and_branch) (edge e, basic_block b);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 /* Same as the above but allows redirecting of fallthru edges. In that case
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 newly created forwarder basic block is returned. The edge must
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 not be abnormal. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 basic_block (*redirect_edge_and_branch_force) (edge, basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 /* Returns true if it is possible to remove the edge by redirecting it
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 to the destination of the other edge going from its source. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 bool (*can_remove_branch_p) (const_edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 /* Remove statements corresponding to a given basic block. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 void (*delete_basic_block) (basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 /* Creates a new basic block just after basic block B by splitting
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 everything after specified instruction I. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 basic_block (*split_block) (basic_block b, void * i);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
108
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 /* Move block B immediately after block A. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 bool (*move_block_after) (basic_block b, basic_block a);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 /* Return true when blocks A and B can be merged into single basic block. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 bool (*can_merge_blocks_p) (basic_block a, basic_block b);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 /* Merge blocks A and B. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 void (*merge_blocks) (basic_block a, basic_block b);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 /* Predict edge E using PREDICTOR to given PROBABILITY. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 void (*predict_edge) (edge e, enum br_predictor predictor, int probability);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 /* Return true if the one of outgoing edges is already predicted by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 PREDICTOR. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 bool (*predicted_by_p) (const_basic_block bb, enum br_predictor predictor);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 /* Return true when block A can be duplicated. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 bool (*can_duplicate_block_p) (const_basic_block a);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 /* Duplicate block A. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
129 basic_block (*duplicate_block) (basic_block a, copy_bb_data *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 /* Higher level functions representable by primitive operations above if
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 we didn't have some oddities in RTL and Tree representations. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 basic_block (*split_edge) (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 void (*make_forwarder_block) (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
111
kono
parents: 55
diff changeset
136 /* Try to make the edge fallthru. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 void (*tidy_fallthru_edge) (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138
111
kono
parents: 55
diff changeset
139 /* Make the edge non-fallthru. */
kono
parents: 55
diff changeset
140 basic_block (*force_nonfallthru) (edge);
kono
parents: 55
diff changeset
141
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 /* Say whether a block ends with a call, possibly followed by some
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 other code that must stay with the call. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 bool (*block_ends_with_call_p) (basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 /* Say whether a block ends with a conditional branch. Switches
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 and unconditional branches do not qualify. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 bool (*block_ends_with_condjump_p) (const_basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 /* Add fake edges to the function exit for any non constant and non noreturn
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 calls, volatile inline assembly in the bitmap of blocks specified by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 BLOCKS or to the whole CFG if BLOCKS is zero. Return the number of blocks
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 that were split.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 The goal is to expose cases in which entering a basic block does not imply
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 that all subsequent instructions must be executed. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 int (*flow_call_edges_add) (sbitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 /* This function is called immediately after edge E is added to the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 edge vector E->dest->preds. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 void (*execute_on_growing_pred) (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 /* This function is called immediately before edge E is removed from
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 the edge vector E->dest->preds. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 void (*execute_on_shrinking_pred) (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 /* A hook for duplicating loop in CFG, currently this is used
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 in loop versioning. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
169 bool (*cfg_hook_duplicate_loop_to_header_edge) (class loop *, edge,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 unsigned, sbitmap,
111
kono
parents: 55
diff changeset
171 edge, vec<edge> *,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 int);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 /* Add condition to new basic block and update CFG used in loop
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 versioning. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 void (*lv_add_condition_to_bb) (basic_block, basic_block, basic_block,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 /* Update the PHI nodes in case of loop versioning. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 void (*lv_adjust_loop_header_phi) (basic_block, basic_block,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 basic_block, edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 /* Given a condition BB extract the true/false taken/not taken edges
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 (depending if we are on tree's or RTL). */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 void (*extract_cond_bb_edges) (basic_block, edge *, edge *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 /* Add PHI arguments queued in PENDINT_STMT list on edge E to edge
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 E->dest (only in tree-ssa loop versioning. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 void (*flush_pending_stmts) (edge);
111
kono
parents: 55
diff changeset
190
kono
parents: 55
diff changeset
191 /* True if a block contains no executable instructions. */
kono
parents: 55
diff changeset
192 bool (*empty_block_p) (basic_block);
kono
parents: 55
diff changeset
193
kono
parents: 55
diff changeset
194 /* Split a basic block if it ends with a conditional branch and if
kono
parents: 55
diff changeset
195 the other part of the block is not empty. */
kono
parents: 55
diff changeset
196 basic_block (*split_block_before_cond_jump) (basic_block);
kono
parents: 55
diff changeset
197
kono
parents: 55
diff changeset
198 /* Do book-keeping of a basic block for the profile consistency checker. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
199 void (*account_profile_record) (basic_block, struct profile_record *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 extern void verify_flow_info (void);
111
kono
parents: 55
diff changeset
203
kono
parents: 55
diff changeset
204 /* Check control flow invariants, if internal consistency checks are
kono
parents: 55
diff changeset
205 enabled. */
kono
parents: 55
diff changeset
206
kono
parents: 55
diff changeset
207 static inline void
kono
parents: 55
diff changeset
208 checking_verify_flow_info (void)
kono
parents: 55
diff changeset
209 {
kono
parents: 55
diff changeset
210 /* TODO: Add a separate option for -fchecking=cfg. */
kono
parents: 55
diff changeset
211 if (flag_checking)
kono
parents: 55
diff changeset
212 verify_flow_info ();
kono
parents: 55
diff changeset
213 }
kono
parents: 55
diff changeset
214
kono
parents: 55
diff changeset
215 extern void dump_bb (FILE *, basic_block, int, dump_flags_t);
kono
parents: 55
diff changeset
216 extern void dump_bb_for_graph (pretty_printer *, basic_block);
kono
parents: 55
diff changeset
217 extern void dump_flow_info (FILE *, dump_flags_t);
kono
parents: 55
diff changeset
218
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 extern edge redirect_edge_and_branch (edge, basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 extern basic_block redirect_edge_and_branch_force (edge, basic_block);
111
kono
parents: 55
diff changeset
221 extern edge redirect_edge_succ_nodup (edge, basic_block);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 extern bool can_remove_branch_p (const_edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 extern void remove_branch (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 extern void remove_edge (edge);
111
kono
parents: 55
diff changeset
225 extern edge split_block (basic_block, rtx);
kono
parents: 55
diff changeset
226 extern edge split_block (basic_block, gimple *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 extern edge split_block_after_labels (basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 extern bool move_block_after (basic_block, basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 extern void delete_basic_block (basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 extern basic_block split_edge (edge);
111
kono
parents: 55
diff changeset
231 extern basic_block create_basic_block (rtx, rtx, basic_block);
kono
parents: 55
diff changeset
232 extern basic_block create_basic_block (gimple_seq, basic_block);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 extern basic_block create_empty_bb (basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 extern bool can_merge_blocks_p (basic_block, basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 extern void merge_blocks (basic_block, basic_block);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 extern edge make_forwarder_block (basic_block, bool (*)(edge),
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
237 void (*) (basic_block));
111
kono
parents: 55
diff changeset
238 extern basic_block force_nonfallthru (edge);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239 extern void tidy_fallthru_edge (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 extern void tidy_fallthru_edges (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 extern void predict_edge (edge e, enum br_predictor predictor, int probability);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242 extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 extern bool can_duplicate_block_p (const_basic_block);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
244 extern basic_block duplicate_block (basic_block, edge, basic_block,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
245 copy_bb_data * = NULL);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 extern bool block_ends_with_call_p (basic_block bb);
111
kono
parents: 55
diff changeset
247 extern bool empty_block_p (basic_block);
kono
parents: 55
diff changeset
248 extern basic_block split_block_before_cond_jump (basic_block);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 extern bool block_ends_with_condjump_p (const_basic_block bb);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 extern int flow_call_edges_add (sbitmap);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 extern void execute_on_growing_pred (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 extern void execute_on_shrinking_pred (edge);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
253 extern bool cfg_hook_duplicate_loop_to_header_edge (class loop *loop, edge,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 unsigned int ndupl,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 sbitmap wont_exit,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 edge orig,
111
kono
parents: 55
diff changeset
257 vec<edge> *to_remove,
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 int flags);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 extern void lv_flush_pending_stmts (edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 extern void extract_cond_bb_edges (basic_block, edge *, edge*);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 extern void lv_adjust_loop_header_phi (basic_block, basic_block, basic_block,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 edge);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 void *);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266
111
kono
parents: 55
diff changeset
267 extern bool can_copy_bbs_p (basic_block *, unsigned);
kono
parents: 55
diff changeset
268 extern void copy_bbs (basic_block *, unsigned, basic_block *,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
269 edge *, unsigned, edge *, class loop *,
111
kono
parents: 55
diff changeset
270 basic_block, bool);
kono
parents: 55
diff changeset
271
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
272 void profile_record_check_consistency (profile_record *);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
273 void profile_record_account_profile (profile_record *);
111
kono
parents: 55
diff changeset
274
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 /* Hooks containers. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 extern struct cfg_hooks gimple_cfg_hooks;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 extern struct cfg_hooks rtl_cfg_hooks;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 extern struct cfg_hooks cfg_layout_rtl_cfg_hooks;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 /* Declarations. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 extern enum ir_type current_ir_type (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 extern void rtl_register_cfg_hooks (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 extern void cfg_layout_rtl_register_cfg_hooks (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 extern void gimple_register_cfg_hooks (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 extern struct cfg_hooks get_cfg_hooks (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 extern void set_cfg_hooks (struct cfg_hooks);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287
111
kono
parents: 55
diff changeset
288 #endif /* GCC_CFGHOOKS_H */