GCC Middle and Back End API Reference
cfgrtl.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "cfghooks.h"
#include "df.h"
#include "insn-config.h"
#include "memmodel.h"
#include "emit-rtl.h"
#include "cfgrtl.h"
#include "cfganal.h"
#include "cfgbuild.h"
#include "cfgcleanup.h"
#include "bb-reorder.h"
#include "rtl-error.h"
#include "insn-attr.h"
#include "dojump.h"
#include "expr.h"
#include "cfgloop.h"
#include "tree-pass.h"
#include "print-rtl.h"
#include "rtl-iter.h"
#include "gimplify.h"
#include "profile.h"
#include "sreal.h"
#include "gt-cfgrtl.h"
Include dependency graph for cfgrtl.cc:

Functions

static rtx_insnskip_insns_after_block (basic_block)
 
static void record_effective_endpoints (void)
 
static void fixup_reorder_chain (void)
 
void verify_insn_chain (void)
 
static void fixup_fallthru_exit_predecessor (void)
 
static bool can_delete_note_p (const rtx_note *)
 
static bool can_delete_label_p (const rtx_code_label *)
 
static basic_block rtl_split_edge (edge)
 
static bool rtl_move_block_after (basic_block, basic_block)
 
static bool 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, dump_flags_t)
 
static bool rtl_verify_flow_info_1 (void)
 
static void rtl_make_forwarder_block (edge)
 
static bool rtl_bb_info_initialized_p (basic_block bb)
 
void delete_insn (rtx_insn *insn)
 
bool delete_insn_and_edges (rtx_insn *insn)
 
void delete_insn_chain (rtx start, rtx_insn *finish, bool clear_bb)
 
basic_block create_basic_block_structure (rtx_insn *head, rtx_insn *end, rtx_note *bb_note, basic_block after)
 
static basic_block rtl_create_basic_block (void *headp, void *endp, basic_block after)
 
static basic_block cfg_layout_create_basic_block (void *head, void *end, basic_block after)
 
void compute_bb_for_insn (void)
 
void free_bb_for_insn (void)
 
rtl_opt_passmake_pass_free_cfg (gcc::context *ctxt)
 
rtx_insnentry_of_function (void)
 
void emit_insn_at_entry (rtx insn)
 
static void update_bb_for_insn_chain (rtx_insn *begin, rtx_insn *end, basic_block bb)
 
void update_bb_for_insn (basic_block bb)
 
static bool flow_active_insn_p (const rtx_insn *insn)
 
bool contains_no_active_insn_p (const_basic_block bb)
 
bool forwarder_block_p (const_basic_block bb)
 
bool can_fallthru (basic_block src, basic_block target)
 
static bool could_fall_through (basic_block src, basic_block target)
 
rtx_notebb_note (basic_block bb)
 
static rtx_insnfirst_insn_after_basic_block_note (basic_block block)
 
static bool loc_equal (location_t loc1, location_t loc2)
 
static bool unique_locus_on_edge_between_p (basic_block a, basic_block b)
 
static void emit_nop_for_unique_locus_between (basic_block a, basic_block b)
 
static void rtl_merge_blocks (basic_block a, basic_block b)
 
static bool rtl_can_merge_blocks (basic_block a, basic_block b)
 
rtx_code_labelblock_label (basic_block block)
 
static void remove_barriers_from_footer (basic_block bb)
 
edge try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
 
static bool patch_jump_insn (rtx_insn *insn, rtx_insn *old_label, basic_block new_bb)
 
static edge redirect_branch_edge (edge e, basic_block target)
 
static void fixup_partition_crossing (edge e)
 
static void fixup_new_cold_bb (basic_block bb)
 
void emit_barrier_after_bb (basic_block bb)
 
basic_block force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
 
static basic_block rtl_force_nonfallthru (edge e)
 
static void rtl_tidy_fallthru_edge (edge e)
 
static basic_block last_bb_in_partition (basic_block start_bb)
 
void insert_insn_on_edge (rtx pattern, edge e)
 
void prepend_insn_to_edge (rtx pattern, edge e)
 
void commit_one_edge_insertion (edge e)
 
void commit_edge_insertions (void)
 
void print_rtl_with_bb (FILE *outf, const rtx_insn *rtx_first, dump_flags_t flags)
 
void update_br_prob_note (basic_block bb)
 
rtx_insnget_last_bb_insn (basic_block bb)
 
void find_bbs_reachable_by_hot_paths (hash_set< basic_block > *set)
 
static auto_vec< basic_blockfind_partition_fixes (bool flag_only)
 
void fixup_partitions (void)
 
static bool verify_hot_cold_block_grouping (void)
 
static bool rtl_verify_edges (void)
 
static bool rtl_verify_bb_insns (void)
 
static bool rtl_verify_bb_pointers (void)
 
static bool rtl_verify_bb_insn_chain (void)
 
static bool rtl_verify_fallthru (void)
 
static bool rtl_verify_bb_layout (void)
 
bool purge_dead_edges (basic_block bb)
 
bool purge_all_dead_edges (void)
 
bool fixup_abnormal_edges (void)
 
void update_cfg_for_uncondjump (rtx_insn *insn)
 
