GCC Middle and Back End API Reference
cfgrtl.c File Reference

Functions

static rtx skip_insns_after_block (basic_block)
static void record_effective_endpoints (void)
static rtx label_for_bb (basic_block)
static void fixup_reorder_chain (void)
void verify_insn_chain (void)
static void fixup_fallthru_exit_predecessor (void)
static int can_delete_note_p (const_rtx)
static int can_delete_label_p (const_rtx)
static basic_block rtl_split_edge (edge)
static bool rtl_move_block_after (basic_block, basic_block)
static int rtl_verify_flow_info (void)
static basic_block cfg_layout_split_block (basic_block, void *)
static edge cfg_layout_redirect_edge_and_branch (edge, basic_block)
static basic_block cfg_layout_redirect_edge_and_branch_force (edge, basic_block)
static void cfg_layout_delete_block (basic_block)
static void rtl_delete_block (basic_block)
static basic_block rtl_redirect_edge_and_branch_force (edge, basic_block)
static edge rtl_redirect_edge_and_branch (edge, basic_block)
static basic_block rtl_split_block (basic_block, void *)
static void rtl_dump_bb (FILE *, basic_block, int, int)
static int rtl_verify_flow_info_1 (void)
static void rtl_make_forwarder_block (edge)
static int can_delete_note_p ()
static int can_delete_label_p ()
void delete_insn ()
void delete_insn_and_edges ()
void delete_insn_chain ()
basic_block create_basic_block_structure ()
static basic_block rtl_create_basic_block ()
static basic_block cfg_layout_create_basic_block ()
static void rtl_delete_block ()
void compute_bb_for_insn ()
unsigned int free_bb_for_insn ()
static unsigned int rest_of_pass_free_cfg ()
rtl_opt_passmake_pass_free_cfg ()
rtx entry_of_function ()
void emit_insn_at_entry ()
static void update_bb_for_insn_chain ()
void update_bb_for_insn ()
static bool flow_active_insn_p ()
bool contains_no_active_insn_p ()
bool forwarder_block_p ()
bool can_fallthru ()
static bool could_fall_through ()
rtx bb_note ()
static rtx first_insn_after_basic_block_note ()
static basic_block rtl_split_block ()
static bool unique_locus_on_edge_between_p ()
static void emit_nop_for_unique_locus_between ()
static void rtl_merge_blocks ()
static bool rtl_can_merge_blocks ()
rtx block_label ()
edge try_redirect_by_replacing_jump ()
static bool patch_jump_insn ()
static edge redirect_branch_edge ()
static void fixup_partition_crossing ()
static edge rtl_redirect_edge_and_branch ()
void emit_barrier_after_bb ()
basic_block force_nonfallthru_and_redirect ()
static basic_block rtl_force_nonfallthru ()
static basic_block rtl_redirect_edge_and_branch_force ()
static void rtl_tidy_fallthru_edge ()
static basic_block last_bb_in_partition ()
static basic_block rtl_split_edge ()
void insert_insn_on_edge ()
void commit_one_edge_insertion ()
void commit_edge_insertions ()
static void rtl_dump_bb ()
void print_rtl_with_bb ()
void update_br_prob_note ()
rtx get_last_bb_insn ()
static int verify_hot_cold_block_grouping ()
static int rtl_verify_edges ()
static int rtl_verify_bb_insns ()
static int rtl_verify_bb_pointers ()
static int rtl_verify_bb_insn_chain ()
static int rtl_verify_fallthru ()
static int rtl_verify_bb_layout ()
bool purge_dead_edges ()
bool purge_all_dead_edges ()
bool fixup_abnormal_edges ()
rtx unlink_insn_chain ()
static rtx skip_insns_after_block ()
static rtx label_for_bb ()
static unsigned int into_cfg_layout_mode ()
static unsigned int outof_cfg_layout_mode ()
rtl_opt_passmake_pass_into_cfg_layout_mode ()
rtl_opt_passmake_pass_outof_cfg_layout_mode ()
void relink_block_chain ()
static void force_one_exit_fallthru ()
static bool cfg_layout_can_duplicate_bb_p ()
rtx duplicate_insn_chain ()
static basic_block cfg_layout_duplicate_bb ()
void cfg_layout_initialize ()
void break_superblocks ()
void cfg_layout_finalize ()
static basic_block cfg_layout_split_block ()
static edge cfg_layout_redirect_edge_and_branch ()
static basic_block cfg_layout_redirect_edge_and_branch_force ()
static void cfg_layout_delete_block ()
static bool cfg_layout_can_merge_blocks_p ()
static void cfg_layout_merge_blocks ()
static basic_block cfg_layout_split_edge ()
static void rtl_make_forwarder_block ()
static bool rtl_block_empty_p ()
static basic_block rtl_split_block_before_cond_jump ()
static bool rtl_block_ends_with_call_p ()
static bool rtl_block_ends_with_condjump_p ()
static bool need_fake_edge_p ()
static int rtl_flow_call_edges_add ()
static void rtl_lv_add_condition_to_bb (basic_block first_head, basic_block second_head, basic_block cond_bb, void *comp_rtx)
static void rtl_extract_cond_bb_edges (basic_block b, edge *branch_edge, edge *fallthru_edge)
void init_rtl_bb_info ()
static bool rtl_can_remove_branch_p ()
static basic_block rtl_duplicate_bb ()
static void rtl_account_profile_record (basic_block bb, int after_pass, struct profile_record *record)

Variables

static rtx cfg_layout_function_footer
static rtx cfg_layout_function_header
struct cfg_hooks rtl_cfg_hooks
struct cfg_hooks cfg_layout_rtl_cfg_hooks

Function Documentation

rtx bb_note ( )
Return the NOTE_INSN_BASIC_BLOCK of BB.   
rtx block_label ( )
Return the label in the head of basic block BLOCK.  Create one if it doesn't
   exist.   

References emit_label_before(), and gen_label_rtx().

static int can_delete_label_p ( const_rtx  )
static

Referenced by delete_insn().

static int can_delete_label_p ( )
static
True if a given label can be deleted.   

References in_expr_list_p().

static int can_delete_note_p ( const_rtx  )
static

Referenced by delete_insn_chain().

static int can_delete_note_p ( )
static
Return true if NOTE is not one of the ones that must be kept paired,
   so that we may simply delete it.   
bool can_fallthru ( )
Return nonzero if we can reach target from src by falling through.   
FIXME: Make this a cfg hook.   

References active_insn_p(), edge_def::dest, edge_def::flags, next_active_insn(), basic_block_def::next_bb, and basic_block_def::succs.

static bool cfg_layout_can_duplicate_bb_p ( )
static
Return true in case it is possible to duplicate the basic block BB.   

References tablejump_p(), and targetm.

static bool cfg_layout_can_merge_blocks_p ( )
static
static basic_block cfg_layout_create_basic_block ( )
static
static void cfg_layout_delete_block ( basic_block  )
static
static void cfg_layout_delete_block ( )
static
static basic_block cfg_layout_duplicate_bb ( )
static
Create a duplicate of the basic block BB.   

References create_basic_block(), duplicate_insn_chain(), get_last_insn(), and unlink_insn_chain().

Referenced by rtl_duplicate_bb().

void cfg_layout_initialize ( )
Main entry point to this module - initialize the datastructures for
   CFG layout changes.  It keeps LOOPS up-to-date if not null.

   FLAGS is a set of additional flags to pass to cleanup_cfg().   

References cfg_layout_rtl_register_cfg_hooks(), cleanup_cfg(), basic_block_def::flags, initialize_original_copy_tables(), and record_effective_endpoints().

static edge cfg_layout_redirect_edge_and_branch ( edge  ,
basic_block   
)
static
static basic_block cfg_layout_redirect_edge_and_branch_force ( edge  ,
basic_block   
)
static
static basic_block cfg_layout_redirect_edge_and_branch_force ( )
static
Simple wrapper as we always can redirect fallthru edges.   

References cfg_layout_redirect_edge_and_branch().

static basic_block cfg_layout_split_block ( basic_block  ,
void *   
)
static
static basic_block cfg_layout_split_block ( )
static
Same as split_block but update cfg_layout structures.   

References rtl_split_block().

static basic_block cfg_layout_split_edge ( )
static
void compute_bb_for_insn ( void  )
Records the basic block struct in BLOCK_FOR_INSN for every insn.   

Referenced by schedule_ebbs_init().

bool contains_no_active_insn_p ( )
Return true if the block has no effect and only forwards control flow to
   its single destination.   

References flow_active_insn_p(), simplejump_p(), and single_succ_p().

static bool could_fall_through ( )
static
Return nonzero if we could reach target from src by falling through,
   if the target was made adjacent.  If we already have a fall-through
   edge to the exit block, we can't do that.   

References edge_def::dest, edge_def::flags, and basic_block_def::succs.

Referenced by fixup_reorder_chain().

basic_block create_basic_block_structure ( )
Create a new basic block consisting of the instructions between HEAD and END
   inclusive.  This function is designed to allow fast BB construction - reuses
   the note and basic block struct in BB_NOTE, if any and do not grow
   BASIC_BLOCK chain and should be used directly only by CFG construction code.
   END can be NULL in to create new empty basic block before HEAD.  Both END
   and HEAD can be NULL to create basic block at the end of INSN chain.
   AFTER is the basic block we should be put after.   

References alloc_block(), basic_block_def::aux, bb_note(), df_bb_refs_record(), emit_note_after(), emit_note_before(), basic_block_def::flags, get_last_insn(), basic_block_def::index, init_rtl_bb_info(), link_block(), reorder_insns_nobb(), and update_bb_for_insn().

void delete_insn ( )
Delete INSN by patching it out.   

References bb_note(), can_delete_label_p(), df_insn_delete(), find_reg_note(), len, remove_insn(), remove_node_from_expr_list(), remove_note(), and reorder_insns_nobb().

Referenced by add_test(), attempt_change(), calculate_needs_all_insns(), cfg_layout_merge_blocks(), cfg_layout_redirect_edge_and_branch(), cleanup_barriers(), combine_btr_defs(), combine_stack_adjustments_for_block(), commit_one_edge_insertion(), convert_jumps_to_returns(), cprop_jump(), cse_cc_succs(), cse_extended_basic_block(), dead_or_predicable(), delete_address_reloads_1(), delete_caller_save_insns(), delete_dead_jumptables(), delete_dead_store_insn(), delete_debug_insns(), delete_insn_and_edges(), delete_insn_chain(), delete_output_reload(), delete_redundant_insns_1(), delete_related_insns(), doloop_modify(), dse_step5_nospill(), duplicate_insn_chain(), eliminate_partially_redundant_load(), expand_gimple_tailcall(), final(), final_scan_insn(), find_and_remove_re(), find_comparisons_in_bb(), find_cond_trap(), fix_crossing_unconditional_branches(), fixup_abnormal_edges(), fixup_reorder_chain(), get_uncond_jump_length(), hoist_code(), instantiate_virtual_regs_in_insn(), lra_final_code_change(), maybe_cleanup_end_of_block(), merge_blocks_move_predecessor_nojumps(), merge_blocks_move_successor_nojumps(), move_btr_def(), move_for_stack_reg(), move_insn_for_shrink_wrap(), move_invariant_reg(), move_unallocated_pseudos(), pre_delete(), reemit_insn_block_notes(), reload(), reload_as_needed(), reload_combine_recognize_const_pattern(), reload_combine_recognize_pattern(), reload_cse_move2add(), replace_store_insn(), resolve_shift_zext(), resolve_simple_move(), resolve_use(), sched_remove_insn(), split_iv(), thread_prologue_and_epilogue_insns(), try_auto_increment(), try_eliminate_compare(), try_optimize_cfg(), try_split(), update_cfg_for_uncondjump(), and update_equiv_regs().

void delete_insn_and_edges ( )
void delete_insn_chain ( )
Unlink a chain of insns between START and FINISH, leaving notes
   that must be paired.  If CLEAR_BB is true, we set bb field for
   insns that cannot be removed to NULL.   

References can_delete_note_p(), and delete_insn().

Referenced by cond_exec_process_if_block(), peep2_attempt(), rtl_delete_block(), rtl_merge_blocks(), rtl_tidy_fallthru_edge(), try_head_merge_bb(), and try_redirect_by_replacing_jump().

void emit_barrier_after_bb ( )
Emit a barrier after BB, into the footer if we are in CFGLAYOUT mode.   

References current_ir_type(), emit_barrier_after(), IR_RTL_CFGLAYOUT, IR_RTL_CFGRTL, and unlink_insn_chain().

void emit_insn_at_entry ( )
Emit INSN at the entry point of the function, ensuring that it is only
   executed once per function.   

References commit_edge_insertions(), ei_safe_edge(), edge_def::flags, and insert_insn_on_edge().

Referenced by emit_initial_value_sets().

static void emit_nop_for_unique_locus_between ( )
static
If the single edge between blocks A and B is the only place in RTL which
   holds some unique locus, emit a nop with that locus between the blocks.   

References emit_insn_after_noloc(), and unique_locus_on_edge_between_p().

Referenced by cfg_layout_merge_blocks(), and rtl_merge_blocks().

rtx entry_of_function ( void  )
Return RTX to emit after when we want to emit code on the entry of function.   

References get_insns().

Referenced by expand_builtin_apply_args(), expand_builtin_saveregs(), and get_arg_pointer_save_area().

static rtx first_insn_after_basic_block_note ( )
static
Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK
   note associated with the BLOCK.   

Referenced by rtl_split_block().

bool fixup_abnormal_edges ( void  )
This is used by a few passes that emit some instructions after abnormal
   calls, moving the basic block's end, while they in fact do want to emit
   them on the fallthru edge.  Look for abnormal call edges, find backward
   the call in the block and insert the instructions on the edge instead.

   Similarly, handle instructions throwing exceptions internally.

   Return true when instructions have been found and inserted on edges.   

