20#ifndef GCC_BASIC_BLOCK_H
21#define GCC_BASIC_BLOCK_H
56#define DEF_EDGE_FLAG(NAME,IDX) EDGE_##NAME = 1 << IDX ,
58#include "cfg-flags.def"
64#define EDGE_ALL_FLAGS ((LAST_CFG_EDGE_FLAG - 1) * 2 - 1)
70 (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH | EDGE_PRESERVE)
123 void *
GTY ((skip (
""))) aux;
141 }
GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il;
158#define BB_FREQ_MAX 10000
161#define DEF_BASIC_BLOCK_FLAG(NAME,IDX) BB_##NAME = 1 << IDX ,
164#include "cfg-flags.def"
167#undef DEF_BASIC_BLOCK_FLAG
170#define BB_ALL_FLAGS ((LAST_CFG_BB_FLAG - 1) * 2 - 1)
174#define BB_FLAGS_TO_PRESERVE \
175 (BB_DISABLE_SCHEDULE | BB_RTL | BB_NON_LOCAL_GOTO_TARGET \
176 | BB_HOT_PARTITION | BB_COLD_PARTITION)
179#define BB_UNPARTITIONED 0
183#define BB_PARTITION(bb) ((bb)->flags & (BB_HOT_PARTITION|BB_COLD_PARTITION))
184#define BB_SET_PARTITION(bb, part) do { \
185 basic_block bb_ = (bb); \
186 bb_->flags = ((bb_->flags & ~(BB_HOT_PARTITION|BB_COLD_PARTITION)) \
190#define BB_COPY_PARTITION(dstbb, srcbb) \
191 BB_SET_PARTITION (dstbb, BB_PARTITION (srcbb))
194#define ENTRY_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_entry_block_ptr)
195#define EXIT_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_exit_block_ptr)
196#define basic_block_info_for_fn(FN) ((FN)->cfg->x_basic_block_info)
197#define n_basic_blocks_for_fn(FN) ((FN)->cfg->x_n_basic_blocks)
198#define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges)
199#define last_basic_block_for_fn(FN) ((FN)->cfg->x_last_basic_block)
200#define label_to_block_map_for_fn(FN) ((FN)->cfg->x_label_to_block_map)
201#define profile_status_for_fn(FN) ((FN)->cfg->x_profile_status)
203#define BASIC_BLOCK_FOR_FN(FN,N) \
204 ((*basic_block_info_for_fn (FN))[(N)])
205#define SET_BASIC_BLOCK_FOR_FN(FN,N,BB) \
206 ((*basic_block_info_for_fn (FN))[(N)] = (BB))
209#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
210 for (BB = FROM; BB != TO; BB = BB->DIR)
212#define FOR_EACH_BB_FN(BB, FN) \
213 FOR_BB_BETWEEN (BB, (FN)->cfg->x_entry_block_ptr->next_bb, (FN)->cfg->x_exit_block_ptr, next_bb)
215#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
216 FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)
219#define FOR_BB_INSNS(BB, INSN) \
220 for ((INSN) = BB_HEAD (BB); \
221 (INSN) && (INSN) != NEXT_INSN (BB_END (BB)); \
222 (INSN) = NEXT_INSN (INSN))
226#define FOR_BB_INSNS_SAFE(BB, INSN, CURR) \
227 for ((INSN) = BB_HEAD (BB), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL; \
228 (INSN) && (INSN) != NEXT_INSN (BB_END (BB)); \
229 (INSN) = (CURR), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL)
231#define FOR_BB_INSNS_REVERSE(BB, INSN) \
232 for ((INSN) = BB_END (BB); \
233 (INSN) && (INSN) != PREV_INSN (BB_HEAD (BB)); \
234 (INSN) = PREV_INSN (INSN))
236#define FOR_BB_INSNS_REVERSE_SAFE(BB, INSN, CURR) \
237 for ((INSN) = BB_END (BB),(CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL; \
238 (INSN) && (INSN) != PREV_INSN (BB_HEAD (BB)); \
239 (INSN) = (CURR), (CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL)
244#define FOR_ALL_BB_FN(BB, FN) \
245 for (BB = ENTRY_BLOCK_PTR_FOR_FN (FN); BB; BB = BB->next_bb)
254#define BB_HEAD(B) (B)->il.x.head_
255#define BB_END(B) (B)->il.x.rtl->end_
256#define BB_HEADER(B) (B)->il.x.rtl->header_
257#define BB_FOOTER(B) (B)->il.x.rtl->footer_
261#define ENTRY_BLOCK (0)
262#define EXIT_BLOCK (1)
265#define NUM_FIXED_BLOCKS (2)
268#define EDGE_INDEX_NO_EDGE -1
272#define EDGE_INDEX(el, pred, succ) (find_edge_index ((el), (pred), (succ)))
276#define INDEX_EDGE_PRED_BB(el, index) ((el)->index_to_edge[(index)]->src)
277#define INDEX_EDGE_SUCC_BB(el, index) ((el)->index_to_edge[(index)]->dest)
280#define INDEX_EDGE(el, index) ((el)->index_to_edge[(index)])
283#define NUM_EDGES(el) ((el)->num_edges)
286#define FALLTHRU_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
287 ? EDGE_SUCC ((bb), 0) : EDGE_SUCC ((bb), 1))
290#define BRANCH_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
291 ? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0))
294#define EDGE_FREQUENCY(e) e->count ().to_frequency (cfun)
298#define GCOV_COMPUTE_SCALE(num,den) \
299 ((den) ? RDIV ((num) * REG_BR_PROB_BASE, (den)) : REG_BR_PROB_BASE)
302#define EDGE_CRITICAL_P(e) (EDGE_COUNT ((e)->src->succs) >= 2 \
303 && EDGE_COUNT ((e)->dest->preds) >= 2)
305#define EDGE_COUNT(ev) vec_safe_length (ev)
306#define EDGE_I(ev,i) (*ev)[(i)]
307#define EDGE_PRED(bb,i) (*(bb)->preds)[(i)]
308#define EDGE_SUCC(bb,i) (*(bb)->succs)[(i)]
378#define ei_start(iter) ei_start_1 (&(iter))
379#define ei_last(iter) ei_last_1 (&(iter))
487#define FOR_EACH_EDGE(EDGE,ITER,EDGE_VEC) \
488 for ((ITER) = ei_start ((EDGE_VEC)); \
489 ei_cond ((ITER), &(EDGE)); \
492#define CLEANUP_EXPENSIVE 1
494#define CLEANUP_CROSSJUMP 2
495#define CLEANUP_POST_REGSTACK 4
497#define CLEANUP_THREADING 8
498#define CLEANUP_NO_INSN_DEL 16
500#define CLEANUP_CFGLAYOUT 32
501#define CLEANUP_CFG_CHANGED 64
502#define CLEANUP_NO_PARTITIONING 128
503#define CLEANUP_FORCE_FAST_DCE 0x100
511 return bb->
flags & BB_IN_TRANSACTION;
523 if (e->flags & EDGE_EH)
538 if (e->flags & EDGE_ABNORMAL)
552 if (e->flags & EDGE_FALLTHRU)
614 if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
630 if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
bool has_abnormal_call_or_eh_pred_edge_p(basic_block bb)
Definition basic-block.h:620
#define EDGE_I(ev, i)
Definition basic-block.h:306
gcov_type apply_probability(gcov_type freq, int prob)
Definition basic-block.h:586
#define EDGE_COUNT(ev)
Definition basic-block.h:305
cfg_bb_flags
Definition basic-block.h:163
@ LAST_CFG_BB_FLAG
Definition basic-block.h:358
bool bb_has_abnormal_pred(basic_block bb)
Definition basic-block.h:527
void check_probability(int prob)
Definition basic-block.h:557
edge single_pred_edge(const_basic_block bb)
Definition basic-block.h:340
edge_iterator ei_start_1(vec< edge, va_gc > **ev)
Definition basic-block.h:383
bool bb_has_eh_pred(basic_block bb)
Definition basic-block.h:512
gcov_type apply_scale(gcov_type freq, gcov_type scale)
Definition basic-block.h:578
basic_block single_succ(const_basic_block bb)
Definition basic-block.h:350
#define EDGE_SUCC(bb, i)
Definition basic-block.h:308
edge single_succ_edge(const_basic_block bb)
Definition basic-block.h:330
vec< edge, va_gc > * ei_container(edge_iterator i)
Definition basic-block.h:372
bool single_pred_p(const_basic_block bb)
Definition basic-block.h:321
bool ei_end_p(edge_iterator i)
Definition basic-block.h:408
bool ei_cond(edge_iterator ei, edge *p)
Definition basic-block.h:458
bool single_succ_p(const_basic_block bb)
Definition basic-block.h:313
cfg_edge_flags
Definition basic-block.h:57
@ LAST_CFG_EDGE_FLAG
Definition basic-block.h:252
bool bb_in_transaction(basic_block bb)
Definition basic-block.h:505
bool ei_one_before_end_p(edge_iterator i)
Definition basic-block.h:416
bool has_abnormal_or_eh_outgoing_edge_p(basic_block bb)
Definition basic-block.h:604
int combine_probabilities(int prob1, int prob2)
Definition basic-block.h:566
edge_iterator ei_last_1(vec< edge, va_gc > **ev)
Definition basic-block.h:396
edge ei_safe_edge(edge_iterator i)
Definition basic-block.h:448
int inverse_probability(int prob1)
Definition basic-block.h:595
edge find_fallthru_edge(vec< edge, va_gc > *edges)
Definition basic-block.h:542
void ei_next(edge_iterator *i)
Definition basic-block.h:423
#define EDGE_PRED(bb, i)
Definition basic-block.h:307
#define FOR_EACH_EDGE(EDGE, ITER, EDGE_VEC)
Definition basic-block.h:487
basic_block single_pred(const_basic_block bb)
Definition basic-block.h:359
edge ei_edge(edge_iterator i)
Definition basic-block.h:439
void ei_prev(edge_iterator *i)
Definition basic-block.h:431
Definition basic-block.h:26
profile_probability probability
Definition basic-block.h:49
profile_count count() const
Definition basic-block.h:633
unsigned int dest_idx
Definition basic-block.h:46
void * aux
Definition basic-block.h:39
basic_block src
Definition basic-block.h:29
union edge_def::edge_def_insns insns
int flags
Definition basic-block.h:48
location_t goto_locus
Definition basic-block.h:42
basic_block dest
Definition basic-block.h:30
Definition profile-count.h:147
class edge_def * edge
Definition coretypes.h:352
#define GTY(x)
Definition coretypes.h:41
int64_t gcov_type
Definition coretypes.h:46
static unsigned int count[debug_counter_number_of_counters]
Definition dbgcnt.cc:50
static hash_table< insn_hasher > * insns
Definition gentarget-def.cc:53
if(N >=2) for(unsigned int i
i
Definition poly-int.h:776
#define RDIV(X, Y)
Definition profile-count.h:75
#define REG_BR_PROB_BASE
Definition profile-count.h:73
Definition basic-block.h:117
basic_block prev_bb
Definition basic-block.h:132
profile_count count
Definition basic-block.h:150
struct et_node * dom[2]
Definition basic-block.h:129
vec< edge, va_gc > * preds
Definition basic-block.h:119
vec< edge, va_gc > * succs
Definition basic-block.h:120
basic_block next_bb
Definition basic-block.h:133
void * aux
Definition basic-block.h:123
union basic_block_def::basic_block_il_dependent il
int flags
Definition basic-block.h:144
class loop * loop_father
Definition basic-block.h:126
int index
Definition basic-block.h:147
Definition basic-block.h:366
unsigned index
Definition basic-block.h:367
vec< edge, va_gc > ** container
Definition basic-block.h:368
Definition et-forest.h:57
Definition basic-block.h:83
gimple_seq phi_nodes
Definition basic-block.h:88
gimple_seq seq
Definition basic-block.h:85
Definition profile-count.h:750
profile_count apply_probability(int prob) const
Definition profile-count.h:1124
Definition basic-block.h:72
rtx_insn * footer_
Definition basic-block.h:80
rtx_insn * end_
Definition basic-block.h:75
rtx_insn * header_
Definition basic-block.h:79
#define NULL
Definition system.h:50
#define true
Definition system.h:887
#define false
Definition system.h:888
#define STATIC_ASSERT(X)
Definition system.h:864
#define gcc_checking_assert(EXPR)
Definition system.h:821
Definition basic-block.h:135
struct rtl_bb_info * rtl
Definition basic-block.h:139
rtx_insn * head_
Definition basic-block.h:138
struct basic_block_def::basic_block_il_dependent::@2 x
Definition basic-block.h:33
rtx_insn * r
Definition basic-block.h:35
gimple_seq g
Definition basic-block.h:34