rtx_insnunlink_insn_chain (rtx_insn *first, rtx_insn *last)
 
static rtx_insnlabel_for_bb (basic_block bb)
 
rtl_opt_passmake_pass_into_cfg_layout_mode (gcc::context *ctxt)
 
rtl_opt_passmake_pass_outof_cfg_layout_mode (gcc::context *ctxt)
 
void relink_block_chain (bool stay_in_cfglayout_mode)
 
static void force_one_exit_fallthru (void)
 
static bool cfg_layout_can_duplicate_bb_p (const_basic_block bb)
 
rtx_insnduplicate_insn_chain (rtx_insn *from, rtx_insn *to, class loop *loop, copy_bb_data *id)
 
static basic_block cfg_layout_duplicate_bb (basic_block bb, copy_bb_data *id)
 
void cfg_layout_initialize (int flags)
 
void break_superblocks (void)
 
void cfg_layout_finalize (void)
 
static bool cfg_layout_can_merge_blocks_p (basic_block a, basic_block b)
 
static void cfg_layout_merge_blocks (basic_block a, basic_block b)
 
static basic_block cfg_layout_split_edge (edge e)
 
static bool rtl_block_empty_p (basic_block bb)
 
static basic_block rtl_split_block_before_cond_jump (basic_block bb)
 
static bool rtl_block_ends_with_call_p (basic_block bb)
 
static bool rtl_block_ends_with_condjump_p (const_basic_block bb)
 
static bool need_fake_edge_p (const rtx_insn *insn)
 
static int rtl_flow_call_edges_add (sbitmap blocks)
 
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 (basic_block bb)
 
static bool rtl_can_remove_branch_p (const_edge e)
 
static basic_block rtl_duplicate_bb (basic_block bb, copy_bb_data *id)
 
static void rtl_account_profile_record (basic_block bb, struct profile_record *record)
 

Variables

static rtx_insncfg_layout_function_footer
 
static rtx_insncfg_layout_function_header
 
struct cfg_hooks rtl_cfg_hooks
 
struct cfg_hooks cfg_layout_rtl_cfg_hooks
 

Function Documentation

◆ bb_note()

◆ block_label()

◆ break_superblocks()

◆ can_delete_label_p()

static bool can_delete_label_p ( const rtx_code_label * label)
static
True if a given label can be deleted.   

References forced_labels, LABEL_NAME, LABEL_PRESERVE_P, and vec_safe_contains().

Referenced by delete_insn().

◆ can_delete_note_p()

static bool can_delete_note_p ( const rtx_note * note)
static
Return true if NOTE is not one of the ones that must be kept paired,
so that we may simply delete it.   

References NOTE_KIND.

Referenced by delete_insn_chain().

◆ can_fallthru()

bool can_fallthru ( basic_block src,
basic_block target )
Return nonzero if we can reach target from src by falling through.   
FIXME: Make this a cfg hook, the result is only valid in cfgrtl mode.   

References active_insn_p(), BB_END, BB_HEAD, cfun, EXIT_BLOCK_PTR_FOR_FN, FOR_EACH_EDGE, next_active_insn(), basic_block_def::next_bb, NULL, basic_block_def::succs, and tablejump_p().

Referenced by expand_gimple_basic_block(), expand_gimple_tailcall(), fixup_reorder_chain(), try_redirect_by_replacing_jump(), and try_simplify_condjump().

◆ cfg_layout_can_duplicate_bb_p()

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

References BB_END, BB_HEAD, INSN_P, NEXT_INSN(), NULL, tablejump_p(), and targetm.

◆ cfg_layout_can_merge_blocks_p()

◆ cfg_layout_create_basic_block()

static basic_block cfg_layout_create_basic_block ( void * head,
void * end,
basic_block after )
static

References end(), and rtl_create_basic_block().

◆ cfg_layout_delete_block()

◆ cfg_layout_duplicate_bb()

◆ cfg_layout_finalize()

void cfg_layout_finalize ( void )

◆ cfg_layout_initialize()

void cfg_layout_initialize ( int flags)
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 BLOCK_FOR_INSN(), cfg_layout_rtl_register_cfg_hooks(), cleanup_cfg(), CLEANUP_CFGLAYOUT, crtl, basic_block_def::flags, gcc_assert, initialize_original_copy_tables(), rtx_insn_list::insn(), rtx_insn_list::next(), nonlocal_goto_handler_labels, and record_effective_endpoints().

Referenced by reorder_loops(), and thread_prologue_and_epilogue_insns().

◆ cfg_layout_merge_blocks()

◆ cfg_layout_redirect_edge_and_branch()

◆ cfg_layout_redirect_edge_and_branch_force()

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

References cfg_layout_redirect_edge_and_branch(), gcc_assert, and NULL.

◆ cfg_layout_split_block()

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

References BB_FOOTER, NULL, and rtl_split_block().

◆ cfg_layout_split_edge()

◆ commit_edge_insertions()

◆ commit_one_edge_insertion()

◆ compute_bb_for_insn()

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

References BB_END, BB_HEAD, BLOCK_FOR_INSN(), cfun, end(), FOR_EACH_BB_FN, and NEXT_INSN().

