GCC Middle and Back End API Reference
insn_propagation Class Reference

#include <recog.h>

Inheritance diagram for insn_propagation:
Collaboration diagram for insn_propagation:

Public Member Functions

 insn_propagation (rtx_insn *)
 
 insn_propagation (rtx_insn *, rtx, rtx, bool=true)
 
bool apply_to_pattern (rtx *)
 
bool apply_to_rvalue (rtx *)
 
bool apply_to_note (rtx *)
 
virtual bool check_mem (int, rtx)
 
virtual void note_simplification (int, uint16_t, rtx, rtx)
 
rtx simplify_unary_operation (rtx_code, machine_mode, rtx, machine_mode)
 
rtx simplify_binary_operation (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_ternary_operation (rtx_code, machine_mode, machine_mode, rtx, rtx, rtx)
 
rtx simplify_relational_operation (rtx_code, machine_mode, machine_mode, rtx, rtx)
 
rtx simplify_subreg (machine_mode, rtx, machine_mode, poly_uint64)
 
rtx lowpart_subreg (machine_mode, rtx, machine_mode)
 
rtx simplify_merge_mask (rtx, rtx, int)
 
rtx simplify_gen_unary (rtx_code, machine_mode, rtx, machine_mode)
 
rtx simplify_gen_binary (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_gen_ternary (rtx_code, machine_mode, machine_mode, rtx, rtx, rtx)
 
rtx simplify_gen_relational (rtx_code, machine_mode, machine_mode, rtx, rtx)
 
rtx simplify_gen_subreg (machine_mode, rtx, machine_mode, poly_uint64)
 
rtx simplify_gen_vec_select (rtx, unsigned int)
 

Data Fields

rtx_insninsn
 
rtx from
 
rtx to
 
unsigned int num_replacements
 
uint16_t result_flags: 16
 
uint16_t should_unshare: 1
 
uint16_t should_check_mems: 1
 
uint16_t should_note_simplifications: 1
 
uint16_t spare: 13
 
const char * failure_reason
 
unsigned int mem_depth = 0
 
unsigned int assoc_count = 0
 

Static Public Attributes

static const uint16_t UNSIMPLIFIED = 1U << 0
 
static const uint16_t FIRST_SPARE_RESULT = 1U << 1
 
static const unsigned int max_assoc_count = 64
 

Private Member Functions

bool apply_to_mem_1 (rtx)
 
bool apply_to_lvalue_1 (rtx)
 
bool apply_to_rvalue_1 (rtx *)
 
bool apply_to_pattern_1 (rtx *)
 
rtx simplify_truncation (machine_mode, rtx, machine_mode)
 
rtx simplify_byte_swapping_operation (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_associative_operation (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_distributive_operation (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_logical_relational_operation (rtx_code, machine_mode, rtx, rtx, bool=false)
 
rtx simplify_binary_operation_series (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_distribute_over_subregs (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_shift_const_int (rtx_code, machine_mode, rtx, unsigned int)
 
rtx simplify_plus_minus (rtx_code, machine_mode, rtx, rtx)
 
rtx simplify_cond_clz_ctz (rtx, rtx_code, rtx, rtx)
 
rtx simplify_unary_operation_1 (rtx_code, machine_mode, rtx)
 
rtx simplify_binary_operation_1 (rtx_code, machine_mode, rtx, rtx, rtx, rtx)
 
rtx simplify_ternary_operation_1 (rtx_code, machine_mode, machine_mode, rtx, rtx, rtx)
 
rtx simplify_relational_operation_1 (rtx_code, machine_mode, machine_mode, rtx, rtx)
 

Detailed Description

A class for substituting one rtx for another within an instruction, or for recursively simplifying the instruction as-is. Derived classes can record or filter certain decisions.

Constructor & Destructor Documentation

◆ insn_propagation() [1/2]

insn_propagation::insn_propagation ( rtx_insn * insn)
inline
Try to simplify INSN without performing a substitution.

References insn, insn_propagation(), and NULL_RTX.

Referenced by apply_to_rvalue_1(), and insn_propagation().

◆ insn_propagation() [2/2]

insn_propagation::insn_propagation ( rtx_insn * insn,
rtx from,
rtx to,
bool shared_p = true )
inline
Try to replace FROM with TO in INSN. SHARED_P is true if TO is shared with other instructions, false if INSN can use TO directly.

References failure_reason, false, from, insn, num_replacements, result_flags, should_check_mems, should_note_simplifications, should_unshare, spare, and to.

Member Function Documentation

◆ apply_to_lvalue_1()

bool insn_propagation::apply_to_lvalue_1 ( rtx dest)
private
Try to process the lvalue expression at *LOC. Return true on success; leave the caller to clean up on failure.

References apply_to_mem_1(), apply_to_rvalue_1(), failure_reason, from, GET_CODE, MEM_P, read_modify_subreg_p(), reg_overlap_mentioned_p(), REG_P, SUBREG_P, SUBREG_REG, and XEXP.

Referenced by apply_to_pattern_1().

◆ apply_to_mem_1()

bool insn_propagation::apply_to_mem_1 ( rtx mem)
private
Try to process the address of memory expression MEM. Return true on success; leave the caller to clean up on failure.

References apply_to_rvalue_1(), check_mem(), simplify_context::mem_depth, num_validated_changes(), should_check_mems, and XEXP.

Referenced by apply_to_lvalue_1(), and apply_to_rvalue_1().

◆ apply_to_note()

bool insn_propagation::apply_to_note ( rtx * loc)
Like apply_to_rvalue, but specifically for the case where *LOC is in a note. This never changes the INSN_CODE.

References apply_to_rvalue(), insn, and INSN_CODE.

◆ apply_to_pattern()

bool insn_propagation::apply_to_pattern ( rtx * loc)
Apply this insn_propagation object's simplification or substitution to the instruction pattern at LOC.

References apply_to_pattern_1(), cancel_changes(), num_changes, and num_validated_changes().

Referenced by fixup_debug_use().

◆ apply_to_pattern_1()

bool insn_propagation::apply_to_pattern_1 ( rtx * loc)
private
Try to process the instruction pattern at *LOC. Return true on success; leave the caller to clean up on failure.

References apply_to_lvalue_1(), apply_to_pattern_1(), apply_to_rvalue_1(), ASM_OPERANDS_INPUT, ASM_OPERANDS_INPUT_LENGTH, COND_EXEC_CODE, COND_EXEC_TEST, GET_CODE, i, SET, SET_DEST, SET_SRC, XEXP, XVECEXP, and XVECLEN.

Referenced by apply_to_pattern(), and apply_to_pattern_1().

◆ apply_to_rvalue()

bool insn_propagation::apply_to_rvalue ( rtx * loc)
Apply this insn_propagation object's simplification or substitution to the rvalue expression at LOC.

References apply_to_rvalue_1(), cancel_changes(), num_changes, and num_validated_changes().

Referenced by apply_to_note(), and apply_to_rvalue_1().

◆ apply_to_rvalue_1()

bool insn_propagation::apply_to_rvalue_1 ( rtx * loc)
private
Try to process the rvalue expression at *LOC. Return true on success; leave the caller to clean up on failure.

References apply_to_mem_1(), apply_to_rvalue(), apply_to_rvalue_1(), asm_noperands(), cancel_changes(), changes, CONSTANT_P, copy_rtx(), failure_reason, FOR_EACH_SUBRTX, from, gcc_assert, gcc_unreachable, GET_CODE, GET_MODE, GET_RTX_CLASS, GET_RTX_FORMAT, HARD_REGISTER_P, i, insn, insn_propagation(), simplify_context::mem_depth, note_simplification(), NULL_RTX, num_changes, num_replacements, num_validated_changes(), paradoxical_subreg_p(), PATTERN(), REG_CAN_CHANGE_MODE_P, REG_NREGS, reg_overlap_mentioned_p(), REG_P, register_asm_p(), REGNO, result_flags, RTX_AUTOINC, RTX_BIN_ARITH, RTX_BITFIELD_OPS, RTX_COMM_ARITH, RTX_COMM_COMPARE, RTX_COMPARE, RTX_CONST_OBJ, rtx_equal_p(), RTX_EXTRA, RTX_INSN, RTX_MATCH, RTX_OBJ, RTX_TERNARY, RTX_UNARY, should_note_simplifications, should_unshare, simplify_context::simplify_binary_operation(), simplify_context::simplify_gen_binary(), simplify_context::simplify_relational_operation(), simplify_context::simplify_subreg(), simplify_context::simplify_ternary_operation(), simplify_context::simplify_unary_operation(), split_const(), SUBREG_BYTE, subreg_lowpart_offset(), SUBREG_REG, swap_commutative_operands_p(), to, UNSIMPLIFIED, validate_change(), validate_subreg(), validate_unshare_change(), XEXP, XVECEXP, and XVECLEN.

Referenced by apply_to_lvalue_1(), apply_to_mem_1(), apply_to_pattern_1(), apply_to_rvalue(), and apply_to_rvalue_1().

◆ check_mem()

virtual bool insn_propagation::check_mem ( int ,
rtx  )
inlinevirtual

Referenced by apply_to_mem_1().

◆ lowpart_subreg()

rtx simplify_context::lowpart_subreg ( machine_mode outer_mode,
rtx expr,
machine_mode inner_mode )
inherited
Generates a subreg to get the least significant part of EXPR (in mode INNER_MODE) to OUTER_MODE.

References simplify_gen_subreg(), and subreg_lowpart_offset().

Referenced by lowpart_subreg(), simplify_binary_operation_1(), simplify_gen_vec_select(), simplify_relational_operation_1(), and simplify_subreg().

◆ note_simplification()

virtual void insn_propagation::note_simplification ( int ,
uint16_t ,
rtx ,
rtx  )
inlinevirtual

Referenced by apply_to_rvalue_1().

◆ simplify_associative_operation()

rtx simplify_context::simplify_associative_operation ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1 )
privateinherited
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 assoc_count, GET_CODE, max_assoc_count, NULL_RTX, simplify_binary_operation(), simplify_gen_binary(), swap_commutative_operands_p(), and XEXP.

Referenced by simplify_binary_operation_1().

◆ simplify_binary_operation()

rtx simplify_context::simplify_binary_operation ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1 )
inherited
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(), gcc_assert, GET_RTX_CLASS, NULL_RTX, RTX_COMM_ARITH, RTX_COMM_COMPARE, RTX_COMPARE, simplify_binary_operation_1(), simplify_const_binary_operation(), simplify_gen_binary(), and swap_commutative_operands_p().

Referenced by insn_propagation::apply_to_rvalue_1(), simplify_associative_operation(), simplify_binary_operation(), simplify_binary_operation_1(), simplify_binary_operation_series(), simplify_gen_binary(), and simplify_plus_minus().

◆ simplify_binary_operation_1()

rtx simplify_context::simplify_binary_operation_1 ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1,
rtx trueop0,
rtx trueop1 )
privateinherited
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 a, as_a(), avoid_constant_pool_reference(), b, BITS_PER_WORD, cfun, CLZ_DEFINED_VALUE_AT_ZERO, COMPARISON_P, CONST0_RTX, const0_rtx, CONST1_RTX, const1_rtx, CONST_DOUBLE_AS_FLOAT_P, const_double_from_real_value(), CONST_DOUBLE_REAL_VALUE, CONST_INT_P, CONST_SCALAR_INT_P, const_true_rtx, const_vec_duplicate_p(), CONST_VECTOR_ELT, CONSTM1_RTX, constm1_rtx, contains_symbolic_reference_p(), copy_rtx(), count, d1, dconst0, dconst1, dconst2, dconstm1, DECIMAL_FLOAT_MODE_P, exact_log2(), wi::exact_log2(), f1, FLOAT_MODE_P, gcc_assert, gcc_unreachable, gen_const_vec_series(), GEN_INT, gen_int_mode(), gen_int_shift_amount(), rtl_hooks::gen_lowpart_no_emit, gen_rtx_CONST_VECTOR(), gen_vec_duplicate(), GET_CODE, GET_MODE, GET_MODE_BITSIZE(), GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_MASK, GET_MODE_NUNITS(), GET_MODE_PRECISION(), GET_MODE_SIZE(), GET_MODE_UNIT_BITSIZE, GET_MODE_UNIT_PRECISION, HONOR_NANS(), HONOR_SIGN_DEPENDENT_ROUNDING(), HONOR_SIGNED_ZEROS(), HONOR_SNANS(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, HWI_COMPUTABLE_MODE_P(), i, i1, immed_wide_int_const(), IN_RANGE, INTEGRAL_MODE_P, INTVAL, is_a(), known_eq, known_ge, known_lt, lowpart_subreg(), wi::mask(), match_plus_neg_pattern(), maybe_ge, mem_depth, wi::minus_one(), mode_signbit_p(), wi::neg(), neg_poly_int_rtx(), nonzero_bits(), NULL_RTX, wi::one(), optimize_function_for_speed_p(), paradoxical_subreg_p(), plus_constant(), plus_minus_operand_p(), poly_int_rtx_p(), real_arithmetic(), real_convert(), real_equal(), REAL_VALUE_NEGATIVE, REAL_VALUE_TYPE, reverse_rotate_by_imm_p(), reversed_comparison(), rtvec_alloc(), RTVEC_ELT, rtx_equal_p(), SCALAR_FLOAT_MODE_P, SCALAR_INT_MODE_P, wi::set_bit_in_zero(), set_src_cost(), SHIFT_COUNT_TRUNCATED, side_effects_p(), simplify_associative_operation(), simplify_binary_operation(), simplify_binary_operation_series(), simplify_byte_swapping_operation(), simplify_distributive_operation(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_unary(), simplify_logical_relational_operation(), simplify_plus_minus(), simplify_rotate_op(), simplify_unary_operation(), STORE_FLAG_VALUE, subreg_lowpart_p(), subreg_memory_offset(), SUBREG_P, SUBREG_REG, poly_int< N, C >::to_constant(), trunc_int_for_mode(), UINTVAL, unwrap_const_vec_duplicate(), val_signbit_p(), valid_for_const_vector_p(), vec_duplicate_p(), vec_series_highpart_p(), vec_series_lowpart_p(), VECTOR_MODE_P, word_mode, WORD_REGISTER_OPERATIONS, XEXP, XVECEXP, XVECLEN, and y.

Referenced by simplify_binary_operation().

◆ simplify_binary_operation_series()

rtx simplify_context::simplify_binary_operation_series ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1 )
privateinherited
Subroutine of simplify_binary_operation_1 that looks for cases in which OP0 and OP1 are both vector series or vector duplicates (which are really just series with a step of 0). If so, try to form a new series by applying CODE to the bases and to the steps. Return null if no simplification is possible. MODE is the mode of the operation and is known to be a vector integer mode.

References const0_rtx, gen_vec_series(), GET_MODE_INNER, NULL_RTX, simplify_binary_operation(), vec_duplicate_p(), and vec_series_p().

Referenced by simplify_binary_operation_1().

◆ simplify_byte_swapping_operation()

rtx simplify_context::simplify_byte_swapping_operation ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1 )
privateinherited
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 CONST_SCALAR_INT_P, GET_CODE, NULL_RTX, simplify_gen_binary(), simplify_gen_unary(), and XEXP.

Referenced by simplify_binary_operation_1().

◆ simplify_cond_clz_ctz()

rtx simplify_context::simplify_cond_clz_ctz ( rtx x,
rtx_code cmp_code,
rtx true_val,
rtx false_val )
privateinherited
Recognize expressions of the form (X CMP 0) ? VAL : OP (X) where OP is CLZ or CTZ and VAL is the value from CLZ_DEFINED_VALUE_AT_ZERO or CTZ_DEFINED_VALUE_AT_ZERO respectively and return OP (X) if the expression can be simplified to that or NULL_RTX if not. Assume X is compared against zero with CMP_CODE and the true arm is TRUE_VAL and the false arm is FALSE_VAL.

References as_a(), CLZ_DEFINED_VALUE_AT_ZERO, CONST_INT_P, CTZ_DEFINED_VALUE_AT_ZERO, GET_CODE, GET_MODE, INTVAL, NULL_RTX, rtx_equal_p(), and XEXP.

Referenced by simplify_ternary_operation().

◆ simplify_distribute_over_subregs()

rtx simplify_context::simplify_distribute_over_subregs ( rtx_code ,
machine_mode ,
rtx ,
rtx  )
privateinherited

◆ simplify_distributive_operation()

rtx simplify_context::simplify_distributive_operation ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1 )
privateinherited
Subroutine of simplify_binary_operation_1. Un-distribute a binary operation CODE with result mode MODE, operating on OP0 and OP1. e.g. simplify (xor (and A C) (and (B C)) to (and (xor (A B) C). Returns NULL_RTX if no simplification is possible.

References gcc_assert, GET_CODE, GET_RTX_CLASS, NULL_RTX, RTX_COMM_ARITH, rtx_equal_p(), side_effects_p(), simplify_gen_binary(), and XEXP.

Referenced by simplify_binary_operation_1().

◆ simplify_gen_binary()

◆ simplify_gen_relational()

rtx simplify_context::simplify_gen_relational ( rtx_code code,
machine_mode mode,
machine_mode cmp_mode,
rtx op0,
rtx op1 )
inherited

◆ simplify_gen_subreg()

rtx simplify_context::simplify_gen_subreg ( machine_mode outermode,
rtx op,
machine_mode innermode,
poly_uint64 byte )
inherited

◆ simplify_gen_ternary()

rtx simplify_context::simplify_gen_ternary ( rtx_code code,
machine_mode mode,
machine_mode op0_mode,
rtx op0,
rtx op1,
rtx op2 )
inherited

◆ simplify_gen_unary()

rtx simplify_context::simplify_gen_unary ( rtx_code code,
machine_mode mode,
rtx op,
machine_mode op_mode )
inherited
Make a unary operation by first seeing if it folds and otherwise making the specified operation.

References simplify_unary_operation().

Referenced by simplify_binary_operation_1(), simplify_byte_swapping_operation(), simplify_gen_unary(), simplify_merge_mask(), simplify_relational_operation_1(), simplify_truncation(), and simplify_unary_operation_1().

◆ simplify_gen_vec_select()

rtx simplify_context::simplify_gen_vec_select ( rtx op,
unsigned int index )
inherited
Generate RTX to select element at INDEX out of vector OP.

References gcc_assert, GEN_INT, gen_rtvec(), GET_MODE, GET_MODE_INNER, GET_MODE_SIZE(), known_eq, lowpart_subreg(), subreg_lowpart_offset(), and VECTOR_MODE_P.

Referenced by simplify_gen_vec_select().

◆ simplify_logical_relational_operation()

rtx simplify_context::simplify_logical_relational_operation ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1,
bool invert0_p = false )
privateinherited
Simplify a logical operation CODE with result mode MODE, operating on OP0 and OP1, in the case where both are relational operations. Assume that OP0 is inverted if INVERT0_P is true. Return 0 if no such simplification is possible.

References COMPARISON_P, comparison_to_mask(), const0_rtx, const_true_rtx, GET_CODE, GET_MODE, GET_MODE_CLASS, HONOR_NANS(), IN_RANGE, mask_to_comparison(), mask_to_unsigned_comparison(), relational_result(), rtx_equal_p(), side_effects_p(), simplify_gen_relational(), unsigned_comparison_to_mask(), and XEXP.

Referenced by simplify_binary_operation_1(), and simplify_relational_operation_1().

◆ simplify_merge_mask()

rtx simplify_context::simplify_merge_mask ( rtx x,
rtx mask,
int op )
inherited
Try to simplify X given that it appears within operand OP of a VEC_MERGE operation whose mask is MASK. X need not use the same vector mode as the VEC_MERGE, but it must have the same number of elements. Return the simplified X on success, otherwise return NULL_RTX.

References BINARY_P, COMPARISON_P, gcc_assert, GET_CODE, GET_MODE, GET_MODE_NUNITS(), GET_RTX_CLASS, known_eq, NULL_RTX, rtx_equal_p(), RTX_TERNARY, side_effects_p(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_ternary(), simplify_gen_unary(), simplify_merge_mask(), UNARY_P, VECTOR_MODE_P, and XEXP.

Referenced by simplify_merge_mask(), and simplify_ternary_operation().

◆ simplify_plus_minus()

rtx simplify_context::simplify_plus_minus ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1 )
privateinherited
Simplify and canonicalize a PLUS or MINUS, at least one of whose operands may be another PLUS or MINUS. Rather than test for specific case, we do this by a brute-force method and do all possible simplifications until no more changes occur. Then we rebuild the operation. May return NULL_RTX when no changes were made.

References arg_pointer_rtx, CASE_CONST_SCALAR_INT, changed, CONST_INT_P, CONSTANT_P, CONSTM1_RTX, fixed_regs, frame_pointer_rtx, gcc_assert, GET_CODE, GET_MODE, global_regs, i, INTVAL, neg_poly_int_rtx(), NULL_RTX, plus_constant(), poly_int_rtx_p(), REG_P, REGNO, simplify_binary_operation(), simplify_const_binary_operation(), simplify_plus_minus_op_data_cmp(), stack_pointer_rtx, swap_commutative_operands_p(), and XEXP.

Referenced by simplify_binary_operation_1().

◆ simplify_relational_operation()

rtx simplify_context::simplify_relational_operation ( rtx_code code,
machine_mode mode,
machine_mode cmp_mode,
rtx op0,
rtx op1 )
inherited
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(), const0_rtx, GET_CODE, GET_MODE, GET_MODE_CLASS, NULL_RTX, relational_result(), simplify_const_relational_operation(), simplify_gen_relational(), simplify_relational_operation_1(), swap_commutative_operands_p(), swap_condition(), and XEXP.

Referenced by insn_propagation::apply_to_rvalue_1(), simplify_gen_relational(), simplify_relational_operation(), and simplify_ternary_operation().

◆ simplify_relational_operation_1()

rtx simplify_context::simplify_relational_operation_1 ( rtx_code code,
machine_mode mode,
machine_mode cmp_mode,
rtx op0,
rtx op1 )
privateinherited
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 COMPARISON_P, CONST0_RTX, const0_rtx, const1_rtx, CONST_INT_P, CONST_SCALAR_INT_P, CONSTANT_P, constm1_rtx, copy_rtx(), GET_CODE, GET_MODE, GET_MODE_PRECISION(), GET_MODE_SIZE(), INTEGRAL_MODE_P, INTVAL, is_a(), is_int_mode(), lowpart_subreg(), nonzero_bits(), NULL, NULL_RTX, partial_subreg_p(), reversed_comparison_code(), rtx_equal_p(), SCALAR_INT_MODE_P, side_effects_p(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_unary(), simplify_logical_relational_operation(), simplify_rtx(), STORE_FLAG_VALUE, subreg_lowpart_p(), UINTVAL, and XEXP.

Referenced by simplify_relational_operation().

◆ simplify_shift_const_int()

rtx simplify_context::simplify_shift_const_int ( rtx_code ,
machine_mode ,
rtx ,
unsigned int  )
privateinherited

◆ simplify_subreg()

rtx simplify_context::simplify_subreg ( machine_mode outermode,
rtx op,
machine_mode innermode,
poly_uint64 byte )
inherited
Simplify SUBREG:OUTERMODE(OP:INNERMODE, BYTE) Return 0 if no simplifications are possible.

References adjust_address_nv, COMPARISON_P, CONST0_RTX, CONST_DOUBLE_AS_FLOAT_P, CONST_FIXED_P, CONST_INT_P, CONST_POLY_INT_P, const_poly_int_value(), CONST_SCALAR_INT_P, poly_int< NUM_POLY_INT_COEFFS, wide_int >::from(), gcc_assert, gen_rtx_REG_offset(), gen_rtx_SUBREG(), gen_vec_duplicate(), GET_CODE, GET_MODE, GET_MODE_ALIGNMENT, GET_MODE_BITSIZE(), GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_NUNITS(), GET_MODE_PRECISION(), GET_MODE_SIZE(), GET_MODE_UNIT_SIZE, HARD_REGISTER_NUM_P, HARD_REGISTER_P, have_insn_for(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, immed_wide_int_const(), int_mode_for_size(), INTVAL, is_a(), known_eq, known_ge, known_gt, known_le, known_lt, lowpart_subreg(), maybe_ge, maybe_gt, MEM_ADDR_SPACE, MEM_ALIGN, MEM_P, MEM_VOLATILE_P, mode_dependent_address_p(), NULL_RTX, ORIGINAL_REGNO, paradoxical_subreg_p(), REG_P, REGNO, SCALAR_INT_MODE_P, SET, SIGNED, simplify_const_vector_byte_offset(), simplify_const_vector_subreg(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_subreg(), simplify_immed_subreg(), simplify_subreg(), simplify_subreg_regno(), simplify_truncation(), SUBREG_BYTE, subreg_highpart_offset(), subreg_lowpart_offset(), subreg_lowpart_p(), subreg_lsb_1(), subreg_memory_offset(), SUBREG_PROMOTED_GET, SUBREG_PROMOTED_SET, SUBREG_PROMOTED_SIGN, SUBREG_PROMOTED_VAR_P, SUBREG_REG, UINTVAL, validate_subreg(), vec_duplicate_p(), VECTOR_MODE_P, word_mode, and XEXP.

Referenced by insn_propagation::apply_to_rvalue_1(), simplify_gen_subreg(), simplify_subreg(), and simplify_subreg().

◆ simplify_ternary_operation()

◆ simplify_ternary_operation_1()

rtx simplify_context::simplify_ternary_operation_1 ( rtx_code ,
machine_mode ,
machine_mode ,
rtx ,
rtx ,
rtx  )
privateinherited

◆ simplify_truncation()

rtx simplify_context::simplify_truncation ( machine_mode mode,
rtx op,
machine_mode op_mode )
privateinherited
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 adjust_address_nv, BITS_PER_WORD, CONST_INT_P, constm1_rtx, gcc_assert, GEN_INT, GET_CODE, GET_MODE, GET_MODE_BITSIZE(), GET_MODE_MASK, GET_MODE_PRECISION(), GET_MODE_SIZE(), GET_MODE_UNIT_PRECISION, INTVAL, is_a(), MEM_ADDR_SPACE, MEM_P, MEM_VOLATILE_P, mode_dependent_address_p(), NULL_RTX, REG_P, SCALAR_INT_MODE_P, shift, simplify_gen_binary(), simplify_gen_subreg(), simplify_gen_ternary(), simplify_gen_unary(), subreg_lowpart_offset(), subreg_lowpart_p(), SUBREG_REG, trunc_int_for_mode(), UINTVAL, WORD_REGISTER_OPERATIONS, and XEXP.

Referenced by simplify_subreg(), and simplify_unary_operation_1().

◆ simplify_unary_operation()

rtx simplify_context::simplify_unary_operation ( rtx_code code,
machine_mode mode,
rtx op,
machine_mode op_mode )
inherited
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 insn_propagation::apply_to_rvalue_1(), simplify_binary_operation_1(), simplify_gen_unary(), simplify_ternary_operation(), simplify_unary_operation(), and simplify_unary_operation_1().

◆ simplify_unary_operation_1()

rtx simplify_context::simplify_unary_operation_1 ( rtx_code code,
machine_mode mode,
rtx op )
privateinherited
Perform some simplifications we can do even if the operands aren't constant.

References ADDR_SPACE_GENERIC, as_a(), COMPARISON_P, const0_rtx, CONST1_RTX, const1_rtx, CONST_DOUBLE_AS_FLOAT_P, CONST_INT_P, CONST_SCALAR_INT_P, CONSTANT_P, CONSTM1_RTX, constm1_rtx, convert_memory_address_addr_space_1(), DECIMAL_FLOAT_MODE_P, exact_int_to_float_conversion_p(), false_rtx, gcc_assert, gen_int_mode(), gen_int_shift_amount(), rtl_hooks::gen_lowpart_no_emit, gen_vec_duplicate(), gen_vec_series(), GET_CODE, GET_MODE, GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_MASK, GET_MODE_NUNITS(), GET_MODE_PRECISION(), GET_MODE_UNIT_PRECISION, GET_MODE_UNIT_SIZE, HONOR_SIGN_DEPENDENT_ROUNDING(), HONOR_SIGNED_ZEROS(), HOST_BITS_PER_WIDE_INT, HWI_COMPUTABLE_MODE_P(), int_mode_for_size(), INTVAL, is_a(), known_eq, MEM_ADDR_SPACE, MEM_VOLATILE_P, mode_dependent_address_p(), mode_signbit_p(), nonzero_bits(), NULL, num_sign_bit_copies(), paradoxical_subreg_p(), partial_subreg_p(), plus_constant(), ptr_mode, REG_P, REG_POINTER, reversed_comparison(), reversed_comparison_code(), rtx_equal_p(), side_effects_p(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_ternary(), simplify_gen_unary(), simplify_truncation(), simplify_unary_operation(), SRP_SIGNED, SRP_UNSIGNED, STORE_FLAG_VALUE, subreg_lowpart_p(), SUBREG_PROMOTED_SET, SUBREG_PROMOTED_SIGNED_P, SUBREG_PROMOTED_UNSIGNED_P, SUBREG_PROMOTED_VAR_P, SUBREG_REG, target_default_pointer_address_modes_p(), targetm, true_rtx, TRULY_NOOP_TRUNCATION_MODES_P, truncated_to_mode(), val_signbit_known_clear_p(), vec_duplicate_p(), vec_series_p(), VECTOR_MODE_P, and XEXP.

Referenced by simplify_unary_operation().

Field Documentation

◆ assoc_count

unsigned int simplify_context::assoc_count = 0
inherited

◆ failure_reason

const char* insn_propagation::failure_reason

◆ FIRST_SPARE_RESULT

const uint16_t insn_propagation::FIRST_SPARE_RESULT = 1U << 1
static

◆ from

rtx insn_propagation::from

◆ insn

rtx_insn* insn_propagation::insn

◆ max_assoc_count

const unsigned int simplify_context::max_assoc_count = 64
staticinherited

◆ mem_depth

unsigned int simplify_context::mem_depth = 0
inherited

◆ num_replacements

unsigned int insn_propagation::num_replacements

◆ result_flags

uint16_t insn_propagation::result_flags

◆ should_check_mems

uint16_t insn_propagation::should_check_mems

Referenced by apply_to_mem_1(), and insn_propagation().

◆ should_note_simplifications

uint16_t insn_propagation::should_note_simplifications

◆ should_unshare

uint16_t insn_propagation::should_unshare

◆ spare

uint16_t insn_propagation::spare

Referenced by insn_propagation().

◆ to

rtx insn_propagation::to

◆ UNSIMPLIFIED

const uint16_t insn_propagation::UNSIMPLIFIED = 1U << 0
static

Referenced by apply_to_rvalue_1().


The documentation for this class was generated from the following files: