GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | cselib_val |
struct | elt_loc_list |
struct | cselib_set |
Typedefs | |
typedef rtx(* | cselib_expand_callback) (rtx, bitmap, int, void *) |
Enumerations | |
enum | cselib_record_what { CSELIB_RECORD_MEMORY = 1 , CSELIB_PRESERVE_CONSTANTS = 2 } |
Variables | |
void(* | cselib_discard_hook )(cselib_val *) |
void(* | cselib_record_sets_hook )(rtx_insn *insn, struct cselib_set *sets, int n_sets) |
enum cselib_record_what |
|
inline |
Return the canonical value for VAL, following the equivalence chain towards the earliest (== lowest uid) equivalent value.
References canonical_cselib_val(), CSELIB_VAL_PTR, gcc_checking_assert, GET_CODE, elt_loc_list::loc, cselib_val::locs, elt_loc_list::next, and cselib_val::uid.
Referenced by add_mem_for_addr(), canonical_cselib_val(), cselib_invalidate_mem(), cselib_invalidate_regno_val(), cselib_lookup_mem(), get_addr(), memrefs_conflict_p(), new_elt_loc_list(), remove_useless_values(), reverse_op(), rtx_equal_for_cselib_1(), and val_bind().
|
extern |
Make ELT and X's VALUE equivalent to each other at INSN.
References cselib_any_perm_equivs, cselib_current_insn, cselib_lookup(), cselib_preserve_value(), elt_list::elt, gcc_checking_assert, GET_MODE, new_elt_loc_list(), PRESERVED_VALUE_P, side_effects_p(), and cselib_val::val_rtx.
Referenced by cselib_record_sets(), record_entry_value(), reverse_op(), and vt_initialize().
|
extern |
Remove all entries from the hash table. Also used during initialization.
References cselib_reset_table().
Referenced by cselib_finish(), dse_step1(), and local_cprop_pass().
|
extern |
Similar to cselib_expand_value_rtx_cb, but no rtxs are actually copied or simplified. Useful to find out whether cselib_expand_value_rtx_cb would return NULL or non-NULL, without allocating new rtx.
References expand_value_data::callback, expand_value_data::callback_arg, cselib_expand_value_rtx_1(), expand_value_data::dummy, NULL, and expand_value_data::regs_active.
Forward substitute and expand an expression out to its roots. This is the opposite of common subexpression. Because local value numbering is such a weak optimization, the expanded expression is pretty much unique (not from a pointer equals point of view but from a tree shape point of view. This function returns NULL if the expansion fails. The expansion will fail if there is no value number for one of the operands or if one of the operands has been overwritten between the current insn and the beginning of the basic block. For instance x has no expansion in: r1 <- r1 + 3 x <- r1 + 8 REGS_ACTIVE is a scratch bitmap that should be clear when passing in. It is clear on return.
References expand_value_data::callback, expand_value_data::callback_arg, cselib_expand_value_rtx_1(), expand_value_data::dummy, NULL, and expand_value_data::regs_active.
Referenced by canon_address(), get_call_args(), record_store(), and reverse_op().
|
extern |
Same as cselib_expand_value_rtx, but using a callback to try to resolve some expressions. The CB function should return ORIG if it can't or does not want to deal with a certain RTX. Any other return value, including NULL, will be used as the expansion for VALUE, without any further changes.
References expand_value_data::callback, expand_value_data::callback_arg, cselib_expand_value_rtx_1(), expand_value_data::dummy, and expand_value_data::regs_active.
Referenced by vt_expand_loc(), vt_expand_loc_callback(), and vt_expand_var_loc_chain().
|
extern |
Called when the current user is done with cselib.
References cfa_base_preserved_regno, cfa_base_preserved_val, cselib_any_perm_equivs, cselib_clear_table(), cselib_discard_hook, cselib_hash_table, cselib_preserve_constants, cselib_preserved_hash_table, cselib_val_pool, elt_list_pool, elt_loc_list_pool, free(), INVALID_REGNUM, n_debug_values, n_useless_debug_values, n_useless_values, next_uid, NULL, base_pool_allocator< TBlockAllocator >::release(), used_regs, and value_pool.
Referenced by dse_step1(), local_cprop_pass(), reload_cse_regs_1(), thread_jump(), and vt_finalize().
|
extern |
Return the number of the next value that will be generated.
References next_uid.
Referenced by vt_emit_notes(), and vt_initialize().
|
extern |
Return TRUE if any permanent equivalences have been recorded since the table was last initialized.
References cselib_any_perm_equivs.
Referenced by get_addr().
|
extern |
Initialize cselib for one pass. The caller must also call init_alias_analysis.
References callmem, cselib_any_perm_equivs, cselib_hash_table, cselib_nregs, CSELIB_PRESERVE_CONSTANTS, cselib_preserve_constants, cselib_preserved_hash_table, CSELIB_RECORD_MEMORY, cselib_record_memory, free(), gen_rtx_MEM(), max_reg_num(), n_used_regs, next_uid, reg_values, reg_values_size, and used_regs.
Referenced by dse_step1(), local_cprop_pass(), reload_cse_regs_1(), thread_jump(), and vt_initialize().
|
extern |
Invalidate DEST.
References cselib_invalidate_mem(), cselib_invalidate_regno(), GET_CODE, GET_MODE, MEM_P, REG_P, REGNO, and XEXP.
Referenced by cselib_invalidate_rtx_note_stores(), cselib_process_insn(), cselib_record_sets(), reload_cse_simplify(), variable_post_merge_new_vals(), and vt_initialize().
|
extern |
Wrapper for cselib_lookup_1, that logs the lookup result and maintains invariants related with debug insns.
References cselib_lookup_1(), dump_file, dump_flags, cselib_val::hash, print_inline_rtx(), TDF_CSELIB, and cselib_val::uid.
Referenced by add_stores(), add_uses(), autoinc_split(), canon_address(), cselib_add_permanent_equiv(), cselib_hash_plus_const_int(), cselib_hash_rtx(), cselib_invalidate_mem(), cselib_lookup_from_insn(), cselib_lookup_mem(), cselib_record_sets(), cselib_redundant_set_p(), cselib_subst_to_values(), do_local_cprop(), find_use_val(), new_cselib_val(), prepare_call_arguments(), reload_cse_simplify_operands(), reload_cse_simplify_set(), replace_expr_with_values(), reverse_op(), rtx_equal_for_cselib_1(), use_narrower_mode_test(), use_type(), variable_post_merge_new_vals(), and vt_initialize().
|
extern |
Wrapper for cselib_lookup, that indicates X is in INSN.
References cselib_current_insn, cselib_lookup(), gcc_assert, and NULL.
Referenced by cselib_record_sp_cfa_base_equiv(), vt_add_function_parameter(), vt_init_cfa_base(), and vt_initialize().
|
extern |
Arrange for a REG value to be assumed constant through the whole function, never invalidated and preserved across cselib_reset_table calls.
References cfa_base_preserved_regno, cfa_base_preserved_val, cselib_preserve_constants, elt_loc_list::loc, cselib_val::locs, and REG_P.
Referenced by vt_init_cfa_base(), and vt_initialize().
|
extern |
Clean all non-constant expressions in the hash table, but retain their values.
References callmem, cselib_invalidate_mem(), cselib_invalidate_regno(), dummy_val, first_containing_mem, gcc_assert, i, reg_raw_mode, and remove_useless_values().
Referenced by cselib_process_insn(), and vt_initialize().
|
extern |
Arrange for a value to not be removed from the hash table even if it becomes useless.
References PRESERVED_VALUE_P, and cselib_val::val_rtx.
Referenced by cselib_add_permanent_equiv(), cselib_record_sets(), preserve_value(), and variable_post_merge_new_vals().
|
extern |
Test whether a value is preserved.
References PRESERVED_VALUE_P, and cselib_val::val_rtx.
Referenced by add_stores(), add_uses(), prepare_call_arguments(), reverse_op(), use_type(), val_store(), vt_expand_var_loc_chain(), and vt_initialize().
|
extern |
Record the effects of INSN.
References CALL_INSN_FUNCTION_USAGE, CALL_P, callmem, cselib_current_insn, cselib_hash_table, cselib_invalidate_mem(), cselib_invalidate_regno_val(), cselib_invalidate_rtx(), cselib_invalidated_by_call_p(), cselib_preserve_constants, cselib_preserve_only_values(), cselib_record_sets(), cselib_reset_table(), find_reg_note(), fp_setter_insn(), frame_pointer_needed, GET_CODE, i, insn_callee_abi(), INSN_P, LABEL_P, MAX_USELESS_VALUES, MEM_P, n_debug_values, n_useless_values, elt_list::next, next_uid, NULL, REG_VALUES, reload_completed, remove_useless_values(), RTL_CONST_OR_PURE_CALL_P, RTL_LOOPING_CONST_OR_PURE_CALL_P, stack_pointer_rtx, and XEXP.
Referenced by dse_step1(), local_cprop_pass(), reload_cse_regs_1(), thread_jump(), and vt_initialize().
|
extern |
Record stack_pointer_rtx to be equal to (plus:P cfa_base_preserved_val offset). Used by var-tracking at the start of basic blocks for !frame_pointer_needed functions.
References cfa_base_preserved_val, CONST_INT_P, cselib_lookup_from_insn(), cselib_record_set(), GET_CODE, cselib_val::locs, elt_loc_list::next, NULL, NULL_RTX, offset, plus_constant(), PRESERVED_VALUE_P, SP_DERIVED_VALUE_P, stack_pointer_rtx, UINTVAL, cselib_val::val_rtx, and XEXP.
Referenced by vt_initialize().
Wrapper for rtx_equal_for_cselib_p to determine whether a SET is truly redundant, taking into account aliasing information.
References cselib_lookup(), cselib_reg_set_mode(), gcc_assert, GET_CODE, GET_MODE, cselib_val::locs, MEM_P, mems_same_for_tbaa_p(), elt_loc_list::next, rtx_equal_for_cselib_1(), rtx_equal_for_cselib_p(), SET, SET_DEST, SET_SRC, and XEXP.
Referenced by mark_effect(), and reload_cse_simplify().
|
extern |
Return the mode in which a register was last set. If X is not a register, return its mode. If the mode in which the register was set is not known, or the value was already clobbered, return VOIDmode.
References GET_MODE, NULL, REG_P, REG_VALUES, and REGNO.
Referenced by cselib_redundant_set_p().
|
extern |
Remove all entries from the hash table, arranging for the next value to be numbered NUM.
References cfa_base_preserved_regno, cfa_base_preserved_val, CONST_INT_P, cselib_any_perm_equivs, cselib_current_insn, cselib_hash_table, cselib_preserve_constants, CSELIB_VAL_PTR, dummy_val, first_containing_mem, gcc_assert, gcc_checking_assert, GET_CODE, GET_MODE, hard_regno_nregs(), i, invariant_or_equiv_p(), elt_loc_list::loc, cselib_val::locs, max_value_regs, n_debug_values, n_used_regs, n_useless_debug_values, n_useless_values, new_elt_loc_list(), elt_loc_list::next, next_uid, NULL, plus_constant(), preserve_constants_and_equivs(), REG_VALUES, SP_DERIVED_VALUE_P, UINTVAL, used_regs, cselib_val::val_rtx, and XEXP.
Referenced by cselib_clear_table(), cselib_process_insn(), and vt_initialize().
|
extern |
Arrange for a value to be marked as based on stack pointer for find_base_term purposes.
References SP_BASED_VALUE_P, and cselib_val::val_rtx.
Referenced by add_stores(), and vt_initialize().
|
extern |
Test whether a value is based on stack pointer for find_base_term purposes.
References SP_BASED_VALUE_P, and cselib_val::val_rtx.
Referenced by find_base_term().
|
extern |
Return true if V is SP_DERIVED_VALUE_P (or SP_DERIVED_VALUE_P + CONST_INT) that can be expressed using cfa_base_preserved_val + CONST_INT.
References cfa_base_preserved_val, CONST_INT_P, CSELIB_VAL_PTR, GET_CODE, cselib_val::locs, elt_loc_list::next, SP_DERIVED_VALUE_P, cselib_val::val_rtx, and XEXP.
Referenced by add_stores().
Walk rtx X and replace all occurrences of REG and MEM subexpressions with VALUE expressions. This way, it becomes independent of changes to registers and memory. X isn't actually modified; if modifications are needed, new rtl is allocated. However, the return value can share rtl with X. If X is within a MEM, MEMMODE must be the mode of the MEM.
References CASE_CONST_ANY, const0_rtx, CONST_INT_P, cselib_lookup(), cselib_lookup_mem(), cselib_subst_to_values(), CSELIB_VAL_PTR, elt_list::elt, gcc_assert, gcc_unreachable, GET_CODE, GET_MODE, GET_MODE_SIZE(), GET_RTX_FORMAT, GET_RTX_LENGTH, i, INTVAL, new_cselib_val(), elt_list::next, next_uid, NULL, offset, plus_constant(), REG_VALUES, REGNO, shallow_copy_rtvec(), shallow_copy_rtx(), SP_DERIVED_VALUE_P, cselib_val::val_rtx, XEXP, XVEC, XVECEXP, and XVECLEN.
Referenced by cselib_lookup_1(), cselib_subst_to_values(), cselib_subst_to_values_from_insn(), and replace_expr_with_values().
Wrapper for cselib_subst_to_values, that indicates X is in INSN.
References cselib_current_insn, cselib_subst_to_values(), gcc_assert, and NULL.
|
extern |
Dump to OUT everything in the CSELIB table.
References cselib_hash_table, cselib_preserved_hash_table, dummy_val, dump_cselib_val(), first_containing_mem, fputc(), next_uid, print_inline_rtx(), and cselib_val::val_rtx.
Referenced by vt_initialize().
Return true if INSN in the prologue initializes hard_frame_pointer_rtx.
References expr, find_reg_note(), hard_frame_pointer_rtx, modified_in_p(), NULL_RTX, RTX_FRAME_RELATED_P, and XEXP.
Referenced by cselib_process_insn(), and vt_initialize().
Return true if X contains a VALUE rtx. If ONLY_USELESS is set, we only return true for values which point to a cselib_val whose value element has been set to zero, which implies the cselib_val will be removed.
References CSELIB_VAL_PTR, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, PRESERVED_VALUE_P, references_value_p(), XEXP, XVECEXP, and XVECLEN.
Referenced by discard_useless_locs(), invariant_or_equiv_p(), references_value_p(), reload_cse_simplify_set(), and reverse_op().
Return true if we can prove that X and Y contain the same value, taking our gathered information into account. MEMMODE holds the mode of the enclosing MEM, if any, as required to deal with autoinc addressing modes. If X and Y are not (known to be) part of addresses, MEMMODE should be VOIDmode.
References autoinc_split(), canonical_cselib_val(), CASE_CONST_UNIQUE, CONST_INT_P, cselib_lookup(), CSELIB_VAL_PTR, DEBUG_IMPLICIT_PTR_DECL, DEBUG_PARAMETER_REF_DECL, ENTRY_VALUE_EXP, gcc_unreachable, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, label_ref_label(), elt_loc_list::loc, cselib_val::locs, MEM_P, elt_loc_list::next, NULL, NULL_RTX, REG_P, REGNO, rtx_equal_for_cselib_1(), rtx_equal_p(), same_vector_encodings_p(), SP_DERIVED_VALUE_P, SUBREG_BYTE, targetm, cselib_val::val_rtx, XEXP, XINT, XLOC, XSTR, XVECEXP, XVECLEN, XWINT, and y.
Referenced by cselib_redundant_set_p(), cselib_hasher::equal(), rtx_equal_for_cselib_1(), and rtx_equal_for_cselib_p().
Return true if we can prove that X and Y contain the same value, taking our gathered information into account.
References rtx_equal_for_cselib_1(), and y.
Referenced by cselib_redundant_set_p().
|
extern |
If nonnull, cselib will call this function before freeing useless VALUEs. A VALUE is deemed useless if its "locs" field is null.
Referenced by cselib_finish(), discard_useless_values(), and dse_step1().
|
extern |
If nonnull, cselib will call this function before recording sets or even clobbering outputs of INSN. All the recorded sets will be represented in the array sets[n_sets]. new_val_min can be used to tell whether values present in sets are introduced by this instruction.
Referenced by cselib_record_sets(), and vt_initialize().