◆ contains_no_active_insn_p()

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

References BB_END, BB_HEAD, cfun, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, flow_active_insn_p(), INSN_P, JUMP_P, NEXT_INSN(), simplejump_p(), single_succ_edge(), and single_succ_p().

Referenced by doloop_optimize(), and forwarder_block_p().

◆ could_fall_through()

static bool could_fall_through ( basic_block src,
basic_block target )
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 cfun, EXIT_BLOCK_PTR_FOR_FN, FOR_EACH_EDGE, and basic_block_def::succs.

Referenced by fixup_reorder_chain().

◆ create_basic_block_structure()

basic_block create_basic_block_structure ( rtx_insn * head,
rtx_insn * end,
rtx_note * bb_note,
basic_block after )
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_END, BB_HEAD, bb_note(), BB_SET_PARTITION, BB_UNPARTITIONED, cfun, df_bb_refs_record(), emit_note_after(), emit_note_before(), end(), basic_block_def::flags, get_last_insn(), basic_block_def::index, init_rtl_bb_info(), LABEL_P, last_basic_block_for_fn, link_block(), NEXT_INSN(), NOTE_BASIC_BLOCK, NULL, PREV_INSN(), reorder_insns_nobb(), SET_BASIC_BLOCK_FOR_FN, and update_bb_for_insn().

Referenced by rtl_create_basic_block().

◆ delete_insn()

void delete_insn ( rtx_insn * insn)
Delete INSN by patching it out.   

References as_a(), BB_END, BB_HEAD, bb_note(), BLOCK_FOR_INSN(), can_delete_label_p(), rtx_insn::deleted(), df_insn_delete(), dyn_cast(), find_reg_note(), gcc_assert, GET_NUM_ELEM, i, INSN_P, JUMP_LABEL, JUMP_P, LABEL_NAME, LABEL_NUSES, LABEL_P, NEXT_INSN(), nonlocal_goto_handler_labels, NOTE_DELETED_LABEL_NAME, NOTE_INSN_BASIC_BLOCK_P, NOTE_KIND, NOTE_P, NULL, NULL_RTX, PUT_CODE, remove_insn(), remove_node_from_insn_list(), remove_note(), reorder_insns_nobb(), RTVEC_ELT, rtx_insn::set_deleted(), table, and XEXP.

Referenced by add_test(), attempt_change(), find_comparison_dom_walker::before_dom_children(), calculate_needs_all_insns(), cfg_layout_merge_blocks(), cfg_layout_redirect_edge_and_branch(), cleanup_barriers(), combine_and_move_insns(), combine_stack_adjustments_for_block(), commit_one_edge_insertion(), copyprop_hardreg_forward_1(), cprop_jump(), cse_cc_succs(), dead_or_predicable(), delete_address_reloads_1(), delete_caller_save_insns(), delete_dead_jumptables(), delete_dead_store_insn(), delete_insn_and_edges(), delete_insn_chain(), delete_output_reload(), delete_redundant_insns_1(), delete_related_insns(), delete_vta_debug_insn(), doloop_modify(), dse_step5(), duplicate_insn_chain(), eliminate_partially_redundant_load(), expand_gimple_tailcall(), final_1(), final_scan_insn_1(), find_and_remove_re(), find_bb_boundaries(), find_cond_trap(), fix_crossing_unconditional_branches(), fixup_abnormal_edges(), fixup_reorder_chain(), 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(), merge_if_block(), move_insn_for_shrink_wrap(), move_invariant_reg(), move_unallocated_pseudos(), pre_delete(), reemit_insn_block_notes(), reemit_marker_as_note(), 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(), rtl_tidy_fallthru_edge(), split_iv(), try_eliminate_compare(), try_merge_compare(), try_optimize_cfg(), try_split(), and update_cfg_for_uncondjump().

◆ delete_insn_and_edges()

bool delete_insn_and_edges ( rtx_insn * insn)

◆ delete_insn_chain()

void delete_insn_chain ( rtx start,
rtx_insn * finish,
bool clear_bb )
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 as_a(), can_delete_note_p(), delete_insn(), rtx_insn::deleted(), NOTE_P, NULL, PREV_INSN(), and set_block_for_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().

◆ duplicate_insn_chain()

◆ emit_barrier_after_bb()

◆ emit_insn_at_entry()

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

References cfun, commit_edge_insertions(), ei_safe_edge(), ei_start, ENTRY_BLOCK_PTR_FOR_FN, gcc_assert, and insert_insn_on_edge().

Referenced by emit_initial_value_sets().

◆ emit_nop_for_unique_locus_between()

static void emit_nop_for_unique_locus_between ( basic_block a,
basic_block b )
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 a, b, BB_END, EDGE_SUCC, emit_insn_after_noloc(), INSN_LOCATION(), and unique_locus_on_edge_between_p().

Referenced by cfg_layout_merge_blocks(), and rtl_merge_blocks().

◆ entry_of_function()

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

References BB_HEAD, cfun, ENTRY_BLOCK_PTR_FOR_FN, get_insns(), n_basic_blocks_for_fn, and NUM_FIXED_BLOCKS.

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

