GCC Middle and Back End API Reference
cfghooks.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cfg_hooks

Functions

void verify_flow_info (void)
void dump_bb (FILE *, basic_block, int, int)
void dump_bb_for_graph (pretty_printer *, basic_block)
edge redirect_edge_and_branch (edge, basic_block)
basic_block redirect_edge_and_branch_force (edge, basic_block)
bool can_remove_branch_p (const_edge)
void remove_branch (edge)
void remove_edge (edge)
edge split_block (basic_block, void *)
edge split_block_after_labels (basic_block)
bool move_block_after (basic_block, basic_block)
void delete_basic_block (basic_block)
basic_block split_edge (edge)
basic_block create_basic_block (void *, void *, basic_block)
basic_block create_empty_bb (basic_block)
bool can_merge_blocks_p (basic_block, basic_block)
void merge_blocks (basic_block, basic_block)
edge make_forwarder_block (basic_block, bool(*)(edge), void(*)(basic_block))
basic_block force_nonfallthru (edge)
void tidy_fallthru_edge (edge)
void tidy_fallthru_edges (void)
void predict_edge (edge e, enum br_predictor predictor, int probability)
bool predicted_by_p (const_basic_block bb, enum br_predictor predictor)
bool can_duplicate_block_p (const_basic_block)
basic_block duplicate_block (basic_block, edge, basic_block)
bool block_ends_with_call_p (basic_block bb)
bool empty_block_p (basic_block)
basic_block split_block_before_cond_jump (basic_block)
bool block_ends_with_condjump_p (const_basic_block bb)
int flow_call_edges_add (sbitmap)
void execute_on_growing_pred (edge)
void execute_on_shrinking_pred (edge)
bool cfg_hook_duplicate_loop_to_header_edge (struct loop *loop, edge, unsigned int ndupl, sbitmap wont_exit, edge orig, vec< edge > *to_remove, int flags)
void lv_flush_pending_stmts (edge)
void extract_cond_bb_edges (basic_block, edge *, edge *)
void lv_adjust_loop_header_phi (basic_block, basic_block, basic_block, edge)
void lv_add_condition_to_bb (basic_block, basic_block, basic_block, void *)
bool can_copy_bbs_p (basic_block *, unsigned)
void copy_bbs (basic_block *, unsigned, basic_block *, edge *, unsigned, edge *, struct loop *, basic_block, bool)
void account_profile_record (struct profile_record *, int)
void cfg_layout_initialize (unsigned int)
void cfg_layout_finalize (void)
enum ir_type current_ir_type (void)
void rtl_register_cfg_hooks (void)
void cfg_layout_rtl_register_cfg_hooks (void)
void gimple_register_cfg_hooks (void)
struct cfg_hooks get_cfg_hooks (void)
void set_cfg_hooks (struct cfg_hooks)

Variables

struct cfg_hooks gimple_cfg_hooks
struct cfg_hooks rtl_cfg_hooks
struct cfg_hooks cfg_layout_rtl_cfg_hooks

Function Documentation

void account_profile_record ( struct profile_record ,
int   
)
bool block_ends_with_call_p ( basic_block  bb)
bool block_ends_with_condjump_p ( const_basic_block  bb)
bool can_copy_bbs_p ( basic_block ,
unsigned   
)
bool can_duplicate_block_p ( const_basic_block  )
bool can_merge_blocks_p ( basic_block  ,
basic_block   
)
bool can_remove_branch_p ( const_edge  )
bool cfg_hook_duplicate_loop_to_header_edge ( struct loop loop,
edge  e,
unsigned int  ndupl,
sbitmap  wont_exit,
edge  orig,
vec< edge > *  to_remove,
int  flags 
)

Loop versioning uses the duplicate_loop_to_header_edge to create a new version of the loop basic-blocks, the parameters here are exactly the same as in duplicate_loop_to_header_edge or tree_duplicate_loop_to_header_edge; while in tree-ssa there is additional work to maintain ssa information that's why there is a need to call the tree_duplicate_loop_to_header_edge rather than duplicate_loop_to_header_edge when we are in tree mode.

void cfg_layout_finalize ( void  )

Finalize the changes: reorder insn list according to the sequence specified by aux pointers, enter compensation code, rebuild scope forest.

void cfg_layout_initialize ( unsigned  int)

Referenced by reorder_basic_blocks().

void cfg_layout_rtl_register_cfg_hooks ( void  )

Initialization of functions specific to the rtl IR.

References gimple_cfg_hooks.

void copy_bbs ( basic_block bbs,
unsigned  n,
basic_block new_bbs,
edge edges,
unsigned  num_edges,
edge new_edges,
struct loop base,
basic_block  after,
bool  update_dominance 
)

Duplicates N basic blocks stored in array BBS. Newly created basic blocks are placed into array NEW_BBS in the same order. Edges from basic blocks in BBS are also duplicated and copies of those that lead into BBS are redirected to appropriate newly created block. The function assigns bbs into loops (copy of basic block bb is assigned to bb->loop_father->copy loop, so this must be set up correctly in advance)

If UPDATE_DOMINANCE is true then this function updates dominators locally (LOOPS structure that contains the information about dominators is passed to enable this), otherwise it does not update the dominator information and it assumed that the caller will do this, perhaps by destroying and recreating it instead of trying to do an incremental update like this function does when update_dominance is true.

BASE is the superloop to that basic block belongs; if its header or latch is copied, we do not set the new blocks as header or latch.

Created copies of N_EDGES edges in array EDGES are stored in array NEW_EDGES, also in the same order.

