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 *)
 
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)
 
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.   

◆ 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.   

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_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_rvalue_1().

◆ apply_to_rvalue_1()

bool insn_propagation::apply_to_rvalue_1 ( rtx * loc)
private

◆ 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

◆ 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 simplify_context::assoc_count, GET_CODE, simplify_context::max_assoc_count, NULL_RTX, simplify_context::simplify_binary_operation(), simplify_context::simplify_gen_binary(), swap_commutative_operands_p(), and XEXP.

Referenced by simplify_context::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_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_VECTOR_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, simplify_context::lowpart_subreg(), wi::mask(), maybe_ge, simplify_context::mem_depth, wi::minus_one(), mode_signbit_p(), wi::neg(), neg_poly_int_rtx(), nonzero_bits(), NULL_RTX, offset, wi::one(), optimize_function_for_speed_p(), plus_constant(), plus_minus_operand_p(), poly_int_rtx_p(), real_arithmetic(), real_convert(), real_equal(), REAL_VALUE_NEGATIVE, REAL_VALUE_TYPE, REG_P, REGNO, 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_context::simplify_associative_operation(), simplify_context::simplify_binary_operation(), simplify_context::simplify_binary_operation_series(), simplify_context::simplify_byte_swapping_operation(), simplify_context::simplify_distributive_operation(), simplify_context::simplify_gen_binary(), simplify_context::simplify_gen_relational(), simplify_context::simplify_gen_unary(), simplify_context::simplify_logical_relational_operation(), simplify_context::simplify_plus_minus(), simplify_context::simplify_unary_operation(), STORE_FLAG_VALUE, SUBREG_BYTE, subreg_lowpart_p(), subreg_memory_offset(), SUBREG_P, SUBREG_REG, poly_int< N, C >::to_constant(), trunc_int_for_mode(), UINTVAL, 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_context::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_context::simplify_binary_operation(), vec_duplicate_p(), and vec_series_p().

Referenced by simplify_context::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_context::simplify_gen_binary(), simplify_context::simplify_gen_unary(), and XEXP.

Referenced by simplify_context::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_context::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_context::simplify_gen_binary(), and XEXP.

Referenced by simplify_context::simplify_binary_operation_1().

◆ simplify_gen_binary()

◆ simplify_gen_relational()

◆ 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

◆ simplify_gen_vec_select()

rtx simplify_context::simplify_gen_vec_select ( rtx op,
unsigned int index )
inherited

◆ simplify_logical_relational_operation()

rtx simplify_context::simplify_logical_relational_operation ( rtx_code code,
machine_mode mode,
rtx op0,
rtx op1 )
privateinherited
Simplify a logical operation CODE with result mode MODE, operating on OP0
and OP1, which should be both relational operations.  Return 0 if no such
simplification is possible.   

References comparison_code_valid_for_mode(), COMPARISON_P, comparison_to_mask(), const_true_rtx, GET_CODE, GET_MODE, mask_to_comparison(), relational_result(), rtx_equal_p(), simplify_context::simplify_gen_relational(), and XEXP.

Referenced by simplify_context::simplify_binary_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_context::simplify_gen_binary(), simplify_context::simplify_gen_relational(), simplify_context::simplify_gen_ternary(), simplify_context::simplify_gen_unary(), simplify_context::simplify_merge_mask(), UNARY_P, VECTOR_MODE_P, and XEXP.

Referenced by simplify_context::simplify_merge_mask(), and simplify_context::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_context::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_context::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_context::simplify_gen_relational(), simplify_context::simplify_relational_operation_1(), swap_commutative_operands_p(), swap_condition(), and XEXP.

Referenced by apply_to_rvalue_1(), simplify_context::simplify_gen_relational(), simplify_relational_operation(), and simplify_context::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

◆ 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< N, C >::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, simplify_context::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_context::simplify_gen_binary(), simplify_context::simplify_gen_relational(), simplify_context::simplify_gen_subreg(), simplify_immed_subreg(), simplify_context::simplify_subreg(), simplify_subreg_regno(), simplify_context::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 apply_to_rvalue_1(), simplify_context::simplify_gen_subreg(), simplify_context::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_context::simplify_gen_binary(), simplify_context::simplify_gen_subreg(), simplify_context::simplify_gen_ternary(), simplify_context::simplify_gen_unary(), subreg_lowpart_offset(), subreg_lowpart_p(), SUBREG_REG, trunc_int_for_mode(), UINTVAL, WORD_REGISTER_OPERATIONS, and XEXP.

Referenced by simplify_context::simplify_subreg(), and simplify_context::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_context::simplify_unary_operation_1().

Referenced by apply_to_rvalue_1(), simplify_context::simplify_binary_operation_1(), simplify_context::simplify_gen_unary(), simplify_context::simplify_ternary_operation(), simplify_unary_operation(), and simplify_context::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_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_context::simplify_gen_binary(), simplify_context::simplify_gen_relational(), simplify_context::simplify_gen_ternary(), simplify_context::simplify_gen_unary(), simplify_context::simplify_truncation(), simplify_context::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_context::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

Referenced by apply_to_rvalue_1().

◆ 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

Referenced by apply_to_rvalue_1().

◆ result_flags

uint16_t insn_propagation::result_flags

Referenced by apply_to_rvalue_1().

◆ should_check_mems

uint16_t insn_propagation::should_check_mems

Referenced by apply_to_mem_1().

◆ should_note_simplifications

uint16_t insn_propagation::should_note_simplifications

Referenced by apply_to_rvalue_1().

◆ should_unshare

uint16_t insn_propagation::should_unshare

Referenced by apply_to_rvalue_1().

◆ spare

uint16_t insn_propagation::spare

◆ to

rtx insn_propagation::to

Referenced by apply_to_rvalue_1().

◆ 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: