00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GCC_BASIC_BLOCK_H
00023 #define GCC_BASIC_BLOCK_H
00024
00025 #include "bitmap.h"
00026 #include "sbitmap.h"
00027 #include "varray.h"
00028 #include "partition.h"
00029 #include "hard-reg-set.h"
00030 #include "predict.h"
00031 #include "vec.h"
00032 #include "errors.h"
00033
00034
00035 typedef bitmap_head regset_head;
00036
00037
00038 typedef bitmap regset;
00039
00040
00041 #define ALLOC_REG_SET(OBSTACK) BITMAP_ALLOC (OBSTACK)
00042
00043
00044 #define FREE_REG_SET(REGSET) BITMAP_FREE (REGSET)
00045
00046
00047 #define INIT_REG_SET(HEAD) bitmap_initialize (HEAD, ®_obstack)
00048
00049
00050 #define CLEAR_REG_SET(HEAD) bitmap_clear (HEAD)
00051
00052
00053 #define COPY_REG_SET(TO, FROM) bitmap_copy (TO, FROM)
00054
00055
00056 #define REG_SET_EQUAL_P(A, B) bitmap_equal_p (A, B)
00057
00058
00059 #define AND_REG_SET(TO, FROM) bitmap_and_into (TO, FROM)
00060
00061
00062 #define AND_COMPL_REG_SET(TO, FROM) bitmap_and_compl_into (TO, FROM)
00063
00064
00065 #define IOR_REG_SET(TO, FROM) bitmap_ior_into (TO, FROM)
00066
00067
00068 #define XOR_REG_SET(TO, FROM) bitmap_xor_into (TO, FROM)
00069
00070
00071 #define IOR_AND_COMPL_REG_SET(TO, FROM1, FROM2) \
00072 bitmap_ior_and_compl_into (TO, FROM1, FROM2)
00073
00074
00075 #define CLEAR_REGNO_REG_SET(HEAD, REG) bitmap_clear_bit (HEAD, REG)
00076
00077
00078 #define SET_REGNO_REG_SET(HEAD, REG) bitmap_set_bit (HEAD, REG)
00079
00080
00081 #define REGNO_REG_SET_P(TO, REG) bitmap_bit_p (TO, REG)
00082
00083
00084 extern void reg_set_to_hard_reg_set (HARD_REG_SET *, bitmap);
00085 #define REG_SET_TO_HARD_REG_SET(TO, FROM) \
00086 do { \
00087 CLEAR_HARD_REG_SET (TO); \
00088 reg_set_to_hard_reg_set (&TO, FROM); \
00089 } while (0)
00090
00091 typedef bitmap_iterator reg_set_iterator;
00092
00093
00094
00095 #define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, RSI) \
00096 EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, RSI)
00097
00098
00099
00100
00101 #define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \
00102 EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI)
00103
00104
00105
00106
00107 #define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \
00108 EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI) \
00109
00110
00111
00112
00113
00114
00115 typedef HOST_WIDEST_INT gcov_type;
00116
00117
00118 struct edge_def GTY(())
00119 {
00120
00121 struct basic_block_def *src;
00122 struct basic_block_def *dest;
00123
00124
00125 union edge_def_insns {
00126 rtx GTY ((tag ("0"))) r;
00127 tree GTY ((tag ("1"))) t;
00128 } GTY ((desc ("ir_type ()"))) insns;
00129
00130
00131 PTR GTY ((skip (""))) aux;
00132
00133
00134 source_locus goto_locus;
00135
00136 int flags;
00137 int probability;
00138 gcov_type count;
00139
00140
00141
00142
00143 unsigned int dest_idx;
00144 };
00145
00146 typedef struct edge_def *edge;
00147 DEF_VEC_GC_P(edge);
00148
00149 #define EDGE_FALLTHRU 1
00150 #define EDGE_ABNORMAL 2
00151
00152 #define EDGE_ABNORMAL_CALL 4
00153
00154 #define EDGE_EH 8
00155 #define EDGE_FAKE 16
00156 #define EDGE_DFS_BACK 32
00157 #define EDGE_CAN_FALLTHRU 64
00158
00159 #define EDGE_IRREDUCIBLE_LOOP 128
00160 #define EDGE_SIBCALL 256
00161 #define EDGE_LOOP_EXIT 512
00162 #define EDGE_TRUE_VALUE 1024
00163
00164 #define EDGE_FALSE_VALUE 2048
00165
00166 #define EDGE_EXECUTABLE 4096
00167
00168 #define EDGE_CROSSING 8192
00169
00170
00171 #define EDGE_ALL_FLAGS 16383
00172
00173 #define EDGE_COMPLEX (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)
00174
00175
00176
00177 extern const struct gcov_ctr_summary *profile_info;
00178
00179
00180 struct loop;
00181 struct loops;
00182
00183
00184 struct bb_ann_d;
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb")))
00213 {
00214 /* The first and last insns of the block. */
00215 rtx head_;
00216 rtx end_;
00217
00218 /* Pointers to the first and last trees of the block. */
00219 tree stmt_list;
00220
00221 /* The edges into and out of the block. */
00222 VEC(edge) *preds;
00223 VEC(edge) *succs;
00224
00225 /* The registers that are live on entry to this block. */
00226 bitmap GTY ((skip (""))) global_live_at_start;
00227
00228 /* The registers that are live on exit from this block. */
00229 bitmap GTY ((skip (""))) global_live_at_end;
00230
00231 /* Auxiliary info specific to a pass. */
00232 PTR GTY ((skip (""))) aux;
00233
00234 /* Innermost loop containing the block. */
00235 struct loop * GTY ((skip (""))) loop_father;
00236
00237 /* The dominance and postdominance information node. */
00238 struct et_node * GTY ((skip (""))) dom[2];
00239
00240 /* Previous and next blocks in the chain. */
00241 struct basic_block_def *prev_bb;
00242 struct basic_block_def *next_bb;
00243
00244 /* The data used by basic block copying and reordering functions. */
00245 struct reorder_block_def * GTY ((skip (""))) rbi;
00246
00247 /* Annotations used at the tree level. */
00248 struct bb_ann_d *tree_annotations;
00249
00250 /* Expected number of executions: calculated in profile.c. */
00251 gcov_type count;
00252
00253 /* The index of this block. */
00254 int index;
00255
00256 /* The loop depth of this block. */
00257 int loop_depth;
00258
00259 /* Expected frequency. Normalized to be in range 0 to BB_FREQ_MAX. */
00260 int frequency;
00261
00262 /* Various flags. See BB_* below. */
00263 int flags;
00264 };
00265
00266 typedef struct basic_block_def *basic_block;
00267
00268 /* Structure to hold information about the blocks during reordering and
00269 copying. */
00270
00271 typedef struct reorder_block_def
00272 {
00273 rtx header;
00274 rtx footer;
00275 basic_block next;
00276 basic_block original;
00277 /* Used by loop copying. */
00278 basic_block copy;
00279 int duplicated;
00280 int copy_number;
00281
00282 /* These fields are used by bb-reorder pass. */
00283 int visited;
00284 } *reorder_block_def_p;
00285
00286 #define BB_FREQ_MAX 10000
00287
00288 /* Masks for basic_block.flags.
00289
00290 BB_VISITED should not be used by passes, it is used internally by
00291 dfs_enumerate_from.
00292
00293 BB_HOT_PARTITION and BB_COLD_PARTITION should be preserved throughout
00294 the compilation, so they are never cleared.
00295
00296 All other flags may be cleared by clear_bb_flags(). It is generally
00297 a bad idea to rely on any flags being up-to-date. */
00298
00299 /* Set if insns in BB have are modified. Used for updating liveness info. */
00300 #define BB_DIRTY 1
00301
00302 /* Only set on blocks that have just been created by create_bb. */
00303 #define BB_NEW 2
00304
00305 /* Set by find_unreachable_blocks. Do not rely on this being set in any
00306 pass. */
00307 #define BB_REACHABLE 4
00308
00309 /* Used by dfs_enumerate_from to keep track of visited basic blocks. */
00310 #define BB_VISITED 8
00311
00312 /* Set for blocks in an irreducible loop by loop analysis. */
00313 #define BB_IRREDUCIBLE_LOOP 16
00314
00315 /* Set on blocks that may actually not be single-entry single-exit block. */
00316 #define BB_SUPERBLOCK 32
00317
00318 /* Set on basic blocks that the scheduler should not touch. This is used
00319 by SMS to prevent other schedulers from messing with the loop schedule. */
00320 #define BB_DISABLE_SCHEDULE 64
00321
00322 /* Set on blocks that should be put in a hot section. */
00323 #define BB_HOT_PARTITION 128
00324
00325 /* Set on blocks that should be put in a cold section. */
00326 #define BB_COLD_PARTITION 256
00327
00328 /* Dummy flag for convenience in the hot/cold partitioning code. */
00329 #define BB_UNPARTITIONED 0
00330
00331 /* Partitions, to be used when partitioning hot and cold basic blocks into
00332 separate sections. */
00333 #define BB_PARTITION(bb) ((bb)->flags & (BB_HOT_PARTITION|BB_COLD_PARTITION))
00334 #define BB_SET_PARTITION(bb, part) do { \
00335 basic_block bb_ = (bb); \
00336 bb_->flags = ((bb_->flags & ~(BB_HOT_PARTITION|BB_COLD_PARTITION)) \
00337 | (part)); \
00338 } while (0)
00339
00340 #define BB_COPY_PARTITION(dstbb, srcbb) \
00341 BB_SET_PARTITION (dstbb, BB_PARTITION (srcbb))
00342
00343 /* Number of basic blocks in the current function. */
00344
00345 extern int n_basic_blocks;
00346
00347 /* First free basic block number. */
00348
00349 extern int last_basic_block;
00350
00351 /* Number of edges in the current function. */
00352
00353 extern int n_edges;
00354
00355 /* Signalize the status of profile information in the CFG. */
00356 extern enum profile_status
00357 {
00358 PROFILE_ABSENT,
00359 PROFILE_GUESSED,
00360 PROFILE_READ
00361 } profile_status;
00362
00363 /* Index by basic block number, get basic block struct info. */
00364
00365 extern GTY(()) varray_type basic_block_info;
00366
00367 #define BASIC_BLOCK(N) (VARRAY_BB (basic_block_info, (N)))
00368
00369 /* For iterating over basic blocks. */
00370 #define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
00371 for (BB = FROM; BB != TO; BB = BB->DIR)
00372
00373 #define FOR_EACH_BB(BB) \
00374 FOR_BB_BETWEEN (BB, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR, next_bb)
00375
00376 #define FOR_EACH_BB_REVERSE(BB) \
00377 FOR_BB_BETWEEN (BB, EXIT_BLOCK_PTR->prev_bb, ENTRY_BLOCK_PTR, prev_bb)
00378
00379 /* For iterating over insns in basic block. */
00380 #define FOR_BB_INSNS(BB, INSN) \
00381 for ((INSN) = BB_HEAD (BB); \
00382 (INSN) != NEXT_INSN (BB_END (BB)); \
00383 (INSN) = NEXT_INSN (INSN))
00384
00385 #define FOR_BB_INSNS_REVERSE(BB, INSN) \
00386 for ((INSN) = BB_END (BB); \
00387 (INSN) != PREV_INSN (BB_HEAD (BB)); \
00388 (INSN) = PREV_INSN (INSN))
00389
00390 /* Cycles through _all_ basic blocks, even the fake ones (entry and
00391 exit block). */
00392
00393 #define FOR_ALL_BB(BB) \
00394 for (BB = ENTRY_BLOCK_PTR; BB; BB = BB->next_bb)
00395
00396 /* What registers are live at the setjmp call. */
00397
00398 extern regset regs_live_at_setjmp;
00399
00400 /* Special labels found during CFG build. */
00401
00402 extern GTY(()) rtx label_value_list;
00403
00404 extern bitmap_obstack reg_obstack;
00405
00406 /* Indexed by n, gives number of basic block that (REG n) is used in.
00407 If the value is REG_BLOCK_GLOBAL (-2),
00408 it means (REG n) is used in more than one basic block.
00409 REG_BLOCK_UNKNOWN (-1) means it hasn't been seen yet so we don't know.
00410 This information remains valid for the rest of the compilation
00411 of the current function; it is used to control register allocation. */
00412
00413 #define REG_BLOCK_UNKNOWN -1
00414 #define REG_BLOCK_GLOBAL -2
00415
00416 #define REG_BASIC_BLOCK(N) (VARRAY_REG (reg_n_info, N)->basic_block)
00417
00418 /* Stuff for recording basic block info. */
00419
00420 #define BB_HEAD(B) (B)->head_
00421 #define BB_END(B) (B)->end_
00422
00423 /* Special block numbers [markers] for entry and exit. */
00424 #define ENTRY_BLOCK (-1)
00425 #define EXIT_BLOCK (-2)
00426
00427 /* Special block number not valid for any block. */
00428 #define INVALID_BLOCK (-3)
00429
00430 /* Similarly, block pointers for the edge list. */
00431 extern GTY(()) basic_block ENTRY_BLOCK_PTR;
00432 extern GTY(()) basic_block EXIT_BLOCK_PTR;
00433
00434 #define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0)
00435 #define set_block_for_insn(INSN, BB) (BLOCK_FOR_INSN (INSN) = BB)
00436
00437 extern void compute_bb_for_insn (void);
00438 extern void free_bb_for_insn (void);
00439 extern void update_bb_for_insn (basic_block);
00440
00441 extern void free_basic_block_vars (void);
00442
00443 extern void insert_insn_on_edge (rtx, edge);
00444 bool safe_insert_insn_on_edge (rtx, edge);
00445
00446 extern void commit_edge_insertions (void);
00447 extern void commit_edge_insertions_watch_calls (void);
00448
00449 extern void remove_fake_edges (void);
00450 extern void remove_fake_exit_edges (void);
00451 extern void add_noreturn_fake_exit_edges (void);
00452 extern void connect_infinite_loops_to_exit (void);
00453 extern edge unchecked_make_edge (basic_block, basic_block, int);
00454 extern edge cached_make_edge (sbitmap *, basic_block, basic_block, int);
00455 extern edge make_edge (basic_block, basic_block, int);
00456 extern edge make_single_succ_edge (basic_block, basic_block, int);
00457 extern void remove_edge (edge);
00458 extern void redirect_edge_succ (edge, basic_block);
00459 extern edge redirect_edge_succ_nodup (edge, basic_block);
00460 extern void redirect_edge_pred (edge, basic_block);
00461 extern basic_block create_basic_block_structure (rtx, rtx, rtx, basic_block);
00462 extern void clear_bb_flags (void);
00463 extern void flow_reverse_top_sort_order_compute (int *);
00464 extern int flow_depth_first_order_compute (int *, int *);
00465 extern int dfs_enumerate_from (basic_block, int,
00466 bool (*)(basic_block, void *),
00467 basic_block *, int, void *);
00468 extern void compute_dominance_frontiers (bitmap *);
00469 extern void dump_edge_info (FILE *, edge, int);
00470 extern void brief_dump_cfg (FILE *);
00471 extern void clear_edges (void);
00472 extern rtx first_insn_after_basic_block_note (basic_block);
00473
00474 /* Structure to group all of the information to process IF-THEN and
00475 IF-THEN-ELSE blocks for the conditional execution support. This
00476 needs to be in a public file in case the IFCVT macros call
00477 functions passing the ce_if_block data structure. */
00478
00479 typedef struct ce_if_block
00480 {
00481 basic_block test_bb; /* First test block. */
00482 basic_block then_bb; /* THEN block. */
00483 basic_block else_bb; /* ELSE block or NULL. */
00484 basic_block join_bb; /* Join THEN/ELSE blocks. */
00485 basic_block last_test_bb; /* Last bb to hold && or || tests. */
00486 int num_multiple_test_blocks; /* # of && and || basic blocks. */
00487 int num_and_and_blocks; /* # of && blocks. */
00488 int num_or_or_blocks; /* # of || blocks. */
00489 int num_multiple_test_insns; /* # of insns in && and || blocks. */
00490 int and_and_p; /* Complex test is &&. */
00491 int num_then_insns; /* # of insns in THEN block. */
00492 int num_else_insns; /* # of insns in ELSE block. */
00493 int pass; /* Pass number. */
00494
00495 #ifdef IFCVT_EXTRA_FIELDS
00496 IFCVT_EXTRA_FIELDS /* Any machine dependent fields. */
00497 #endif
00498
00499 } ce_if_block_t;
00500
00501 /* This structure maintains an edge list vector. */
00502 struct edge_list
00503 {
00504 int num_blocks;
00505 int num_edges;
00506 edge *index_to_edge;
00507 };
00508
00509 /* This is the value which indicates no edge is present. */
00510 #define EDGE_INDEX_NO_EDGE -1
00511
00512 /* EDGE_INDEX returns an integer index for an edge, or EDGE_INDEX_NO_EDGE
00513 if there is no edge between the 2 basic blocks. */
00514 #define EDGE_INDEX(el, pred, succ) (find_edge_index ((el), (pred), (succ)))
00515
00516 /* INDEX_EDGE_PRED_BB and INDEX_EDGE_SUCC_BB return a pointer to the basic
00517 block which is either the pred or succ end of the indexed edge. */
00518 #define INDEX_EDGE_PRED_BB(el, index) ((el)->index_to_edge[(index)]->src)
00519 #define INDEX_EDGE_SUCC_BB(el, index) ((el)->index_to_edge[(index)]->dest)
00520
00521 /* INDEX_EDGE returns a pointer to the edge. */
00522 #define INDEX_EDGE(el, index) ((el)->index_to_edge[(index)])
00523
00524 /* Number of edges in the compressed edge list. */
00525 #define NUM_EDGES(el) ((el)->num_edges)
00526
00527 /* BB is assumed to contain conditional jump. Return the fallthru edge. */
00528 #define FALLTHRU_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
00529 ? EDGE_SUCC ((bb), 0) : EDGE_SUCC ((bb), 1))
00530
00531 /* BB is assumed to contain conditional jump. Return the branch edge. */
00532 #define BRANCH_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
00533 ? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0))
00534
00535 /* Return expected execution frequency of the edge E. */
00536 #define EDGE_FREQUENCY(e) (((e)->src->frequency \
00537 * (e)->probability \
00538 + REG_BR_PROB_BASE / 2) \
00539 / REG_BR_PROB_BASE)
00540
00541 /* Return nonzero if edge is critical. */
00542 #define EDGE_CRITICAL_P(e) (EDGE_COUNT ((e)->src->succs) >= 2 \
00543 && EDGE_COUNT ((e)->dest->preds) >= 2)
00544
00545 #define EDGE_COUNT(ev) VEC_length (edge, (ev))
00546 #define EDGE_I(ev,i) VEC_index (edge, (ev), (i))
00547 #define EDGE_PRED(bb,i) VEC_index (edge, (bb)->preds, (i))
00548 #define EDGE_SUCC(bb,i) VEC_index (edge, (bb)->succs, (i))
00549
00550 /* Iterator object for edges. */
00551
00552 typedef struct {
00553 unsigned index;
00554 VEC(edge) **container;
00555 } edge_iterator;
00556
00557 static inline VEC(edge) *
00558 ei_container (edge_iterator i)
00559 {
00560 gcc_assert (i.container);
00561 return *i.container;
00562 }
00563
00564 #define ei_start(iter) ei_start_1 (&(iter))
00565 #define ei_last(iter) ei_last_1 (&(iter))
00566
00567 /* Return an iterator pointing to the start of an edge vector. */
00568 static inline edge_iterator
00569 ei_start_1 (VEC(edge) **ev)
00570 {
00571 edge_iterator i;
00572
00573 i.index = 0;
00574 i.container = ev;
00575
00576 return i;
00577 }
00578
00579 /* Return an iterator pointing to the last element of an edge
00580 vector. */
00581 static inline edge_iterator
00582 ei_last_1 (VEC(edge) **ev)
00583 {
00584 edge_iterator i;
00585
00586 i.index = EDGE_COUNT (*ev) - 1;
00587 i.container = ev;
00588
00589 return i;
00590 }
00591
00592 /* Is the iterator `i' at the end of the sequence? */
00593 static inline bool
00594 ei_end_p (edge_iterator i)
00595 {
00596 return (i.index == EDGE_COUNT (ei_container (i)));
00597 }
00598
00599 /* Is the iterator `i' at one position before the end of the
00600 sequence? */
00601 static inline bool
00602 ei_one_before_end_p (edge_iterator i)
00603 {
00604 return (i.index + 1 == EDGE_COUNT (ei_container (i)));
00605 }
00606
00607 /* Advance the iterator to the next element. */
00608 static inline void
00609 ei_next (edge_iterator *i)
00610 {
00611 gcc_assert (i->index < EDGE_COUNT (ei_container (*i)));
00612 i->index++;
00613 }
00614
00615 /* Move the iterator to the previous element. */
00616 static inline void
00617 ei_prev (edge_iterator *i)
00618 {
00619 gcc_assert (i->index > 0);
00620 i->index--;
00621 }
00622
00623 /* Return the edge pointed to by the iterator `i'. */
00624 static inline edge
00625 ei_edge (edge_iterator i)
00626 {
00627 return EDGE_I (ei_container (i), i.index);
00628 }
00629
00630 /* Return an edge pointed to by the iterator. Do it safely so that
00631 NULL is returned when the iterator is pointing at the end of the
00632 sequence. */
00633 static inline edge
00634 ei_safe_edge (edge_iterator i)
00635 {
00636 return !ei_end_p (i) ? ei_edge (i) : NULL;
00637 }
00638
00639 /* This macro serves as a convenient way to iterate each edge in a
00640 vector of predecessor or successor edges. It must not be used when
00641 an element might be removed during the traversal, otherwise
00642 elements will be missed. Instead, use a for-loop like that shown
00643 in the following pseudo-code:
00644
00645 FOR (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
00646 {
00647 IF (e != taken_edge)
00648 remove_edge (e);
00649 ELSE
00650 ei_next (&ei);
00651 }
00652 */
00653
00654 #define FOR_EACH_EDGE(EDGE,ITER,EDGE_VEC) \
00655 for ((EDGE) = NULL, (ITER) = ei_start ((EDGE_VEC)); \
00656 ((EDGE) = ei_safe_edge ((ITER))); \
00657 ei_next (&(ITER)))
00658
00659 struct edge_list * create_edge_list (void);
00660 void free_edge_list (struct edge_list *);
00661 void print_edge_list (FILE *, struct edge_list *);
00662 void verify_edge_list (FILE *, struct edge_list *);
00663 int find_edge_index (struct edge_list *, basic_block, basic_block);
00664 edge find_edge (basic_block, basic_block);
00665
00666
00667 enum update_life_extent
00668 {
00669 UPDATE_LIFE_LOCAL = 0,
00670 UPDATE_LIFE_GLOBAL = 1,
00671 UPDATE_LIFE_GLOBAL_RM_NOTES = 2
00672 };
00673
00674 /* Flags for life_analysis and update_life_info. */
00675
00676 #define PROP_DEATH_NOTES 1 /* Create DEAD and UNUSED notes. */
00677 #define PROP_LOG_LINKS 2 /* Create LOG_LINKS. */
00678 #define PROP_REG_INFO 4 /* Update regs_ever_live et al. */
00679 #define PROP_KILL_DEAD_CODE 8 /* Remove dead code. */
00680 #define PROP_SCAN_DEAD_CODE 16 /* Scan for dead code. */
00681 #define PROP_ALLOW_CFG_CHANGES 32 /* Allow the CFG to be changed
00682 by dead code removal. */
00683 #define PROP_AUTOINC 64 /* Create autoinc mem references. */
00684 #define PROP_EQUAL_NOTES 128 /* Take into account REG_EQUAL notes. */
00685 #define PROP_SCAN_DEAD_STORES 256 /* Scan for dead code. */
00686 #define PROP_ASM_SCAN 512 /* Internal flag used within flow.c
00687 to flag analysis of asms. */
00688 #define PROP_FINAL (PROP_DEATH_NOTES | PROP_LOG_LINKS \
00689 | PROP_REG_INFO | PROP_KILL_DEAD_CODE \
00690 | PROP_SCAN_DEAD_CODE | PROP_AUTOINC \
00691 | PROP_ALLOW_CFG_CHANGES \
00692 | PROP_SCAN_DEAD_STORES)
00693 #define PROP_POSTRELOAD (PROP_DEATH_NOTES \
00694 | PROP_KILL_DEAD_CODE \
00695 | PROP_SCAN_DEAD_CODE \
00696 | PROP_SCAN_DEAD_STORES)
00697
00698 #define CLEANUP_EXPENSIVE 1 /* Do relatively expensive optimizations
00699 except for edge forwarding */
00700 #define CLEANUP_CROSSJUMP 2 /* Do crossjumping. */
00701 #define CLEANUP_POST_REGSTACK 4 /* We run after reg-stack and need
00702 to care REG_DEAD notes. */
00703 #define CLEANUP_PRE_LOOP 8 /* Take care to preserve syntactic loop
00704 notes. */
00705 #define CLEANUP_UPDATE_LIFE 16 /* Keep life information up to date. */
00706 #define CLEANUP_THREADING 32 /* Do jump threading. */
00707 #define CLEANUP_NO_INSN_DEL 64 /* Do not try to delete trivially dead
00708 insns. */
00709 #define CLEANUP_CFGLAYOUT 128 /* Do cleanup in cfglayout mode. */
00710 #define CLEANUP_LOG_LINKS 256 /* Update log links. */
00711
00712 extern void life_analysis (FILE *, int);
00713 extern int update_life_info (sbitmap, enum update_life_extent, int);
00714 extern int update_life_info_in_dirty_blocks (enum update_life_extent, int);
00715 extern int count_or_remove_death_notes (sbitmap, int);
00716 extern int propagate_block (basic_block, regset, regset, regset, int);
00717
00718 struct propagate_block_info;
00719 extern rtx propagate_one_insn (struct propagate_block_info *, rtx);
00720 extern struct propagate_block_info *init_propagate_block_info
00721 (basic_block, regset, regset, regset, int);
00722 extern void free_propagate_block_info (struct propagate_block_info *);
00723
00724 /* In lcm.c */
00725 extern struct edge_list *pre_edge_lcm (FILE *, int, sbitmap *, sbitmap *,
00726 sbitmap *, sbitmap *, sbitmap **,
00727 sbitmap **);
00728 extern struct edge_list *pre_edge_rev_lcm (FILE *, int, sbitmap *,
00729 sbitmap *, sbitmap *,
00730 sbitmap *, sbitmap **,
00731 sbitmap **);
00732 extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
00733 extern int optimize_mode_switching (FILE *);
00734
00735 /* In predict.c */
00736 extern void estimate_probability (struct loops *);
00737 extern void expected_value_to_br_prob (void);
00738 extern bool maybe_hot_bb_p (basic_block);
00739 extern bool probably_cold_bb_p (basic_block);
00740 extern bool probably_never_executed_bb_p (basic_block);
00741 extern bool tree_predicted_by_p (basic_block, enum br_predictor);
00742 extern bool rtl_predicted_by_p (basic_block, enum br_predictor);
00743 extern void tree_predict_edge (edge, enum br_predictor, int);
00744 extern void rtl_predict_edge (edge, enum br_predictor, int);
00745 extern void predict_edge_def (edge, enum br_predictor, enum prediction);
00746 extern void guess_outgoing_edge_probabilities (basic_block);
00747
00748 /* In flow.c */
00749 extern void init_flow (void);
00750 extern void debug_bb (basic_block);
00751 extern basic_block debug_bb_n (int);
00752 extern void dump_regset (regset, FILE *);
00753 extern void debug_regset (regset);
00754 extern void allocate_reg_life_data (void);
00755 extern void expunge_block (basic_block);
00756 extern void link_block (basic_block, basic_block);
00757 extern void unlink_block (basic_block);
00758 extern void compact_blocks (void);
00759 extern basic_block alloc_block (void);
00760 extern void find_unreachable_blocks (void);
00761 extern int delete_noop_moves (void);
00762 extern basic_block force_nonfallthru (edge);
00763 extern rtx block_label (basic_block);
00764 extern bool forwarder_block_p (basic_block);
00765 extern bool purge_all_dead_edges (int);
00766 extern bool purge_dead_edges (basic_block);
00767 extern void find_sub_basic_blocks (basic_block);
00768 extern void find_many_sub_basic_blocks (sbitmap);
00769 extern void rtl_make_eh_edge (sbitmap *, basic_block, rtx);
00770 extern bool can_fallthru (basic_block, basic_block);
00771 extern bool could_fall_through (basic_block, basic_block);
00772 extern void flow_nodes_print (const char *, const sbitmap, FILE *);
00773 extern void flow_edge_list_print (const char *, const edge *, int, FILE *);
00774 extern void alloc_aux_for_block (basic_block, int);
00775 extern void alloc_aux_for_blocks (int);
00776 extern void clear_aux_for_blocks (void);
00777 extern void free_aux_for_blocks (void);
00778 extern void alloc_aux_for_edge (edge, int);
00779 extern void alloc_aux_for_edges (int);
00780 extern void clear_aux_for_edges (void);
00781 extern void free_aux_for_edges (void);
00782 extern void find_basic_blocks (rtx);
00783 extern bool cleanup_cfg (int);
00784 extern bool delete_unreachable_blocks (void);
00785 extern bool merge_seq_blocks (void);
00786
00787 typedef struct conflict_graph_def *conflict_graph;
00788
00789 /* Callback function when enumerating conflicts. The arguments are
00790 the smaller and larger regno in the conflict. Returns zero if
00791 enumeration is to continue, nonzero to halt enumeration. */
00792 typedef int (*conflict_graph_enum_fn) (int, int, void *);
00793
00794
00795 /* Prototypes of operations on conflict graphs. */
00796
00797 extern conflict_graph conflict_graph_new
00798 (int);
00799 extern void conflict_graph_delete (conflict_graph);
00800 extern int conflict_graph_add (conflict_graph, int, int);
00801 extern int conflict_graph_conflict_p (conflict_graph, int, int);
00802 extern void conflict_graph_enum (conflict_graph, int, conflict_graph_enum_fn,
00803 void *);
00804 extern void conflict_graph_merge_regs (conflict_graph, int, int);
00805 extern void conflict_graph_print (conflict_graph, FILE*);
00806 extern bool mark_dfs_back_edges (void);
00807 extern void set_edge_can_fallthru_flag (void);
00808 extern void update_br_prob_note (basic_block);
00809 extern void fixup_abnormal_edges (void);
00810 extern bool inside_basic_block_p (rtx);
00811 extern bool control_flow_insn_p (rtx);
00812
00813 /* In bb-reorder.c */
00814 extern void reorder_basic_blocks (unsigned int);
00815 extern void duplicate_computed_gotos (void);
00816 extern void partition_hot_cold_basic_blocks (void);
00817
00818 /* In cfg.c */
00819 extern void alloc_rbi_pool (void);
00820 extern void initialize_bb_rbi (basic_block bb);
00821 extern void free_rbi_pool (void);
00822
00823 /* In dominance.c */
00824
00825 enum cdi_direction
00826 {
00827 CDI_DOMINATORS,
00828 CDI_POST_DOMINATORS
00829 };
00830
00831 enum dom_state
00832 {
00833 DOM_NONE, /* Not computed at all. */
00834 DOM_NO_FAST_QUERY, /* The data is OK, but the fast query data are not usable. */
00835 DOM_OK /* Everything is ok. */
00836 };
00837
00838 extern enum dom_state dom_computed[2];
00839
00840 extern bool dom_info_available_p (enum cdi_direction);
00841 extern void calculate_dominance_info (enum cdi_direction);
00842 extern void free_dominance_info (enum cdi_direction);
00843 extern basic_block nearest_common_dominator (enum cdi_direction,
00844 basic_block, basic_block);
00845 extern void set_immediate_dominator (enum cdi_direction, basic_block,
00846 basic_block);
00847 extern basic_block get_immediate_dominator (enum cdi_direction, basic_block);
00848 extern bool dominated_by_p (enum cdi_direction, basic_block, basic_block);
00849 extern int get_dominated_by (enum cdi_direction, basic_block, basic_block **);
00850 extern unsigned get_dominated_by_region (enum cdi_direction, basic_block *,
00851 unsigned, basic_block *);
00852 extern void add_to_dominance_info (enum cdi_direction, basic_block);
00853 extern void delete_from_dominance_info (enum cdi_direction, basic_block);
00854 basic_block recount_dominator (enum cdi_direction, basic_block);
00855 extern void redirect_immediate_dominators (enum cdi_direction, basic_block,
00856 basic_block);
00857 extern void iterate_fix_dominators (enum cdi_direction, basic_block *, int);
00858 extern void verify_dominators (enum cdi_direction);
00859 extern basic_block first_dom_son (enum cdi_direction, basic_block);
00860 extern basic_block next_dom_son (enum cdi_direction, basic_block);
00861 extern edge try_redirect_by_replacing_jump (edge, basic_block, bool);
00862 extern void break_superblocks (void);
00863 extern void check_bb_profile (basic_block, FILE *);
00864 extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge);
00865
00866 #include "cfghooks.h"
00867
00868 #endif /* GCC_BASIC_BLOCK_H */