GCC Middle and Back End API Reference
|
Data Structures | |
struct | simplify_plus_minus_op_data |
Enumerations | |
enum | { CMP_EQ = 1, CMP_LT = 2, CMP_GT = 4, CMP_LTU = 8, CMP_GTU = 16 } |
Functions | |
static rtx | neg_const_int (enum machine_mode, const_rtx) |
static bool | plus_minus_operand_p (const_rtx) |
static bool | simplify_plus_minus_op_data_cmp (rtx, rtx) |
static rtx | simplify_plus_minus (enum rtx_code, enum machine_mode, rtx, rtx) |
static rtx | simplify_immed_subreg (enum machine_mode, rtx, enum machine_mode, unsigned int) |
static rtx | simplify_associative_operation (enum rtx_code, enum machine_mode, rtx, rtx) |
static rtx | simplify_relational_operation_1 (enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx) |
static rtx | simplify_unary_operation_1 (enum rtx_code, enum machine_mode, rtx) |
static rtx | simplify_binary_operation_1 (enum rtx_code, enum machine_mode, rtx, rtx, rtx, rtx) |
static rtx | neg_const_int () |
bool | mode_signbit_p () |
bool | val_signbit_p () |
bool | val_signbit_known_set_p () |
bool | val_signbit_known_clear_p () |
rtx | simplify_gen_binary (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) |
rtx | avoid_constant_pool_reference () |
rtx | delegitimize_mem_from_attrs () |
rtx | simplify_gen_unary (enum rtx_code code, enum machine_mode mode, rtx op, enum machine_mode op_mode) |
rtx | simplify_gen_ternary (enum rtx_code code, enum machine_mode mode, enum machine_mode op0_mode, rtx op0, rtx op1, rtx op2) |
rtx | simplify_gen_relational (enum rtx_code code, enum machine_mode mode, enum machine_mode cmp_mode, rtx op0, rtx op1) |
rtx | simplify_replace_fn_rtx (rtx x, const_rtx old_rtx, rtx(*fn)(rtx, const_rtx, void *), void *data) |
rtx | simplify_replace_rtx () |
static rtx | simplify_truncation (enum machine_mode mode, rtx op, enum machine_mode op_mode) |
rtx | simplify_unary_operation (enum rtx_code code, enum machine_mode mode, rtx op, enum machine_mode op_mode) |
static rtx | simplify_unary_operation_1 () |
rtx | simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode, rtx op, enum machine_mode op_mode) |
static rtx | simplify_byte_swapping_operation (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) |
rtx | simplify_binary_operation (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) |
rtx | simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) |
static bool | simplify_plus_minus_op_data_cmp () |
static bool | plus_minus_operand_p () |
rtx | simplify_relational_operation (enum rtx_code code, enum machine_mode mode, enum machine_mode cmp_mode, rtx op0, rtx op1) |
static rtx | comparison_result () |
rtx | simplify_const_relational_operation (enum rtx_code code, enum machine_mode mode, rtx op0, rtx op1) |
rtx | simplify_ternary_operation (enum rtx_code code, enum machine_mode mode, enum machine_mode op0_mode, rtx op0, rtx op1, rtx op2) |
rtx | simplify_subreg (enum machine_mode outermode, rtx op, enum machine_mode innermode, unsigned int byte) |
rtx | simplify_gen_subreg (enum machine_mode outermode, rtx op, enum machine_mode innermode, unsigned int byte) |
rtx | simplify_rtx () |
rtx avoid_constant_pool_reference | ( | ) |
If X is a MEM referencing the constant pool, return the real value. Otherwise return X.
References avoid_constant_pool_reference(), get_pool_constant(), get_pool_mode(), HOST_WIDE_INT, offset, simplify_subreg(), and targetm.
|
static |
Convert the known results for EQ, LT, GT, LTU, GTU contained in KNOWN_RESULT to a CONST_INT, based on the requested comparison CODE For KNOWN_RESULT to make sense it should be either CMP_EQ, or the logical OR of one of (CMP_LT, CMP_GT) and one of (CMP_LTU, CMP_GTU). For floating-point comparisons, assume that the operands were ordered.
References CMP_EQ, CMP_GT, CMP_GTU, CMP_LT, CMP_LTU, and const_true_rtx.
Referenced by simplify_const_relational_operation().
rtx delegitimize_mem_from_attrs | ( | ) |
Simplify a MEM based on its attributes. This is the default delegitimize_address target hook, and it's recommended that every overrider call it.
References get_inner_reference(), host_integerp(), HOST_WIDE_INT, offset, and rtx_equal_p().
bool mode_signbit_p | ( | ) |
Test whether expression, X, is an immediate constant that represents the most significant bit of machine mode MODE.
References HOST_BITS_PER_WIDE_INT, and HOST_WIDE_INT.
Referenced by simplify_binary_operation_1(), and simplify_plus_minus().
|
static |
Negate a CONST_INT rtx, truncating (because a conversion from a maximally negative number can overflow).
References gen_int_mode(), and HOST_WIDE_INT.
|
static |
Referenced by simplify_binary_operation_1().
|
static |
Check whether an operand is suitable for calling simplify_plus_minus.
|
static |
Subroutine of simplify_binary_operation to simplify a commutative, associative binary operation CODE with result mode MODE, operating on OP0 and OP1. CODE is currently one of PLUS, MULT, AND, IOR, XOR, SMIN, SMAX, UMIN or UMAX. Return zero if no simplification or canonicalization is possible.
References simplify_binary_operation(), simplify_gen_binary(), and swap_commutative_operands_p().
Referenced by simplify_binary_operation_1().
Simplify a binary operation CODE with result mode MODE, operating on OP0 and OP1. Return 0 if no simplification is possible. Don't use this for relational operations such as EQ or LT. Use simplify_relational_operation instead.
References avoid_constant_pool_reference(), RTX_COMM_ARITH, RTX_COMM_COMPARE, RTX_COMPARE, simplify_binary_operation_1(), simplify_const_binary_operation(), and swap_commutative_operands_p().
Referenced by combine_simplify_rtx(), eliminate_constant_term(), expand_and(), fold_rtx(), force_to_mode(), simplify_associative_operation(), simplify_binary_operation_1(), simplify_comparison(), simplify_const_binary_operation(), simplify_const_relational_operation(), simplify_expand_binop(), simplify_gen_binary(), simplify_plus_minus(), and simplify_rtx().
|
static |
Subroutine of simplify_binary_operation. Simplify a binary operation CODE with result mode MODE, operating on OP0 and OP1. If OP0 and/or OP1 are constant pool references, TRUEOP0 and TRUEOP1 represent the actual constants.
References avoid_constant_pool_reference(), function::can_throw_non_call_exceptions, cfun, const_true_rtx, copy_rtx(), count, dconst0, dconst1, dconst2, dconstm1, exact_log2(), double_int::from_shwi(), gen_int_mode(), rtl_hooks::gen_lowpart_no_emit, gen_rtx_CONST_VECTOR(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, i1, immed_double_int_const(), mode_signbit_p(), neg_const_int(), nonzero_bits(), offset, optimize_function_for_speed_p(), plus_constant(), plus_minus_operand_p(), reversed_comparison(), rtvec_alloc(), rtx_equal_p(), double_int::set_bit(), set_src_cost(), side_effects_p(), simplify_associative_operation(), simplify_binary_operation(), simplify_byte_swapping_operation(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_unary(), simplify_plus_minus(), simplify_unary_operation(), trunc_int_for_mode(), and val_signbit_p().
Referenced by simplify_binary_operation().
|
static |
Subroutine of simplify_binary_operation to simplify a binary operation CODE that can commute with byte swapping, with result mode MODE and operating on OP0 and OP1. CODE is currently one of AND, IOR or XOR. Return zero if no simplification or canonicalization is possible.
References simplify_gen_binary(), and simplify_gen_unary().
Referenced by simplify_binary_operation_1().
rtx simplify_const_binary_operation | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
rtx | op0, | ||
rtx | op1 | ||
) |
References double_int::alshift(), dconst0, double_int::divmod_with_overflow(), f1, gen_int_mode(), gen_rtx_CONST_VECTOR(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT_M1U, immed_double_int_const(), double_int::lrotate(), real_arithmetic(), real_convert(), real_from_target(), real_identical(), real_to_target(), double_int::rrotate(), double_int::rshift(), rtvec_alloc(), rtx_to_double_int(), rtx_to_tree_code(), simplify_binary_operation(), double_int::smax(), double_int::smin(), double_int::umax(), double_int::umin(), and val_signbit_known_set_p().
Referenced by find_shift_sequence(), simplify_binary_operation(), simplify_plus_minus(), and simplify_shift_const_1().
rtx simplify_const_relational_operation | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
rtx | op0, | ||
rtx | op1 | ||
) |
Check if the given comparison (done in the given MODE) is actually a tautology or a contradiction. If no simplification is possible, this function returns zero. Otherwise, it returns either const_true_rtx or const0_rtx.
References avoid_constant_pool_reference(), CMP_EQ, CMP_GT, CMP_GTU, CMP_LT, CMP_LTU, comparison_result(), const_true_rtx, d1, get_mode_bounds(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, nonzero_address_p(), nonzero_bits(), num_sign_bit_copies(), rtx_equal_p(), side_effects_p(), signed_condition(), simplify_binary_operation(), simplify_const_relational_operation(), swap_commutative_operands_p(), swap_condition(), val_signbit_known_set_p(), WARN_STRICT_OVERFLOW_CONDITIONAL, and warning().
Referenced by simplify_const_relational_operation(), and simplify_relational_operation().
rtx simplify_const_unary_operation | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
rtx | op, | ||
enum machine_mode | op_mode | ||
) |
Try to compute the value of a unary operation CODE whose output mode is to be MODE with input operand OP whose mode was originally OP_MODE. Return zero if the value cannot be computed.
References ctz_hwi(), ffs_hwi(), first, floor_log2(), double_int::from_pair(), double_int::from_shwi(), double_int::from_uhwi(), gen_int_mode(), gen_rtx_CONST_VECTOR(), double_int::high, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT_M1U, immed_double_const(), immed_double_int_const(), double_int::is_negative(), double_int::low, real_arithmetic(), real_convert(), real_from_integer(), real_from_target(), real_isnan(), real_sqrt(), real_to_target(), real_value_abs(), real_value_negate(), real_value_truncate(), rtvec_alloc(), simplify_unary_operation(), and val_signbit_known_set_p().
Referenced by make_compound_operation(), and simplify_unary_operation().
Make a binary operation by properly ordering the operands and seeing if the expression folds.
References RTX_COMM_ARITH, simplify_binary_operation(), and swap_commutative_operands_p().
Referenced by anti_adjust_stack_and_probe(), apply_distributive_law(), break_out_memory_refs(), canon_reg_for_combine(), combine_simplify_rtx(), combine_var_copies_in_loop_exit(), distribute_and_simplify_rtx(), doloop_modify(), emit_block_move_via_loop(), expand_debug_expr(), expand_expr_addr_expr_1(), expand_expr_real_1(), expand_expr_real_2(), expand_field_assignment(), expand_shift_1(), extract_left_shift(), find_split_point(), fold_rtx(), force_to_mode(), gen_addr_rtx(), get_biv_step_1(), get_iv_value(), if_then_else_cond(), implies_p(), instantiate_virtual_regs_in_insn(), instantiate_virtual_regs_in_rtx(), iv_add(), iv_analyze_biv(), iv_mult(), iv_number_of_iterations(), iv_shift(), iv_subreg(), make_compound_operation(), noce_try_bitop(), offset_address(), probe_stack_range(), process_address(), propagate_rtx_1(), reverse_op(), simplify_and_const_int(), simplify_and_const_int_1(), simplify_associative_operation(), simplify_binary_operation_1(), simplify_byte_swapping_operation(), simplify_comparison(), simplify_if_then_else(), simplify_relational_operation_1(), simplify_replace_fn_rtx(), simplify_rtx(), simplify_set(), simplify_shift_const(), simplify_shift_const_1(), simplify_truncation(), simplify_unary_operation_1(), simplify_while_replacing(), split_iv(), try_combine(), unroll_loop_runtime_iterations(), and use_narrower_mode().
rtx simplify_gen_relational | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
enum machine_mode | cmp_mode, | ||
rtx | op0, | ||
rtx | op1 | ||
) |
Likewise, for relational operations. CMP_MODE specifies mode comparison is done in.
References simplify_relational_operation().
Referenced by canon_reg_for_combine(), combine_simplify_rtx(), determine_max_iter(), emit_conditional_add(), emit_conditional_move(), expand_debug_expr(), if_then_else_cond(), iv_number_of_iterations(), may_unswitch_on(), prepare_float_lib_cmp(), propagate_rtx_1(), reversed_comparison(), shorten_into_mode(), simplify_binary_operation_1(), simplify_if_then_else(), simplify_relational_operation(), simplify_relational_operation_1(), simplify_replace_fn_rtx(), simplify_ternary_operation(), and simplify_unary_operation_1().
rtx simplify_gen_subreg | ( | enum machine_mode | outermode, |
rtx | op, | ||
enum machine_mode | innermode, | ||
unsigned int | byte | ||
) |
Make a SUBREG operation or equivalent if it folds.
References gen_rtx_SUBREG(), simplify_subreg(), and validate_subreg().
Referenced by adjust_mems(), convert_debug_memory_address(), convert_modes(), convert_move(), cse_insn(), cselib_expand_value_rtx_1(), emit_group_load_1(), emit_group_store(), emit_move_change_mode(), emit_store_flag_1(), expand_assignment(), expand_debug_expr(), expand_debug_source_expr(), expand_expr_real_2(), expand_twoval_binop_libfunc(), extract_bit_field_1(), find_reloads_toplev(), find_replacement(), force_operand(), gen_highpart(), gen_highpart_mode(), gen_lowpart_common(), gen_lowpart_for_combine(), if_then_else_cond(), instantiate_virtual_regs_in_insn(), loc_equivalence_change_p(), lowpart_subreg(), lra_eliminate_regs_1(), operand_subword(), propagate_rtx_1(), read_complex_part(), resolve_simple_move(), simplify_gen_subreg_concatn(), simplify_replace_fn_rtx(), simplify_subreg_concatn(), simplify_truncation(), store_bit_field_1(), store_bit_field_using_insv(), vt_expand_loc_callback(), and write_complex_part().
rtx simplify_gen_ternary | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
enum machine_mode | op0_mode, | ||
rtx | op0, | ||
rtx | op1, | ||
rtx | op2 | ||
) |
Likewise for ternary operations.
References simplify_ternary_operation().
Referenced by canon_reg_for_combine(), expand_debug_expr(), prepare_float_lib_cmp(), propagate_rtx_1(), simplify_replace_fn_rtx(), and simplify_ternary_operation().
rtx simplify_gen_unary | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
rtx | op, | ||
enum machine_mode | op_mode | ||
) |
Make a unary operation by first seeing if it folds and otherwise making the specified operation.
References simplify_unary_operation().
Referenced by add_equal_note(), apply_distributive_law(), canon_reg_for_combine(), canonicalize_iv_subregs(), combine_simplify_rtx(), doloop_optimize(), expand_debug_expr(), expand_debug_source_expr(), expand_field_assignment(), expand_shift_1(), expand_unop(), extract_left_shift(), force_to_mode(), gen_lowpart_or_truncate(), get_iv_value(), if_then_else_cond(), insert_var_expansion_initialization(), iv_add(), iv_extend(), iv_neg(), iv_number_of_iterations(), known_cond(), make_compound_operation(), make_extraction(), propagate_rtx_1(), simplify_binary_operation_1(), simplify_byte_swapping_operation(), simplify_comparison(), simplify_if_then_else(), simplify_relational_operation_1(), simplify_replace_fn_rtx(), simplify_set(), simplify_shift_const_1(), simplify_truncation(), simplify_unary_operation_1(), and simplify_while_replacing().
|
static |
Evaluate a SUBREG of a CONST_INT or CONST_DOUBLE or CONST_FIXED or CONST_VECTOR, returning another CONST_INT or CONST_DOUBLE or CONST_FIXED or CONST_VECTOR. Works by unpacking OP into a collection of 8-bit values represented as a little-endian array of 'unsigned char', selecting by BYTE, and then repacking them again for OUTERMODE.
References CONST_FIXED_FROM_FIXED_VALUE, FIXED_VALUE_TYPE, gen_int_mode(), gen_rtx_CONST_VECTOR(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, immed_double_const(), simplify_plus_minus_op_data::op, real_from_target(), real_to_target(), and rtvec_alloc().
Referenced by simplify_subreg().
|
static |
References changed, memset(), simplify_plus_minus_op_data::neg, neg_const_int(), simplify_plus_minus_op_data::op, plus_constant(), simplify_binary_operation(), simplify_const_binary_operation(), simplify_plus_minus_op_data_cmp(), and swap_commutative_operands_p().
Referenced by simplify_binary_operation_1().
Referenced by simplify_plus_minus().
|
static |
References commutative_operand_precedence().
rtx simplify_relational_operation | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
enum machine_mode | cmp_mode, | ||
rtx | op0, | ||
rtx | op1 | ||
) |
Like simplify_binary_operation except used for relational operators. MODE is the mode of the result. If MODE is VOIDmode, both operands must not also be VOIDmode. CMP_MODE specifies in which mode the comparison is done in, so it is the mode of the operands. If CMP_MODE is VOIDmode, it is taken from the operands or, if both are VOIDmode, the operands are compared in "infinite precision".
References avoid_constant_pool_reference(), rtvec_alloc(), simplify_const_relational_operation(), simplify_gen_relational(), simplify_relational_operation_1(), swap_commutative_operands_p(), and swap_condition().
Referenced by combine_simplify_rtx(), cselib_expand_value_rtx_1(), do_compare_rtx_and_jump(), expand_doubleword_shift(), fold_rtx(), simplify_gen_relational(), simplify_rtx(), simplify_set(), and simplify_ternary_operation().
|
static |
This part of simplify_relational_operation is only used when CMP_MODE is not in class MODE_CC (i.e. it is a real comparison). MODE is the mode of the result, while CMP_MODE specifies in which mode the comparison is done in, so it is the mode of the operands.
References copy_rtx(), lowpart_subreg(), nonzero_bits(), reversed_comparison_code(), rtx_equal_p(), side_effects_p(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_unary(), and simplify_rtx().
Referenced by simplify_relational_operation().
rtx simplify_replace_fn_rtx | ( | rtx | x, |
const_rtx | old_rtx, | ||
rtx(*)(rtx, const_rtx, void *) | fn, | ||
void * | data | ||
) |
If FN is NULL, replace all occurrences of OLD_RTX in X with copy_rtx (DATA) and simplify the result. If FN is non-NULL, call this callback on each X, if it returns non-NULL, replace X with its return value and simplify the result.
References copy_rtx(), replace_equiv_address_nv(), RTX_BIN_ARITH, RTX_BITFIELD_OPS, RTX_COMM_ARITH, RTX_COMM_COMPARE, RTX_COMPARE, rtx_equal_p(), RTX_EXTRA, RTX_OBJ, RTX_TERNARY, RTX_UNARY, shallow_copy_rtvec(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_subreg(), simplify_gen_ternary(), simplify_gen_unary(), and simplify_replace_fn_rtx().
Referenced by adjust_cleared_regs(), adjust_mem_stores(), adjust_mem_uses(), adjust_mems(), delete_trivially_dead_insns(), lra_constraints(), prepare_call_arguments(), propagate_for_debug(), simplify_replace_fn_rtx(), simplify_replace_rtx(), and update_equiv_regs().
rtx simplify_replace_rtx | ( | ) |
Replace all occurrences of OLD_RTX in X with NEW_RTX and try to simplify the resulting RTX. Return a new RTX which is as simplified as possible.
References simplify_replace_fn_rtx().
rtx simplify_rtx | ( | ) |
Simplify X, an rtx expression. Return the simplified expression or NULL if no simplifications were possible. This is the preferred entry point into the simplification routines; however, we still allow passes to call the more specific routines. Right now GCC has three (yes, three) major bodies of RTL simplification code that need to be unified. 1. fold_rtx in cse.c. This code uses various CSE specific information to aid in RTL simplification. 2. simplify_rtx in combine.c. Similar to fold_rtx, except that it uses combine specific information to aid in RTL simplification. 3. The routines in this file. Long term we want to only have one body of simplification code; to get to that state I recommend the following steps: 1. Pour over fold_rtx & simplify_rtx and move any simplifications which are not pass dependent state into these routines. 2. As code is moved by #1, change fold_rtx & simplify_rtx to use this routine whenever possible. 3. Allow for pass dependent state to be provided to these routines and add simplifications based on the pass dependent state. Remove code from cse.c & combine.c that becomes redundant/dead. It will take time, but ultimately the compiler will be easier to maintain and improve. It's totally silly that when we add a simplification that it needs to be added to 4 places (3 for RTL simplification and 1 for tree simplification.
References RTX_BIN_ARITH, RTX_BITFIELD_OPS, RTX_COMM_ARITH, RTX_COMM_COMPARE, RTX_COMPARE, rtx_equal_p(), RTX_EXTRA, RTX_OBJ, RTX_TERNARY, RTX_UNARY, simplify_binary_operation(), simplify_gen_binary(), simplify_relational_operation(), simplify_subreg(), simplify_ternary_operation(), simplify_unary_operation(), and swap_commutative_operands_p().
rtx simplify_subreg | ( | enum machine_mode | outermode, |
rtx | op, | ||
enum machine_mode | innermode, | ||
unsigned int | byte | ||
) |
Simplify SUBREG:OUTERMODE(OP:INNERMODE, BYTE) Return 0 if no simplifications are possible.
References gen_rtx_REG_offset(), gen_rtx_SUBREG(), have_insn_for(), mode_dependent_address_p(), offset, simplify_plus_minus_op_data::op, SET, simplify_immed_subreg(), simplify_subreg(), simplify_subreg_regno(), simplify_truncation(), subreg_lowpart_offset(), subreg_lowpart_p(), subreg_lsb_1(), and validate_subreg().
Referenced by alter_subreg(), assemble_integer(), avoid_constant_pool_reference(), combine_simplify_rtx(), emit_move_change_mode(), emit_note_insn_var_location(), equiv_constant(), expand_expr_real_2(), extract_low_bits(), find_reloads_subreg_address(), find_shift_sequence(), kill_value(), known_cond(), make_compound_operation(), prepare_call_arguments(), replace_rtx(), simplify_gen_subreg(), simplify_rtx(), simplify_subreg(), simplify_while_replacing(), store_bit_field_using_insv(), and subst().
rtx simplify_ternary_operation | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
enum machine_mode | op0_mode, | ||
rtx | op0, | ||
rtx | op1, | ||
rtx | op2 | ||
) |
Simplify CODE, an operation with result mode MODE and three operands, OP0, OP1, and OP2. OP0_MODE was the mode of OP0 before it became a constant. Return 0 if no simplifications is possible.
References avoid_constant_pool_reference(), gen_int_mode(), gen_rtx_CONST_VECTOR(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, reversed_comparison_code(), rtvec_alloc(), rtx_equal_p(), side_effects_p(), simplify_gen_relational(), simplify_gen_ternary(), simplify_relational_operation(), simplify_unary_operation(), and swap_commutative_operands_p().
Referenced by combine_simplify_rtx(), cselib_expand_value_rtx_1(), fold_rtx(), simplify_gen_ternary(), and simplify_rtx().
Try to simplify a MODE truncation of OP, which has OP_MODE. Only handle cases where the truncated value is inherently an rvalue. RTL provides two ways of truncating a value: 1. a lowpart subreg. This form is only a truncation when both the outer and inner modes (here MODE and OP_MODE respectively) are scalar integers, and only then when the subreg is used as an rvalue. It is only valid to form such truncating subregs if the truncation requires no action by the target. The onus for proving this is on the creator of the subreg -- e.g. the caller to simplify_subreg or simplify_gen_subreg -- and typically involves either TRULY_NOOP_TRUNCATION_MODES_P or truncated_to_mode. 2. a TRUNCATE. This form handles both scalar and compound integers. The first form is preferred where valid. However, the TRUNCATE handling in simplify_unary_operation turns the second form into the first form when TRULY_NOOP_TRUNCATION_MODES_P or truncated_to_mode allow, so it is generally safe to form rvalue truncations using: simplify_gen_unary (TRUNCATE, ...) and leave simplify_unary_operation to work out which representation should be used. Because of the proof requirements on (1), simplify_truncation must also use simplify_gen_unary (TRUNCATE, ...) to truncate parts of OP, regardless of whether the outer truncation came from a SUBREG or a TRUNCATE. For example, if the caller has proven that an SImode truncation of: (and:DI X Y) is a no-op and can be represented as a subreg, it does not follow that SImode truncations of X and Y are also no-ops. On a target like 64-bit MIPS that requires SImode values to be stored in sign-extended form, an SImode truncation of: (and:DI (reg:DI X) (const_int 63)) is trivially a no-op because only the lower 6 bits can be set. However, X is still an arbitrary 64-bit number and so we cannot assume that truncating it too is a no-op.
References loop::inner, mode_dependent_address_p(), simplify_gen_binary(), simplify_gen_subreg(), simplify_gen_unary(), subreg_lowpart_offset(), and subreg_lowpart_p().
Referenced by simplify_subreg(), and simplify_unary_operation_1().
rtx simplify_unary_operation | ( | enum rtx_code | code, |
enum machine_mode | mode, | ||
rtx | op, | ||
enum machine_mode | op_mode | ||
) |
Try to simplify a unary operation CODE whose output mode is to be MODE with input operand OP whose mode was originally OP_MODE. Return zero if no simplification can be made.
References avoid_constant_pool_reference(), simplify_const_unary_operation(), and simplify_unary_operation_1().
Referenced by combine_simplify_rtx(), convert_memory_address_addr_space(), cselib_expand_value_rtx_1(), expand_copysign(), expand_copysign_absneg(), fold_rtx(), known_cond(), make_extraction(), negate_rtx(), replace_rtx(), simplify_binary_operation_1(), simplify_comparison(), simplify_const_unary_operation(), simplify_gen_unary(), simplify_rtx(), simplify_ternary_operation(), simplify_unary_operation_1(), and subst().
Referenced by simplify_unary_operation().
|
static |
Perform some simplifications we can do even if the operands aren't constant.
References rtl_hooks::gen_lowpart_no_emit, HOST_BITS_PER_WIDE_INT, loop::inner, mode_dependent_address_p(), mode_for_size(), mode_signbit_p(), nonzero_bits(), num_sign_bit_copies(), plus_constant(), ptr_mode, reversed_comparison_code(), side_effects_p(), significand_size(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_unary(), simplify_truncation(), simplify_unary_operation(), subreg_lowpart_p(), target_default_pointer_address_modes_p(), truncated_to_mode(), and val_signbit_known_clear_p().
bool val_signbit_known_clear_p | ( | ) |
Test whether the most significant bit of mode MODE is clear in VAL. Returns false if the precision of MODE is too large to handle.
References HOST_BITS_PER_WIDE_INT, and HOST_WIDE_INT.
bool val_signbit_known_set_p | ( | ) |
Test whether the most significant bit of mode MODE is set in VAL. Returns false if the precision of MODE is too large to handle.
References HOST_BITS_PER_WIDE_INT, and HOST_WIDE_INT.
bool val_signbit_p | ( | ) |
Test whether VAL is equal to the most significant bit of mode MODE (after masking with the mode mask of MODE). Returns false if the precision of MODE is too large to handle.
References HOST_BITS_PER_WIDE_INT, and HOST_WIDE_INT.