References can_throw_internal(), delete_insn(), find_fallthru_edge(), edge_def::flags, insert_insn_on_edge(), inserted, purge_dead_edges(), and basic_block_def::succs.

Referenced by convert_regs(), lra(), and reload().

static void fixup_fallthru_exit_predecessor ( )
static
If we have assembler epilogues, the block falling through to exit must
   be the last one in the reordered chain when we reach final.  Ensure
   that this condition is met.   

References basic_block_def::aux, edge_def::dest, find_fallthru_edge(), basic_block_def::next_bb, reload_completed, split_block(), and edge_def::src.

Referenced by cfg_layout_finalize().

static void fixup_partition_crossing ( )
static
Called when edge E has been redirected to a new destination,
   in order to update the region crossing flag on the edge and
   jump.   

References add_reg_note(), edge_def::dest, find_reg_note(), edge_def::flags, remove_note(), edge_def::src, and basic_block_def::succs.

Referenced by force_nonfallthru_and_redirect(), and rtl_redirect_edge_and_branch().

static bool flow_active_insn_p ( )
static
Like active_insn_p, except keep the return value clobber around
   even after reload.   

References active_insn_p().

Referenced by contains_no_active_insn_p().

static void force_one_exit_fallthru ( )
static
In case there are more than one fallthru predecessors of exit, force that
   there is only one.   

References basic_block_def::aux, ei_next(), ei_safe_edge(), edge_def::flags, redirect_edge_and_branch_force(), split_edge(), and edge_def::src.

Referenced by cfg_layout_finalize().

bool forwarder_block_p ( )
Likewise, but protect loop latches, headers and preheaders.   
FIXME: Make this a cfg hook.   

References contains_no_active_insn_p(), loop::header, and basic_block_def::loop_father.

unsigned int free_bb_for_insn ( void  )
Release the basic_block_for_insn array.   

References get_insns().

Referenced by rest_of_clean_state(), and rest_of_pass_free_cfg().

rtx get_last_bb_insn ( )
Get the last insn associated with block BB (that includes barriers and
   tablejumps after BB).   

References next_nonnote_insn_bb(), and tablejump_p().

void insert_insn_on_edge ( )
Queue instructions for insertion on an edge between two basic blocks.
   The new instructions and basic blocks (if any) will not appear in the
   CFG until commit_edge_insertions is called.   

References emit_insn(), end_sequence(), edge_def::flags, get_insns(), edge_def::insns, push_to_sequence(), edge_def::edge_def_insns::r, and start_sequence().

static unsigned int into_cfg_layout_mode ( )
static
static rtx label_for_bb ( basic_block  )
static
static rtx label_for_bb ( )
static
Locate or create a label for a given basic block.   

References block_label(), dump_file, and basic_block_def::index.

static basic_block last_bb_in_partition ( )
static
Locate the last bb in the same partition as START_BB.   

References basic_block_def::next_bb, and basic_block_def::prev_bb.

Referenced by rtl_split_edge().

rtl_opt_pass* make_pass_free_cfg ( )
rtl_opt_pass* make_pass_into_cfg_layout_mode ( )
rtl_opt_pass* make_pass_outof_cfg_layout_mode ( )
static bool need_fake_edge_p ( )
static
Return true if we need to add fake edge to exit.
   Helper function for rtl_flow_call_edges_add.   

References asm_noperands(), and find_reg_note().

Referenced by rtl_flow_call_edges_add().

static unsigned int outof_cfg_layout_mode ( )
static
static bool patch_jump_insn ( )
static
Subroutine of redirect_branch_edge that tries to patch the jump
   instruction INSN so that it reaches block NEW.  Do this
   only when it originally reached block OLD.  Return true if this
   worked or the original target wasn't OLD, return false if redirection
   doesn't work.   

References add_reg_note(), block_label(), computed_jump_p(), currently_expanding_to_rtl, extract_asm_operands(), find_reg_note(), pc_rtx, redirect_jump(), remove_note(), returnjump_p(), and tablejump_p().

Referenced by redirect_branch_edge(), and rtl_split_edge().

void print_rtl_with_bb ( )
Like dump_function_to_file, but for RTL.  Print out dataflow information
   for the start of each basic block.  FLAGS are the TDF_* masks documented
   in dumpfile.h.   

References bb_state, cfun, function::curr_properties, df, df_dump_bottom(), df_dump_insn_bottom(), df_dump_insn_top(), df_dump_start(), df_dump_top(), dump_bb_info(), dump_flags, dump_insn_slim(), free(), get_max_uid(), max_uid, and print_rtl_single().

Referenced by execute_function_dump(), if_convert(), and rtl_verify_edges().

bool purge_all_dead_edges ( void  )
Search all basic blocks for potentially dead edges and purge them.  Return
   true if some edge has been eliminated.   

