GCC Middle and Back End API Reference
|
int any_condjump_p | ( | ) |
Return true when insn is a conditional jump. This function works for instructions containing PC sets in PARALLELs. The instruction may have various other effects so before removing the jump you must verify onlyjump_p. Note that unlike condjump_p it returns false for unconditional jumps.
References pc_set().
Referenced by bypass_conditional_jumps(), can_predict_insn_p(), cfg_layout_redirect_edge_and_branch(), check_simple_exit(), cond_exec_get_condition(), constprop_register(), cse_extended_basic_block(), cse_find_path(), dead_or_predicable(), emit_cmp_and_jump_insn_1(), find_dead_or_set_registers(), find_jump_block(), fix_crossing_conditional_branches(), fix_crossing_unconditional_branches(), fixup_reorder_chain(), force_nonfallthru_and_redirect(), get_condition(), may_unswitch_on(), maybe_cleanup_end_of_block(), noce_get_condition(), outgoing_edges_match(), predict_insn(), purge_dead_edges(), record_jump_equiv(), relax_delay_slots(), reload_cse_move2add(), rotate_loop(), rtl_block_ends_with_condjump_p(), rtl_predict_edge(), rtl_split_block_before_cond_jump(), rtl_tidy_fallthru_edge(), rtl_verify_edges(), sched_get_condition_with_rev_uncached(), set_edge_can_fallthru_flag(), simplify_using_initial_values(), thread_jump(), try_simplify_condjump(), and try_split().
int any_uncondjump_p | ( | ) |
Return true when insn is an unconditional direct jump, possibly bundled inside a PARALLEL.
References find_reg_note(), and pc_set().
Referenced by add_test(), emit(), find_dead_or_set_registers(), follow_jumps(), rtl_block_empty_p(), rtl_tidy_fallthru_edge(), rtl_verify_edges(), and try_combine().
|
static |
Some old code expects exactly one BARRIER as the NEXT_INSN of a non-fallthru insn. This is not generally true, as multiple barriers may have crept in, or the BARRIER may be separated from the last real insn by one or more NOTEs. This simple pass moves barriers and removes duplicates so that the old code is happy.
References delete_insn(), get_insns(), prev_nonnote_insn(), and reorder_insns_nobb().
int comparison_dominates_p | ( | ) |
Return nonzero if CODE1 is more strict than CODE2, i.e., if the truth of CODE1 implies the truth of CODE2.
Referenced by condition_dominates_p(), fold_rtx(), known_cond(), and thread_jump().
int condjump_in_parallel_p | ( | ) |
Return nonzero if INSN is a (possibly) conditional jump inside a PARALLEL. Use this function is deprecated, since we need to support combined branch and compare insns. Use any_condjump_p instead whenever possible.
Referenced by dbr_schedule(), fill_eager_delay_slots(), fill_simple_delay_slots(), get_branch_condition(), get_jump_flags(), relax_delay_slots(), and reload_combine().
int condjump_p | ( | ) |
Return nonzero if INSN is a (possibly) conditional jump and nothing more. Use of this function is deprecated, since we need to support combined branch and compare insns. Use any_condjump_p instead whenever possible.
References SET.
Referenced by convert_jumps_to_returns(), cse_insn(), dbr_schedule(), fill_eager_delay_slots(), fill_simple_delay_slots(), get_jump_flags(), relax_delay_slots(), reload_combine(), and rtl_verify_bb_layout().
void delete_for_peephole | ( | ) |
Delete a range of insns from FROM to TO, inclusive. This is for the sake of peephole optimization, so assume that whatever these insns do will still be done by a new peephole insn that will replace them.
rtx delete_related_insns | ( | ) |
Delete insn INSN from the chain of insns and update label ref counts and delete insns now unreachable. Returns the first insn after INSN that was not deleted. Usage of this instruction is deprecated. Use delete_insn instead and subsequent cfg_cleanup pass to delete unreachable code if needed.
References delete_insn(), jump_to_label_p(), len, remove_insn(), and tablejump_p().
Referenced by dbr_schedule(), delete_address_reloads(), delete_computation(), delete_from_delay_slot(), delete_scheduled_jump(), fill_simple_delay_slots(), fill_slots_from_thread(), make_return_insns(), optimize_skip(), redirect_jump_2(), relax_delay_slots(), and try_merge_delay_insns().
int eh_returnjump_p | ( | ) |
References eh_returnjump_p_1(), and for_each_rtx().
Referenced by thread_prologue_and_epilogue_insns().
|
static |
Return true if INSN is a (possibly conditional) return insn.
Referenced by eh_returnjump_p().
|
static |
@verbatim Optimize jump instructions, 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 is the pathetic reminder of old fame of the jump-optimization pass of the compiler. Now it contains basically a set of utility functions to operate with jumps. Each CODE_LABEL has a count of the times it is used stored in the LABEL_NUSES internal field, and each JUMP_INSN has one label that it refers to stored in the JUMP_LABEL internal field. With this we can detect labels that become unused because of the deletion of all the jumps that formerly used them. The JUMP_LABEL info is sometimes looked at by later passes. For return insns, it contains either a RETURN or a SIMPLE_RETURN rtx. The subroutines redirect_jump and invert_jump are used from other passes as well.
Optimize jump y; x: ... y: jumpif... x? Don't know if it is worth bothering with.
Optimize two cases of conditional jump to conditional jump? This can never delete any instruction or make anything dead, or even change what is live at any point. So perhaps let combiner do it.
Referenced by rebuild_jump_labels_1().
|
static |
Initialize LABEL_NUSES and JUMP_LABEL fields, add REG_LABEL_TARGET for remaining targets for JUMP_P. Delete any REG_LABEL_OPERAND notes whose labels don't occur in the insn any more.
References reg_mentioned_p(), and remove_note().
Referenced by invert_jump_1(), and redirect_jump_2().
|
static |
Invert the jump condition X contained in jump insn INSN. Accrue the modifications into the change group. Return nonzero for success.
References comp, reversed_comparison_code(), and validate_change().
int invert_jump | ( | ) |
Invert the condition of the jump JUMP, and make it jump to label NLABEL instead of where it jumps now. Return true if successful.
References apply_change_group(), cancel_changes(), invert_jump_1(), and redirect_jump_2().
Referenced by fix_up_fall_thru_edges(), fixup_reorder_chain(), optimize_skip(), relax_delay_slots(), set_edge_can_fallthru_flag(), and try_simplify_condjump().
int invert_jump_1 | ( | ) |
Invert the condition of the jump JUMP, and make it jump to label NLABEL instead of where it jumps now. Accrue changes into the change group. Return false if we didn't see how to perform the inversion and redirection.
References invert_exp_1(), num_validated_changes(), pc_set(), and redirect_jump_1().
Referenced by dead_or_predicable(), and invert_jump().
bool jump_to_label_p | ( | ) |
Return true iff INSN is a jump and its JUMP_LABEL is a label, not NULL or a return.
Referenced by delete_related_insns(), fill_simple_delay_slots(), fill_slots_from_thread(), and make_return_insns().
rtl_opt_pass* make_pass_cleanup_barriers | ( | ) |
|
static |
Referenced by rebuild_jump_labels_1().
|
static |
Mark the label each jump jumps to. Combine consecutive labels, and count uses of labels.
References current_ir_type(), IR_RTL_CFGLAYOUT, mark_jump_label(), and maybe_propagate_label_ref().
void mark_jump_label | ( | ) |
Find all CODE_LABELs referred to in X, and increment their use counts. If INSN is a JUMP_INSN and there is at least one CODE_LABEL referenced in INSN as a jump target, then store the last one in JUMP_LABEL (INSN). For a tablejump, this must be the label for the ADDR_VEC. Store any other jump targets as REG_LABEL_TARGET notes. If INSN is an INSN or a CALL_INSN or non-target operands of a JUMP_INSN, and there is at least one CODE_LABEL referenced in INSN, add a REG_LABEL_OPERAND note containing that label to INSN. For returnjumps, the JUMP_LABEL will also be set as appropriate. Note that two labels separated by a loop-beginning note must be kept distinct if we have not yet done loop-optimization, because the gap between them is where loop-optimize will want to move invariant code to. CROSS_JUMP tells us that loop-optimization is done with.
References extract_asm_operands(), mark_jump_label_1(), and mark_jump_label_asm().
Referenced by emit_copy_of_insn_after(), gen_reload(), mark_all_labels(), mark_jump_label_1(), try_combine(), and try_split().
Referenced by mark_jump_label(), mark_jump_label_1(), mark_jump_label_asm(), and maybe_propagate_label_ref().
|
static |
Worker function for mark_jump_label. IN_MEM is TRUE when X occurs within a (MEM ...). IS_TARGET is TRUE when X is to be treated as a jump-target; when the JUMP_LABEL field of INSN should be set or a REG_LABEL_TARGET note should be added, not a REG_LABEL_OPERAND note.
References add_reg_note(), find_reg_note(), get_pool_constant(), mark_jump_label(), and mark_jump_label_1().
Referenced by mark_jump_label().
|
static |
Worker function for mark_jump_label. Handle asm insns specially. In particular, output operands need not be considered so we can avoid re-scanning the replicated asm_operand. Also, the asm_labels need to be considered targets.
References mark_jump_label_1().
|
static |
A subroutine of mark_all_labels. Trivially propagate a simple label load into a jump_insn that uses it.
References find_reg_note(), mark_jump_label_1(), pc_set(), and rtx_equal_p().
Referenced by mark_all_labels().
int only_sets_cc0_p | ( | ) |
Return nonzero if X is an RTX that only sets the condition codes and has no side effects.
References sets_cc0_p(), and side_effects_p().
Referenced by rtl_merge_blocks(), rtl_tidy_fallthru_edge(), and try_redirect_by_replacing_jump().
int onlyjump_p | ( | ) |
Return true if INSN is a jump that only transfers control and nothing more.
References side_effects_p().
Referenced by bypass_conditional_jumps(), cfg_layout_can_merge_blocks_p(), cfg_layout_redirect_edge_and_branch(), check_cond_move_block(), cond_exec_process_if_block(), constprop_register(), find_cond_trap(), fixup_reorder_chain(), flow_find_cross_jump(), follow_jumps(), noce_find_if_block(), outgoing_edges_match(), rtl_can_merge_blocks(), rtl_can_remove_branch_p(), rtl_tidy_fallthru_edge(), sched_get_condition_with_rev_uncached(), thread_jump(), try_optimize_cfg(), and try_redirect_by_replacing_jump().
rtx pc_set | ( | ) |
Return set of PC, otherwise NULL.
References SET.
Referenced by any_condjump_p(), any_uncondjump_p(), bypass_block(), compare_and_jump_seq(), cond_exec_get_condition(), condjump_label(), cprop_jump(), get_condition(), invert_jump_1(), maybe_propagate_label_ref(), noce_emit_store_flag(), noce_get_alt_condition(), noce_get_condition(), outgoing_edges_match(), record_jump_equiv(), sched_get_condition_with_rev_uncached(), and thread_jump().
void rebuild_jump_labels | ( | ) |
This function rebuilds the JUMP_LABEL field and REG_LABEL_TARGET notes in jumping insns and REG_LABEL_OPERAND notes in non-jumping instructions and jumping insns that have labels as operands (e.g. cbranchsi4).
References rebuild_jump_labels_1().
Referenced by break_superblocks(), cfg_layout_finalize(), gimple_expand_cfg(), ira(), peephole2_optimize(), rest_of_handle_combine(), rest_of_handle_cse(), rest_of_handle_cse2(), rest_of_handle_cse_after_global_opts(), and rest_of_handle_gcse2().
|
static |
Worker for rebuild_jump_labels and rebuild_jump_labels_chain.
References init_label_info(), mark_all_labels(), timevar_pop(), and timevar_push().
Referenced by rebuild_jump_labels(), and rebuild_jump_labels_chain().
void rebuild_jump_labels_chain | ( | ) |
This function is like rebuild_jump_labels, but doesn't run over forced_labels. It can be used on insn chains that aren't the main function chain.
References rebuild_jump_labels_1().
Referenced by gimple_expand_cfg().
Referenced by redirect_exp_1(), redirect_jump_1(), and redirect_jump_2().
|
static |
Throughout LOC, redirect OLABEL to NLABEL. Treat null OLABEL or NLABEL as a return. Accrue modifications into the change group.
References pc_rtx, redirect_exp_1(), redirect_target(), SET, and validate_change().
int redirect_jump | ( | ) |
Make JUMP go to NLABEL instead of where it jumps now. If the old jump target label is unused as a result, it and the code following it may be deleted. Normally, NLABEL will be a label, but it may also be a RETURN rtx; in that case we are to turn the jump into a (possibly conditional) return insn. The return value will be 1 if the change was made, 0 if it wasn't (this can only occur when trying to produce return insns).
References apply_change_group(), epilogue_completed, redirect_jump_1(), and redirect_jump_2().
Referenced by compare_and_jump_seq(), convert_jumps_to_returns(), dbr_schedule(), fix_crossing_conditional_branches(), force_nonfallthru_and_redirect(), patch_jump_insn(), reorg_redirect_jump(), and try_redirect_by_replacing_jump().
int redirect_jump_1 | ( | ) |
Make JUMP go to NLABEL instead of where it jumps now. Accrue the modifications into the change group. Return false if we did not see how to do that.
References extract_asm_operands(), num_validated_changes(), and redirect_exp_1().
Referenced by dead_or_predicable(), invert_jump_1(), and redirect_jump().
Fix up JUMP_LABEL and label ref counts after OLABEL has been replaced with NLABEL in JUMP. If DELETE_UNUSED is positive, delete related insn to OLABEL if its ref count has dropped to zero.
References confirm_change_group(), delete_related_insns(), find_reg_note(), invert_br_probabilities(), invert_exp_1(), redirect_exp_1(), and remove_note().
Referenced by dead_or_predicable(), invert_jump(), and redirect_jump().
|
static |
A helper function for redirect_exp_1; examines its input X and returns either a LABEL_REF around a label, or a RETURN if X was NULL.
References ret_rtx.
Referenced by redirect_exp_1().
unsigned int reg_or_subregno | ( | ) |
Return regno of the register REG and handle subregs too.
Referenced by gen_reload(), and push_reload().
int returnjump_p | ( | ) |
Return TRUE if INSN is a return jump.
References for_each_rtx(), and returnjump_p_1().
Referenced by commit_one_edge_insertion(), create_trace_edges(), fixup_reorder_chain(), flow_find_cross_jump(), make_edges(), make_insn_raw(), patch_jump_insn(), purge_dead_edges(), rtl_verify_bb_layout(), thread_prologue_and_epilogue_insns(), and try_combine().
|
static |
Referenced by returnjump_p().
|
static |
Return true if INSN is a (possibly conditional) return insn.
References SET.
enum rtx_code reverse_condition | ( | ) |
Given an rtx-code for a comparison, return the code for the negated comparison. If no such code exists, return UNKNOWN. WATCH OUT! reverse_condition is not safe to use on a jump that might be acting on the results of an IEEE floating point comparison, because of the special treatment of non-signaling nans in comparisons. Use reversed_comparison_code instead.
Referenced by alter_cond(), do_compare_rtx_and_jump(), emit_store_flag(), emit_store_flag_force(), fold_rtx(), iv_number_of_iterations(), known_cond(), noce_get_condition(), reversed_comparison_code_parts(), and simplify_comparison().
enum rtx_code reverse_condition_maybe_unordered | ( | ) |
Similar, but we're allowed to generate unordered comparisons, which makes it safe for IEEE floating-point. Of course, we have to recognize that the target will support them too...
Referenced by do_compare_rtx_and_jump(), emit_store_flag(), emit_store_flag_force(), prepare_float_lib_cmp(), and reversed_comparison_code_parts().
rtx reversed_comparison | ( | ) |
Return comparison with reversed code of EXP. Return NULL_RTX in case we fail to do the reversal.
References reversed_comparison_code(), and simplify_gen_relational().
Referenced by simplify_binary_operation_1(), and simplify_if_then_else().
enum rtx_code reversed_comparison_code | ( | ) |
A wrapper around the previous function to take COMPARISON as rtx expression. This simplifies many callers.
References reversed_comparison_code_parts().
Referenced by canonicalize_condition(), cond_exec_get_condition(), cond_exec_process_if_block(), conditions_mutex_p(), dead_or_predicable(), find_comparison_args(), find_cond_trap(), get_branch_condition(), if_then_else_cond(), invert_exp_1(), known_cond(), noce_emit_store_flag(), noce_try_addcc(), noce_try_cmove_arith(), noce_try_store_flag(), noce_try_store_flag_constants(), noce_try_store_flag_mask(), outgoing_edges_match(), reversed_comparison(), reversed_condition(), sched_get_condition_with_rev_uncached(), sched_get_reverse_condition_uncached(), simplify_comparison(), simplify_if_then_else(), simplify_relational_operation_1(), simplify_ternary_operation(), simplify_unary_operation_1(), subst_stack_regs_pat(), and thread_jump().
enum rtx_code reversed_comparison_code_parts | ( | enum rtx_code | code, |
const_rtx | arg0, | ||
const_rtx | arg1, | ||
const_rtx | insn | ||
) |
Given a comparison (CODE ARG0 ARG1), inside an insn, INSN, return a code of reversed comparison if it is possible to do so. Otherwise return UNKNOWN. UNKNOWN may be returned in case we are having CC_MODE compare and we don't know whether it's source is floating point or integer comparison. Machine description should define REVERSIBLE_CC_MODE and REVERSE_CONDITION macros to help this function avoid overhead in these cases.
References prev_nonnote_insn(), reverse_condition(), reverse_condition_maybe_unordered(), RTX_COMM_COMPARE, RTX_COMPARE, rtx_equal_p(), SET, and set_of().
Referenced by combine_simplify_rtx(), emit_conditional_move(), record_jump_equiv(), and reversed_comparison_code().
int rtx_renumbered_equal_p | ( | ) |
Like rtx_equal_p except that it considers two REGs as equal if they renumber to the same value and considers two commutative operations to be the same if the order of the operands has been reversed.
References next_real_insn(), subreg_info::offset, reg_renumber, subreg_info::representable_p, rtx_equal_p(), subreg_get_info(), and targetm.
Referenced by can_replace_by(), equal_different_set_p(), find_equiv_reg(), old_insns_match_p(), and outgoing_edges_match().
int sets_cc0_p | ( | ) |
Return 1 if X is an RTX that does nothing but set the condition codes and CLOBBER or USE registers. Return -1 if X does explicitly set the condition codes, but also does other things.
Referenced by add_branch_dependences(), can_combine_p(), can_move_insns_across(), combine_instructions(), delete_computation(), delete_scheduled_jump(), distribute_notes(), fill_simple_delay_slots(), fill_slots_from_thread(), find_invariant_insn(), find_moveable_pseudos(), find_reloads_address_1(), flow_find_cross_jump(), flow_find_head_matching_sequence(), insert_insn_end_basic_block(), insn_a_feeds_b(), only_sets_cc0_p(), prev_cc0_setter(), push_reload(), reload_combine_recognize_const_pattern(), steal_delay_list_from_fallthrough(), try_combine(), and try_merge_delay_insns().
enum rtx_code signed_condition | ( | ) |
Similarly, return the signed version of a comparison.
Referenced by simplify_const_relational_operation().
int simplejump_p | ( | ) |
Return 1 if INSN is an unconditional jump and nothing else.
References SET.
Referenced by cfg_layout_can_merge_blocks_p(), cfg_layout_redirect_edge_and_branch(), cond_exec_find_if_block(), contains_no_active_insn_p(), convert_jumps_to_returns(), cprop_jump(), dup_block_and_redirect(), fill_simple_delay_slots(), fixup_reorder_chain(), flow_find_cross_jump(), outgoing_edges_match(), purge_dead_edges(), relax_delay_slots(), rtl_can_merge_blocks(), simplejump_or_return_p(), try_optimize_cfg(), and try_redirect_by_replacing_jump().
enum rtx_code swap_condition | ( | ) |
Similar, but return the code when two operands of a comparison are swapped. This IS safe for IEEE floating-point.
Referenced by alter_cond(), canon_condition(), canonicalize_condition(), canonicalize_iv_subregs(), do_compare_rtx_and_jump(), do_store_flag(), emit_cmp_and_jump_insns(), emit_conditional_add(), emit_conditional_move(), emit_store_flag_1(), if_then_else_cond(), iv_number_of_iterations(), known_cond(), noce_get_alt_condition(), noce_try_minmax(), outgoing_edges_match(), prepare_float_lib_cmp(), simplify_comparison(), simplify_const_relational_operation(), simplify_relational_operation(), simplify_while_replacing(), and swap_rtx_condition_1().
int true_regnum | ( | ) |
If X is a hard register or equivalent to one or a subregister of one, return the hard register number. If X is a pseudo register that was not assigned a hard register, return the pseudo register number. Otherwise, return -1. Any rtx is valid for X.
References lra_in_progress, subreg_info::offset, reg_renumber, subreg_info::representable_p, and subreg_get_info().
Referenced by choose_reload_regs(), clear_reload_reg_in_use(), deallocate_reload_reg(), decompose(), find_equiv_reg(), find_reusable_reload(), reload_cse_simplify_operands(), reload_cse_simplify_set(), reload_reg_free_for_value_p(), and set_reload_reg().
enum rtx_code unsigned_condition | ( | ) |
Given a comparison CODE, return the corresponding unsigned comparison. If CODE is an equality comparison or already an unsigned comparison, CODE is returned.
Referenced by do_compare_rtx_and_jump(), emit_cmp_and_jump_insns(), emit_conditional_add(), emit_conditional_move(), emit_store_flag_1(), and simplify_comparison().