1 | /* Flags on basic blocks and edges. |
2 | Copyright (C) 2012-2023 Free Software Foundation, Inc. |
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 | /* This file defines flags that may appear on basic blocks or on |
21 | edges. Source files define DEF_BASIC_BLOCK_FLAG or DEF_EDGE_FLAG |
22 | appropriately before including this file. */ |
23 | |
24 | #if !defined(DEF_BASIC_BLOCK_FLAG) && !defined(DEF_EDGE_FLAG) |
25 | #error "You must define DEF_BASIC_BLOCK_FLAG or DEF_EDGE_FLAG" |
26 | #endif |
27 | |
28 | #ifdef DEF_BASIC_BLOCK_FLAG |
29 | |
30 | /* Masks for basic_block.flags. |
31 | |
32 | The format of this file is: DEF_BASIC_BLOCK_FLAG(NAME, IDX). |
33 | NAME is the name of the basic block flag. A flag BB_#NAME will be |
34 | created and the name is used in dump_edge_info. |
35 | IDX is a sequence number that is used to determine the value |
36 | of the flag, which is 1 << IDX). |
37 | |
38 | BB_HOT_PARTITION and BB_COLD_PARTITION should be preserved throughout |
39 | the compilation, so they are never cleared. |
40 | |
41 | All other flags may be cleared by clear_bb_flags(). It is generally |
42 | a bad idea to rely on any flags being up-to-date. */ |
43 | |
44 | /* Only set on blocks that have just been created by create_bb. */ |
45 | DEF_BASIC_BLOCK_FLAG(NEW, 0) |
46 | |
47 | /* Set by find_unreachable_blocks. Do not rely on this being set in any |
48 | pass. */ |
49 | DEF_BASIC_BLOCK_FLAG(REACHABLE, 1) |
50 | |
51 | /* Set for blocks in an irreducible loop by loop analysis. */ |
52 | DEF_BASIC_BLOCK_FLAG(IRREDUCIBLE_LOOP, 2) |
53 | |
54 | /* Set on blocks that may actually not be single-entry single-exit block. */ |
55 | DEF_BASIC_BLOCK_FLAG(SUPERBLOCK, 3) |
56 | |
57 | /* Set on basic blocks that the scheduler should not touch. This is used |
58 | by SMS to prevent other schedulers from messing with the loop schedule. */ |
59 | DEF_BASIC_BLOCK_FLAG(DISABLE_SCHEDULE, 4) |
60 | |
61 | /* Set on blocks that should be put in a hot section. */ |
62 | DEF_BASIC_BLOCK_FLAG(HOT_PARTITION, 5) |
63 | |
64 | /* Set on blocks that should be put in a cold section. */ |
65 | DEF_BASIC_BLOCK_FLAG(COLD_PARTITION, 6) |
66 | |
67 | /* Set on block that was duplicated. */ |
68 | DEF_BASIC_BLOCK_FLAG(DUPLICATED, 7) |
69 | |
70 | /* Set if the label at the top of this block is the target of a non-local goto. */ |
71 | DEF_BASIC_BLOCK_FLAG(NON_LOCAL_GOTO_TARGET, 8) |
72 | |
73 | /* Set on blocks that are in RTL format. */ |
74 | DEF_BASIC_BLOCK_FLAG(RTL, 9) |
75 | |
76 | /* Set on blocks that are forwarder blocks. |
77 | Only used in cfgcleanup.cc. */ |
78 | DEF_BASIC_BLOCK_FLAG(FORWARDER_BLOCK, 10) |
79 | |
80 | /* Set on blocks that cannot be threaded through. |
81 | Only used for jump threading. */ |
82 | DEF_BASIC_BLOCK_FLAG(NONTHREADABLE_BLOCK, 11) |
83 | |
84 | /* Set on blocks that were modified in some way. This bit is set in |
85 | df_set_bb_dirty, but not cleared by df_analyze, so it can be used |
86 | to test whether a block has been modified prior to a df_analyze call. */ |
87 | DEF_BASIC_BLOCK_FLAG(MODIFIED, 12) |
88 | |
89 | /* A general visited flag for passes to use. */ |
90 | DEF_BASIC_BLOCK_FLAG(VISITED, 13) |
91 | |
92 | /* Set on blocks that are in a transaction. This is calculated on |
93 | demand, and is available after calling compute_transaction_bits(). */ |
94 | DEF_BASIC_BLOCK_FLAG(IN_TRANSACTION, 14) |
95 | |
96 | #endif |
97 | |
98 | #ifdef DEF_EDGE_FLAG |
99 | |
100 | /* Masks for edge.flags. |
101 | |
102 | The format of this file is: DEF_EDGE_FLAG(NAME, IDX, STRING). |
103 | NAME is the name of the edge flag. A flag EDGE_#NAME will be |
104 | created and the name is used in dump_edge_info. |
105 | IDX is a sequence number that is used to determine the value |
106 | of the flag, which is 1 << IDX). */ |
107 | |
108 | /* 'Straight line' flow. In GIMPLE and in cfglayout mode, all normal |
109 | edges are fallthru edges. In cfgrtl mode, this flag really means |
110 | that control flow falls through to the next basic block in the line. */ |
111 | DEF_EDGE_FLAG(FALLTHRU, 0) |
112 | |
113 | /* Strange flow, like a computed jump or exception handling. Usually |
114 | this means that the edge cannot be split. */ |
115 | DEF_EDGE_FLAG(ABNORMAL, 1) |
116 | |
117 | /* Edge out of a basic block that ends with a CALL_INSN with abnormal |
118 | exit, like an exception or a non-local goto. |
119 | ABNORMAL_CALL edges also have ABNORMAL set. |
120 | This flag is only used for the RTL CFG. */ |
121 | DEF_EDGE_FLAG(ABNORMAL_CALL, 2) |
122 | |
123 | /* Exception edge. Exception handling edges represent possible control |
124 | transfers from a trapping instruction to an exception handler. |
125 | EH edges also have ABNORMAL set for the RTL CFG. */ |
126 | DEF_EDGE_FLAG(EH, 3) |
127 | |
128 | /* Never merge blocks via this edge. This is used for exception handling, |
129 | to prevent merging away edges to the post-landing-pad basic block. |
130 | This flag is only used for the RTL CFG. */ |
131 | DEF_EDGE_FLAG(PRESERVE, 4) |
132 | |
133 | /* Not a real edge. This is used to connect parts of the CFG that do |
134 | not halt, such as infinite loops and noreturn functions, to the |
135 | EXIT_BLOCK, so that traversing of the reverse CFG is possible. */ |
136 | DEF_EDGE_FLAG(FAKE, 5) |
137 | |
138 | /* A back edge, marked in a depth-first search of the CFG. Back edges |
139 | are hints that this edge may be part of a loop in the CFG. */ |
140 | DEF_EDGE_FLAG(DFS_BACK, 6) |
141 | |
142 | /* Edge in a part of the CFG that is an irreducible loop. */ |
143 | DEF_EDGE_FLAG(IRREDUCIBLE_LOOP, 7) |
144 | |
145 | /* Edge taken when controlling predicate is nonzero. |
146 | This is only used for the GIMPLE CFG. */ |
147 | DEF_EDGE_FLAG(TRUE_VALUE, 8) |
148 | |
149 | /* Edge taken when controlling predicate is zero. |
150 | This is only used for the GIMPLE CFG. */ |
151 | DEF_EDGE_FLAG(FALSE_VALUE, 9) |
152 | |
153 | /* Edge is executable. This is only used in GIMPLE SSA-CCP and VRP. |
154 | This is only used for the GIMPLE CFG. */ |
155 | DEF_EDGE_FLAG(EXECUTABLE, 10) |
156 | |
157 | /* Edge crosses between hot and cold sections, when we do partitioning. |
158 | This flag is only used for the RTL CFG. */ |
159 | DEF_EDGE_FLAG(CROSSING, 11) |
160 | |
161 | /* Edge from a sibcall CALL_INSN to exit. |
162 | SIBCALL edges also have ABNORMAL set. |
163 | This flag is only used for the RTL CFG. */ |
164 | DEF_EDGE_FLAG(SIBCALL, 12) |
165 | |
166 | /* Candidate for straight line flow. Only used in bb-reorder.cc. |
167 | This flag is only used for the RTL CFG. */ |
168 | DEF_EDGE_FLAG(CAN_FALLTHRU, 13) |
169 | |
170 | /* Exit of a loop. This is only used in ifcvt.cc. |
171 | This flag is only used for the RTL CFG. */ |
172 | DEF_EDGE_FLAG(LOOP_EXIT, 14) |
173 | |
174 | /* Uninstrumented edge out of a GIMPLE_TRANSACTION statement. */ |
175 | DEF_EDGE_FLAG(TM_UNINSTRUMENTED, 15) |
176 | |
177 | /* Abort (over) edge out of a GIMPLE_TRANSACTION statement. */ |
178 | DEF_EDGE_FLAG(TM_ABORT, 16) |
179 | |
180 | /* An edge we should ignore. It should be entirely local to |
181 | passes. ie, it is never set on any edge upon the completion |
182 | of any pass. */ |
183 | DEF_EDGE_FLAG(IGNORE, 17) |
184 | |
185 | #endif |
186 | |
187 | /* |
188 | Local variables: |
189 | mode:c |
190 | End: |
191 | */ |
192 | |