References purge_dead_edges().

Referenced by combine_instructions(), gimple_expand_cfg(), ira(), rest_of_handle_cse_after_global_opts(), and rest_of_handle_postreload().

bool purge_dead_edges ( )
static void record_effective_endpoints ( )
static
Locate the effective beginning and end of the insn chain for each
   block, as defined by skip_insns_after_block above.   

References cfg_layout_function_footer, cfg_layout_function_header, get_insns(), get_last_insn(), next_insn(), skip_insns_after_block(), and unlink_insn_chain().

Referenced by cfg_layout_initialize().

static edge redirect_branch_edge ( )
static
Redirect edge representing branch of (un)conditional jump or tablejump,
   NULL on failure   

References currently_expanding_to_rtl, edge_def::dest, dump_file, edge_def::flags, basic_block_def::index, patch_jump_insn(), redirect_edge_succ_nodup(), and edge_def::src.

Referenced by cfg_layout_redirect_edge_and_branch(), and rtl_redirect_edge_and_branch().

void relink_block_chain ( )
Link the basic blocks in the correct order, compacting the basic
   block queue while at it.  If STAY_IN_CFGLAYOUT_MODE is false, this
   function also clears the basic block header and footer fields.

   This function is usually called after a pass (e.g. tracer) finishes
   some transformations while in cfglayout mode.  The required sequence
   of the basic blocks is in a linked list along the bb->aux field.
   This functions re-links the basic block prev_bb and next_bb pointers
   accordingly, and it compacts and renumbers the blocks.

   FIXME: This currently works only for RTL, but the only RTL-specific
   bits are the STAY_IN_CFGLAYOUT_MODE bits.  The tracer pass was moved
   to GIMPLE a long time ago, but it doesn't relink the basic block
   chain.  It could do that (to give better initial RTL) if this function
   is made IR-agnostic (and moved to cfganal.c or cfg.c while at it).   

References basic_block_def::aux, compact_blocks(), dump_file, forwarder_block_p(), free_original_copy_tables(), basic_block_def::frequency, get_bb_original(), basic_block_def::index, initialize_original_copy_tables(), basic_block_def::next_bb, and basic_block_def::prev_bb.

static unsigned int rest_of_pass_free_cfg ( )
static
static void rtl_account_profile_record ( basic_block  bb,
int  after_pass,
struct profile_record record 
)
static
Do book-keeping of basic block BB for the profile consistency checker.
   If AFTER_PASS is 0, do pre-pass accounting, or if AFTER_PASS is 1
   then do post-pass accounting.  Store the counting in RECORD.   

References basic_block_def::count, basic_block_def::frequency, insn_rtx_cost(), PROFILE_GUESSED, PROFILE_READ, profile_record::size, and profile_record::time.

static bool rtl_block_empty_p ( )
static
Return true if BB contains only labels or non-executable
   instructions.   

References any_uncondjump_p().

static bool rtl_block_ends_with_call_p ( )
static
Return 1 if BB ends with a call, possibly followed by some
   instructions that must stay with the call, 0 otherwise.   

References keep_with_call_p().

static bool rtl_block_ends_with_condjump_p ( )
static
Return 1 if BB ends with a conditional branch, 0 otherwise.   

References any_condjump_p().

static bool rtl_can_merge_blocks ( )
static
static bool rtl_can_remove_branch_p ( )
static
Returns true if it is possible to remove edge E by redirecting
   it to the destination of the other edge from E->src.   

References edge_def::flags, onlyjump_p(), side_effects_p(), edge_def::src, and tablejump_p().

static basic_block rtl_create_basic_block ( )
static
Create new basic block consisting of instructions in between HEAD and END
   and place it to the BB chain after block AFTER.  END can be NULL to
   create a new empty basic block before HEAD.  Both END and HEAD can be
   NULL to create basic block at the end of INSN chain.   

References basic_block_def::aux, create_basic_block_structure(), and vec_safe_grow_cleared().

Referenced by cfg_layout_create_basic_block().

static void rtl_delete_block ( basic_block  )
static

Referenced by cfg_layout_delete_block().

static void rtl_delete_block ( )
static
Delete the insns in a (non-live) block.  We physically delete every
   non-deleted-note insn, and update the flow graph appropriately.

   Return nonzero if we deleted an exception handler.   
??? Preserving all such notes strikes me as wrong.  It would be nice
   to post-process the stream to remove empty blocks, loops, ranges, etc.   

References delete_insn_chain(), df_bb_delete(), dump_file, get_last_bb_insn(), and basic_block_def::index.