Newly created basic blocks are put after the basic block AFTER in the instruction stream, and the order of the blocks in BBS array is preserved.

 Duplicate bbs, update dominators, assign bbs to loops.   
     Duplicate.   
         Possibly set loop header.   
         Or latch.   
 Set dominators.   
 Redirect edges.   
 Clear information about duplicates.   

Referenced by tm_memopt_clear_visited().

basic_block create_basic_block ( void *  ,
void *  ,
basic_block   
)
basic_block create_empty_bb ( basic_block  )
enum ir_type current_ir_type ( void  )

Declarations.

Returns current ir type.

Referenced by cond_exec_find_if_block(), gimplify_build3(), and remove_branch().

void delete_basic_block ( basic_block  )
void dump_bb ( FILE *  ,
basic_block  ,
int  ,
int   
)
void dump_bb_for_graph ( pretty_printer ,
basic_block   
)
basic_block duplicate_block ( basic_block  ,
edge  ,
basic_block   
)
bool empty_block_p ( basic_block  )
void execute_on_growing_pred ( edge  )
void execute_on_shrinking_pred ( edge  )
void extract_cond_bb_edges ( basic_block  ,
edge ,
edge  
)
int flow_call_edges_add ( sbitmap  )
basic_block force_nonfallthru ( edge  )
struct cfg_hooks get_cfg_hooks ( void  )
read
void gimple_register_cfg_hooks ( void  )

Initialization of functions specific to the tree IR.

References cfg_hooks.

Referenced by cgraph_process_new_functions().

void lv_add_condition_to_bb ( basic_block  first,
basic_block  second,
basic_block  new_block,
void *  cond 
)

Conditions in trees and RTL are different so we need a different handling when we add the condition to the versioning code.

References duplicate_block(), and NULL.

void lv_adjust_loop_header_phi ( basic_block  first,
basic_block  second,
basic_block  new_block,
edge  e 
)

Responsible for updating the ssa info (PHI nodes) on the new condition basic block that guards the versioned loop.

void lv_flush_pending_stmts ( edge  )
edge make_forwarder_block ( basic_block  bb,
bool(*)(edge redirect_edge_p,
void(*)(basic_block new_bb_cbk 
)

Split BB into entry part and the rest (the rest is the newly created block). Redirect those edges for that REDIRECT_EDGE_P returns true to the entry part. Returns the edge connecting the entry part to the rest.

 Redirect back edges we want to keep.   
         If we redirected the loop latch edge, the JUMP block now acts like
         the new latch of the loop.   
     If we do not split a loop header, then both blocks belong to the
     same loop.  In case we split loop header and do not redirect the
     latch edge to DUMMY, then DUMMY belongs to the outer loop, and
     BB becomes the new header.  If latch is not recorded for the loop,
     we leave this updating on the caller (this may only happen during
     loop analysis).   
     In case we split loop latch, update it.   
void merge_blocks ( basic_block  ,
basic_block   
)
bool move_block_after ( basic_block  ,
basic_block   
)
void predict_edge ( edge  e,
enum br_predictor  predictor,
int  probability 
)
bool predicted_by_p ( const_basic_block  bb,
enum br_predictor  predictor 
)
edge redirect_edge_and_branch ( edge  ,
basic_block   
)
basic_block redirect_edge_and_branch_force ( edge  ,
basic_block   
)
void remove_branch ( edge  )
void remove_edge ( edge  )
void rtl_register_cfg_hooks ( void  )

Initialization of functions specific to the rtl IR.

void set_cfg_hooks ( struct cfg_hooks  )
edge split_block ( basic_block  ,
void *   
)
edge split_block_after_labels ( basic_block  )
basic_block split_block_before_cond_jump ( basic_block  )
basic_block split_edge ( edge  )
void tidy_fallthru_edge ( edge  )
void tidy_fallthru_edges ( void  )

Fix up edges that now fall through, or rather should now fall through but previously required a jump around now deleted blocks. Simplify the search by only examining blocks numerically adjacent, since this is how they were created.

??? This routine is currently RTL specific.

We care about simple conditional or unconditional jumps with a single successor.

If we had a conditional branch to the next instruction when CFG was built, then there will only be one out edge for the block which ended with the conditional branch (since we do not create duplicate edges).

Furthermore, the edge will be marked as a fallthru because we merge the flags for the duplicate edges. So we do not want to check that the edge is not a FALLTHRU edge.

References add_bb_to_loop(), CDI_DOMINATORS, current_loops, dom_info_available_p(), find_common_loop(), NULL, rescan_loop_exit(), set_immediate_dominator(), single_pred(), and single_succ().

void verify_flow_info ( void  )

Verify the CFG consistency.

Currently it does following: checks edge and basic block list correctness and calls into IL dependent checking then.

 Check bb chain & numbers.   
 Now check the basic blocks (boundaries etc.)  
 Complete edge checksumming for ENTRY and EXIT.   
 Clean up.   

Referenced by cleanup_tree_cfg_1().


Variable Documentation

struct cfg_hooks cfg_layout_rtl_cfg_hooks

Implementation of CFG manipulation for cfg layout RTL, where basic block connected via fallthru edges does not have to be adjacent. This representation will hopefully become the default one in future version of the compiler.

struct cfg_hooks gimple_cfg_hooks

Hooks containers.

Referenced by cfg_layout_rtl_register_cfg_hooks(), and set_cfg_hooks().

struct cfg_hooks rtl_cfg_hooks

Implementation of CFG manipulation for linearized RTL.

Referenced by set_cfg_hooks().