◆ find_bbs_reachable_by_hot_paths()

void find_bbs_reachable_by_hot_paths ( hash_set< basic_block > * set)
Add all BBs reachable from entry via hot paths into the SET.   

References BB_PARTITION, cfun, ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_EDGE, basic_block_def::succs, and worklist.

Referenced by find_partition_fixes(), and find_rarely_executed_basic_blocks_and_crossing_edges().

◆ find_partition_fixes()

static auto_vec< basic_block > find_partition_fixes ( bool flag_only)
static
Sanity check partition hotness to ensure that basic blocks in
  the cold partition don't dominate basic blocks in the hot partition.
  If FLAG_ONLY is true, report violations as errors. Otherwise
  re-mark the dominated blocks as cold, since this is run after
  cfg optimizations that may make hot blocks previously reached
  by both hot and cold blocks now only reachable along cold paths.   

References BB_PARTITION, BB_SET_PARTITION, cfun, crtl, error(), find_bbs_reachable_by_hot_paths(), FOR_EACH_BB_FN, gcc_checking_assert, and basic_block_def::index.

Referenced by fixup_partitions(), and rtl_verify_edges().

◆ first_insn_after_basic_block_note()

static rtx_insn * first_insn_after_basic_block_note ( basic_block block)
static
Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK
note associated with the BLOCK.   

References BB_HEAD, gcc_assert, LABEL_P, NEXT_INSN(), NOTE_INSN_BASIC_BLOCK_P, NULL, and NULL_RTX.

Referenced by rtl_split_block().

◆ fixup_abnormal_edges()

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 BARRIER_P, BB_END, BB_HEAD, CALL_P, can_throw_internal(), cfun, delete_insn(), find_fallthru_edge(), FOR_EACH_BB_FN, FOR_EACH_EDGE, insert_insn_on_edge(), INSN_P, NEXT_INSN(), NONJUMP_INSN_P, NOTE_P, NULL, NULL_RTX, PREV_INSN(), purge_dead_edges(), set_block_for_insn(), SET_NEXT_INSN(), SET_PREV_INSN(), rtx_insn::set_undeleted(), and basic_block_def::succs.

Referenced by lra(), and reload().

◆ fixup_fallthru_exit_predecessor()

static void fixup_fallthru_exit_predecessor ( void )
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, BB_FOOTER, cfun, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, find_fallthru_edge(), gcc_assert, basic_block_def::next_bb, NULL, reload_completed, and split_block_after_labels().

Referenced by cfg_layout_finalize().

◆ fixup_new_cold_bb()

static void fixup_new_cold_bb ( basic_block bb)
static
Called when block BB has been reassigned to the cold partition,
because it is now dominated by another cold block,
to ensure that the region crossing attributes are updated.   

References BB_PARTITION, cfun, EXIT_BLOCK_PTR_FOR_FN, fixup_partition_crossing(), FOR_EACH_EDGE, force_nonfallthru(), basic_block_def::preds, and basic_block_def::succs.

Referenced by fixup_partitions().

◆ fixup_partition_crossing()

static void fixup_partition_crossing ( edge e)
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 BB_END, BB_PARTITION, cfun, CROSSING_JUMP_P, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, FOR_EACH_EDGE, and JUMP_P.

Referenced by cfg_layout_redirect_edge_and_branch(), fixup_new_cold_bb(), force_nonfallthru_and_redirect(), and rtl_redirect_edge_and_branch().

◆ fixup_partitions()

◆ fixup_reorder_chain()

◆ flow_active_insn_p()

static bool flow_active_insn_p ( const rtx_insn * insn)
static
Like active_insn_p, except keep the return value use or clobber around
even after reload.   

References active_insn_p(), GET_CODE, PATTERN(), REG_FUNCTION_VALUE_P, REG_P, and XEXP.

Referenced by contains_no_active_insn_p().

◆ force_nonfallthru_and_redirect()

◆ force_one_exit_fallthru()

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

References basic_block_def::aux, cfun, ei_next(), ei_safe_edge(), ei_start, EXIT_BLOCK_PTR_FOR_FN, FOR_EACH_BB_FN, FOR_EACH_EDGE, NULL, redirect_edge_and_branch_force(), and split_edge().

Referenced by cfg_layout_finalize().

◆ forwarder_block_p()

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

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

Referenced by add_forwarder_blocks(), find_if_case_1(), notice_new_block(), relink_block_chain(), and update_forwarder_flag().

◆ free_bb_for_insn()

void free_bb_for_insn ( void )
Release the basic_block_for_insn array.   

References BARRIER_P, BLOCK_FOR_INSN(), get_insns(), NEXT_INSN(), and NULL.

Referenced by rest_of_clean_state().

◆ get_last_bb_insn()

rtx_insn * get_last_bb_insn ( basic_block bb)
Get the last insn associated with block BB (that includes barriers and
tablejumps after BB).   

References BARRIER_P, BB_END, end(), next_nonnote_nondebug_insn_bb(), NULL, table, and tablejump_p().

Referenced by cond_exec_process_if_block(), rtl_delete_block(), rtl_split_edge(), and try_optimize_cfg().

◆ init_rtl_bb_info()