static void rtl_dump_bb ( FILE *  ,
basic_block  ,
int  ,
int   
)
static
static void rtl_dump_bb ( )
static
Print out RTL-specific basic block information (live information
   at start and end with TDF_DETAILS).  FLAGS are the TDF_* masks
   documented in dumpfile.h.   

References df, df_dump_bottom(), df_dump_insn_bottom(), df_dump_insn_top(), df_dump_top(), dump_insn_slim(), indent, basic_block_def::index, last, memset(), and print_rtl_single().

static basic_block rtl_duplicate_bb ( )
static
static void rtl_extract_cond_bb_edges ( basic_block  b,
edge branch_edge,
edge fallthru_edge 
)
static
Given a block B with unconditional branch at its end, get the
   store the return the branch edge and the fall-thru edge in
   BRANCH_EDGE and FALLTHRU_EDGE respectively.   

References edge_def::flags.

static int rtl_flow_call_edges_add ( )
static
Add fake edges to the function exit for any non constant and non noreturn
   calls, volatile inline assembly in the bitmap of blocks specified by
   BLOCKS or to the whole CFG if BLOCKS is zero.  Return the number of blocks
   that were split.

   The goal is to expose cases in which entering a basic block does not imply
   that all subsequent instructions must be executed.   

References bitmap_bit_p(), commit_edge_insertions(), find_edge(), gen_use(), insert_insn_on_edge(), keep_with_call_p(), last_bb, make_edge(), need_fake_edge_p(), basic_block_def::prev_bb, split_block(), and verify_flow_info().

static basic_block rtl_force_nonfallthru ( )
static
Edge E is assumed to be fallthru edge.  Emit needed jump instruction
   (and possibly create new basic block) to make edge non-fallthru.
   Return newly created BB or NULL if none.   

References edge_def::dest, and force_nonfallthru_and_redirect().

static void rtl_lv_add_condition_to_bb ( basic_block  first_head,
basic_block  second_head,
basic_block  cond_bb,
void *  comp_rtx 
)
static
Add COMP_RTX as a condition at end of COND_BB.  FIRST_HEAD is
   the conditional branch target, SECOND_HEAD should be the fall-thru
   there is no need to handle this here the loop versioning code handles
   this.  the reason for SECON_HEAD is that it is needed for condition
   in trees, and this should be of the same type since it is a hook.   

References block_label(), comp, do_compare_rtx_and_jump(), emit_insn_after(), end_sequence(), force_operand(), get_insns(), get_last_insn(), and start_sequence().

static void rtl_make_forwarder_block ( edge  )
static
static void rtl_make_forwarder_block ( )
static
Do postprocessing after making a forwarder block joined by edge FALLTHRU.   
static void rtl_merge_blocks ( )
static
static bool rtl_move_block_after ( basic_block  bb,
basic_block  after 
)
static
Should move basic block BB after basic block AFTER.  NIY.   
static edge rtl_redirect_edge_and_branch ( edge  ,
basic_block   
)
static
static edge rtl_redirect_edge_and_branch ( )
static
Attempt to change code to redirect edge E to TARGET.  Don't do that on
   expense of adding new instructions or reordering basic blocks.

   Function can be also called with edge destination equivalent to the TARGET.
   Then it should try the simplifications and do nothing if none is possible.

   Return edge representing the branch if transformation succeeded.  Return NULL
   on failure.
   We still return NULL in case E already destinated TARGET and we didn't
   managed to simplify instruction stream.   

References edge_def::dest, df_set_bb_dirty(), fixup_partition_crossing(), edge_def::flags, redirect_branch_edge(), edge_def::src, and try_redirect_by_replacing_jump().

static basic_block rtl_redirect_edge_and_branch_force ( edge  ,
basic_block   
)
static
static basic_block rtl_redirect_edge_and_branch_force ( )
static
Redirect edge even at the expense of creating new jump insn or
   basic block.  Return new basic block if created, NULL otherwise.
   Conversion must be possible.   

References edge_def::dest, df_set_bb_dirty(), force_nonfallthru_and_redirect(), redirect_edge_and_branch(), and edge_def::src.

static basic_block rtl_split_block ( basic_block  ,
void *   
)
static

Referenced by cfg_layout_split_block().

static basic_block rtl_split_block ( )
static
Creates a new basic block just after basic block B by splitting
   everything after specified instruction I.   

References create_basic_block(), df_set_bb_dirty(), emit_note_after(), first_insn_after_basic_block_note(), get_last_insn(), edge_def::src, and basic_block_def::succs.

static basic_block rtl_split_block_before_cond_jump ( )
static
Split a basic block if it ends with a conditional branch and if
   the other part of the block is not empty.   

References any_condjump_p(), edge_def::dest, last, and split_block().

