GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "predict.h"
#include "memmodel.h"
#include "optabs.h"
#include "emit-rtl.h"
#include "recog.h"
#include "diagnostic-core.h"
#include "varasm.h"
#include "flags.h"
#include "selftest.h"
#include "selftest-rtl.h"
#include "rtx-vector-builder.h"
#include "rtlanal.h"
Macros | |
#define | HWI_SIGN_EXTEND(low) |
Enumerations | |
enum | { CMP_EQ = 1 , CMP_LT = 2 , CMP_GT = 4 , CMP_LTU = 8 , CMP_GTU = 16 } |
Functions | |
static bool | plus_minus_operand_p (const_rtx) |
static rtx | neg_poly_int_rtx (machine_mode mode, const_rtx i) |
bool | mode_signbit_p (machine_mode mode, const_rtx x) |
bool | val_signbit_p (machine_mode mode, unsigned HOST_WIDE_INT val) |
bool | val_signbit_known_set_p (machine_mode mode, unsigned HOST_WIDE_INT val) |
bool | val_signbit_known_clear_p (machine_mode mode, unsigned HOST_WIDE_INT val) |
rtx | avoid_constant_pool_reference (rtx x) |
rtx | delegitimize_mem_from_attrs (rtx x) |
rtx | simplify_replace_fn_rtx (rtx x, const_rtx old_rtx, rtx(*fn)(rtx, const_rtx, void *), void *data) |
rtx | simplify_replace_rtx (rtx x, const_rtx old_rtx, rtx new_rtx) |
static bool | exact_int_to_float_conversion_p (const_rtx op) |
rtx | simplify_const_unary_operation (enum rtx_code code, machine_mode mode, rtx op, machine_mode op_mode) |
static int | unsigned_comparison_to_mask (rtx_code comparison) |
static rtx_code | mask_to_unsigned_comparison (int mask) |
static int | comparison_to_mask (enum rtx_code comparison) |
static enum rtx_code | mask_to_comparison (int mask) |
static rtx | relational_result (machine_mode mode, machine_mode cmp_mode, rtx res) |
bool | reverse_rotate_by_imm_p (machine_mode mode, unsigned int left, rtx op1) |
static bool | extract_ashift_operands_p (rtx x, rtx *shift_opnd, rtx *shift_amnt) |
static rtx | simplify_rotate_op (rtx op0, rtx op1, machine_mode mode) |
static bool | match_plus_neg_pattern (rtx op0, rtx op1, machine_mode mode) |
static bool | distributes_over_addition_p (rtx_code op, int opno) |
rtx | simplify_const_binary_operation (enum rtx_code code, machine_mode mode, rtx op0, rtx op1) |
static int | simplify_plus_minus_op_data_cmp (rtx x, rtx y) |
static rtx | comparison_result (enum rtx_code code, int known_results) |
rtx | simplify_const_relational_operation (enum rtx_code code, machine_mode mode, rtx op0, rtx op1) |
bool | native_encode_rtx (machine_mode mode, rtx x, vec< target_unit > &bytes, unsigned int first_byte, unsigned int num_bytes) |
rtx | native_decode_vector_rtx (machine_mode mode, const vec< target_unit > &bytes, unsigned int first_byte, unsigned int npatterns, unsigned int nelts_per_pattern) |
rtx | native_decode_rtx (machine_mode mode, const vec< target_unit > &bytes, unsigned int first_byte) |
static poly_uint64 | simplify_const_vector_byte_offset (rtx x, poly_uint64 byte) |
static rtx | simplify_const_vector_subreg (machine_mode outermode, rtx x, machine_mode innermode, unsigned int first_byte) |
static rtx | simplify_immed_subreg (fixed_size_mode outermode, rtx x, machine_mode innermode, unsigned int first_byte) |
rtx | simplify_rtx (const_rtx x) |
#define HWI_SIGN_EXTEND | ( | low | ) |
RTL simplification functions for GNU compiler. Copyright (C) 1987-2025 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Simplification and canonicalization of RTL.
Much code operates on (low, high) pairs; the low value is an unsigned wide int, the high value a signed wide int. We occasionally need to sign extend from low to high as if low were a signed wide int.
If X is a MEM referencing the constant pool, return the real value. Otherwise return X.
References avoid_constant_pool_reference(), CONST_DOUBLE_AS_FLOAT_P, const_double_from_real_value(), CONST_DOUBLE_REAL_VALUE, CONSTANT_P, CONSTANT_POOL_ADDRESS_P, GET_CODE, GET_MODE, GET_MODE_SIZE(), get_pool_constant(), get_pool_mode(), known_eq, simplify_subreg(), strip_offset(), targetm, and XEXP.
Referenced by adjust_mems(), avoid_constant_pool_reference(), commutative_operand_precedence(), constant_pool_constant_p(), dw_loc_list_1(), equiv_constant(), find_constant_src(), forward_propagate_and_simplify(), loc_descriptor(), mem_loc_descriptor(), rtl_for_decl_location(), simplify_context::simplify_binary_operation(), simplify_context::simplify_binary_operation_1(), simplify_const_relational_operation(), simplify_context::simplify_relational_operation(), simplify_context::simplify_ternary_operation(), simplify_context::simplify_unary_operation(), subst(), and want_to_gcse_p().
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, const0_rtx, const_true_rtx, and gcc_unreachable.
Referenced by simplify_const_relational_operation().
|
static |
Return a mask describing the COMPARISON.
References gcc_unreachable.
Referenced by simplify_context::simplify_logical_relational_operation().
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 adjust_address_nv, DECL_RTL, DECL_RTL_SET_P, DECL_THREAD_LOCAL_P, get_inner_reference(), GET_MODE, GET_MODE_BITSIZE(), known_eq, MEM_EXPR, MEM_OFFSET, MEM_OFFSET_KNOWN_P, MEM_P, NULL, poly_int_tree_p(), rtx_equal_p(), strip_offset(), TREE_CODE, TREE_STATIC, VAR_P, and XEXP.
Return true if binary operation OP distributes over addition in operand OPNO, with the other operand being held constant. OPNO counts from 1.
Referenced by simplify_const_binary_operation().
Return true if FLOAT or UNSIGNED_FLOAT operation OP is known to be exact.
References wi::ctz(), gcc_unreachable, GET_CODE, GET_MODE, GET_MODE_INNER, GET_MODE_UNIT_PRECISION, HWI_COMPUTABLE_MODE_P(), wi::min_precision(), nonzero_bits(), num_sign_bit_copies(), significand_size(), wi::uhwi(), UNSIGNED, and XEXP.
Referenced by simplify_context::simplify_unary_operation_1().
Analyse argument X to see if it represents an (ASHIFT X Y) operation and return the expression to be shifted in SHIFT_OPND and the shift amount in SHIFT_AMNT. This is primarily used to group handling of ASHIFT (X, CST) and (PLUS (X, X)) in one place. If the expression is not equivalent to an ASHIFT then return FALSE and set SHIFT_OPND and SHIFT_AMNT to NULL.
References CONST1_RTX, GET_CODE, GET_MODE, NULL_RTX, rtx_equal_p(), and XEXP.
Referenced by simplify_rotate_op().
|
static |
Return a comparison corresponding to the MASK.
References gcc_unreachable.
Referenced by simplify_context::simplify_logical_relational_operation().
|
static |
Reverse the mapping in unsigned_comparison_to_mask, going from masks to comparisons.
References gcc_unreachable.
Referenced by simplify_context::simplify_logical_relational_operation().
Returns true if OP0 and OP1 match the pattern (OP (plus (A - 1)) (neg A)), and the pattern can be simplified (there are no side effects).
References CONSTM1_RTX, GET_CODE, rtx_equal_p(), side_effects_p(), subreg_lowpart_p(), and XEXP.
Referenced by simplify_context::simplify_binary_operation_1().
Test whether expression, X, is an immediate constant that represents the most significant bit of machine mode MODE.
References CONST_DOUBLE_AS_INT_P, CONST_DOUBLE_HIGH, CONST_DOUBLE_LOW, CONST_INT_P, CONST_WIDE_INT_ELT, CONST_WIDE_INT_NUNITS, CONST_WIDE_INT_P, GET_MODE_PRECISION(), HOST_BITS_PER_DOUBLE_INT, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, i, INTVAL, and is_int_mode().
Referenced by simplify_context::simplify_binary_operation_1(), simplify_shift_const_1(), and simplify_context::simplify_unary_operation_1().
rtx native_decode_rtx | ( | machine_mode | mode, |
const vec< target_unit > & | bytes, | ||
unsigned int | first_byte ) |
Read an rtx of mode MODE from the target memory image given by BYTES, starting at byte FIRST_BYTE. Each element of BYTES contains BITS_PER_UNIT bits and the bytes are in target memory order. The image has enough values to specify all bytes of MODE. Return the rtx on success, otherwise return NULL_RTX.
References ALL_SCALAR_FIXED_POINT_MODE_P, as_a(), CEIL, const_double_from_real_value(), CONST_FIXED_FROM_FIXED_VALUE, FIXED_VALUE_TYPE, gcc_assert, GET_MODE_BITSIZE(), GET_MODE_NUNITS(), GET_MODE_PRECISION(), GET_MODE_SIZE(), HOST_BITS_PER_WIDE_INT, i, immed_wide_int_const(), is_a(), MIN, native_decode_vector_rtx(), NULL_RTX, r, real_from_target(), REAL_VALUE_TYPE, subreg_size_lsb(), subreg_size_offset_from_lsb(), poly_int< N, C >::to_constant(), VECTOR_MODE_P, and wi::zero().
Referenced by c_readstr(), native_decode_vector_rtx(), and simplify_immed_subreg().
rtx native_decode_vector_rtx | ( | machine_mode | mode, |
const vec< target_unit > & | bytes, | ||
unsigned int | first_byte, | ||
unsigned int | npatterns, | ||
unsigned int | nelts_per_pattern ) |
Read a vector of mode MODE from the target memory image given by BYTES, starting at byte FIRST_BYTE. The vector is known to be encodable using NPATTERNS interleaved patterns with NELTS_PER_PATTERN elements each, and BYTES is known to have enough bytes to supply NPATTERNS * NELTS_PER_PATTERN vector elements. Each element of BYTES contains BITS_PER_UNIT bits and the bytes are in target memory order. Return the vector on success, otherwise return NULL_RTX.
References rtx_vector_builder::build(), vector_builder< T, Shape, Derived >::encoded_nelts(), gcc_assert, gen_int_mode(), GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_NUNITS(), GET_MODE_PRECISION(), i, native_decode_rtx(), NULL_RTX, and vector_element_size.
Referenced by native_decode_rtx(), and simplify_const_vector_subreg().
bool native_encode_rtx | ( | machine_mode | mode, |
rtx | x, | ||
vec< target_unit > & | bytes, | ||
unsigned int | first_byte, | ||
unsigned int | num_bytes ) |
Try to calculate NUM_BYTES bytes of the target memory image of X, starting at byte FIRST_BYTE. Return true on success and add the bytes to BYTES, such that each byte has BITS_PER_UNIT bits and such that the bytes follow target memory order. Leave BYTES unmodified on failure. MODE is the mode of X. The caller must reserve NUM_BYTES bytes in BYTES before calling this function.
References CONST_DOUBLE_P, CONST_DOUBLE_REAL_VALUE, CONST_FIXED_VALUE_HIGH, CONST_FIXED_VALUE_LOW, CONST_SCALAR_INT_P, CONST_VECTOR_ELT, generic_wide_int< storage >::elt(), gcc_assert, GET_CODE, GET_MODE, GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_MASK, GET_MODE_NUNITS(), GET_MODE_PRECISION(), GET_MODE_SIZE(), GET_MODE_UNIT_SIZE, HOST_BITS_PER_WIDE_INT, i, INTVAL, is_a(), MIN, native_encode_rtx(), real_to_target(), shift, subreg_size_lsb(), poly_int< N, C >::to_constant(), and vector_element_size.
Referenced by native_encode_rtx(), optimize_constant_pool(), output_constant_pool_2(), simplify_const_vector_subreg(), and simplify_immed_subreg().
Negate I, which satisfies poly_int_rtx_p. MODE is the mode of I.
References i, immed_wide_int_const(), and wi::to_poly_wide().
Referenced by simplify_context::simplify_binary_operation_1(), and simplify_context::simplify_plus_minus().
Check whether an operand is suitable for calling simplify_plus_minus.
References CONSTANT_P, GET_CODE, and XEXP.
Referenced by simplify_context::simplify_binary_operation_1().
Canonicalize RES, a scalar const0_rtx/const_true_rtx to the right false/true value of comparison with MODE where comparison operands have CMP_MODE.
References CONST0_RTX, const0_rtx, CONST1_RTX, const1_rtx, const_double_from_real_value(), const_true_rtx, gen_const_vec_duplicate(), NULL_RTX, REAL_VALUE_TYPE, SCALAR_FLOAT_MODE_P, SCALAR_INT_MODE_P, and VECTOR_MODE_P.
Referenced by simplify_context::simplify_logical_relational_operation(), and simplify_context::simplify_relational_operation().
Return TRUE if a rotate in mode MODE with a constant count in OP1 should be reversed. If the rotate should not be reversed, return FALSE. LEFT indicates if this is a rotate left or a rotate right.
References CONST_INT_P, GET_MODE_UNIT_PRECISION, IN_RANGE, insn_operand_matches(), INTVAL, and optab_handler().
Referenced by expand_shift_1(), and simplify_context::simplify_binary_operation_1().
References wi::add(), wi::arshift(), wi::bit_and(), wi::bit_or(), wi::bit_xor(), BITS_PER_WORD, rtx_vector_builder::build(), wi::clrsb(), wi::clz(), CONST_DOUBLE_AS_FLOAT_P, const_double_from_real_value(), CONST_DOUBLE_REAL_VALUE, CONST_FIXED_P, CONST_SCALAR_INT_P, CONST_VECTOR_DUPLICATE_P, CONST_VECTOR_ELT, CONST_VECTOR_NPATTERNS, CONST_VECTOR_NUNITS, CONST_VECTOR_STEPPED_P, count, dconst0, distributes_over_addition_p(), wi::div_trunc(), vector_builder< T, Shape, Derived >::encoded_nelts(), wi::eq_p(), f1, gcc_assert, gcc_unreachable, gen_rtx_CONST_VECTOR(), GET_CODE, GET_MODE, GET_MODE_INNER, GET_MODE_NUNITS(), GET_MODE_PRECISION(), wi::geu_p(), HONOR_NANS(), HONOR_SNANS(), HOST_BITS_PER_DOUBLE_INT, i, immed_wide_int_const(), is_a(), wi::leu_p(), wi::lrotate(), wi::lrshift(), wi::lshift(), wi::max_value(), wi::min_value(), wi::mod_trunc(), MODE_COMPOSITE_P, MODE_HAS_INFINITIES, wi::mul(), wi::mul_high(), wi::neg_p(), vector_builder< T, Shape, Derived >::new_binary_operation(), NULL_RTX, NUM_POLY_INT_COEFFS, wi::OVF_NONE, wi::OVF_OVERFLOW, wi::OVF_UNDERFLOW, poly_int_rtx_p(), r, real_arithmetic(), real_convert(), real_copysign(), real_equal(), real_from_target(), real_identical(), real_to_target(), REAL_VALUE_ISINF, REAL_VALUE_ISSIGNALING_NAN, REAL_VALUE_NEGATIVE, REAL_VALUE_TYPE, wi::rrotate(), rtvec_alloc(), RTVEC_ELT, rtx_to_tree_code(), SCALAR_FLOAT_MODE_P, shift, SHIFT_COUNT_TRUNCATED, SIGNED, simplify_binary_operation(), wi::smax(), wi::smin(), wi::sub(), poly_int< N, C >::to_constant(), wi::to_poly_wide(), wi::umax(), wi::umin(), wi::umod_trunc(), UNSIGNED, valid_for_const_vector_p(), VECTOR_MODE_P, and word_mode.
Referenced by find_shift_sequence(), simplify_context::simplify_binary_operation(), simplify_context::simplify_plus_minus(), and simplify_shift_const_1().
Check if the given comparison (done in the given MODE) is actually a tautology or a contradiction. If the mode is VOIDmode, the comparison is done in "infinite precision". 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(), CONST0_RTX, const0_rtx, CONST_DOUBLE_AS_FLOAT_P, CONST_DOUBLE_REAL_VALUE, CONST_INT_P, CONST_SCALAR_INT_P, const_true_rtx, d1, wi::eq_p(), gcc_assert, GET_CODE, GET_MODE, get_mode_bounds(), GET_MODE_CLASS, GET_MODE_MASK, GET_MODE_PRECISION(), HONOR_NANS(), HONOR_SNANS(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, HWI_COMPUTABLE_MODE_P(), INTEGRAL_MODE_P, INTVAL, is_a(), wi::lts_p(), wi::ltu_p(), nonzero_address_p(), nonzero_bits(), NULL_RTX, num_sign_bit_copies(), real_equal(), real_less(), REAL_VALUE_ISNAN, REAL_VALUE_TYPE, REG_P, rtx_equal_p(), SCALAR_FLOAT_MODE_P, side_effects_p(), signed_condition(), simplify_binary_operation(), simplify_const_relational_operation(), swap_commutative_operands_p(), swap_condition(), UINTVAL, and XEXP.
Referenced by simplify_const_relational_operation(), and simplify_context::simplify_relational_operation().
rtx simplify_const_unary_operation | ( | enum rtx_code | code, |
machine_mode | mode, | ||
rtx | op, | ||
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 wi::abs(), as_a(), wi::bit_not(), wi::bitreverse(), wi::bswap(), rtx_vector_builder::build(), wi::clrsb(), wi::clz(), CLZ_DEFINED_VALUE_AT_ZERO, const0_rtx, CONST_DOUBLE_AS_FLOAT_P, const_double_from_real_value(), CONST_DOUBLE_REAL_VALUE, CONST_POLY_INT_P, const_poly_int_value(), CONST_SCALAR_INT_P, CONST_VECTOR_DUPLICATE_P, CONST_VECTOR_ELT, CONST_VECTOR_NPATTERNS, CONST_VECTOR_NUNITS, count, wi::ctz(), CTZ_DEFINED_VALUE_AT_ZERO, vector_builder< T, Shape, Derived >::encoded_nelts(), exact_real_truncate(), wi::ffs(), wide_int_storage::from(), gcc_assert, gcc_unreachable, gen_const_vec_duplicate(), GET_CODE, GET_MODE, GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_NUNITS(), GET_MODE_PRECISION(), HONOR_SIGN_DEPENDENT_ROUNDING(), HONOR_SNANS(), HOST_BITS_PER_DOUBLE_INT, i, immed_wide_int_const(), is_a(), is_int_mode(), known_eq, wi::max(), wi::max_value(), wi::min(), wi::min_value(), wi::ne_p(), wi::neg(), vector_builder< T, Shape, Derived >::new_unary_operation(), NULL, NULL_RTX, wi::only_sign_bit_p(), wi::parity(), wi::popcount(), real_arithmetic(), real_convert(), real_from_integer(), real_from_target(), real_less(), real_to_integer(), real_to_target(), real_value_abs(), REAL_VALUE_ISINF, REAL_VALUE_ISNAN, REAL_VALUE_ISSIGNALING_NAN, real_value_negate(), REAL_VALUE_NEGATIVE, real_value_truncate(), REAL_VALUE_TYPE, SCALAR_FLOAT_MODE_P, wi::shwi(), SIGNED, simplify_unary_operation(), UNSIGNED, valid_for_const_vector_p(), and VECTOR_MODE_P.
Referenced by simplify_context::simplify_unary_operation().
|
static |
Simplify a byte offset BYTE into CONST_VECTOR X. The main purpose is to convert a runtime BYTE value into a constant one.
References CONST_VECTOR_NELTS_PER_PATTERN, CONST_VECTOR_NPATTERNS, GET_MODE, GET_MODE_NUNITS(), GET_MODE_PRECISION(), known_gt, least_common_multiple(), and vector_element_size.
Referenced by simplify_context::simplify_subreg().
|
static |
Subroutine of simplify_subreg in which: - X is known to be a CONST_VECTOR - OUTERMODE is known to be a vector mode Try to handle the subreg by operating on the CONST_VECTOR encoding rather than on each individual element of the CONST_VECTOR. Return the simplified subreg on success, otherwise return NULL_RTX.
References CEIL, CONST_VECTOR_NELTS_PER_PATTERN, CONST_VECTOR_NPATTERNS, CONST_VECTOR_STEPPED_P, GET_MODE_INNER, GET_MODE_NUNITS(), GET_MODE_PRECISION(), least_common_multiple(), native_decode_vector_rtx(), native_encode_rtx(), NULL_RTX, paradoxical_subreg_p(), and vector_element_size.
Referenced by simplify_context::simplify_subreg().
|
static |
Try to simplify a subreg of a constant by encoding the subreg region as a sequence of target bytes and reading them back in the new mode. Return the new value on success, otherwise return null. The subreg has outer mode OUTERMODE, inner mode INNERMODE, inner value X and byte offset FIRST_BYTE.
References byte_lowpart_offset(), CONST_INT_P, CONST_SCALAR_INT_P, FLOAT_MODE_P, GET_MODE_CLASS, GET_MODE_SIZE(), i, native_decode_rtx(), native_encode_rtx(), wi::neg_p(), NULL_RTX, paradoxical_subreg_p(), and poly_int< N, C >::to_constant().
Referenced by simplify_context::simplify_subreg().
Return a positive integer if X should sort after Y. The value returned is 1 if and only if X and Y are both regs.
References commutative_operand_precedence(), REG_P, REGNO, and y.
Referenced by simplify_context::simplify_plus_minus().
rtx simplify_replace_fn_rtx | ( | rtx | x, |
const_rtx | old_rtx, | ||
rtx(* | fn )(rtx, const_rtx, void *), | ||
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(), GET_CODE, GET_MODE, GET_NUM_ELEM, GET_RTX_CLASS, GET_RTX_FORMAT, i, NULL, replace_equiv_address_nv(), RTVEC_ELT, 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(), shallow_copy_rtx(), simplify_gen_binary(), simplify_gen_relational(), simplify_gen_subreg(), simplify_gen_ternary(), simplify_gen_unary(), simplify_replace_fn_rtx(), split_const(), SUBREG_BYTE, SUBREG_REG, UNLIKELY, XEXP, and XVEC.
Referenced by adjust_cleared_regs(), adjust_mem_stores(), adjust_mem_uses(), adjust_mems(), combine_and_move_insns(), cse_process_note(), delete_trivially_dead_insns(), lra_constraints(), prepare_call_arguments(), propagate_for_debug(), simplify_replace_fn_rtx(), simplify_replace_rtx(), and update_equiv().
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().
Referenced by bypass_block(), cprop_jump(), emit_input_reload_insns(), fixup_debug_insns(), forward_propagate_and_simplify(), implies_p(), maybe_merge_cfa_adjust(), noce_convert_multiple_sets_1(), reload(), replace_in_expr(), replace_single_def_regs(), simplify_using_condition(), try_combine(), try_replace_in_use(), and try_replace_reg().
OP0 and OP1 are combined under an operation of mode MODE that can potentially result in a ROTATE expression. Analyze the OP0 and OP1 and return the resulting ROTATE expression if so. Return NULL otherwise. This is used in detecting the patterns (X << C1) [+,|,^] (X >> C2) where C1 + C2 == GET_MODE_UNIT_PRECISION (mode). (X << C1) and (C >> C2) would be OP0 and OP1.
References CONST_INT_P, extract_ashift_operands_p(), GET_CODE, GET_MODE, GET_MODE_PRECISION(), GET_MODE_SIZE(), GET_MODE_UNIT_PRECISION, INTVAL, is_a(), known_eq, NULL_RTX, rtx_equal_p(), SUBREG_BYTE, SUBREG_REG, unwrap_const_vec_duplicate(), and XEXP.
Referenced by simplify_context::simplify_binary_operation_1().
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.cc. This code uses various CSE specific information to aid in RTL simplification. 2. simplify_rtx in combine.cc. 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.cc & combine.cc 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 GET_CODE, GET_MODE, GET_RTX_CLASS, NULL, 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(), SUBREG_BYTE, SUBREG_REG, swap_commutative_operands_p(), and XEXP.
Referenced by combine_set_extension(), cselib_expand_value_rtx_1(), simplify_context::simplify_relational_operation_1(), simplify_set(), simplify_subtraction(), try_replace_reg(), and validate_simplify_insn().
|
static |
If COMPARISON can be treated as an unsigned comparison, return a mask that represents it (8 if it includes <, 4 if it includes > and 2 if it includes ==). Return 0 otherwise.
Referenced by simplify_context::simplify_logical_relational_operation().
bool val_signbit_known_clear_p | ( | machine_mode | mode, |
unsigned HOST_WIDE_INT | val ) |
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 GET_MODE_PRECISION(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, and is_int_mode().
Referenced by simplify_shift_const_1(), and simplify_context::simplify_unary_operation_1().
bool val_signbit_known_set_p | ( | machine_mode | mode, |
unsigned HOST_WIDE_INT | val ) |
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 GET_MODE_PRECISION(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, and is_int_mode().
Referenced by canonicalize_condition(), emit_cstore(), emit_store_flag_1(), find_comparison_args(), nonzero_bits1(), sign_extend_short_imm(), and simplify_comparison().
bool val_signbit_p | ( | machine_mode | mode, |
unsigned HOST_WIDE_INT | val ) |
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 GET_MODE_MASK, GET_MODE_PRECISION(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, and is_int_mode().
Referenced by combine_simplify_rtx(), emit_store_flag(), emit_store_flag_1(), force_int_to_mode(), and simplify_context::simplify_binary_operation_1().