◆ insert_insn_on_edge()

void insert_insn_on_edge ( rtx pattern,
edge e )
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.  If there are already
queued instructions on the edge, PATTERN is appended to them.   

References EDGE_CRITICAL_P, emit_insn(), end_sequence(), gcc_assert, get_insns(), NULL_RTX, push_to_sequence(), and start_sequence().

Referenced by bypass_block(), eliminate_partially_redundant_load(), emit_insn_at_entry(), emit_moves(), fixup_abnormal_edges(), insert_part_to_rtx_on_edge(), insert_partition_copy_on_edge(), insert_prologue_epilogue_for_components(), insert_rtx_to_part_on_edge(), insert_store(), insert_value_copy_on_edge(), ira(), pre_edge_insert(), rtl_flow_call_edges_add(), sjlj_emit_function_enter(), and thread_prologue_and_epilogue_insns().

◆ label_for_bb()

static rtx_insn * label_for_bb ( basic_block bb)
static
Locate or create a label for a given basic block.   

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

Referenced by cleanup_dead_labels(), cleanup_dead_labels_eh(), fixup_reorder_chain(), and main_block_label().

◆ last_bb_in_partition()

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

References BB_PARTITION, cfun, EXIT_BLOCK_PTR_FOR_FN, FOR_BB_BETWEEN, basic_block_def::next_bb, and basic_block_def::prev_bb.

Referenced by rtl_split_edge().

◆ loc_equal()

static bool loc_equal ( location_t loc1,
location_t loc2 )
static
Return true if LOC1 and LOC2 are equivalent for
unique_locus_on_edge_between_p purposes.   

References expand_location(), and NULL.

Referenced by fixup_reorder_chain(), and unique_locus_on_edge_between_p().

◆ make_pass_free_cfg()

rtl_opt_pass * make_pass_free_cfg ( gcc::context * ctxt)

◆ make_pass_into_cfg_layout_mode()

rtl_opt_pass * make_pass_into_cfg_layout_mode ( gcc::context * ctxt)

◆ make_pass_outof_cfg_layout_mode()

rtl_opt_pass * make_pass_outof_cfg_layout_mode ( gcc::context * ctxt)

◆ need_fake_edge_p()

static bool need_fake_edge_p ( const rtx_insn * insn)
static
Return true if we need to add fake edge to exit.
Helper function for rtl_flow_call_edges_add.   

References asm_noperands(), CALL_P, find_reg_note(), GET_CODE, INSN_P, MEM_VOLATILE_P, NULL, PATTERN(), RTL_CONST_OR_PURE_CALL_P, SIBLING_CALL_P, and XVECEXP.

Referenced by rtl_flow_call_edges_add().

◆ patch_jump_insn()

static bool patch_jump_insn ( rtx_insn * insn,
rtx_insn * old_label,
basic_block new_bb )
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(), as_a(), ASM_OPERANDS_LABEL, ASM_OPERANDS_LABEL_LENGTH, block_label(), cfun, computed_jump_p(), CROSSING_JUMP_P, currently_expanding_to_rtl, EXIT_BLOCK_PTR_FOR_FN, extract_asm_operands(), find_reg_note(), gcc_assert, GET_CODE, GET_NUM_ELEM, i, JUMP_LABEL, LABEL_NUSES, label_ref_label(), NULL, NULL_RTX, PATTERN(), redirect_jump(), remove_note(), returnjump_p(), RTVEC_ELT, SET_SRC, table, tablejump_casesi_pattern(), tablejump_p(), and XEXP.

Referenced by redirect_branch_edge(), and rtl_split_edge().

◆ prepend_insn_to_edge()

void prepend_insn_to_edge ( rtx pattern,
edge e )
Like insert_insn_on_edge, but if there are already queued instructions
on the edge, PATTERN is prepended to them.   

References EDGE_CRITICAL_P, emit_insn(), end_sequence(), gcc_assert, get_insns(), and start_sequence().

Referenced by expand_asm_stmt().

◆ print_rtl_with_bb()

void print_rtl_with_bb ( FILE * outf,
const rtx_insn * rtx_first,
dump_flags_t flags )

◆ purge_all_dead_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 cfun, FOR_EACH_BB_FN, and purge_dead_edges().

Referenced by combine_instructions(), indirect_jump_optimize(), rest_of_handle_cse_after_global_opts(), rest_of_handle_dse(), and rest_of_handle_thread_prologue_and_epilogue().

◆ purge_dead_edges()

◆ record_effective_endpoints()

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

References BB_END, BB_FOOTER, BB_HEAD, BB_HEADER, cfg_layout_function_footer, cfg_layout_function_header, cfun, end(), FOR_EACH_BB_FN, gcc_assert, get_insns(), get_last_insn(), NEXT_INSN(), next_insn(), NOTE_KIND, NOTE_P, NULL, PREV_INSN(), skip_insns_after_block(), and unlink_insn_chain().

Referenced by cfg_layout_initialize().

◆ redirect_branch_edge()

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

References as_a(), BB_END, BB_HEAD, currently_expanding_to_rtl, dump_file, FOR_BB_INSNS, basic_block_def::index, JUMP_P, NULL, patch_jump_insn(), and redirect_edge_succ_nodup().