static basic_block rtl_split_edge ( edge  )
static
static basic_block rtl_split_edge ( )
static
Split a (typically critical) edge.  Return the new block.
   The edge must not be abnormal.

   ??? The code generally expects to be called on critical edges.
   The case of a block ending in an unconditional jump to a
   block with multiple predecessors is not handled optimally.   

References create_basic_block(), edge_def::dest, df_set_bb_dirty(), extract_asm_operands(), find_fallthru_edge(), edge_def::flags, force_nonfallthru(), last, last_bb_in_partition(), make_single_succ_edge(), patch_jump_insn(), basic_block_def::preds, basic_block_def::prev_bb, redirect_edge_and_branch(), redirect_edge_succ(), single_succ_edge(), and edge_def::src.

static void rtl_tidy_fallthru_edge ( )
static
The given edge should potentially be a fallthru edge.  If that is in
   fact true, delete the jump and barriers that are in the way.   

References any_condjump_p(), any_uncondjump_p(), delete_insn_chain(), edge_def::flags, basic_block_def::next_bb, only_sets_cc0_p(), onlyjump_p(), single_succ_p(), and edge_def::src.

static int rtl_verify_bb_insn_chain ( )
static
Walk the instruction chain and verify that bb head/end pointers
  are correct, and that instructions are in exactly one bb and have
  correct block pointers.   

References error(), free(), get_last_insn(), get_max_uid(), basic_block_def::index, and max_uid.

Referenced by rtl_verify_flow_info().

static int rtl_verify_bb_insns ( )
static
Checks on the instructions within blocks. Currently checks that each
   block starts with a basic block note, and that basic block notes and
   control flow jumps are not found in the middle of the block.   

References control_flow_insn_p(), error(), and basic_block_def::index.

Referenced by rtl_verify_flow_info_1().

static int rtl_verify_bb_layout ( )
static
Verify that blocks are laid out in consecutive order. While walking the
   instructions, verify that all expected instructions are inside the basic
   blocks, and that all returns are followed by barriers.   

References condjump_p(), curr_bb, get_insns(), internal_error(), basic_block_def::next_bb, next_nonnote_insn(), and returnjump_p().

Referenced by rtl_verify_flow_info().

static int rtl_verify_bb_pointers ( )
static
Verify that block pointers for instructions in basic blocks, headers and
   footers are set appropriately.   

References error(), basic_block_def::flags, and basic_block_def::index.

Referenced by rtl_verify_flow_info_1().

static int rtl_verify_edges ( )
static
Perform several checks on the edges out of each block, such as
   the consistency of the branch probabilities, the correctness
   of hot/cold partition crossing edges, and the number of expected
   successor edges.   

References any_condjump_p(), any_uncondjump_p(), edge_def::dest, error(), find_reg_note(), edge_def::flags, get_insns(), basic_block_def::index, print_rtl_with_bb(), PROFILE_ABSENT, edge_def::src, and basic_block_def::succs.

Referenced by rtl_verify_flow_info_1().

static int rtl_verify_fallthru ( )
static
Verify that fallthru edges point to adjacent blocks in layout order and
   that barriers exist after non-fallthru blocks.   

References edge_def::dest, error(), find_fallthru_edge(), basic_block_def::index, basic_block_def::next_bb, edge_def::src, and basic_block_def::succs.

Referenced by rtl_verify_flow_info().

static int rtl_verify_flow_info ( )
static
Verify the CFG and RTL consistency common for both underlying RTL and
   cfglayout RTL, plus consistency checks specific to linearized RTL mode.

   Currently it does following checks:
   - all checks of rtl_verify_flow_info_1
   - test head/end pointers
   - check that blocks are laid out in consecutive order
   - check that all insns are in the basic blocks
     (except the switch handling code, barriers and notes)
   - check that all returns are followed by barriers
   - check that all fallthru edge points to the adjacent blocks.   

References rtl_verify_bb_insn_chain(), rtl_verify_bb_layout(), rtl_verify_fallthru(), rtl_verify_flow_info_1(), and verify_hot_cold_block_grouping().

static int rtl_verify_flow_info_1 ( )
static
Verify the CFG and RTL consistency common for both underlying RTL and
   cfglayout RTL.

   Currently it does following checks:

   - overlapping of basic blocks
   - insns with wrong BLOCK_FOR_INSN pointers
   - headers of basic blocks (the NOTE_INSN_BASIC_BLOCK note)
   - tails of basic blocks (ensure that boundary is necessary)
   - scans body of the basic block for JUMP_INSN, CODE_LABEL
     and NOTE_INSN_BASIC_BLOCK
   - verify that no fall_thru edge crosses hot/cold partition boundaries
   - verify that there are no pending RTL branch predictions
   - verify that there is a single hot/cold partition boundary after bbro

   In future it can be extended check a lot of other stuff as well
   (reachability of basic blocks, life information, etc. etc.).   

