GCC Middle and Back End API 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"
Variables | |
static rtx_insn * | cfg_layout_function_footer |
static rtx_insn * | cfg_layout_function_header |
struct cfg_hooks | rtl_cfg_hooks |
struct cfg_hooks | cfg_layout_rtl_cfg_hooks |
rtx_note * bb_note | ( | basic_block | bb | ) |
Return the NOTE_INSN_BASIC_BLOCK of BB.
References as_a(), BB_HEAD, gcc_assert, LABEL_P, NEXT_INSN(), and NOTE_INSN_BASIC_BLOCK_P.
Referenced by _succ_iter_cond(), create_basic_block_structure(), delete_insn(), emit_common_heads_for_components(), inherit_in_ebb(), move_insn_for_shrink_wrap(), and split_live_ranges_for_shrink_wrap().
rtx_code_label * block_label | ( | basic_block | block | ) |
Return the label in the head of basic block BLOCK. Create one if it doesn't exist.
References as_a(), BB_HEAD, cfun, emit_label_before(), EXIT_BLOCK_PTR_FOR_FN, gen_label_rtx(), LABEL_P, and NULL.
Referenced by add_labels_and_missing_jumps(), add_test(), block_has_preserve_label(), create_eh_forwarder_block(), dead_or_predicable(), doloop_modify(), doloop_optimize(), fix_crossing_conditional_branches(), fix_up_fall_thru_edges(), force_nonfallthru_and_redirect(), label_for_bb(), label_rtx_for_bb(), patch_jump_insn(), rtl_lv_add_condition_to_bb(), try_optimize_cfg(), try_redirect_by_replacing_jump(), try_simplify_condjump(), and unroll_loop_runtime_iterations().
void break_superblocks | ( | void | ) |
Splits superblocks.
References bitmap_clear(), bitmap_set_bit, cfun, find_many_sub_basic_blocks(), basic_block_def::flags, FOR_EACH_BB_FN, get_insns(), basic_block_def::index, last_basic_block_for_fn, and rebuild_jump_labels().
Referenced by finish_eh_generation().
|
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().
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().
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().
|
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.
|
static |
Return true when blocks A and B can be safely merged.
References a, b, BB_END, BB_HEAD, BB_PARTITION, cfun, current_loops, EDGE_COMPLEX, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, find_fallthru_edge(), JUMP_P, NEXT_INSN(), onlyjump_p(), reload_completed, simplejump_p(), single_pred_p(), single_succ(), single_succ_edge(), and single_succ_p().
Referenced by cfg_layout_merge_blocks().
|
static |
References end(), and rtl_create_basic_block().
|
static |
Same as delete_basic_block but update cfg_layout structures.
References BARRIER_P, BB_END, BB_FOOTER, BB_HEAD, BB_HEADER, cfg_layout_function_footer, cfun, EXIT_BLOCK_PTR_FOR_FN, get_insns(), get_last_insn(), LABEL_P, basic_block_def::next_bb, NEXT_INSN(), PREV_INSN(), rtl_delete_block(), set_first_insn(), set_last_insn(), SET_NEXT_INSN(), SET_PREV_INSN(), and unlink_insn_chain().
|
static |
Create a duplicate of the basic block BB.
References BB_COPY_PARTITION, BB_END, BB_FOOTER, BB_HEAD, BB_HEADER, cfun, create_basic_block(), current_loops, duplicate_insn_chain(), EXIT_BLOCK_PTR_FOR_FN, get_last_insn(), basic_block_def::loop_father, NEXT_INSN(), NULL, and unlink_insn_chain().
Referenced by rtl_duplicate_bb().
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.
References CDI_DOMINATORS, checking_verify_flow_info(), delete_dead_jumptables(), fixup_fallthru_exit_predecessor(), fixup_reorder_chain(), force_one_exit_fallthru(), free_dominance_info(), get_insns(), rebuild_jump_labels(), reload_completed, rtl_register_cfg_hooks(), targetm, and verify_insn_chain().
Referenced by reorder_loops(), and thread_prologue_and_epilogue_insns().
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().
|
static |
Merge block A and B. The blocks must be mergeable.
References a, b, BB_END, BB_FOOTER, BB_HEAD, BB_HEADER, cfg_layout_can_merge_blocks_p(), current_function_decl, DECL_IGNORED_P, delete_insn(), df_bb_delete(), dump_file, EDGE_SUCC, emit_insn_after_noloc(), emit_nop_for_unique_locus_between(), gcc_assert, gcc_checking_assert, JUMP_P, LABEL_P, last, LOCATION_LOCUS, NEXT_INSN(), NOTE_INSN_BASIC_BLOCK_P, NULL, SET_NEXT_INSN(), SET_PREV_INSN(), try_redirect_by_replacing_jump(), UNKNOWN_LOCATION, unlink_insn_chain(), and update_bb_for_insn_chain().
|
static |
Redirect Edge to DEST.
References any_condjump_p(), BB_END, BB_HEAD, BB_PARTITION, cfun, CROSSING_JUMP_P, delete_insn(), df_set_bb_dirty(), dump_file, EDGE_COMPLEX, EDGE_COUNT, EDGE_SUCC, ENTRY_BLOCK_PTR_FOR_FN, fixup_partition_crossing(), gcc_assert, basic_block_def::index, JUMP_P, label_is_jump_target_p(), NULL, onlyjump_p(), redirect_branch_edge(), redirect_edge_succ(), redirect_edge_succ_nodup(), remove_barriers_from_footer(), simplejump_p(), basic_block_def::succs, and try_redirect_by_replacing_jump().
Referenced by cfg_layout_redirect_edge_and_branch_force().
|
static |
Simple wrapper as we always can redirect fallthru edges.
References cfg_layout_redirect_edge_and_branch(), gcc_assert, and NULL.
|
static |
Same as split_block but update cfg_layout structures.
References BB_FOOTER, NULL, and rtl_split_block().
|
static |
Split edge E.
References BB_COPY_PARTITION, BB_END, cfun, create_basic_block(), ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, get_insns(), make_edge(), NEXT_INSN(), NULL_RTX, and redirect_edge_and_branch_force().
void commit_edge_insertions | ( | void | ) |
Update the CFG for all queued instructions.
References cfun, checking_verify_flow_info(), commit_one_edge_insertion(), currently_expanding_to_rtl, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, fixup_partitions(), FOR_BB_BETWEEN, FOR_EACH_EDGE, rebuild_jump_labels_chain(), and basic_block_def::succs.
Referenced by bypass_conditional_jumps(), eliminate_partially_redundant_loads(), emit_insn_at_entry(), finish_eh_generation(), insert_prologue_epilogue_for_components(), ira(), ira_emit(), lra(), one_store_motion_pass(), pre_gcse(), reload(), rtl_flow_call_edges_add(), and thread_prologue_and_epilogue_insns().
void commit_one_edge_insertion | ( | edge | e | ) |
Update the CFG for the instructions queued on edge E.
References BB_END, BB_HEAD, cfun, currently_expanding_to_rtl, delete_insn(), emit_barrier_after(), emit_insn_after_noloc(), emit_insn_before_noloc(), ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, find_sub_basic_blocks(), gcc_assert, get_last_insn(), insns, JUMP_P, LABEL_P, last, NEXT_INSN(), NOTE_INSN_BASIC_BLOCK_P, NULL, PREV_INSN(), prev_nonnote_insn(), rebuild_jump_labels_chain(), returnjump_p(), simplejump_p(), single_pred_p(), single_succ_edge(), single_succ_p(), and split_edge().
Referenced by commit_edge_insertions().
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().
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().
|
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().
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().
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().
Like delete_insn but also purge dead edges from BB. Return true if any edges are eliminated.
References BB_END, BLOCK_FOR_INSN(), DEBUG_INSN_P, delete_insn(), NEXT_INSN(), NONDEBUG_INSN_P, and purge_dead_edges().
Referenced by cse_cc_succs(), cse_insn(), delete_noop_moves(), delete_trivially_dead_insns(), delete_unmarked_insns(), discover_loops(), reload_cse_simplify(), split_all_insns(), and split_all_insns_noflow().
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().
rtx_insn * duplicate_insn_chain | ( | rtx_insn * | from, |
rtx_insn * | to, | ||
class loop * | loop, | ||
copy_bb_data * | id ) |
References ALL, ANY_RETURN_P, as_a(), BARRIER_P, cfun, DEBUG_BIND_INSN_P, DEBUG_INSN_P, delete_insn(), emit_barrier(), emit_copy_of_insn_after(), emit_note(), emit_note_copy(), FOR_EACH_SUBRTX, gcc_assert, gcc_unreachable, GET_CODE, get_last_insn(), get_new_clique(), hash_map< KeyId, Value, Traits >::get_or_insert(), handled_component_p(), INSN_VAR_LOCATION_DECL, JUMP_LABEL, JUMP_P, last, maybe_copy_prologue_epilogue_insn(), MEM_EXPR, MEM_P, MR_DEPENDENCE_CLIQUE, NEXT_INSN(), NOTE_KIND, NULL_RTX, loop::owned_clique, PATTERN(), set_mem_expr(), TREE_CODE, TREE_OPERAND, and unshare_expr().
Referenced by cfg_layout_duplicate_bb(), and expand_asm_stmt().
void emit_barrier_after_bb | ( | basic_block | bb | ) |
Emit a barrier after BB, into the footer if we are in CFGLAYOUT mode.
References BARRIER_P, BB_END, BB_FOOTER, current_ir_type(), emit_barrier_after(), gcc_assert, IR_RTL_CFGLAYOUT, IR_RTL_CFGRTL, NEXT_INSN(), SET_NEXT_INSN(), SET_PREV_INSN(), and unlink_insn_chain().
Referenced by add_labels_and_missing_jumps(), create_eh_forwarder_block(), fix_crossing_conditional_branches(), fix_up_fall_thru_edges(), force_nonfallthru_and_redirect(), handle_simple_exit(), local_cprop_pass(), maybe_duplicate_computed_goto(), one_cprop_pass(), try_combine(), try_optimize_cfg(), and try_shrink_wrapping().
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().
|
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().
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().
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().
|
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().
|
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().
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.
|
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().
|
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().
|
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().
void fixup_partitions | ( | void | ) |
Perform cleanup on the hot/cold bb partitioning after optimization passes that modify the cfg.
References BB_HEAD, BB_PARTITION, BB_UNPARTITIONED, cfun, crtl, current_ir_type(), delete_unreachable_blocks(), find_partition_fixes(), fixup_new_cold_bb(), FOR_EACH_BB_FN, gcc_assert, IR_RTL_CFGRTL, basic_block_def::next_bb, NULL, basic_block_def::prev_bb, PREV_INSN(), SET_NEXT_INSN(), and SET_PREV_INSN().
Referenced by commit_edge_insertions(), duplicate_computed_gotos(), if_convert(), rest_of_handle_thread_prologue_and_epilogue(), and try_optimize_cfg().
|
static |
Given a reorder chain, rearrange the code to match.
References any_condjump_p(), as_a(), basic_block_def::aux, BB_END, BB_FOOTER, BB_HEAD, BB_HEADER, bb_is_just_return(), can_fallthru(), cfg_layout_function_footer, cfg_layout_function_header, cfun, could_fall_through(), current_function_decl, DECL_IGNORED_P, delete_insn(), delete_unreachable_blocks(), dyn_cast(), EDGE_COUNT, ei_next(), ei_safe_edge(), ei_start, emit_barrier_after(), emit_insn_after_noloc(), end(), ENTRY_BLOCK_PTR_FOR_FN, profile_probability::even(), EXIT_BLOCK_PTR_FOR_FN, extract_asm_operands(), find_fallthru_edge(), find_reg_note(), FOR_EACH_BB_FN, FOR_EACH_EDGE, force_nonfallthru(), force_nonfallthru_and_redirect(), profile_probability::from_reg_br_prob_note(), gcc_assert, gcc_checking_assert, INSN_HAS_LOCATION(), INSN_LOCATION(), INSN_P, invert_jump(), JUMP_LABEL, label_for_bb(), LABEL_NUSES, loc_equal(), LOCATION_LOCUS, NEXT_INSN(), NONDEBUG_INSN_P, NULL, NULL_RTX, onlyjump_p(), PATTERN(), basic_block_def::preds, PREV_INSN(), redirect_edge_and_branch(), relink_block_chain(), ret_rtx, returnjump_p(), set_first_insn(), set_last_insn(), SET_NEXT_INSN(), SET_PREV_INSN(), simple_return_rtx, simplejump_p(), single_pred_p(), split_edge(), basic_block_def::succs, targetm, UNKNOWN_LOCATION, update_br_prob_note(), verify_insn_chain(), and XINT.
Referenced by cfg_layout_finalize().
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().
basic_block force_nonfallthru_and_redirect | ( | edge | e, |
basic_block | target, | ||
rtx | jump_label ) |
Like force_nonfallthru below, but additionally performs redirection Used by redirect_edge_and_branch_force. JUMP_LABEL is used only when redirecting to the EXIT_BLOCK, it is either ret_rtx or simple_return_rtx, indicating which kind of returnjump to create. It should be NULL otherwise.
References add_reg_note(), profile_probability::always(), any_condjump_p(), as_a(), ASM_OPERANDS_LABEL, ASM_OPERANDS_LABEL_LENGTH, b, BB_COPY_PARTITION, BB_END, BB_HEAD, block_label(), cfun, basic_block_def::count, count, create_basic_block(), df_mark_solutions_dirty(), EDGE_COUNT, ei_next(), ei_safe_edge(), ei_start, emit_barrier_after_bb(), emit_jump_insn_after_setloc(), ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, extract_asm_operands(), find_reg_note(), fixup_partition_crossing(), basic_block_def::flags, profile_probability::from_reg_br_prob_note(), gcc_assert, i, edge_iterator::index, JUMP_LABEL, JUMP_P, LABEL_NUSES, make_edge(), make_single_succ_edge(), NEXT_INSN(), NULL, NULL_RTX, PATTERN(), redirect_edge_pred(), redirect_edge_succ_nodup(), redirect_jump(), remove_note(), ret_rtx, set_return_jump_label(), simple_return_rtx, basic_block_def::succs, table, tablejump_p(), targetm, unchecked_make_edge(), vec_safe_push(), XEXP, and XINT.
Referenced by find_if_case_1(), fixup_reorder_chain(), rtl_force_nonfallthru(), and rtl_redirect_edge_and_branch_force().
|
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().
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().
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().
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().
void init_rtl_bb_info | ( | basic_block | bb | ) |
References gcc_assert, ggc_cleared_alloc(), basic_block_def::basic_block_il_dependent::head_, basic_block_def::il, NULL, basic_block_def::basic_block_il_dependent::rtl, and basic_block_def::basic_block_il_dependent::x.
Referenced by construct_init_block(), create_basic_block_structure(), function_reader::create_function(), expand_gimple_basic_block(), and function_reader::parse_block().
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().
|
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().
|
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().
|
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().
rtl_opt_pass * make_pass_free_cfg | ( | gcc::context * | ctxt | ) |
rtl_opt_pass * make_pass_into_cfg_layout_mode | ( | gcc::context * | ctxt | ) |
rtl_opt_pass * make_pass_outof_cfg_layout_mode | ( | gcc::context * | ctxt | ) |
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().
|
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().
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().
void print_rtl_with_bb | ( | FILE * | outf, |
const rtx_insn * | rtx_first, | ||
dump_flags_t | flags ) |
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 BARRIER_P, BB_END, BB_HEAD, cfun, 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(), EDGE_COUNT, end(), find_fallthru_edge(), FOR_EACH_BB_REVERSE_FN, free(), gcc_assert, get_max_uid(), basic_block_def::index, INSN_UID(), max_uid, NEXT_INSN(), NONDEBUG_INSN_P, NOTE_P, NULL, NULL_RTX, print_rtl_single(), print_rtx_head, PROP_cfg, basic_block_def::succs, TDF_BLOCKS, TDF_DETAILS, and TDF_SLIM.
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 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().
bool purge_dead_edges | ( | basic_block | bb | ) |
Assume that the preceding pass has possibly eliminated jump instructions or converted the unconditional jumps. Eliminate the edges from CFG. Return true if any edges are eliminated.
References profile_probability::always(), any_condjump_p(), b, BB_END, BB_HEAD, BRANCH_EDGE, CALL_P, can_nonlocal_goto(), can_throw_internal(), cfun, DEBUG_INSN_P, df_set_bb_dirty(), dump_file, EDGE_COMPLEX, EDGE_COUNT, ei_next(), ei_safe_edge(), ei_start, EXIT_BLOCK_PTR_FOR_FN, FALLTHRU_EDGE, find_reg_equal_equiv_note(), find_reg_note(), FOR_EACH_EDGE, profile_probability::from_reg_br_prob_note(), gcc_assert, basic_block_def::index, JUMP_LABEL, JUMP_P, may_trap_p(), NONJUMP_INSN_P, NOTE_P, NULL, PATTERN(), PREV_INSN(), remove_edge(), remove_note(), returnjump_p(), SIBLING_CALL_P, simplejump_p(), single_succ_edge(), single_succ_p(), basic_block_def::succs, XEXP, and XINT.
Referenced by find_comparison_dom_walker::before_dom_children(), cprop_jump(), cse_extended_basic_block(), delete_insn_and_edges(), find_bb_boundaries(), fixup_abnormal_edges(), peep2_attempt(), purge_all_dead_edges(), and update_cfg_for_uncondjump().
|
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().
|
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().
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().
|
static |
Remove all barriers from BB_FOOTER of a BB.
References BARRIER_P, BB_FOOTER, LABEL_P, NEXT_INSN(), PREV_INSN(), SET_NEXT_INSN(), and SET_PREV_INSN().
Referenced by cfg_layout_redirect_edge_and_branch(), and try_redirect_by_replacing_jump().
|
static |
Do book-keeping of basic block BB for the profile consistency checker. Store the counting in RECORD.
References cfun, basic_block_def::count, count, ENTRY_BLOCK_PTR_FOR_FN, FOR_BB_INSNS, profile_count::initialized_p(), insn_cost(), INSN_P, profile_count::ipa(), profile_info, profile_record::size, profile_record::time, sreal::to_double(), profile_count::to_gcov_type(), and profile_count::to_sreal_scale().
|
static |
References basic_block_def::il, basic_block_def::basic_block_il_dependent::rtl, and basic_block_def::basic_block_il_dependent::x.
Referenced by rtl_dump_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().
|
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().
|
static |
Return true if BB ends with a conditional branch, false otherwise.
References any_condjump_p(), and BB_END.
|
static |
Return true when block A and B can be merged.
References a, b, BB_END, BB_PARTITION, cfun, current_loops, EDGE_COMPLEX, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, JUMP_P, basic_block_def::next_bb, onlyjump_p(), reload_completed, simplejump_p(), single_pred_p(), single_succ(), single_succ_edge(), and single_succ_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 BB_END, BB_PARTITION, cfun, EDGE_SUCC, EXIT_BLOCK_PTR_FOR_FN, NULL, onlyjump_p(), side_effects_p(), single_set(), and tablejump_p().
|
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().
|
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().
|
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.
|
static |
References basic_block_def::aux, cfg_layout_duplicate_bb(), and NULL.
|
static |
|
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().
|
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.
|
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.
|
static |
Do postprocessing after making a forwarder block joined by edge FALLTHRU.
|
static |
Blocks A and B are to be merged into a single block A. The insns are already contiguous.
References a, b, BARRIER_P, BB_END, BB_HEAD, current_function_decl, DEBUG_INSN_P, DECL_IGNORED_P, delete_insn_chain(), df_bb_delete(), dump_file, EDGE_SUCC, emit_nop_for_unique_locus_between(), JUMP_P, LABEL_P, LOCATION_LOCUS, NEXT_INSN(), NOTE_INSN_BASIC_BLOCK_P, NOTE_P, NULL, PREV_INSN(), reorder_insns_nobb(), UNKNOWN_LOCATION, and update_bb_for_insn_chain().
|
static |
Should move basic block BB after basic block AFTER. NIY.
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
edge try_redirect_by_replacing_jump | ( | edge | e, |
basic_block | target, | ||
bool | in_cfglayout ) |
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 profile_probability::always(), as_a(), BARRIER_P, BB_END, BB_HEAD, BB_PARTITION, block_label(), can_fallthru(), cfun, delete_insn_chain(), dump_file, EDGE_COUNT, EDGE_SUCC, emit_barrier_after(), emit_jump_insn_after_noloc(), EXIT_BLOCK_PTR_FOR_FN, gcc_assert, basic_block_def::index, INSN_UID(), JUMP_LABEL, LABEL_NUSES, NEXT_INSN(), next_nonnote_nondebug_insn(), NULL, onlyjump_p(), PREV_INSN(), redirect_edge_succ(), redirect_jump(), reload_completed, remove_barriers_from_footer(), remove_edge(), SET_NEXT_INSN(), SET_PREV_INSN(), side_effects_p(), simplejump_p(), single_set(), single_succ_edge(), single_succ_p(), basic_block_def::succs, table, tablejump_p(), targetm, and update_bb_for_insn_chain().
Referenced by cfg_layout_merge_blocks(), cfg_layout_redirect_edge_and_branch(), rtl_redirect_edge_and_branch(), and try_optimize_cfg().
|
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().
Cut the insns from FIRST to LAST out of the insns stream.
References last, NEXT_INSN(), NULL, PREV_INSN(), set_first_insn(), set_last_insn(), SET_NEXT_INSN(), and SET_PREV_INSN().
Referenced by cfg_layout_delete_block(), cfg_layout_duplicate_bb(), cfg_layout_merge_blocks(), emit_barrier_after_bb(), record_effective_endpoints(), and reload_as_needed().
void update_bb_for_insn | ( | basic_block | bb | ) |
Update BLOCK_FOR_INSN of insns in BB to BB, and notify df of the change.
References BB_END, BB_HEAD, and update_bb_for_insn_chain().
Referenced by construct_exit_block(), construct_init_block(), create_basic_block_structure(), emit_to_new_bb_before(), expand_gimple_basic_block(), expand_gimple_cond(), and expand_gimple_tailcall().
|
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().
void update_br_prob_note | ( | basic_block | bb | ) |
Update the branch probability of BB if a REG_BR_PROB is present.
References BB_END, BRANCH_EDGE, find_reg_note(), JUMP_P, NULL_RTX, REG_NOTES, XEXP, and XINT.
Referenced by add_test(), dead_or_predicable(), find_many_sub_basic_blocks(), fix_up_fall_thru_edges(), fixup_reorder_chain(), force_edge_cold(), try_crossjump_to_edge(), try_forward_edges(), try_optimize_cfg(), try_simplify_condjump(), and unroll_loop_constant_iterations().
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().
|
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().
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().
|
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().
|
static |
Referenced by fixup_reorder_chain(), and record_effective_endpoints().
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().