Referenced by cfg_layout_redirect_edge_and_branch(), and rtl_redirect_edge_and_branch().

◆ relink_block_chain()

void relink_block_chain ( bool stay_in_cfglayout_mode)
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.cc or cfg.cc while at it).   

References basic_block_def::aux, BB_FOOTER, BB_HEAD, BB_HEADER, cfun, compact_blocks(), dump_file, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, FOR_ALL_BB_FN, forwarder_block_p(), free_original_copy_tables(), get_bb_original(), basic_block_def::index, initialize_original_copy_tables(), LABEL_P, basic_block_def::next_bb, NULL, NUM_FIXED_BLOCKS, original_copy_tables_initialized_p(), and basic_block_def::prev_bb.

Referenced by fixup_reorder_chain(), and reorder_basic_blocks().

◆ remove_barriers_from_footer()

static void remove_barriers_from_footer ( basic_block bb)
static

◆ rtl_account_profile_record()

static void rtl_account_profile_record ( basic_block bb,
struct profile_record * record )
static

◆ rtl_bb_info_initialized_p()

◆ rtl_block_empty_p()

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

References any_uncondjump_p(), cfun, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, FOR_BB_INSNS, NONDEBUG_INSN_P, and onlyjump_p().

◆ rtl_block_ends_with_call_p()

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

References BB_END, BB_HEAD, CALL_P, DEBUG_INSN_P, keep_with_call_p(), NOTE_P, and PREV_INSN().

◆ rtl_block_ends_with_condjump_p()

static bool rtl_block_ends_with_condjump_p ( const_basic_block bb)
static
Return true if BB ends with a conditional branch, false otherwise.   

References any_condjump_p(), and BB_END.

◆ rtl_can_merge_blocks()

◆ rtl_can_remove_branch_p()

static bool rtl_can_remove_branch_p ( const_edge e)
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 BB_END, BB_PARTITION, cfun, EDGE_SUCC, EXIT_BLOCK_PTR_FOR_FN, NULL, onlyjump_p(), side_effects_p(), single_set(), and tablejump_p().

◆ rtl_create_basic_block()

static basic_block rtl_create_basic_block ( void * headp,
void * endp,
basic_block after )
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, basic_block_info_for_fn, cfun, create_basic_block_structure(), end(), last_basic_block_for_fn, n_basic_blocks_for_fn, NULL, and vec_safe_grow_cleared().

Referenced by cfg_layout_create_basic_block().

◆ rtl_delete_block()

static void rtl_delete_block ( basic_block b)
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 b, BB_HEAD, delete_insn_chain(), df_bb_delete(), dump_file, end(), get_last_bb_insn(), and NULL.

Referenced by cfg_layout_delete_block().

◆ rtl_dump_bb()

static void rtl_dump_bb ( FILE * outf,
basic_block bb,
int indent,
dump_flags_t flags )
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 alloca, BB_END, BB_HEAD, df, df_dump_bottom(), df_dump_insn_bottom(), df_dump_insn_top(), df_dump_top(), dump_insn_slim(), ENTRY_BLOCK, EXIT_BLOCK, basic_block_def::index, last, NEXT_INSN(), print_rtl_single(), rtl_bb_info_initialized_p(), TDF_DETAILS, and TDF_SLIM.

◆ rtl_duplicate_bb()

static basic_block rtl_duplicate_bb ( basic_block bb,
copy_bb_data * id )
static

◆ rtl_extract_cond_bb_edges()

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 b, and EDGE_SUCC.

◆ rtl_flow_call_edges_add()

static int rtl_flow_call_edges_add ( sbitmap blocks)
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 BASIC_BLOCK_FOR_FN, BB_END, BB_HEAD, bitmap_bit_p, CALL_P, cfun, commit_edge_insertions(), const0_rtx, EXIT_BLOCK_PTR_FOR_FN, find_edge(), gcc_assert, gen_use(), profile_probability::guessed_never(), i, insert_insn_on_edge(), keep_with_call_p(), last_basic_block_for_fn, make_edge(), n_basic_blocks_for_fn, need_fake_edge_p(), NEXT_INSN(), NULL, NUM_FIXED_BLOCKS, basic_block_def::prev_bb, PREV_INSN(), split_block(), and verify_flow_info().

◆ rtl_force_nonfallthru()

static basic_block rtl_force_nonfallthru ( edge e)
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 force_nonfallthru_and_redirect(), and NULL_RTX.

◆ rtl_lv_add_condition_to_bb()

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 BB_END, block_label(), comp, do_compare_rtx_and_jump(), emit_insn_after(), end_sequence(), force_operand(), GET_CODE, get_insns(), get_last_insn(), GET_MODE, JUMP_LABEL, LABEL_NUSES, NULL, NULL_RTX, start_sequence(), profile_probability::uninitialized(), and XEXP.

◆ rtl_make_forwarder_block()

static void rtl_make_forwarder_block ( edge fallthru)
static
Do postprocessing after making a forwarder block joined by edge FALLTHRU.   

◆ rtl_merge_blocks()

◆ rtl_move_block_after()

