GCC Middle and Back End API Reference
|
Variables | |
static rtx | cfg_layout_function_footer |
static rtx | cfg_layout_function_header |
struct cfg_hooks | rtl_cfg_hooks |
struct cfg_hooks | cfg_layout_rtl_cfg_hooks |
rtx bb_note | ( | ) |
Return the NOTE_INSN_BASIC_BLOCK of BB.
rtx block_label | ( | ) |
Return the label in the head of basic block BLOCK. Create one if it doesn't exist.
References emit_label_before(), and gen_label_rtx().
void break_superblocks | ( | void | ) |
Splits superblocks.
References bitmap_clear(), bitmap_set_bit(), find_many_sub_basic_blocks(), basic_block_def::flags, free(), get_insns(), basic_block_def::index, rebuild_jump_labels(), and sbitmap_alloc().
Referenced by finish_eh_generation().
|
static |
Referenced by delete_insn().
|
static |
True if a given label can be deleted.
References in_expr_list_p().
|
static |
Referenced by delete_insn_chain().
|
static |
Return true if NOTE is not one of the ones that must be kept paired, so that we may simply delete it.
bool can_fallthru | ( | ) |
Return nonzero if we can reach target from src by falling through.
FIXME: Make this a cfg hook.
References active_insn_p(), edge_def::dest, edge_def::flags, next_active_insn(), basic_block_def::next_bb, and basic_block_def::succs.
|
static |
Return true in case it is possible to duplicate the basic block BB.
References tablejump_p(), and targetm.
|
static |
Return true when blocks A and B can be safely merged.
References edge_def::dest, find_fallthru_edge(), loop::latch, basic_block_def::loop_father, onlyjump_p(), reload_completed, simplejump_p(), single_pred_p(), single_succ(), single_succ_edge(), single_succ_p(), and basic_block_def::succs.
Referenced by cfg_layout_merge_blocks().
|
static |
References rtl_create_basic_block().
|
static |
|
static |
Same as delete_basic_block but update cfg_layout structures.
References cfg_layout_function_footer, get_insns(), get_last_insn(), basic_block_def::next_bb, rtl_delete_block(), set_first_insn(), set_last_insn(), and unlink_insn_chain().
|
static |
Create a duplicate of the basic block BB.
References create_basic_block(), duplicate_insn_chain(), get_last_insn(), and unlink_insn_chain().
Referenced by rtl_duplicate_bb().
void cfg_layout_finalize | ( | void | ) |
Finalize the changes: reorder insn list according to the sequence specified by aux pointers, enter compensation code, rebuild scope forest.
References delete_dead_jumptables(), fixup_fallthru_exit_predecessor(), fixup_reorder_chain(), force_one_exit_fallthru(), get_insns(), HAVE_epilogue, rebuild_jump_labels(), reload_completed, rtl_register_cfg_hooks(), verify_flow_info(), and verify_insn_chain().
Referenced by duplicate_computed_gotos(), outof_cfg_layout_mode(), reorder_loops(), rest_of_handle_reorder_blocks(), rest_of_handle_sms(), and thread_prologue_and_epilogue_insns().
void cfg_layout_initialize | ( | ) |
Main entry point to this module - initialize the datastructures for CFG layout changes. It keeps LOOPS up-to-date if not null. FLAGS is a set of additional flags to pass to cleanup_cfg().
References cfg_layout_rtl_register_cfg_hooks(), cleanup_cfg(), basic_block_def::flags, initialize_original_copy_tables(), and record_effective_endpoints().
|
static |
Merge block A and B. The blocks must be mergeable.
References cfg_layout_can_merge_blocks_p(), delete_insn(), df_bb_delete(), dump_file, emit_insn_after_noloc(), emit_nop_for_unique_locus_between(), basic_block_def::flags, basic_block_def::index, last, try_redirect_by_replacing_jump(), unlink_insn_chain(), and update_bb_for_insn_chain().
|
static |
Referenced by cfg_layout_redirect_edge_and_branch_force().
|
static |
Redirect Edge to DEST.
References any_condjump_p(), delete_insn(), edge_def::dest, df_set_bb_dirty(), dump_file, edge_def::flags, basic_block_def::index, label_is_jump_target_p(), onlyjump_p(), redirect_branch_edge(), redirect_edge_succ(), redirect_edge_succ_nodup(), simplejump_p(), edge_def::src, basic_block_def::succs, and try_redirect_by_replacing_jump().
|
static |
|
static |
Simple wrapper as we always can redirect fallthru edges.
References cfg_layout_redirect_edge_and_branch().
|
static |
|
static |
Same as split_block but update cfg_layout structures.
References rtl_split_block().
|
static |
Split edge E.
References create_basic_block(), edge_def::dest, get_insns(), make_edge(), redirect_edge_and_branch_force(), and edge_def::src.
void commit_edge_insertions | ( | void | ) |
Update the CFG for all queued instructions.
References commit_one_edge_insertion(), edge_def::insns, edge_def::edge_def_insns::r, basic_block_def::succs, and verify_flow_info().
Referenced by bypass_conditional_jumps(), convert_regs(), eliminate_partially_redundant_loads(), emit_insn_at_entry(), finish_eh_generation(), ira_emit(), lra(), one_store_motion_pass(), optimize_mode_switching(), pre_gcse(), reload(), rtl_flow_call_edges_add(), and thread_prologue_and_epilogue_insns().
void commit_one_edge_insertion | ( | ) |
Update the CFG for the instructions queued on edge E.
References delete_insn(), edge_def::dest, emit_barrier_after(), emit_insn_after_noloc(), emit_insn_before_noloc(), edge_def::flags, get_last_insn(), edge_def::insns, last, prev_nonnote_insn(), edge_def::edge_def_insns::r, returnjump_p(), single_pred_p(), single_succ_edge(), single_succ_p(), split_edge(), and edge_def::src.
void compute_bb_for_insn | ( | void | ) |
Records the basic block struct in BLOCK_FOR_INSN for every insn.
Referenced by schedule_ebbs_init().
bool contains_no_active_insn_p | ( | ) |
Return true if the block has no effect and only forwards control flow to its single destination.
References flow_active_insn_p(), simplejump_p(), and single_succ_p().
|
static |
Return nonzero if we could reach target from src by falling through, if the target was made adjacent. If we already have a fall-through edge to the exit block, we can't do that.
References edge_def::dest, edge_def::flags, and basic_block_def::succs.
Referenced by fixup_reorder_chain().
basic_block create_basic_block_structure | ( | ) |
Create a new basic block consisting of the instructions between HEAD and END inclusive. This function is designed to allow fast BB construction - reuses the note and basic block struct in BB_NOTE, if any and do not grow BASIC_BLOCK chain and should be used directly only by CFG construction code. END can be NULL in to create new empty basic block before HEAD. Both END and HEAD can be NULL to create basic block at the end of INSN chain. AFTER is the basic block we should be put after.
References alloc_block(), basic_block_def::aux, bb_note(), df_bb_refs_record(), emit_note_after(), emit_note_before(), basic_block_def::flags, get_last_insn(), basic_block_def::index, init_rtl_bb_info(), link_block(), reorder_insns_nobb(), and update_bb_for_insn().
void delete_insn | ( | ) |
Delete INSN by patching it out.
References bb_note(), can_delete_label_p(), df_insn_delete(), find_reg_note(), len, remove_insn(), remove_node_from_expr_list(), remove_note(), and reorder_insns_nobb().
Referenced by add_test(), attempt_change(), calculate_needs_all_insns(), cfg_layout_merge_blocks(), cfg_layout_redirect_edge_and_branch(), cleanup_barriers(), combine_btr_defs(), combine_stack_adjustments_for_block(), commit_one_edge_insertion(), convert_jumps_to_returns(), cprop_jump(), cse_cc_succs(), cse_extended_basic_block(), dead_or_predicable(), delete_address_reloads_1(), delete_caller_save_insns(), delete_dead_jumptables(), delete_dead_store_insn(), delete_debug_insns(), delete_insn_and_edges(), delete_insn_chain(), delete_output_reload(), delete_redundant_insns_1(), delete_related_insns(), doloop_modify(), dse_step5_nospill(), duplicate_insn_chain(), eliminate_partially_redundant_load(), expand_gimple_tailcall(), final(), final_scan_insn(), find_and_remove_re(), find_comparisons_in_bb(), find_cond_trap(), fix_crossing_unconditional_branches(), fixup_abnormal_edges(), fixup_reorder_chain(), get_uncond_jump_length(), hoist_code(), instantiate_virtual_regs_in_insn(), lra_final_code_change(), maybe_cleanup_end_of_block(), merge_blocks_move_predecessor_nojumps(), merge_blocks_move_successor_nojumps(), move_btr_def(), move_for_stack_reg(), move_insn_for_shrink_wrap(), move_invariant_reg(), move_unallocated_pseudos(), pre_delete(), reemit_insn_block_notes(), reload(), reload_as_needed(), reload_combine_recognize_const_pattern(), reload_combine_recognize_pattern(), reload_cse_move2add(), replace_store_insn(), resolve_shift_zext(), resolve_simple_move(), resolve_use(), sched_remove_insn(), split_iv(), thread_prologue_and_epilogue_insns(), try_auto_increment(), try_eliminate_compare(), try_optimize_cfg(), try_split(), update_cfg_for_uncondjump(), and update_equiv_regs().
void delete_insn_and_edges | ( | ) |
Like delete_insn but also purge dead edges from BB.
References delete_insn(), 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().
void delete_insn_chain | ( | ) |
Unlink a chain of insns between START and FINISH, leaving notes that must be paired. If CLEAR_BB is true, we set bb field for insns that cannot be removed to NULL.
References can_delete_note_p(), and delete_insn().
Referenced by cond_exec_process_if_block(), peep2_attempt(), rtl_delete_block(), rtl_merge_blocks(), rtl_tidy_fallthru_edge(), try_head_merge_bb(), and try_redirect_by_replacing_jump().
rtx duplicate_insn_chain | ( | ) |
References copy(), delete_insn(), emit_barrier(), emit_copy_of_insn_after(), emit_note(), emit_note_copy(), get_last_insn(), last, and maybe_copy_prologue_epilogue_insn().
Referenced by cfg_layout_duplicate_bb(), dup_block_and_redirect(), and duplicate_insns_of_cycles().
void emit_barrier_after_bb | ( | ) |
Emit a barrier after BB, into the footer if we are in CFGLAYOUT mode.
References current_ir_type(), emit_barrier_after(), IR_RTL_CFGLAYOUT, IR_RTL_CFGRTL, and unlink_insn_chain().
void emit_insn_at_entry | ( | ) |
Emit INSN at the entry point of the function, ensuring that it is only executed once per function.
References commit_edge_insertions(), ei_safe_edge(), edge_def::flags, and insert_insn_on_edge().
Referenced by emit_initial_value_sets().
|
static |
If the single edge between blocks A and B is the only place in RTL which holds some unique locus, emit a nop with that locus between the blocks.
References emit_insn_after_noloc(), and unique_locus_on_edge_between_p().
Referenced by cfg_layout_merge_blocks(), and rtl_merge_blocks().
rtx entry_of_function | ( | void | ) |
Return RTX to emit after when we want to emit code on the entry of function.
References get_insns().
Referenced by expand_builtin_apply_args(), expand_builtin_saveregs(), and get_arg_pointer_save_area().
|
static |
Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK note associated with the BLOCK.
Referenced by rtl_split_block().
bool fixup_abnormal_edges | ( | void | ) |
This is used by a few passes that emit some instructions after abnormal calls, moving the basic block's end, while they in fact do want to emit them on the fallthru edge. Look for abnormal call edges, find backward the call in the block and insert the instructions on the edge instead. Similarly, handle instructions throwing exceptions internally. Return true when instructions have been found and inserted on edges.
References can_throw_internal(), delete_insn(), find_fallthru_edge(), edge_def::flags, insert_insn_on_edge(), inserted, purge_dead_edges(), and basic_block_def::succs.
Referenced by convert_regs(), lra(), and reload().
|
static |
If we have assembler epilogues, the block falling through to exit must be the last one in the reordered chain when we reach final. Ensure that this condition is met.
References basic_block_def::aux, edge_def::dest, find_fallthru_edge(), basic_block_def::next_bb, reload_completed, split_block(), and edge_def::src.
Referenced by cfg_layout_finalize().
|
static |
Called when edge E has been redirected to a new destination, in order to update the region crossing flag on the edge and jump.
References add_reg_note(), edge_def::dest, find_reg_note(), edge_def::flags, remove_note(), edge_def::src, and basic_block_def::succs.
Referenced by force_nonfallthru_and_redirect(), and rtl_redirect_edge_and_branch().
|
static |
Given a reorder chain, rearrange the code to match.
References any_condjump_p(), basic_block_def::aux, can_fallthru(), cfg_layout_function_footer, cfg_layout_function_header, could_fall_through(), delete_insn(), edge_def::dest, ei_next(), ei_safe_edge(), emit_barrier_after(), emit_insn_after_noloc(), extract_asm_operands(), find_fallthru_edge(), find_reg_note(), edge_def::flags, force_nonfallthru(), force_nonfallthru_and_redirect(), edge_def::goto_locus, invert_jump(), label_for_bb, basic_block_def::next_bb, onlyjump_p(), basic_block_def::preds, redirect_edge_and_branch(), relink_block_chain(), returnjump_p(), set_first_insn(), set_last_insn(), simplejump_p(), single_pred_p(), split_edge(), edge_def::src, basic_block_def::succs, update_br_prob_note(), and verify_insn_chain().
Referenced by cfg_layout_finalize().
|
static |
Like active_insn_p, except keep the return value clobber around even after reload.
References active_insn_p().
Referenced by contains_no_active_insn_p().
basic_block force_nonfallthru_and_redirect | ( | ) |
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(), any_condjump_p(), block_label(), count, edge_def::count, basic_block_def::count, create_basic_block(), edge_def::dest, df_mark_solutions_dirty(), ei_next(), ei_safe_edge(), emit_barrier_after_bb(), emit_jump_insn_after_setloc(), extract_asm_operands(), find_reg_note(), fixup_partition_crossing(), edge_def::flags, basic_block_def::frequency, edge_def::goto_locus, edge_iterator::index, make_edge(), make_single_succ_edge(), prob, edge_def::probability, redirect_edge_pred(), redirect_edge_succ_nodup(), redirect_jump(), remove_note(), ret_rtx, set_return_jump_label(), simple_return_rtx, edge_def::src, basic_block_def::succs, tablejump_p(), unchecked_make_edge(), and vec_safe_push().
|
static |
In case there are more than one fallthru predecessors of exit, force that there is only one.
References basic_block_def::aux, ei_next(), ei_safe_edge(), edge_def::flags, redirect_edge_and_branch_force(), split_edge(), and edge_def::src.
Referenced by cfg_layout_finalize().
bool forwarder_block_p | ( | ) |
Likewise, but protect loop latches, headers and preheaders.
FIXME: Make this a cfg hook.
References contains_no_active_insn_p(), loop::header, and basic_block_def::loop_father.
unsigned int free_bb_for_insn | ( | void | ) |
Release the basic_block_for_insn array.
References get_insns().
Referenced by rest_of_clean_state(), and rest_of_pass_free_cfg().
rtx get_last_bb_insn | ( | ) |
Get the last insn associated with block BB (that includes barriers and tablejumps after BB).
References next_nonnote_insn_bb(), and tablejump_p().
void init_rtl_bb_info | ( | ) |
void insert_insn_on_edge | ( | ) |
Queue instructions for insertion on an edge between two basic blocks. The new instructions and basic blocks (if any) will not appear in the CFG until commit_edge_insertions is called.
References emit_insn(), end_sequence(), edge_def::flags, get_insns(), edge_def::insns, push_to_sequence(), edge_def::edge_def_insns::r, and start_sequence().
|
static |
References cfg_layout_initialize().
|
static |
|
static |
Locate or create a label for a given basic block.
References block_label(), dump_file, and basic_block_def::index.
|
static |
Locate the last bb in the same partition as START_BB.
References basic_block_def::next_bb, and basic_block_def::prev_bb.
Referenced by rtl_split_edge().
rtl_opt_pass* make_pass_free_cfg | ( | ) |
rtl_opt_pass* make_pass_into_cfg_layout_mode | ( | ) |
rtl_opt_pass* make_pass_outof_cfg_layout_mode | ( | ) |
|
static |
Return true if we need to add fake edge to exit. Helper function for rtl_flow_call_edges_add.
References asm_noperands(), and find_reg_note().
Referenced by rtl_flow_call_edges_add().
|
static |
References basic_block_def::aux, cfg_layout_finalize(), and basic_block_def::next_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(), block_label(), computed_jump_p(), currently_expanding_to_rtl, extract_asm_operands(), find_reg_note(), pc_rtx, redirect_jump(), remove_note(), returnjump_p(), and tablejump_p().
Referenced by redirect_branch_edge(), and rtl_split_edge().
void print_rtl_with_bb | ( | ) |
Like dump_function_to_file, but for RTL. Print out dataflow information for the start of each basic block. FLAGS are the TDF_* masks documented in dumpfile.h.
References bb_state, cfun, function::curr_properties, df, df_dump_bottom(), df_dump_insn_bottom(), df_dump_insn_top(), df_dump_start(), df_dump_top(), dump_bb_info(), dump_flags, dump_insn_slim(), free(), get_max_uid(), max_uid, and print_rtl_single().
Referenced by execute_function_dump(), if_convert(), and rtl_verify_edges().
bool purge_all_dead_edges | ( | void | ) |
Search all basic blocks for potentially dead edges and purge them. Return true if some edge has been eliminated.
References purge_dead_edges().
Referenced by combine_instructions(), gimple_expand_cfg(), ira(), rest_of_handle_cse_after_global_opts(), and rest_of_handle_postreload().
bool purge_dead_edges | ( | ) |
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 any_condjump_p(), can_nonlocal_goto(), can_throw_internal(), edge_def::count, basic_block_def::count, edge_def::dest, df_set_bb_dirty(), dump_file, ei_next(), ei_safe_edge(), find_reg_equal_equiv_note(), find_reg_note(), edge_def::flags, basic_block_def::index, may_trap_p(), edge_def::probability, remove_edge(), remove_note(), returnjump_p(), simplejump_p(), single_succ_edge(), single_succ_p(), and basic_block_def::succs.
|
static |
Locate the effective beginning and end of the insn chain for each block, as defined by skip_insns_after_block above.
References cfg_layout_function_footer, cfg_layout_function_header, get_insns(), get_last_insn(), next_insn(), skip_insns_after_block(), and unlink_insn_chain().
Referenced by cfg_layout_initialize().
|
static |
Redirect edge representing branch of (un)conditional jump or tablejump, NULL on failure
References currently_expanding_to_rtl, edge_def::dest, dump_file, edge_def::flags, basic_block_def::index, patch_jump_insn(), redirect_edge_succ_nodup(), and edge_def::src.
Referenced by cfg_layout_redirect_edge_and_branch(), and rtl_redirect_edge_and_branch().
void relink_block_chain | ( | ) |
Link the basic blocks in the correct order, compacting the basic block queue while at it. If STAY_IN_CFGLAYOUT_MODE is false, this function also clears the basic block header and footer fields. This function is usually called after a pass (e.g. tracer) finishes some transformations while in cfglayout mode. The required sequence of the basic blocks is in a linked list along the bb->aux field. This functions re-links the basic block prev_bb and next_bb pointers accordingly, and it compacts and renumbers the blocks. FIXME: This currently works only for RTL, but the only RTL-specific bits are the STAY_IN_CFGLAYOUT_MODE bits. The tracer pass was moved to GIMPLE a long time ago, but it doesn't relink the basic block chain. It could do that (to give better initial RTL) if this function is made IR-agnostic (and moved to cfganal.c or cfg.c while at it).
References basic_block_def::aux, compact_blocks(), dump_file, forwarder_block_p(), free_original_copy_tables(), basic_block_def::frequency, get_bb_original(), basic_block_def::index, initialize_original_copy_tables(), basic_block_def::next_bb, and basic_block_def::prev_bb.
|
static |
References df_analyze(), df_note_add_problem(), free_bb_for_insn(), and insert_section_boundary_note().
|
static |
Do book-keeping of basic block BB for the profile consistency checker. If AFTER_PASS is 0, do pre-pass accounting, or if AFTER_PASS is 1 then do post-pass accounting. Store the counting in RECORD.
References basic_block_def::count, basic_block_def::frequency, insn_rtx_cost(), PROFILE_GUESSED, PROFILE_READ, profile_record::size, and profile_record::time.
|
static |
Return true if BB contains only labels or non-executable instructions.
References any_uncondjump_p().
|
static |
Return 1 if BB ends with a call, possibly followed by some instructions that must stay with the call, 0 otherwise.
References keep_with_call_p().
|
static |
Return 1 if BB ends with a conditional branch, 0 otherwise.
References any_condjump_p().
|
static |
Return true when block A and B can be merged.
References loop::latch, basic_block_def::loop_father, 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 edge_def::flags, onlyjump_p(), side_effects_p(), edge_def::src, 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, create_basic_block_structure(), and vec_safe_grow_cleared().
Referenced by cfg_layout_create_basic_block().
|
static |
Referenced by cfg_layout_delete_block().
|
static |
Delete the insns in a (non-live) block. We physically delete every non-deleted-note insn, and update the flow graph appropriately. Return nonzero if we deleted an exception handler.
??? Preserving all such notes strikes me as wrong. It would be nice to post-process the stream to remove empty blocks, loops, ranges, etc.
References delete_insn_chain(), df_bb_delete(), dump_file, get_last_bb_insn(), and basic_block_def::index.
|
static |
|
static |
Print out RTL-specific basic block information (live information at start and end with TDF_DETAILS). FLAGS are the TDF_* masks documented in dumpfile.h.
References df, df_dump_bottom(), df_dump_insn_bottom(), df_dump_insn_top(), df_dump_top(), dump_insn_slim(), indent, basic_block_def::index, last, memset(), and print_rtl_single().
|
static |
References basic_block_def::aux, and cfg_layout_duplicate_bb().
|
static |
Given a block B with unconditional branch at its end, get the store the return the branch edge and the fall-thru edge in BRANCH_EDGE and FALLTHRU_EDGE respectively.
References edge_def::flags.
|
static |
Add fake edges to the function exit for any non constant and non noreturn calls, volatile inline assembly in the bitmap of blocks specified by BLOCKS or to the whole CFG if BLOCKS is zero. Return the number of blocks that were split. The goal is to expose cases in which entering a basic block does not imply that all subsequent instructions must be executed.
References bitmap_bit_p(), commit_edge_insertions(), find_edge(), gen_use(), insert_insn_on_edge(), keep_with_call_p(), last_bb, make_edge(), need_fake_edge_p(), basic_block_def::prev_bb, split_block(), and verify_flow_info().
|
static |
Edge E is assumed to be fallthru edge. Emit needed jump instruction (and possibly create new basic block) to make edge non-fallthru. Return newly created BB or NULL if none.
References edge_def::dest, and force_nonfallthru_and_redirect().
|
static |
Add COMP_RTX as a condition at end of COND_BB. FIRST_HEAD is the conditional branch target, SECOND_HEAD should be the fall-thru there is no need to handle this here the loop versioning code handles this. the reason for SECON_HEAD is that it is needed for condition in trees, and this should be of the same type since it is a hook.
References block_label(), comp, do_compare_rtx_and_jump(), emit_insn_after(), end_sequence(), force_operand(), get_insns(), get_last_insn(), and start_sequence().
|
static |
|
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 delete_insn_chain(), df_bb_delete(), dump_file, emit_nop_for_unique_locus_between(), basic_block_def::flags, basic_block_def::index, only_sets_cc0_p(), prev_nonnote_insn(), reorder_insns_nobb(), and update_bb_for_insn_chain().
|
static |
Should move basic block BB after basic block AFTER. NIY.
|
static |
|
static |
Attempt to change code to redirect edge E to TARGET. Don't do that on expense of adding new instructions or reordering basic blocks. Function can be also called with edge destination equivalent to the TARGET. Then it should try the simplifications and do nothing if none is possible. Return edge representing the branch if transformation succeeded. Return NULL on failure. We still return NULL in case E already destinated TARGET and we didn't managed to simplify instruction stream.
References edge_def::dest, df_set_bb_dirty(), fixup_partition_crossing(), edge_def::flags, redirect_branch_edge(), edge_def::src, and try_redirect_by_replacing_jump().
|
static |
|
static |
Redirect edge even at the expense of creating new jump insn or basic block. Return new basic block if created, NULL otherwise. Conversion must be possible.
References edge_def::dest, df_set_bb_dirty(), force_nonfallthru_and_redirect(), redirect_edge_and_branch(), and edge_def::src.
|
static |
Referenced by cfg_layout_split_block().
|
static |
Creates a new basic block just after basic block B by splitting everything after specified instruction I.
References create_basic_block(), df_set_bb_dirty(), emit_note_after(), first_insn_after_basic_block_note(), get_last_insn(), edge_def::src, and basic_block_def::succs.
|
static |
Split a basic block if it ends with a conditional branch and if the other part of the block is not empty.
References any_condjump_p(), edge_def::dest, last, and split_block().
|
static |
|
static |
Split a (typically critical) edge. Return the new block. The edge must not be abnormal. ??? The code generally expects to be called on critical edges. The case of a block ending in an unconditional jump to a block with multiple predecessors is not handled optimally.
References create_basic_block(), edge_def::dest, df_set_bb_dirty(), extract_asm_operands(), find_fallthru_edge(), edge_def::flags, force_nonfallthru(), last, last_bb_in_partition(), make_single_succ_edge(), patch_jump_insn(), basic_block_def::preds, basic_block_def::prev_bb, redirect_edge_and_branch(), redirect_edge_succ(), single_succ_edge(), and edge_def::src.
|
static |
The given edge should potentially be a fallthru edge. If that is in fact true, delete the jump and barriers that are in the way.
References any_condjump_p(), any_uncondjump_p(), delete_insn_chain(), edge_def::flags, basic_block_def::next_bb, only_sets_cc0_p(), onlyjump_p(), single_succ_p(), and edge_def::src.
|
static |
Walk the instruction chain and verify that bb head/end pointers are correct, and that instructions are in exactly one bb and have correct block pointers.
References error(), free(), get_last_insn(), get_max_uid(), basic_block_def::index, and max_uid.
Referenced by rtl_verify_flow_info().
|
static |
Checks on the instructions within blocks. Currently checks that each block starts with a basic block note, and that basic block notes and control flow jumps are not found in the middle of the block.
References control_flow_insn_p(), error(), and basic_block_def::index.
Referenced by rtl_verify_flow_info_1().
|
static |
Verify that blocks are laid out in consecutive order. While walking the instructions, verify that all expected instructions are inside the basic blocks, and that all returns are followed by barriers.
References condjump_p(), curr_bb, get_insns(), internal_error(), basic_block_def::next_bb, next_nonnote_insn(), and returnjump_p().
Referenced by rtl_verify_flow_info().
|
static |
Verify that block pointers for instructions in basic blocks, headers and footers are set appropriately.
References error(), basic_block_def::flags, and basic_block_def::index.
Referenced by rtl_verify_flow_info_1().
|
static |
Perform several checks on the edges out of each block, such as the consistency of the branch probabilities, the correctness of hot/cold partition crossing edges, and the number of expected successor edges.
References any_condjump_p(), any_uncondjump_p(), edge_def::dest, error(), find_reg_note(), edge_def::flags, get_insns(), basic_block_def::index, print_rtl_with_bb(), PROFILE_ABSENT, edge_def::src, and basic_block_def::succs.
Referenced by rtl_verify_flow_info_1().
|
static |
Verify that fallthru edges point to adjacent blocks in layout order and that barriers exist after non-fallthru blocks.
References edge_def::dest, error(), find_fallthru_edge(), basic_block_def::index, basic_block_def::next_bb, edge_def::src, and basic_block_def::succs.
Referenced by rtl_verify_flow_info().
|
static |
Verify the CFG and RTL consistency common for both underlying RTL and cfglayout RTL, plus consistency checks specific to linearized RTL mode. Currently it does following checks: - all checks of rtl_verify_flow_info_1 - test head/end pointers - check that blocks are laid out in consecutive order - check that all insns are in the basic blocks (except the switch handling code, barriers and notes) - check that all returns are followed by barriers - check that all fallthru edge points to the adjacent blocks.
References rtl_verify_bb_insn_chain(), rtl_verify_bb_layout(), rtl_verify_fallthru(), rtl_verify_flow_info_1(), and verify_hot_cold_block_grouping().
|
static |
Verify the CFG and RTL consistency common for both underlying RTL and cfglayout RTL. Currently it does following checks: - overlapping of basic blocks - insns with wrong BLOCK_FOR_INSN pointers - headers of basic blocks (the NOTE_INSN_BASIC_BLOCK note) - tails of basic blocks (ensure that boundary is necessary) - scans body of the basic block for JUMP_INSN, CODE_LABEL and NOTE_INSN_BASIC_BLOCK - verify that no fall_thru edge crosses hot/cold partition boundaries - verify that there are no pending RTL branch predictions - verify that there is a single hot/cold partition boundary after bbro In future it can be extended check a lot of other stuff as well (reachability of basic blocks, life information, etc. etc.).
References rtl_verify_bb_insns(), rtl_verify_bb_pointers(), and rtl_verify_edges().
Referenced by rtl_verify_flow_info().
|
static |
Referenced by record_effective_endpoints().
|
static |
Skip over inter-block insns occurring after BB which are typically associated with BB (e.g., barriers). If there are any such insns, we return the last one. Otherwise, we return the end of BB.
References basic_block_def::next_bb, and reorder_insns().
edge try_redirect_by_replacing_jump | ( | ) |
Attempt to perform edge redirection by replacing possibly complex jump instruction by unconditional jump or removing jump completely. This can apply only if all edges now point to the same block. The parameters and return values are equivalent to redirect_edge_and_branch.
References block_label(), can_fallthru(), cc0_rtx, edge_def::count, basic_block_def::count, delete_insn_chain(), edge_def::dest, dump_file, emit_barrier_after(), emit_jump_insn_after_noloc(), edge_def::flags, basic_block_def::index, next_nonnote_insn(), only_sets_cc0_p(), onlyjump_p(), edge_def::probability, redirect_edge_succ(), redirect_jump(), reg_mentioned_p(), reload_completed, remove_edge(), side_effects_p(), simplejump_p(), single_succ_edge(), single_succ_p(), edge_def::src, basic_block_def::succs, table, tablejump_p(), and update_bb_for_insn_chain().
|
static |
Return true if the single edge between blocks A and B is the only place in RTL which holds some unique locus.
Referenced by emit_nop_for_unique_locus_between().
rtx unlink_insn_chain | ( | ) |
Cut the insns from FIRST to LAST out of the insns stream.
References first, set_first_insn(), and set_last_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 | ( | ) |
Update BLOCK_FOR_INSN of insns in BB to BB, and notify df of the change.
References update_bb_for_insn_chain().
|
static |
Update BLOCK_FOR_INSN of insns between BEGIN and END (or BARRIER if found) and notify df of the bb change. The insn chain range is inclusive (i.e. both BEGIN and END will be updated.
References df_insn_change_bb().
Referenced by cfg_layout_merge_blocks(), rtl_merge_blocks(), try_redirect_by_replacing_jump(), and update_bb_for_insn().
void update_br_prob_note | ( | ) |
Update the branch probability of BB if a REG_BR_PROB is present.
References find_reg_note().
|
static |
Verify, in the basic block chain, that there is at most one switch between hot/cold partitions. This condition will not be true until after reorder_basic_blocks is called.
References current_ir_type(), error(), basic_block_def::index, and IR_RTL_CFGRTL.
Referenced by rtl_verify_flow_info().
DEBUG_FUNCTION void verify_insn_chain | ( | ) |
Perform sanity checks on the insn chain. 1. Check that next/prev pointers are consistent in both the forward and reverse direction. 2. Count insns in chain, going both directions, and check if equal. 3. Check that get_last_insn () returns the actual end of chain.
References get_insns(), and get_last_insn().
Referenced by cfg_layout_finalize(), and fixup_reorder_chain().
|
static |
@verbatim Control flow graph manipulation code for GNU compiler.
Copyright (C) 1987-2013 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
This file contains low level functions to manipulate the CFG and analyze it that are aware of the RTL intermediate language. Available functionality: - Basic CFG/RTL manipulation API documented in cfghooks.h - CFG-aware instruction chain manipulation delete_insn, delete_insn_chain - Edge splitting and committing to edges insert_insn_on_edge, commit_edge_insertions - CFG updating after insn simplification purge_dead_edges, purge_all_dead_edges - CFG fixing after coarse manipulation fixup_abnormal_edges Functions not supposed for generic use: - Infrastructure to determine quickly basic block for insn compute_bb_for_insn, update_bb_for_insn, set_block_for_insn, - Edge redirection with updating and optimizing of insn chain block_label, tidy_fallthru_edge, force_nonfallthru
Holds the interesting leading and trailing notes for the function. Only applicable if the CFG is in cfglayout mode.
Referenced by cfg_layout_delete_block(), fixup_reorder_chain(), and record_effective_endpoints().
|
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().