References rtl_verify_bb_insns(), rtl_verify_bb_pointers(), and rtl_verify_edges().

Referenced by rtl_verify_flow_info().

static rtx skip_insns_after_block ( basic_block  )
static
static rtx skip_insns_after_block ( )
static
Skip over inter-block insns occurring after BB which are typically
   associated with BB (e.g., barriers). If there are any such insns,
   we return the last one. Otherwise, we return the end of BB.   

References basic_block_def::next_bb, and reorder_insns().

edge try_redirect_by_replacing_jump ( )
Attempt to perform edge redirection by replacing possibly complex jump
   instruction by unconditional jump or removing jump completely.  This can
   apply only if all edges now point to the same block.  The parameters and
   return values are equivalent to redirect_edge_and_branch.   

References block_label(), can_fallthru(), cc0_rtx, edge_def::count, basic_block_def::count, delete_insn_chain(), edge_def::dest, dump_file, emit_barrier_after(), emit_jump_insn_after_noloc(), edge_def::flags, basic_block_def::index, next_nonnote_insn(), only_sets_cc0_p(), onlyjump_p(), edge_def::probability, redirect_edge_succ(), redirect_jump(), reg_mentioned_p(), reload_completed, remove_edge(), side_effects_p(), simplejump_p(), single_succ_edge(), single_succ_p(), edge_def::src, basic_block_def::succs, table, tablejump_p(), and update_bb_for_insn_chain().

static bool unique_locus_on_edge_between_p ( )
static
Return true if the single edge between blocks A and B is the only place
   in RTL which holds some unique locus.   

Referenced by emit_nop_for_unique_locus_between().

rtx unlink_insn_chain ( )
void update_bb_for_insn ( )
Update BLOCK_FOR_INSN of insns in BB to BB,
   and notify df of the change.   

References update_bb_for_insn_chain().

static void update_bb_for_insn_chain ( )
static
Update BLOCK_FOR_INSN of insns between BEGIN and END
   (or BARRIER if found) and notify df of the bb change.
   The insn chain range is inclusive
   (i.e. both BEGIN and END will be updated.  

References df_insn_change_bb().

Referenced by cfg_layout_merge_blocks(), rtl_merge_blocks(), try_redirect_by_replacing_jump(), and update_bb_for_insn().

void update_br_prob_note ( )
Update the branch probability of BB if a REG_BR_PROB is present.   

References find_reg_note().

static int verify_hot_cold_block_grouping ( )
static
Verify, in the basic block chain, that there is at most one switch
   between hot/cold partitions. This condition will not be true until
   after reorder_basic_blocks is called.   

References current_ir_type(), error(), basic_block_def::index, and IR_RTL_CFGRTL.

Referenced by rtl_verify_flow_info().

DEBUG_FUNCTION void verify_insn_chain ( )
Perform sanity checks on the insn chain.
   1. Check that next/prev pointers are consistent in both the forward and
      reverse direction.
   2. Count insns in chain, going both directions, and check if equal.
   3. Check that get_last_insn () returns the actual end of chain.   

References get_insns(), and get_last_insn().

Referenced by cfg_layout_finalize(), and fixup_reorder_chain().


Variable Documentation

rtx cfg_layout_function_footer
static
@verbatim Control flow graph manipulation code for GNU compiler.

Copyright (C) 1987-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

This file contains low level functions to manipulate the CFG and analyze it
   that are aware of the RTL intermediate language.

   Available functionality:
     - Basic CFG/RTL manipulation API documented in cfghooks.h
     - CFG-aware instruction chain manipulation
         delete_insn, delete_insn_chain
     - Edge splitting and committing to edges
         insert_insn_on_edge, commit_edge_insertions
     - CFG updating after insn simplification
         purge_dead_edges, purge_all_dead_edges
     - CFG fixing after coarse manipulation
        fixup_abnormal_edges

   Functions not supposed for generic use:
     - Infrastructure to determine quickly basic block for insn
         compute_bb_for_insn, update_bb_for_insn, set_block_for_insn,
     - Edge redirection with updating and optimizing of insn chain
         block_label, tidy_fallthru_edge, force_nonfallthru   
Holds the interesting leading and trailing notes for the function.
   Only applicable if the CFG is in cfglayout mode.   

Referenced by cfg_layout_delete_block(), fixup_reorder_chain(), and record_effective_endpoints().

rtx cfg_layout_function_header
static
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.   

Referenced by cfg_layout_rtl_register_cfg_hooks(), and current_ir_type().

struct cfg_hooks rtl_cfg_hooks
Implementation of CFG manipulation for linearized RTL.   

Referenced by current_ir_type(), and rtl_register_cfg_hooks().