static bool rtl_move_block_after ( basic_block bb,
basic_block after )
static
Should move basic block BB after basic block AFTER.  NIY.   

◆ rtl_redirect_edge_and_branch()

static edge rtl_redirect_edge_and_branch ( edge e,
basic_block target )
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 df_set_bb_dirty(), fixup_partition_crossing(), NULL, redirect_branch_edge(), and try_redirect_by_replacing_jump().

◆ rtl_redirect_edge_and_branch_force()

static basic_block rtl_redirect_edge_and_branch_force ( edge e,
basic_block target )
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 df_set_bb_dirty(), force_nonfallthru_and_redirect(), NULL, NULL_RTX, and redirect_edge_and_branch().

◆ rtl_split_block()

static basic_block rtl_split_block ( basic_block bb,
void * insnp )
static
Creates a new basic block just after basic block BB by splitting
everything after specified instruction INSNP.   

References BB_COPY_PARTITION, BB_END, create_basic_block(), DEBUG_INSN_P, df_set_bb_dirty(), emit_note_after(), first_insn_after_basic_block_note(), FOR_EACH_EDGE, get_last_insn(), NEXT_INSN(), NULL, PREV_INSN(), and basic_block_def::succs.

Referenced by cfg_layout_split_block().

◆ rtl_split_block_before_cond_jump()

static basic_block rtl_split_block_before_cond_jump ( basic_block bb)
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(), FOR_BB_INSNS, last, NONDEBUG_INSN_P, NULL, and split_block().

◆ rtl_split_edge()

static basic_block rtl_split_edge ( edge edge_in)
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 BARRIER_P, BB_COPY_PARTITION, BB_END, BB_HEAD, BB_PARTITION, cfun, create_basic_block(), crtl, df_set_bb_dirty(), ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, extract_asm_operands(), find_fallthru_edge(), force_nonfallthru(), gcc_assert, gcc_checking_assert, get_last_bb_insn(), JUMP_LABEL, JUMP_P, last, last_bb_in_partition(), make_single_succ_edge(), NEXT_INSN(), NULL, patch_jump_insn(), PATTERN(), basic_block_def::prev_bb, redirect_edge_and_branch(), redirect_edge_succ(), and single_succ_edge().

◆ rtl_tidy_fallthru_edge()

static void rtl_tidy_fallthru_edge ( edge e)
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_uncondjump_p(), b, BB_END, BB_HEAD, delete_insn(), delete_insn_chain(), JUMP_P, LABEL_NAME, basic_block_def::next_bb, NEXT_INSN(), NONDEBUG_INSN_P, NOTE_DELETED_LABEL_NAME, NOTE_KIND, onlyjump_p(), PREV_INSN(), PUT_CODE, reorder_insns(), single_succ_p(), table, and tablejump_p().

◆ rtl_verify_bb_insn_chain()

static bool rtl_verify_bb_insn_chain ( void )
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 BARRIER_P, BB_END, BB_HEAD, BLOCK_FOR_INSN(), cfun, end(), error(), FOR_EACH_BB_REVERSE_FN, free(), get_last_insn(), get_max_uid(), basic_block_def::index, INSN_UID(), max_uid, NULL, NULL_RTX, and PREV_INSN().

Referenced by rtl_verify_flow_info().

◆ rtl_verify_bb_insns()

static bool rtl_verify_bb_insns ( void )
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 BB_END, BB_HEAD, cfun, control_flow_insn_p(), error(), fatal_insn, FOR_EACH_BB_REVERSE_FN, basic_block_def::index, INSN_UID(), LABEL_P, NEXT_INSN(), NOTE_BASIC_BLOCK, and NOTE_INSN_BASIC_BLOCK_P.

Referenced by rtl_verify_flow_info_1().

◆ rtl_verify_bb_layout()

static bool rtl_verify_bb_layout ( void )
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 BARRIER_P, BB_END, cfun, condjump_p(), curr_bb, ENTRY_BLOCK_PTR_FOR_FN, fatal_insn, GET_CODE, get_insns(), internal_error(), JUMP_P, JUMP_TABLE_DATA_P, n_basic_blocks_for_fn, basic_block_def::next_bb, NEXT_INSN(), next_nonnote_nondebug_insn(), NOTE_BASIC_BLOCK, NOTE_INSN_BASIC_BLOCK_P, NULL, NUM_FIXED_BLOCKS, returnjump_p(), and y.

Referenced by rtl_verify_flow_info().

◆ rtl_verify_bb_pointers()

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

References BARRIER_P, BB_FOOTER, BB_HEADER, BLOCK_FOR_INSN(), cfun, error(), basic_block_def::flags, FOR_BB_INSNS, FOR_EACH_BB_REVERSE_FN, basic_block_def::index, INSN_UID(), NEXT_INSN(), and NULL.

Referenced by rtl_verify_flow_info_1().

◆ rtl_verify_edges()

static bool rtl_verify_edges ( void )
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.  Also verify that the dominance relationship
between hot/cold blocks is sane.   

References any_condjump_p(), any_uncondjump_p(), BB_END, BB_HEAD, BB_PARTITION, BRANCH_EDGE, CALL_P, cfun, CROSSING_JUMP_P, crtl, current_ir_type(), EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, error(), EXIT_BLOCK_PTR_FOR_FN, find_partition_fixes(), find_reg_note(), FOR_EACH_BB_REVERSE_FN, FOR_EACH_EDGE, get_insns(), basic_block_def::index, IR_RTL_CFGLAYOUT, JUMP_LABEL, JUMP_P, NULL, NULL_RTX, basic_block_def::preds, print_rtl_with_bb(), PROFILE_ABSENT, profile_status_for_fn, basic_block_def::succs, TDF_BLOCKS, TDF_DETAILS, and XINT.

Referenced by rtl_verify_flow_info_1().

◆ rtl_verify_fallthru()

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

References BARRIER_P, BB_END, BB_HEAD, cfun, debug_rtx(), ENTRY_BLOCK_PTR_FOR_FN, error(), EXIT_BLOCK_PTR_FOR_FN, find_fallthru_edge(), FOR_EACH_BB_REVERSE_FN, basic_block_def::index, NEXT_INSN(), NONDEBUG_INSN_P, NOTE_INSN_BASIC_BLOCK_P, and basic_block_def::succs.

Referenced by rtl_verify_flow_info().

◆ rtl_verify_flow_info()

static bool rtl_verify_flow_info ( void )
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
- verify that there is a single hot/cold partition boundary after bbro   

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

◆ rtl_verify_flow_info_1()

static bool rtl_verify_flow_info_1 ( void )
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 hot blocks are not dominated by cold blocks

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().

◆ skip_insns_after_block()

static rtx_insn * skip_insns_after_block ( basic_block bb)
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 BB_END, BB_HEAD, cfun, EXIT_BLOCK_PTR_FOR_FN, gcc_assert, gcc_unreachable, GET_CODE, JUMP_TABLE_DATA_P, basic_block_def::next_bb, NEXT_INSN(), NOTE_KIND, NOTE_P, NULL, PREV_INSN(), and reorder_insns().

Referenced by record_effective_endpoints().

◆ try_redirect_by_replacing_jump()

◆ unique_locus_on_edge_between_p()

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

References a, b, BB_END, BB_HEAD, EDGE_SUCC, end(), INSN_HAS_LOCATION(), INSN_LOCATION(), loc_equal(), LOCATION_LOCUS, NEXT_INSN(), NONDEBUG_INSN_P, PREV_INSN(), and UNKNOWN_LOCATION.

Referenced by emit_nop_for_unique_locus_between().

◆ unlink_insn_chain()

◆ update_bb_for_insn()

void update_bb_for_insn ( basic_block bb)

◆ update_bb_for_insn_chain()

static void update_bb_for_insn_chain ( rtx_insn * begin,
rtx_insn * end,
basic_block bb )
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 BARRIER_P, begin(), df_insn_change_bb(), end(), and NEXT_INSN().

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

◆ update_br_prob_note()

◆ update_cfg_for_uncondjump()

void update_cfg_for_uncondjump ( rtx_insn * insn)
Delete the unconditional jump INSN and adjust the CFG correspondingly.
Note that the INSN should be deleted *after* removing dead edges, so
that the kept edge is the fallthrough edge for a (set (pc) (pc))
but not for a (set (pc) (label_ref FOO)).   

References BARRIER_P, BB_END, BB_FOOTER, BLOCK_FOR_INSN(), current_ir_type(), delete_insn(), EDGE_COUNT, emit_barrier_after(), find_fallthru_edge(), gcc_assert, IR_RTL_CFGLAYOUT, LABEL_P, NEXT_INSN(), next_nonnote_nondebug_insn(), PREV_INSN(), purge_dead_edges(), SET_NEXT_INSN(), SET_PREV_INSN(), single_succ_edge(), and basic_block_def::succs.

Referenced by try_combine().

◆ verify_hot_cold_block_grouping()

static bool verify_hot_cold_block_grouping ( void )
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 BB_PARTITION, BB_UNPARTITIONED, cfun, crtl, current_ir_type(), error(), FOR_EACH_BB_FN, basic_block_def::index, and IR_RTL_CFGRTL.

Referenced by rtl_verify_flow_info().

◆ verify_insn_chain()

DEBUG_FUNCTION void verify_insn_chain ( void )
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 gcc_assert, get_insns(), get_last_insn(), NEXT_INSN(), NULL, and PREV_INSN().

Referenced by cfg_layout_finalize(), and fixup_reorder_chain().

Variable Documentation

◆ cfg_layout_function_footer

rtx_insn* cfg_layout_function_footer
static
Control flow graph manipulation code for GNU compiler.
   Copyright (C) 1987-2024 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, prepend_insn_to_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   
Disable warnings about missing quoting in GCC diagnostics.   
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().

◆ cfg_layout_function_header

rtx_insn* cfg_layout_function_header
static

◆ cfg_layout_rtl_cfg_hooks

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().

◆ rtl_cfg_hooks

struct cfg_hooks rtl_cfg_hooks
Implementation of CFG manipulation for linearized RTL.   

Referenced by current_ir_type(), and rtl_register_cfg_hooks().