GCC Middle and Back End API Reference
|
Enumerations | |
enum | comparison_code { COMPCODE_FALSE = 0, COMPCODE_LT = 1, COMPCODE_EQ = 2, COMPCODE_LE = 3, COMPCODE_GT = 4, COMPCODE_LTGT = 5, COMPCODE_GE = 6, COMPCODE_ORD = 7, COMPCODE_UNORD = 8, COMPCODE_UNLT = 9, COMPCODE_UNEQ = 10, COMPCODE_UNLE = 11, COMPCODE_UNGT = 12, COMPCODE_NE = 13, COMPCODE_UNGE = 14, COMPCODE_TRUE = 15 } |
Variables | |
int | folding_initializer = 0 |
static int | fold_deferring_overflow_warnings |
static const char * | fold_deferred_overflow_warning |
static enum warn_strict_overflow_code | fold_deferred_overflow_code |
int | pedantic_lvalues |
enum comparison_code |
The following constants represent a bit based encoding of GCC's comparison operators. This encoding simplifies transformations on relational comparison operators, such as AND and OR.
|
static |
Referenced by fold_truth_andor_1().
|
static |
Return nonzero if MASK represents a mask of SIZE ones in the low-order bit positions.
References build_int_cst_type(), const_binop(), signed_type_for(), and tree_int_cst_equal().
|
static |
Referenced by fold_binary_loc().
|
static |
Re-associate trees split by the above function. T1 and T2 are either expressions to associate or null. Return the new expression, if any. LOC is the location of the new expression. If we build an operation, do it in TYPE and with CODE.
References fold_convert_loc(), and integer_zerop().
tree build_fold_addr_expr_loc | ( | ) |
Build an expression for the address of T.
References build_fold_addr_expr_with_type_loc(), and build_pointer_type().
Referenced by build_fold_addr_expr_with_type_loc(), create_task_copyfn(), expand_task_call(), expand_thunk(), fold_comparison(), fold_gimple_assign(), fold_unary_loc(), gimple_fold_stmt_to_constant_1(), gimplify_addr_expr(), gimplify_cond_expr(), gimplify_expr(), gimplify_modify_expr_to_memcpy(), gimplify_modify_expr_to_memset(), gimplify_va_arg_expr(), gimplify_variable_sized_compare(), initialize_argument_information(), lower_copyprivate_clauses(), lower_omp_critical(), lower_omp_single_copy(), lower_omp_taskreg(), lower_rec_input_clauses(), lower_reduction_clauses(), lower_send_clauses(), split_address_to_core_and_offset(), and try_move_mult_to_index().
tree build_fold_addr_expr_with_type_loc | ( | ) |
Build an expression for the address of T. Folds away INDIRECT_REF to avoid confusing the gimplify process.
References build_fold_addr_expr_loc(), fold_convert_loc(), and integer_zerop().
Referenced by build_fold_addr_expr_loc(), gimplify_expr(), and stabilize_va_list_loc().
tree build_fold_indirect_ref_loc | ( | ) |
Builds an expression for an indirection through T, simplifying some cases.
References fold_indirect_ref_1().
Referenced by fold_binary_loc(), fold_builtin_frexp(), fold_builtin_memset(), fold_builtin_modf(), fold_builtin_sincos(), fold_indirect_ref_1(), lower_copyprivate_clauses(), and optimize_stdarg_builtin().
Given a range, LOW, HIGH, and IN_P, an expression, EXP, and a result type, TYPE, return an expression to test if EXP is in (or out of, depending on IN_P) the range. Return 0 if the test couldn't be created.
References build_int_cst(), build_nonstandard_integer_type(), build_range_check(), const_binop(), fold_build_pointer_plus_loc(), fold_convert_loc(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT_M1U, integer_onep(), integer_zerop(), invert_truthvalue_loc(), operand_equal_p(), range_binop(), signed_type_for(), lang_hooks_for_types::type_for_size, lang_hooks::types, and unsigned_type_for().
Referenced by build_range_check(), fold_div_compare(), fold_range_test(), and update_range_test().
|
static |
Construct a vector of zero elements of vector type TYPE.
References build_vector_from_val(), and fold_convert_const().
Referenced by fold_convert_loc().
|
static |
Returns true if we can interpret the contents of a native encoding as TYPE.
Referenced by fold_ternary_loc().
tree combine_comparisons | ( | location_t | loc, |
enum tree_code | code, | ||
enum tree_code | lcode, | ||
enum tree_code | rcode, | ||
tree | truth_type, | ||
tree | ll_arg, | ||
tree | lr_arg | ||
) |
Return a tree for the comparison which is the combination of doing the AND or OR (depending on CODE) of the two operations LCODE and RCODE on the identical operands LL_ARG and LR_ARG. Take into account the possibility of trapping if the mode has NaNs, and return NULL_TREE if this makes the transformation invalid.
References comparison_to_compcode(), COMPCODE_EQ, COMPCODE_FALSE, COMPCODE_LTGT, COMPCODE_NE, COMPCODE_ORD, compcode_to_comparison(), COMPCODE_TRUE, COMPCODE_UNORD, and constant_boolean_node().
Referenced by and_comparisons_1(), fold_truth_andor_1(), and or_comparisons_1().
|
static |
Referenced by combine_comparisons().
|
static |
Convert a comparison tree code from an enum tree_code representation into a compcode bit-based encoding. This function is the inverse of compcode_to_comparison.
References COMPCODE_EQ, COMPCODE_GE, COMPCODE_GT, COMPCODE_LE, COMPCODE_LT, COMPCODE_LTGT, COMPCODE_NE, COMPCODE_ORD, COMPCODE_UNEQ, COMPCODE_UNGE, COMPCODE_UNGT, COMPCODE_UNLE, COMPCODE_UNLT, and COMPCODE_UNORD.
|
static |
Referenced by combine_comparisons().
|
static |
Convert a compcode bit-based encoding of a comparison operator back to GCC's enum tree_code representation. This function is the inverse of comparison_to_compcode.
References COMPCODE_EQ, COMPCODE_GE, COMPCODE_GT, COMPCODE_LE, COMPCODE_LT, COMPCODE_LTGT, COMPCODE_NE, COMPCODE_ORD, COMPCODE_UNEQ, COMPCODE_UNGE, COMPCODE_UNGT, COMPCODE_UNLE, COMPCODE_UNLT, and COMPCODE_UNORD.
Referenced by all_ones_mask_p(), build_range_check(), const_binop(), decode_field_reference(), extract_muldiv_1(), fold_binary_loc(), fold_comparison(), fold_cond_expr_with_comparison(), fold_ternary_loc(), fold_truth_andor_1(), fold_unary_loc(), multiple_of_p(), optimize_bit_field_compare(), and unextend().
|
static |
Combine two constants ARG1 and ARG2 under operation CODE to produce a new constant. We assume ARG1 and ARG2 have the same data type, or at least are the same kind of constant and the same machine mode. Return zero if combining the constants is not allowed in the current operating mode.
References build_complex(), build_fixed(), build_real(), build_zero_cst(), const_binop(), count, d1, d2, dconst0, do_mpc_arg2(), f1, f2, fixed_arithmetic(), FIXED_VALUE_TYPE, fold_abs_const(), folding_initializer, host_integerp(), HOST_WIDE_INT, i1, i2, int_const_binop(), integer_nonzerop(), offset, real_arithmetic(), real_convert(), real_identical(), tree_low_cst(), and type().
tree constant_boolean_node | ( | ) |
Return a node which has the indicated constant VALUE (either 0 or 1 for scalars or {-1,-1,..} or {0,0,...} for vectors), and is of the indicated TYPE.
References build_int_cst(), and build_vector_from_val().
Referenced by combine_comparisons(), do_store_flag(), fold_binary_loc(), fold_binary_op_with_conditional_arg(), fold_comparison(), fold_relational_const(), fold_truth_andor_1(), fold_truth_not_expr(), fold_unary_loc(), optimize_bit_field_compare(), and range_binop().
|
static |
Callback for walk_tree, looking for LABEL_EXPR. Return *TP if it is a LABEL_EXPR; otherwise return NULL_TREE. Do not check the subtrees of GOTO_EXPR.
Referenced by contains_label_p().
|
static |
Return whether the sub-tree ST contains a label which is accessible from outside the sub-tree.
References contains_label_1().
Referenced by fold_ternary_loc().
DEBUG_FUNCTION void debug_fold_checksum | ( | ) |
Helper function for outputting the checksum of a tree T. When debugging with gdb, you can "define mynext" to be "next" followed by "call debug_fold_checksum (op0)", then just trace down till the outputs differ.
References hash_table< Descriptor, Allocator >::create(), and fold_checksum_tree().
|
static |
Subroutine for fold_truth_andor_1: decode a field reference. If EXP is a comparison reference, we return the innermost reference. *PBITSIZE is set to the number of bits in the reference, *PBITPOS is set to the starting bit number. If the innermost field can be completely contained in a mode-sized unit, *PMODE is set to that mode. Otherwise, it is set to VOIDmode. *PVOLATILEP is set to 1 if the any expression encountered is volatile; otherwise it is not changed. *PUNSIGNEDP is set to the signedness of the field. *PMASK is set to the mask used. This is either contained in a BIT_AND_EXPR or derived from the width of the field. *PAND_MASK is set to the mask found in a BIT_AND_EXPR, if any. Return 0 if this is not a component reference or is one that we can't do anything with.
References build_int_cst_type(), const_binop(), fold_convert_loc(), get_inner_reference(), offset, lang_hooks_for_types::type_for_size, and lang_hooks::types.
Referenced by fold_truth_andor_1().
|
static |
Given a bit-wise operation CODE applied to ARG0 and ARG1, see if both operands are another bit-wise operation with a common input. If so, distribute the bit operations to save an operation and possibly two if constants are involved. For example, convert (A | B) & (A | C) into A | (B & C) Further simplification will occur if B and C are constants. If this optimization cannot be done, 0 will be returned.
References fold_convert_loc(), and operand_equal_p().
Referenced by fold_binary_loc().
|
static |
Knowing that ARG0 and ARG1 are both RDIV_EXPRs, simplify a binary operation with code CODE. This optimization is unsafe.
References build_real(), dconst1, operand_equal_p(), and real_arithmetic().
Referenced by fold_binary_loc().
tree div_if_zero_remainder | ( | ) |
If ARG2 divides ARG1 with zero remainder, carries out the division of type CODE and returns the quotient. Otherwise returns NULL_TREE.
References build_int_cst_wide(), double_int::divmod(), double_int::high, double_int::is_zero(), double_int::low, and tree_to_double_int().
Referenced by try_move_mult_to_index(), and verify_gimple_assign_binary().
|
static |
ARG is a tree that is known to contain just arithmetic operations and comparisons. Evaluate the operations in the tree substituting NEW0 for any occurrence of OLD0 as an operand of a comparison and likewise for NEW1 and OLD1.
References operand_equal_p(), tcc_binary, tcc_comparison, tcc_expression, and tcc_unary.
Referenced by fold_comparison().
|
static |
If the real or vector real constant CST of type TYPE has an exact inverse, return it, else return NULL.
References build_real(), and exact_real_inverse().
Referenced by fold_binary_loc().
|
static |
Return EXPR_LOCATION of T if it is not UNKNOWN_LOCATION. Otherwise, return LOC.
Referenced by fold_ternary_loc(), and fold_truth_not_expr().
|
static |
T is an integer expression that is being multiplied, divided, or taken a modulus (CODE says which and what kind of divide or modulus) by a constant C. See if we can eliminate that operation by folding it with other operations already in T. WIDE_TYPE, if non-null, is a type that should be used for the computation if wider than our type. For example, if we are dividing (X * 8) + (Y * 16) by 4, we can return (X * 2) + (Y * 4). We must, however, be assured that either the original expression would not overflow or that overflow is undefined for the type in the language in question. If we return a non-null expression, it is an equivalent form of the original computation, but need not be in the original type. We set *STRICT_OVERFLOW_P to true if the return values depends on signed overflow being undefined. Otherwise we do not change *STRICT_OVERFLOW_P.
References extract_muldiv_1().
Referenced by extract_muldiv_1(), and fold_binary_loc().
|
static |
When --enable-checking=fold, compute a digest of expr before and after actual fold call to see if fold did not accidentally change original expr.
References build_zero_cst(), fold_binary_loc(), fold_call_expr(), fold_ternary_loc(), fold_unary_loc(), HOST_WIDE_INT, tcc_constant, tcc_vl_exp, tree_int_cst_lt(), type_contains_placeholder_p(), and vec_safe_length().
tree fold_abs_const | ( | ) |
Return the tree for abs (ARG0) when ARG0 is known to be either an integer constant or real constant. TYPE is the type of the result.
References build_real(), force_fit_type_double(), double_int::is_negative(), double_int::neg_with_overflow(), real_value_negate(), and tree_to_double_int().
Referenced by const_binop(), fold_builtin_abs(), fold_builtin_fabs(), and fold_unary_loc().
|
static |
Try to fold a pointer difference of type TYPE two address expressions of array references AREF0 and AREF1 using location LOC. Return a simplified expression for the difference or NULL_TREE.
References array_ref_element_size(), build_int_cst(), fold_binary_loc(), fold_convert_loc(), and operand_equal_p().
Referenced by fold_binary_loc().
Fold a binary expression of code CODE and type TYPE with operands OP0 and OP1. LOC is the location of the resulting expression. Return the folded expression if folding is successful. Otherwise, return NULL_TREE.
References double_int::and_not(), associate_trees(), build_all_ones_cst(), build_call_expr_loc(), build_complex(), build_fold_indirect_ref_loc(), build_int_cst(), build_int_cst_type(), build_minus_one_cst(), build_one_cst(), build_real(), build_zero_cst(), BUILT_IN_NORMAL, builtin_mathfn_code(), commutative_tree_code(), compare_tree_int(), const_binop(), constant_boolean_node(), dconst1, dconst2, distribute_bit_expr(), distribute_real_division(), double_int_to_tree(), element_precision(), exact_inverse(), exact_log2(), double_int::ext(), extract_muldiv(), fold_addr_of_array_ref_difference(), fold_binary_loc(), fold_binary_op_with_conditional_arg(), fold_build_pointer_plus_loc(), fold_comparison(), fold_convert_const(), fold_convert_loc(), fold_minmax(), fold_mult_zconjz(), fold_negate_const(), fold_overflow_warning(), fold_plusminus_mult_expr(), fold_real_zero_addition_p(), fold_relational_const(), fold_single_bit_test_into_sign_test(), fold_strip_sign_ops(), fold_to_nonsharp_ineq_using_bound(), fold_truth_andor(), fold_unary_loc(), double_int::from_uhwi(), get_addr_base_and_unit_offset(), get_callee_fndecl(), get_pointer_modulus_and_residue(), handled_component_p(), double_int::high, HOST_BITS_PER_WIDE_INT, host_integerp(), HOST_WIDE_INT, HOST_WIDE_INT_M1U, in_gimple_form, int_const_binop(), integer_all_onesp(), integer_minus_onep(), integer_nonzerop(), integer_onep(), integer_pow2p(), integer_zerop(), inverse(), invert_truthvalue_loc(), double_int::is_zero(), lookup_attribute(), double_int::low, double_int::mask(), mathfn_built_in(), multiple_of_p(), negate_expr(), negate_expr_p(), non_lvalue_loc(), OEP_ONLY_CONST, omit_one_operand_loc(), omit_two_operands_loc(), operand_equal_p(), optimize_bit_field_compare(), pedantic_non_lvalue_loc(), ptr_difference_const(), real_arithmetic(), real_minus_onep(), real_onep(), real_zerop(), reorder_operands_p(), shift, sign_bit_p(), signed_type_for(), split_tree(), strip_float_extensions(), tcc_binary, tcc_comparison, double_int::trailing_zeros(), tree_expr_nonnegative_p(), tree_expr_nonnegative_warnv_p(), tree_expr_nonzero_p(), tree_int_cst_equal(), tree_int_cst_lt(), tree_int_cst_sgn(), tree_log2(), tree_low_cst(), tree_strip_nop_conversions(), tree_swap_operands_p(), tree_to_double_int(), truth_value_p(), try_move_mult_to_index(), type(), uniform_vector_p(), unsigned_type_for(), vec_cst_ctor_to_array(), WARN_STRICT_OVERFLOW_ALL, WARN_STRICT_OVERFLOW_CONDITIONAL, and WARN_STRICT_OVERFLOW_MISC.
Referenced by ccp_fold(), cleanup_control_expr_graph(), combine_cond_expr_cond(), copy_prop_visit_cond_stmt(), fold(), fold_addr_of_array_ref_difference(), fold_binary_loc(), fold_build2_stat_loc(), fold_cond_expr_cond(), fold_gimple_assign(), fold_gimple_cond(), fold_to_nonsharp_ineq_using_bound(), gimple_fold_stmt_to_constant_1(), optimize_stmt(), propagate_rhs_into_lhs(), and try_move_mult_to_index().
|
static |
Transform `a + (b ? x : y)' into `b ? (a + x) : (a + y)'. Transform, `a + (x < y)' into `(x < y) ? (a + 1) : (a + 0)'. Here CODE corresponds to the `+', COND to the `(b ? x : y)' or `(x < y)' expression, and ARG to `a'. If COND_FIRST_P is nonzero, then the COND is the first argument to CODE; otherwise (as in the example given here), it is the second argument. TYPE is the type of the original expression. Return NULL_TREE if no simplification is possible.
References constant_boolean_node(), and fold_convert_loc().
Referenced by fold_binary_loc().
tree fold_binary_to_constant | ( | ) |
Given the components of a binary expression CODE, TYPE, OP0 and OP1, attempt to fold the expression to a constant without modifying TYPE, OP0 or OP1. If the expression could be simplified to a constant, then return the constant. If the expression would not be simplified to a constant, then return NULL_TREE.
Referenced by compare_values_warnv(), evaluate_conditions_for_known_args(), maybe_fold_tmr(), number_of_iterations_cond(), number_of_iterations_ne(), and operand_less_p().
tree fold_build1_initializer_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree | op | ||
) |
tree fold_build1_stat_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree op0 | MEM_STAT_DECL | ||
) |
Fold a unary tree expression with code CODE of type TYPE with an operand OP0. LOC is the location of the resulting expression. Return a folded expression if successful. Otherwise, return a tree expression with code CODE of type TYPE with an operand OP0.
References build1_stat_loc(), hash_table< Descriptor, Allocator >::create(), fold_check_failed(), fold_checksum_tree(), and fold_unary_loc().
tree fold_build2_initializer_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree | op0, | ||
tree | op1 | ||
) |
tree fold_build2_stat_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree | op0, | ||
tree op1 | MEM_STAT_DECL | ||
) |
Fold a binary tree expression with code CODE of type TYPE with operands OP0 and OP1. LOC is the location of the resulting expression. Return a folded expression if successful. Otherwise, return a tree expression with code CODE of type TYPE with operands OP0 and OP1.
References build2_stat_loc(), hash_table< Descriptor, Allocator >::create(), fold_binary_loc(), fold_check_failed(), and fold_checksum_tree().
tree fold_build3_initializer_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree | op0, | ||
tree | op1, | ||
tree | op2 | ||
) |
tree fold_build3_stat_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree | op0, | ||
tree | op1, | ||
tree op2 | MEM_STAT_DECL | ||
) |
Fold a ternary tree expression with code CODE of type TYPE with operands OP0, OP1, and OP2. Return a folded expression if successful. Otherwise, return a tree expression with code CODE of type TYPE with operands OP0, OP1, and OP2.
References build3_stat_loc(), hash_table< Descriptor, Allocator >::create(), fold_check_failed(), fold_checksum_tree(), fold_ternary_loc(), and tcc_vl_exp.
tree fold_build_call_array_initializer_loc | ( | location_t | loc, |
tree | type, | ||
tree | fn, | ||
int | nargs, | ||
tree * | argarray | ||
) |
References fold_build_call_array_loc().
tree fold_build_call_array_loc | ( | location_t | loc, |
tree | type, | ||
tree | fn, | ||
int | nargs, | ||
tree * | argarray | ||
) |
Fold a CALL_EXPR expression of type TYPE with operands FN and NARGS arguments in ARGARRAY, and a null static chain. Return a folded expression if successful. Otherwise, return a CALL_EXPR of type TYPE from the given operands as constructed by build_call_array.
References hash_table< Descriptor, Allocator >::create(), fold_builtin_call_array(), fold_check_failed(), and fold_checksum_tree().
Referenced by fold_build_call_array_initializer_loc().
tree fold_build_cleanup_point_expr | ( | ) |
If necessary, return a CLEANUP_POINT_EXPR for EXPR with the indicated TYPE. If no CLEANUP_POINT_EXPR is necessary, return EXPR itself.
|
static |
Referenced by fold_build1_stat_loc(), fold_build2_stat_loc(), fold_build3_stat_loc(), and fold_build_call_array_loc().
|
static |
References internal_error().
|
static |
References hash_table< Descriptor, Allocator >::find_slot(), len, memcpy(), tcc_binary, tcc_comparison, tcc_constant, tcc_declaration, tcc_exceptional, tcc_expression, tcc_reference, tcc_statement, tcc_type, tcc_unary, tcc_vl_exp, and tree_size().
Referenced by debug_fold_checksum(), fold_build1_stat_loc(), fold_build2_stat_loc(), fold_build3_stat_loc(), fold_build_call_array_loc(), and print_fold_checksum().
|
static |
Subroutine of fold_binary. This routine performs all of the transformations that are common to the equality/inequality operators (EQ_EXPR and NE_EXPR) and the ordering operators (LT_EXPR, LE_EXPR, GE_EXPR and GT_EXPR). Callers other than fold_binary should call fold_binary. Fold a comparison with tree code CODE and type TYPE with operands OP0 and OP1. Return the folded comparison or NULL_TREE.
References auto_var_in_fn_p(), build_fold_addr_expr_loc(), build_int_cst(), build_real(), builtin_mathfn_code(), const_binop(), constant_boolean_node(), current_function_decl, dconst0, END_BUILTINS, eval_subst(), fold_convert_loc(), fold_div_compare(), fold_inf_compare(), fold_mathfn_compare(), fold_overflow_warning(), fold_relational_const(), fold_sign_changed_comparison(), fold_widened_comparison(), get_inner_reference(), host_integerp(), HOST_WIDE_INT, int_const_binop(), integer_onep(), integer_zerop(), maybe_canonicalize_comparison(), omit_one_operand_loc(), omit_two_operands_loc(), operand_equal_p(), optimize_minmax_comparison(), pointer_may_wrap_p(), real_value_negate(), save_expr(), size_low_cst(), strip_float_extensions(), swap_tree_comparison(), targetm, tree_int_cst_compare(), tree_int_cst_sgn(), tree_swap_operands_p(), twoval_comparison_p(), WARN_STRICT_OVERFLOW_COMPARISON, and WARN_STRICT_OVERFLOW_CONDITIONAL.
Referenced by fold_binary_loc().
|
static |
Subroutine of fold, looking inside expressions of the form A op B ? A : C, where ARG0, ARG1 and ARG2 are the three operands of the COND_EXPR. This function is being used also to optimize A op B ? C : A, by reversing the comparison first. Return a folded expression whose code is not a COND_EXPR anymore, or NULL_TREE if no folding opportunity is found.
References build_int_cst(), build_zero_cst(), const_binop(), fold_convert_loc(), in_gimple_form, integer_zerop(), maybe_lvalue_p(), lang_hooks::name, negate_expr(), OEP_ONLY_CONST, operand_equal_for_comparison_p(), operand_equal_p(), pedantic_non_lvalue_loc(), real_zerop(), signed_type_for(), tcc_comparison, and type().
Referenced by fold_ternary_loc().
Referenced by build_zero_vector(), fold_binary_loc(), fold_convert_loc(), and fold_unary_loc().
|
static |
Attempt to fold type conversion operation CODE of expression ARG1 to type TYPE. If no simplification can be done return NULL_TREE.
References build_real_from_int_cst(), fold_convert_const_fixed_from_fixed(), fold_convert_const_fixed_from_int(), fold_convert_const_fixed_from_real(), fold_convert_const_int_from_fixed(), fold_convert_const_int_from_int(), fold_convert_const_int_from_real(), fold_convert_const_real_from_fixed(), and fold_convert_const_real_from_real().
|
static |
A subroutine of fold_convert_const handling conversions a FIXED_CST to another fixed-point type.
References build_fixed(), fixed_convert(), and FIXED_VALUE_TYPE.
Referenced by fold_convert_const().
|
static |
A subroutine of fold_convert_const handling conversions an INTEGER_CST to a fixed-point type.
References build_fixed(), fixed_convert_from_int(), and FIXED_VALUE_TYPE.
Referenced by fold_convert_const().
|
static |
A subroutine of fold_convert_const handling conversions a REAL_CST to a fixed-point type.
References build_fixed(), fixed_convert_from_real(), and FIXED_VALUE_TYPE.
Referenced by fold_convert_const().
|
static |
A subroutine of fold_convert_const handling conversions of a FIXED_CST to an integer type.
References force_fit_type_double(), double_int::is_negative(), double_int::lshift(), and double_int::rshift().
Referenced by fold_convert_const().
|
static |
A subroutine of fold_convert_const handling conversions of an INTEGER_CST to another integer type.
References force_fit_type_double(), and tree_to_double_int().
Referenced by fold_convert_const().
|
static |
A subroutine of fold_convert_const handling conversions a REAL_CST to an integer type.
References force_fit_type_double(), double_int::high, HOST_WIDE_INT, double_int::low, real_to_integer2(), real_trunc(), real_value_from_int_cst(), and tree_to_double_int().
Referenced by fold_convert_const().
|
static |
A subroutine of fold_convert_const handling conversions a FIXED_CST to a floating point type.
References build_real(), and real_convert_from_fixed().
Referenced by fold_convert_const().
|
static |
A subroutine of fold_convert_const handling conversions a REAL_CST to another floating point type.
References build_real(), and real_convert().
Referenced by fold_convert_const().
tree fold_convert_loc | ( | ) |
Convert expression ARG to type TYPE. Used by the middle-end for simple conversions in preference to calling the front-end's convert.
References build_zero_vector(), fold_convert_const(), fold_ignored_result(), integer_zerop(), protected_set_expr_location_unshare(), save_expr(), and tree_int_cst_equal().
Referenced by adjust_related_strinfos(), array_ref_element_size(), associate_trees(), build_addr_arg_loc(), build_arrays(), build_builtin_expect_predicate(), build_fold_addr_expr_with_type_loc(), build_range_check(), build_size_arg_loc(), component_ref_field_offset(), conditional_replacement(), decode_field_reference(), distribute_bit_expr(), expand_builtin_bzero(), expand_builtin_memcmp(), expand_builtin_strncmp(), expand_expr_real_1(), expand_expr_real_2(), expand_omp_atomic_fetch_op(), expand_parallel_call(), extract_omp_for_data(), fold_addr_of_array_ref_difference(), fold_binary_loc(), fold_binary_op_with_conditional_arg(), fold_builtin_abs(), fold_builtin_bzero(), fold_builtin_copysign(), fold_builtin_expect(), fold_builtin_exponent(), fold_builtin_fabs(), fold_builtin_fmin_fmax(), fold_builtin_fprintf(), fold_builtin_isdigit(), fold_builtin_logarithm(), fold_builtin_logb(), fold_builtin_memchr(), fold_builtin_memcmp(), fold_builtin_memory_chk(), fold_builtin_memory_op(), fold_builtin_memset(), fold_builtin_printf(), fold_builtin_significand(), fold_builtin_snprintf(), fold_builtin_sprintf(), fold_builtin_stpcpy(), fold_builtin_strchr(), fold_builtin_strcmp(), fold_builtin_strcpy(), fold_builtin_strlen(), fold_builtin_strncmp(), fold_builtin_strncpy(), fold_builtin_strpbrk(), fold_builtin_strrchr(), fold_builtin_strstr(), fold_builtin_stxcpy_chk(), fold_builtin_unordered_cmp(), fold_comparison(), fold_cond_expr_with_comparison(), fold_fixed_mathfn(), fold_negate_expr(), fold_plusminus_mult_expr(), fold_read_from_constant_string(), fold_sign_changed_comparison(), fold_single_bit_test(), fold_single_bit_test_into_sign_test(), fold_ternary_loc(), fold_to_nonsharp_ineq_using_bound(), fold_trunc_transparent_mathfn(), fold_truth_andor_1(), fold_unary_loc(), fold_widened_comparison(), gen_inbound_check(), get_string_length(), get_ws_args_for(), gimple_boolify(), gimplify_addr_expr(), gimplify_expr(), gimplify_modify_expr(), gimplify_va_arg_expr(), handle_builtin_memcpy(), handle_builtin_strcat(), handle_builtin_strchr(), handle_builtin_strcpy(), handle_builtin_strlen(), ipa_modify_call_arguments(), layout_decl(), lower_builtin_setjmp(), lower_copyprivate_clauses(), lower_omp_single_copy(), lower_omp_single_simple(), lower_omp_taskreg(), lower_rec_input_clauses(), make_bit_field_ref(), make_range_step(), mf_build_check_statement_for(), mf_xform_derefs_1(), negate_expr(), omit_one_operand_loc(), omit_two_operands_loc(), omp_reduction_init(), optimize_bit_field_compare(), optimize_minmax_comparison(), optimize_stdarg_builtin(), pedantic_omit_one_operand_loc(), record_edge_info(), scan_omp_task(), simplify_bitwise_binary(), size_diffop_loc(), store_expr(), try_move_mult_to_index(), and update_range_test().
bool fold_convertible_p | ( | ) |
Returns true, if ARG is convertible to TYPE using a NOP_EXPR.
References tree_int_cst_equal().
Referenced by declare_return_variable(), gimple_check_call_args(), gimple_check_call_matching_types(), ipa_modify_call_arguments(), ipcp_transform_function(), setup_one_parameter(), and tree_function_versioning().
void fold_defer_overflow_warnings | ( | void | ) |
Start deferring overflow warnings. We could use a stack here to permit nested calls, but at present it is not necessary.
References fold_deferring_overflow_warnings.
Referenced by cleanup_control_expr_graph(), combine_cond_expr_cond(), estimate_numbers_of_iterations(), evaluate_stmt(), expand_simple_operations(), fold_cond_expr_cond(), fold_gimple_assign(), loop_niter_by_eval(), number_of_iterations_exit(), operand_less_p(), scev_probably_wraps_p(), simplify_binary_expression(), and simplify_control_stmt_condition().
bool fold_deferring_overflow_warnings_p | ( | void | ) |
Whether we are deferring overflow warnings.
References fold_deferring_overflow_warnings.
Referenced by verify_interpass_invariants().
|
static |
Subroutine of fold() that optimizes comparisons of a division by a nonzero integer constant against an integer constant, i.e. X/C1 op C2. CODE is the comparison operator: EQ_EXPR, NE_EXPR, GT_EXPR, LT_EXPR, GE_EXPR or LE_EXPR. TYPE is the type of the result and ARG0 and ARG1 are the operands of the comparison. ARG1 must be a TREE_REAL_CST. The function returns the constant folded tree if a simplification can be made, and NULL_TREE otherwise.
References double_int::add_with_sign(), build_int_cst(), build_range_check(), fold_negate_const(), force_fit_type_double(), int_const_binop(), double_int::mul_with_sign(), omit_one_operand_loc(), swap_tree_comparison(), and tree_int_cst_sgn().
Referenced by fold_comparison().
tree fold_ignored_result | ( | ) |
Strip non-trapping, non-side-effecting tree nodes from an expression whose result is ignored. The type of the returned tree need not be the same as the original expression.
References tcc_binary, tcc_comparison, tcc_expression, and tcc_unary.
Referenced by fold_convert_loc(), gimple_fold_builtin(), omit_one_operand_loc(), and pedantic_omit_one_operand_loc().
tree fold_indirect_ref_1 | ( | ) |
Given a pointer value OP0 and a type TYPE, return a simplified version of an indirection through OP0, or NULL_TREE if no simplification is possible.
References build_fold_indirect_ref_loc(), fold_read_from_constant_string(), HOST_WIDE_INT, in_gimple_form, offset, size_binop_loc(), tree_int_cst_equal(), and tree_low_cst().
Referenced by build_fold_indirect_ref_loc(), copy_tree_body_r(), and fold_indirect_ref_loc().
tree fold_indirect_ref_loc | ( | ) |
Given an INDIRECT_REF T, return either T or a simplified version.
References fold_indirect_ref_1().
Referenced by gimplify_compound_lval(), and gimplify_expr().
|
static |
Subroutine of fold() that optimizes comparisons against Infinities, either +Inf or -Inf. CODE is the comparison operator: EQ_EXPR, NE_EXPR, GT_EXPR, LT_EXPR, GE_EXPR or LE_EXPR. TYPE is the type of the result and ARG0 and ARG1 are the operands of the comparison. ARG1 must be a TREE_REAL_CST. The function returns the constant folded tree if a simplification can be made, and NULL_TREE otherwise.
References build_real(), omit_one_operand_loc(), real_maxval(), save_expr(), and swap_tree_comparison().
Referenced by fold_comparison().
|
static |
Fold the truth-negation of ARG. This never alters ARG itself. We assume that ARG is an operation that returns a truth value (0 or 1 for scalars, 0 or -1 for vectors). Return the folded expression if folding is successful. Otherwise, return NULL_TREE.
References fold_unary_loc().
Referenced by fold_ternary_loc().
|
static |
Subroutine of fold() that checks comparisons of built-in math functions against real constants. FCODE is the DECL_FUNCTION_CODE of the built-in, CODE is the comparison operator: EQ_EXPR, NE_EXPR, GT_EXPR, LT_EXPR, GE_EXPR or LE_EXPR. TYPE is the type of the result and ARG0 and ARG1 are the operands of the comparison. ARG1 must be a TREE_REAL_CST. The function returns the constant folded tree if a simplification can be made, and NULL_TREE otherwise.
References build_real(), dconst0, omit_one_operand_loc(), real_convert(), and save_expr().
Referenced by fold_comparison().
|
static |
Fold a binary expression of code CODE and type TYPE with operands OP0 and OP1, containing either a MIN-MAX or a MAX-MIN combination. Return the folded expression if folding is successful. Otherwise, return NULL_TREE.
References omit_one_operand_loc(), operand_equal_p(), and reorder_operands_p().
Referenced by fold_binary_loc().
|
static |
Subroutine of fold_binary. Optimize complex multiplications of the form z * conj(z), as pow(realpart(z),2) + pow(imagpart(z),2). The argument EXPR represents the expression "z" of type TYPE.
References build_zero_cst(), and save_expr().
Referenced by fold_binary_loc().
Referenced by fold_binary_loc(), fold_div_compare(), and fold_negate_expr().
|
static |
Return the tree for neg (ARG0) when ARG0 is known to be either an integer constant, real, or fixed-point constant. TYPE is the type of the result.
References build_fixed(), build_real(), fixed_arithmetic(), FIXED_VALUE_TYPE, force_fit_type_double(), double_int::neg_with_overflow(), real_value_negate(), and tree_to_double_int().
|
static |
Given T, an expression, return a folded tree for -T or NULL_TREE, if no simplification is possible. If negate_expr_p would return true for T, NULL_TREE will never be returned.
References build_call_expr_loc(), build_complex(), build_one_cst(), builtin_mathfn_code(), count, fold_convert_loc(), fold_negate_const(), fold_overflow_warning(), get_callee_fndecl(), HOST_WIDE_INT, integer_onep(), negate_expr(), negate_expr_p(), negate_mathfn_p(), reorder_operands_p(), signed_type_for(), strip_float_extensions(), tree_int_cst_equal(), unsigned_type_for(), and WARN_STRICT_OVERFLOW_MISC.
Referenced by fold_unary_loc(), and negate_expr().
|
static |
Referenced by fold_unary_loc().
|
static |
Return the tree for not (ARG0) when ARG0 is known to be an integer constant. TYPE is the type of the result.
References force_fit_type_double(), and tree_to_double_int().
|
static |
This is called when we fold something based on the fact that signed overflow is undefined.
References fold_deferred_overflow_code, fold_deferred_overflow_warning, fold_deferring_overflow_warnings, and warning().
Referenced by fold_binary_loc(), fold_comparison(), fold_negate_expr(), fold_range_test(), maybe_canonicalize_comparison(), tree_expr_nonnegative_p(), and tree_expr_nonzero_p().
|
static |
Fold a sum or difference of at least one multiplication. Returns the folded tree or NULL if no simplification could be made.
References absu_hwi(), build_int_cst(), build_one_cst(), exact_log2(), fold_convert_loc(), host_integerp(), HOST_WIDE_INT, negate_expr(), negate_expr_p(), operand_equal_p(), and swap().
Referenced by fold_binary_loc().
|
static |
EXP is some logical combination of boolean tests. See if we can merge it into some range test. Return the new tree if so.
References build_range_check(), lang_hooks::decls, fold_overflow_warning(), lang_hooks_for_decls::global_bindings_p, invert_truthvalue_loc(), make_range(), merge_ranges(), operand_equal_p(), save_expr(), simple_operand_p(), and WARN_STRICT_OVERFLOW_COMPARISON.
Referenced by fold_truth_andor().
tree fold_read_from_constant_string | ( | ) |
If EXP represents referencing an element in a constant string (either via pointer arithmetic or array indexing), return the tree representing the value accessed, otherwise return NULL.
References array_ref_low_bound(), build_int_cst_type(), compare_tree_int(), fold_convert_loc(), integer_zerop(), size_diffop_loc(), and string_constant().
Referenced by expand_expr_real_1(), fold_const_aggregate_ref_1(), and fold_indirect_ref_1().
bool fold_real_zero_addition_p | ( | ) |
Subroutine of fold() that checks for the addition of +/- 0.0. If !NEGATE, return true if ADDEND is +/-0.0 and, for all X of type TYPE, X + ADDEND is the same as X. If NEGATE, return true if X - ADDEND is the same as X. X + 0 and X - 0 both give X when X is NaN, infinite, or nonzero and finite. The problematic cases are when X is zero, and its mode has signed zeros. In the case of rounding towards -infinity, X - 0 is not the same as X because 0 - 0 is -0. In other rounding modes, X + 0 is not the same as X because -0 + 0 is 0.
References real_zerop().
Referenced by eliminate_using_constants(), and fold_binary_loc().
Referenced by fold_binary_loc(), fold_comparison(), fold_relational_const(), and fold_widened_comparison().
|
static |
Given CODE, a relational operator, the target type, TYPE and two constant operands OP0 and OP1, return the result of the relational operation. If the result is not a compile time constant, then return NULL_TREE.
References build_int_cst(), constant_boolean_node(), count, fixed_compare(), FIXED_VALUE_TYPE, fold_relational_const(), integer_zerop(), invert_tree_comparison(), real_compare(), real_isnan(), swap_tree_comparison(), and tree_int_cst_equal().
|
static |
Fold comparison ARG0 CODE ARG1 (with result in TYPE), where for ARG0 just the signedness is changed.
References fold_convert_loc(), force_fit_type_double(), and tree_to_double_int().
Referenced by fold_comparison().
tree fold_single_bit_test | ( | location_t | loc, |
enum tree_code | code, | ||
tree | arg0, | ||
tree | arg1, | ||
tree | result_type | ||
) |
If CODE with arguments ARG0 and ARG1 represents a single bit equality/inequality test, then return a simplified form of the test using shifts and logical operations. Otherwise return NULL. TYPE is the desired result type.
References build_int_cst(), compare_tree_int(), fold_convert_loc(), fold_single_bit_test_into_sign_test(), integer_pow2p(), integer_zerop(), tree_log2(), lang_hooks_for_types::type_for_mode, and lang_hooks::types.
Referenced by do_store_flag().
|
static |
If CODE with arguments ARG0 and ARG1 represents a single bit equality/inequality test, then return a simplified form of the test using a sign testing. Otherwise return NULL. TYPE is the desired result type.
References build_int_cst(), fold_convert_loc(), integer_pow2p(), integer_zerop(), sign_bit_p(), and signed_type_for().
Referenced by fold_binary_loc(), and fold_single_bit_test().
tree fold_strip_sign_ops | ( | ) |
Simplify the floating point expression EXP when the sign of the result is not significant. Return NULL_TREE if no simplification is possible.
References build_call_expr_loc(), builtin_mathfn_code(), get_callee_fndecl(), negate_mathfn_p(), and omit_one_operand_loc().
Referenced by fold_binary_loc(), fold_builtin_ccos(), fold_builtin_copysign(), fold_builtin_cos(), fold_builtin_cosh(), fold_builtin_hypot(), fold_builtin_pow(), and fold_unary_loc().
tree fold_ternary_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree | op0, | ||
tree | op1, | ||
tree | op2 | ||
) |
Fold a ternary expression of code CODE and type TYPE with operands OP0, OP1, and OP2. Return the folded expression if folding is successful. Otherwise, return NULL_TREE.
References build_constructor(), build_int_cst(), build_zero_cst(), can_native_interpret_type_p(), changed, const_binop(), contains_label_p(), expr_location_or(), fold_cond_expr_with_comparison(), fold_convert_loc(), fold_fma(), fold_invert_truthvalue(), fold_vec_perm(), HOST_BITS_PER_WIDE_INT, host_integerp(), HOST_WIDE_INT, HOST_WIDE_INT_M1U, integer_all_onesp(), integer_onep(), integer_pow2p(), integer_zerop(), invert_truthvalue_loc(), len, native_encode_expr(), native_interpret_expr(), OEP_ONLY_CONST, operand_equal_for_comparison_p(), operand_equal_p(), pedantic_non_lvalue_loc(), pedantic_omit_one_operand_loc(), sign_bit_p(), signed_type_for(), tree_log2(), tree_low_cst(), tree_swap_operands_p(), truth_value_p(), type_contains_placeholder_p(), unsigned_type_for(), and vec_alloc().
Referenced by fold(), fold_build3_stat_loc(), fold_gimple_assign(), gimple_fold_stmt_to_constant_1(), and maybe_fold_reference().
|
static |
Fold A < X && A + 1 > Y to A < X && A >= Y. Normally A + 1 > Y means A >= Y && A != MAX, but in this case we know that A < X <= MAX. INEQ is A + 1 > Y, BOUND is A < X.
References fold_binary_loc(), fold_convert_loc(), and integer_onep().
Referenced by fold_binary_loc().
|
static |
Fold a binary bitwise/truth expression of code CODE and type TYPE with operands OP0 and OP1. LOC is the location of the resulting expression. ARG0 and ARG1 are the NOP_STRIPed results of OP0 and OP1. Return the folded expression if folding is successful. Otherwise, return NULL_TREE.
References fold_range_test(), fold_truth_andor_1(), merge_truthop_with_opposite_arm(), operand_equal_p(), simple_operand_p_2(), and type().
Referenced by fold_binary_loc().
|
static |
Find ways of folding logical expressions of LHS and RHS: Try to merge two comparisons to the same innermost item. Look for range tests like "ch >= '0' && ch <= '9'". Look for combinations of simple terms on machines with expensive branches and evaluate the RHS unconditionally. For example, if we have p->a == 2 && p->b == 4 and we can make an object large enough to span both A and B, we can do this with a comparison against the object ANDed with the a mask. If we have p->a == q->a && p->b == q->b, we may be able to use bit masking operations to do this with one comparison. We check for both normal comparisons and the BIT_AND_EXPRs made this by function and the one above. CODE is the logical operation being done. It can be TRUTH_ANDIF_EXPR, TRUTH_AND_EXPR, TRUTH_ORIF_EXPR, or TRUTH_OR_EXPR. TRUTH_TYPE is the type of the logical operand and LHS and RHS are its two operands. We return the simplified tree or 0 if no optimization is possible.
References all_ones_mask_p(), build_int_cst(), cfun, combine_comparisons(), const_binop(), constant_boolean_node(), decode_field_reference(), fold_convert_loc(), get_best_mode(), HOST_WIDE_INT, integer_onep(), integer_pow2p(), integer_zerop(), make_bit_field_ref(), operand_equal_p(), optimize_function_for_speed_p(), simple_cst_equal(), simple_operand_p(), swap_tree_comparison(), tcc_comparison, type(), lang_hooks_for_types::type_for_size, lang_hooks::types, unextend(), warning(), and word_mode.
Referenced by fold_truth_andor().
|
static |
Return a simplified tree node for the truth-negation of ARG. This never alters ARG itself. We assume that ARG is an operation that returns a truth value (0 or 1). FIXME: one would think we would fold the result, but it causes problems with the dominator optimizer.
References build_int_cst(), constant_boolean_node(), expr_location_or(), integer_onep(), integer_zerop(), invert_tree_comparison(), invert_truthvalue_loc(), and tcc_comparison.
Referenced by fold_unary_loc().
tree fold_unary_ignore_overflow_loc | ( | location_t | loc, |
enum tree_code | code, | ||
tree | type, | ||
tree | op0 | ||
) |
If the operation was a conversion do _not_ mark a resulting constant with TREE_OVERFLOW if the original constant was not. These conversions have implementation defined behavior and retaining the TREE_OVERFLOW flag here would confuse later passes such as VRP.
References fold_unary_loc().
Referenced by gimple_fold_stmt_to_constant_1().
tree fold_unary_loc | ( | ) |
Fold a unary expression of code CODE and type TYPE with operand OP0. Return the folded expression if folding is successful. Otherwise, return NULL_TREE.
References build_call_expr_loc(), build_complex(), build_fold_addr_expr_loc(), build_int_cst(), build_zero_cst(), BUILT_IN_NORMAL, const_binop(), constant_boolean_node(), count, fold_abs_const(), fold_build_pointer_plus_loc(), fold_convert_const(), fold_convert_loc(), fold_negate_expr(), fold_not_const(), fold_strip_sign_ops(), fold_truth_not_expr(), fold_view_convert_expr(), force_fit_type_double(), get_callee_fndecl(), get_inner_reference(), handled_component_p(), HOST_BITS_PER_WIDE_INT, host_integerp(), HOST_WIDE_INT, HOST_WIDE_INT_M1U, integer_all_onesp(), integer_onep(), integer_zerop(), invert_tree_comparison(), mathfn_built_in(), negate_expr(), offset, omit_one_operand_loc(), strip_float_extensions(), tcc_unary, tree_expr_nonnegative_p(), tree_low_cst(), tree_to_double_int(), type(), TYPE_UNQUALIFIED, unsigned_type_for(), and vec_cst_ctor_to_array().
Referenced by expand_expr_real_1(), fold(), fold_binary_loc(), fold_build1_stat_loc(), fold_builtin_cexp(), fold_gimple_assign(), fold_invert_truthvalue(), fold_unary_ignore_overflow_loc(), gimple_fold_stmt_to_constant_1(), and maybe_fold_reference().
tree fold_unary_to_constant | ( | ) |
Given the components of a unary expression CODE, TYPE and OP0, attempt to fold the expression to a constant without modifying TYPE or OP0. If the expression could be simplified to a constant, then return the constant. If the expression would not be simplified to a constant, then return NULL_TREE.
Referenced by compare_values_warnv(), extract_range_from_binary_expr_1(), and extract_range_from_unary_expr_1().
void fold_undefer_and_ignore_overflow_warnings | ( | void | ) |
Stop deferring overflow warnings, ignoring any deferred warnings.
References fold_undefer_overflow_warnings().
Referenced by cleanup_control_expr_graph(), estimate_numbers_of_iterations(), expand_simple_operations(), loop_niter_by_eval(), number_of_iterations_exit(), operand_less_p(), and scev_probably_wraps_p().
void fold_undefer_overflow_warnings | ( | ) |
Stop deferring overflow warnings. If there is a pending warning, and ISSUE is true, then issue the warning if appropriate. STMT is the statement with which the warning should be associated (used for location information); STMT may be NULL. CODE is the level of the warning--a warn_strict_overflow_code value. This function will use the smaller of CODE and the deferred code when deciding whether to issue the warning. CODE may be zero to mean to always use the deferred code.
References fold_deferred_overflow_code, fold_deferred_overflow_warning, fold_deferring_overflow_warnings, gimple_location(), gimple_no_warning_p(), input_location, and warning_at().
Referenced by cleanup_control_expr_graph(), combine_cond_expr_cond(), evaluate_stmt(), fold_cond_expr_cond(), fold_gimple_assign(), fold_undefer_and_ignore_overflow_warnings(), simplify_binary_expression(), and simplify_control_stmt_condition().
|
static |
Attempt to fold vector permutation of ARG0 and ARG1 vectors using SEL selector. Return the folded VECTOR_CST or CONSTRUCTOR if successful, NULL_TREE otherwise.
References build_constructor(), unshare_expr(), vec_alloc(), and vec_cst_ctor_to_array().
Referenced by fold_ternary_loc().
|
static |
Fold a VIEW_CONVERT_EXPR of a constant expression EXPR to type TYPE at compile-time. If we're unable to perform the conversion return NULL_TREE.
References buffer, len, native_encode_expr(), and native_interpret_expr().
Referenced by fold_unary_loc().
|
static |
Fold comparison ARG0 CODE ARG1 (with result in TYPE), where ARG0 is extended to a wider type.
References fold_convert_loc(), fold_relational_const(), get_unwidened(), int_fits_type_p(), integer_nonzerop(), lower_bound_in_type(), omit_one_operand_loc(), and upper_bound_in_type().
Referenced by fold_comparison().
|
static |
Subroutine of fold_binary. If P is the value of EXPR, computes power-of-two M and (arbitrary) N such that M divides (P-N). This condition guarantees that P and N have the same least significant log2(M) bits. N is not otherwise constrained. In particular, N is not normalized to 0 <= N < M as is common. In general, the precise value of P is unknown. M is chosen as large as possible such that constant N can be determined. Returns M and sets *RESIDUE to N. If ALLOW_FUNC_ALIGN is true, do take functions' DECL_ALIGN_UNIT into account. This is not always possible due to PR 35705.
References get_object_alignment_1(), and HOST_WIDE_INT.
Referenced by fold_binary_loc().
|
static |
Check whether TYPE1 and TYPE2 are equivalent integer types, suitable for use in int_const_binop, size_binop and size_diffop.
Referenced by size_binop_loc(), and size_diffop_loc().
tree int_const_binop | ( | ) |
References int_const_binop_1().
Referenced by build_constructors(), build_debug_ref_for_model(), build_ref_for_offset(), build_user_friendly_ref_for_offset(), check_array_ref(), collect_switch_conv_info(), const_binop(), create_component_ref_by_pieces_1(), emit_case_bit_tests(), expand_vector_condition(), expand_vector_piecewise(), extract_range_from_assert(), extract_range_from_binary_expr_1(), extract_range_from_unary_expr_1(), find_case_label_range(), fold_binary_loc(), fold_comparison(), fold_div_compare(), intersect_ranges(), inverse(), ipa_modify_call_arguments(), layout_type(), maybe_canonicalize_comparison_1(), maybe_fold_tmr(), maybe_rewrite_mem_ref_base(), multiple_of_p(), register_edge_assert_for_2(), set_and_canonicalize_value_range(), simplify_div_or_mod_using_ranges(), simplify_truth_ops_using_ranges(), store_constructor(), tree_fold_divides_p(), union_ranges(), vectorizable_load(), vectorizable_store(), and vrp_int_const_binop().
|
static |
Combine two integer constants ARG1 and ARG2 under operation CODE to produce a new constant. Return NULL_TREE if we don't know how to evaluate CODE at compile-time.
References double_int::add_with_sign(), double_int::divmod_with_overflow(), force_fit_type_double(), double_int::high, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, double_int::is_zero(), double_int::low, double_int::lrotate(), double_int::lshift(), double_int::max(), double_int::min(), double_int::mul_with_sign(), double_int::rrotate(), double_int::rshift(), double_int::sub_with_overflow(), tree_to_double_int(), and double_int::wide_mul_with_sign().
Referenced by int_const_binop(), and size_binop_loc().
enum tree_code invert_tree_comparison | ( | ) |
Given a tree comparison code, return the code that is the logical inverse. It is generally not safe to do this for floating-point comparisons, except for EQ_EXPR, NE_EXPR, ORDERED_EXPR and UNORDERED_EXPR, so we return ERROR_MARK in this case.
Referenced by add_clause(), add_conditions_to_domain(), and_var_with_comparison(), bound_difference(), canonicalize_bool(), extract_code_and_val_from_cond_with_ops(), fold_relational_const(), fold_truth_not_expr(), fold_unary_loc(), forward_propagate_comparison(), get_cmp_code(), gimple_equal_p(), ifcombine_ifandif(), is_comparison_with_loop_invariant_p(), is_gcond_subset_of(), is_pred_expr_subset_of(), is_value_included_in(), iv_elimination_compare_lt(), loop_niter_by_eval(), merge_truthop_with_opposite_arm(), normalize_cond(), number_of_iterations_exit(), optimize_minmax_comparison(), or_var_with_comparison(), parse_predicate(), register_edge_assert_for_1(), same_bool_comparison_p(), set_cond_stmt_execution_predicate(), and simplify_cond_using_ranges().
tree invert_truthvalue_loc | ( | ) |
Return a simplified tree node for the truth-negation of ARG. This never alters ARG itself. We assume that ARG is an operation that returns a truth value (0 or 1 for scalars, 0 or -1 for vectors).
Referenced by build_range_check(), fold_binary_loc(), fold_range_test(), fold_ternary_loc(), fold_truth_not_expr(), optimize_minmax_comparison(), record_edge_info(), and update_range_test().
|
static |
Return a BIT_FIELD_REF of type TYPE to refer to BITSIZE bits of INNER starting at BITPOS. The field is unsigned if UNSIGNEDP is nonzero.
References build_nonstandard_integer_type(), fold_convert_loc(), host_integerp(), tree_low_cst(), and type().
Referenced by fold_truth_andor_1(), and optimize_bit_field_compare().
Given EXP, a logical expression, set the range it is testing into variables denoted by PIN_P, PLOW, and PHIGH. Return the expression actually being tested. *PLOW and *PHIGH will be made of the same type as the returned expression. If EXP is not a comparison, we will most likely not be returning a useful value and range. Set *STRICT_OVERFLOW_P to true if the return value is only valid because signed overflow is undefined; otherwise, do not change *STRICT_OVERFLOW_P.
References build_int_cst(), exp(), integer_onep(), make_range_step(), range_binop(), tcc_binary, tcc_comparison, and tcc_expression.
Referenced by fold_range_test().
tree make_range_step | ( | location_t | loc, |
enum tree_code | code, | ||
tree | arg0, | ||
tree | arg1, | ||
tree | exp_type, | ||
tree * | p_low, | ||
tree * | p_high, | ||
int * | p_in_p, | ||
bool * | strict_overflow_p | ||
) |
Helper routine for make_range. Perform one step for it, return new expression if the loop should continue or NULL_TREE if it should stop.
References build_int_cst(), fold_convert_loc(), int_fits_type_p(), integer_zerop(), merge_ranges(), negate_expr(), normalize(), range_binop(), tree_int_cst_equal(), tree_int_cst_lt(), lang_hooks_for_types::type_for_mode, and lang_hooks::types.
Referenced by init_range_entry(), and make_range().
bool may_negate_without_overflow_p | ( | ) |
Check whether we may negate an integer constant T without causing overflow.
References HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, and type().
Referenced by create_iv(), and negate_expr_p().
|
static |
Canonicalize the comparison ARG0 CODE ARG1 with type TYPE with undefined overflow further. Try to decrease the magnitude of constants involved by changing LE_EXPR and GE_EXPR to LT_EXPR and GT_EXPR or vice versa and put sole constants at the second argument position. Returns the canonicalized tree if changed, otherwise NULL_TREE.
References fold_overflow_warning(), maybe_canonicalize_comparison_1(), swap_tree_comparison(), and WARN_STRICT_OVERFLOW_MAGNITUDE.
Referenced by fold_comparison().
|
static |
Helper that tries to canonicalize the comparison ARG0 CODE ARG1 by changing CODE to reduce the magnitude of constants involved in ARG0 of the comparison. Returns a canonicalized comparison tree if a simplification was possible, otherwise returns NULL_TREE. Set *STRICT_OVERFLOW_P to true if the canonicalization is only valid if signed overflow is undefined.
References build_int_cst(), int_const_binop(), integer_zerop(), swap(), swap_tree_comparison(), tree_int_cst_equal(), and tree_int_cst_sgn().
Referenced by maybe_canonicalize_comparison().
|
static |
Return false if expr can be assumed not to be an lvalue, true otherwise.
Referenced by fold_cond_expr_with_comparison(), and non_lvalue_loc().
bool merge_ranges | ( | int * | pin_p, |
tree * | plow, | ||
tree * | phigh, | ||
int | in0_p, | ||
tree | low0, | ||
tree | high0, | ||
int | in1_p, | ||
tree | low1, | ||
tree | high1 | ||
) |
Given two ranges, see if we can merge them into one. Return 1 if we can, 0 if we can't. Set the output range into the specified parameters.
References integer_onep(), integer_zerop(), range_binop(), range_predecessor(), range_successor(), and tree_int_cst_equal().
Referenced by fold_range_test(), make_range_step(), and optimize_range_tests().
|
static |
For an expression that has the form (A && B) || ~B or (A || B) && ~B, we can drop one of the inner expressions and simplify to A || ~B or A && ~B LOC is the location of the resulting expression. OP is the inner logical operation; the left-hand side in the examples above, while CMPOP is the right-hand side. RHS_ONLY is used to prevent us from accidentally removing a condition that guards another, as in (A != NULL && A->...) || A == NULL which we must not transform. If RHS_ONLY is true, only eliminate the right-most operand of the inner logical operation.
References invert_tree_comparison(), operand_equal_p(), and tcc_comparison.
Referenced by fold_truth_andor().
int multiple_of_p | ( | ) |
Determine if first argument is a multiple of second argument. Return 0 if it is not, or we cannot easily determined it to be. An example of the sort of thing we care about (at this point; this routine could surely be made more general, and expanded to do what the *_DIV_EXPR's fold cases do now) is discovering that SAVE_EXPR (I) * SAVE_EXPR (J * 8) is a multiple of SAVE_EXPR (J * 8) when we know that the two SAVE_EXPR (J * 8) nodes are the same node. This code also handles discovering that SAVE_EXPR (I) * SAVE_EXPR (J * 8) is a multiple of 8 so we don't have to worry about dealing with a possible remainder. Note that we *look* inside a SAVE_EXPR only to determine how it was calculated; it is not safe for fold to do much of anything else with the internals of a SAVE_EXPR, since it cannot know when it will be evaluated at run time. For example, the latter example above *cannot* be implemented as SAVE_EXPR (I) * J or any variant thereof, since the value of J at evaluation time of the original SAVE_EXPR is not necessarily the same at the time the new expression is evaluated. The only optimization of this sort that would be valid is changing SAVE_EXPR (I) * SAVE_EXPR (SAVE_EXPR (J) * 8) divided by 8 to SAVE_EXPR (I) * SAVE_EXPR (J) (where the same SAVE_EXPR (J) is used in the original and the transformed version).
References const_binop(), int_const_binop(), integer_pow2p(), integer_zerop(), operand_equal_p(), and tree_int_cst_sgn().
Referenced by extract_muldiv_1(), fold_binary_loc(), maybe_rewrite_mem_ref_base(), non_rewritable_mem_ref_base(), number_of_iterations_ne_max(), round_down_loc(), and round_up_loc().
|
static |
Subroutine of native_encode_expr. Encode the COMPLEX_CST specified by EXPR into the buffer PTR of length LEN bytes. Return the number of bytes placed in the buffer, or zero upon failure.
References native_encode_expr().
Referenced by native_encode_expr().
int native_encode_expr | ( | ) |
Subroutine of fold_view_convert_expr. Encode the INTEGER_CST, REAL_CST, COMPLEX_CST or VECTOR_CST specified by EXPR into the buffer PTR of length LEN bytes. Return the number of bytes placed in the buffer, or zero upon failure.
References native_encode_complex(), native_encode_fixed(), native_encode_int(), native_encode_real(), native_encode_string(), and native_encode_vector().
Referenced by const_with_all_bytes_same(), fold_ternary_loc(), fold_view_convert_expr(), native_encode_complex(), native_encode_initializer(), native_encode_vector(), and vn_reference_lookup_3().
|
static |
Subroutine of native_encode_expr. Encode the FIXED_CST specified by EXPR into the buffer PTR of length LEN bytes. Return the number of bytes placed in the buffer, or zero upon failure.
References double_int_to_tree(), FIXED_VALUE_TYPE, native_encode_int(), lang_hooks_for_types::type_for_size, and lang_hooks::types.
Referenced by native_encode_expr().
|
static |
Subroutine of native_encode_expr. Encode the INTEGER_CST specified by EXPR into the buffer PTR of length LEN bytes. Return the number of bytes placed in the buffer, or zero upon failure.
References HOST_BITS_PER_WIDE_INT, and offset.
Referenced by native_encode_expr(), and native_encode_fixed().
|
static |
Subroutine of native_encode_expr. Encode the REAL_CST specified by EXPR into the buffer PTR of length LEN bytes. Return the number of bytes placed in the buffer, or zero upon failure.
References offset, and real_to_target().
Referenced by native_encode_expr().
|
static |
Subroutine of native_encode_expr. Encode the STRING_CST specified by EXPR into the buffer PTR of length LEN bytes. Return the number of bytes placed in the buffer, or zero upon failure.
References host_integerp(), HOST_WIDE_INT, memcpy(), memset(), and tree_low_cst().
Referenced by native_encode_expr().
|
static |
Subroutine of native_encode_expr. Encode the VECTOR_CST specified by EXPR into the buffer PTR of length LEN bytes. Return the number of bytes placed in the buffer, or zero upon failure.
References count, native_encode_expr(), and offset.
Referenced by native_encode_expr().
|
static |
Subroutine of native_interpret_expr. Interpret the contents of the buffer PTR of length LEN as a COMPLEX_CST of type TYPE. If the buffer cannot be interpreted, return NULL_TREE.
References build_complex(), and native_interpret_expr().
Referenced by native_interpret_expr().
tree native_interpret_expr | ( | ) |
Subroutine of fold_view_convert_expr. Interpret the contents of the buffer PTR of length LEN as a constant of type TYPE. For INTEGRAL_TYPE_P we return an INTEGER_CST, for SCALAR_FLOAT_TYPE_P we return a REAL_CST, etc... If the buffer cannot be interpreted, return NULL_TREE.
References native_interpret_complex(), native_interpret_fixed(), native_interpret_int(), native_interpret_real(), and native_interpret_vector().
Referenced by fold_ternary_loc(), fold_view_convert_expr(), native_interpret_complex(), native_interpret_vector(), and vn_reference_lookup_3().
|
static |
Subroutine of native_interpret_expr. Interpret the contents of the buffer PTR of length LEN as a FIXED_CST of type TYPE. If the buffer cannot be interpreted, return NULL_TREE.
References build_fixed(), fixed_from_double_int(), FIXED_VALUE_TYPE, and double_int::from_buffer().
Referenced by native_interpret_expr().
|
static |
Subroutine of native_interpret_expr. Interpret the contents of the buffer PTR of length LEN as an INTEGER_CST of type TYPE. If the buffer cannot be interpreted, return NULL_TREE.
References double_int_to_tree(), and double_int::from_buffer().
Referenced by native_interpret_expr().
|
static |
Subroutine of native_interpret_expr. Interpret the contents of the buffer PTR of length LEN as a REAL_CST of type TYPE. If the buffer cannot be interpreted, return NULL_TREE.
References build_real(), memset(), offset, and real_from_target().
Referenced by native_interpret_expr().
|
static |
Subroutine of native_interpret_expr. Interpret the contents of the buffer PTR of length LEN as a VECTOR_CST of type TYPE. If the buffer cannot be interpreted, return NULL_TREE.
References count, and native_interpret_expr().
Referenced by native_interpret_expr().
|
static |
Like fold_negate_expr, but return a NEGATE_EXPR tree, if T can not be negated in a simpler way. Also allow for T to be NULL_TREE, in which case return NULL_TREE.
References fold_convert_loc(), fold_negate_expr(), and type().
|
static |
Referenced by fold_binary_loc(), fold_negate_expr(), fold_plusminus_mult_expr(), and negate_expr_p().
|
static |
Determine whether an expression T can be cheaply negated using the function negate_expr without introducing undefined overflow.
References builtin_mathfn_code(), count, HOST_WIDE_INT, may_negate_without_overflow_p(), negate_expr_p(), negate_mathfn_p(), reorder_operands_p(), strip_float_extensions(), and type().
|
static |
Referenced by fold_negate_expr(), fold_strip_sign_ops(), and negate_expr_p().
|
static |
Return true if the built-in mathematical function specified by CODE is odd, i.e. -f(x) == f(-x).
tree non_lvalue_loc | ( | ) |
Return an expr equal to X but certainly not valid as an lvalue.
References in_gimple_form, and maybe_lvalue_p().
Referenced by fold_binary_loc(), fold_builtin_1(), fold_builtin_cproj(), omit_one_operand_loc(), omit_two_operands_loc(), and pedantic_non_lvalue_loc().
tree omit_one_operand_loc | ( | ) |
Return a tree for the case when the result of an expression is RESULT converted to TYPE and OMITTED was previously an operand of the expression but is now not needed (e.g., we folded OMITTED * 0). If OMITTED has side effects, we must evaluate it. Otherwise, just do the conversion of RESULT to TYPE.
References fold_convert_loc(), fold_ignored_result(), and non_lvalue_loc().
Referenced by fold_binary_loc(), fold_builtin_classify(), fold_builtin_copysign(), fold_builtin_cproj(), fold_builtin_fmin_fmax(), fold_builtin_fputs(), fold_builtin_frexp(), fold_builtin_load_exponent(), fold_builtin_memcmp(), fold_builtin_memory_chk(), fold_builtin_memory_op(), fold_builtin_memset(), fold_builtin_pow(), fold_builtin_powi(), fold_builtin_signbit(), fold_builtin_stpcpy(), fold_builtin_strcat_chk(), fold_builtin_strcspn(), fold_builtin_strncat_chk(), fold_builtin_strncmp(), fold_builtin_strncpy(), fold_builtin_strpbrk(), fold_comparison(), fold_div_compare(), fold_inf_compare(), fold_mathfn_compare(), fold_minmax(), fold_strip_sign_ops(), fold_unary_loc(), fold_widened_comparison(), and optimize_minmax_comparison().
Return a tree for the case when the result of an expression is RESULT converted to TYPE and OMITTED1 and OMITTED2 were previously operands of the expression but are now not needed. If OMITTED1 or OMITTED2 has side effects, they must be evaluated. If both OMITTED1 and OMITTED2 have side effects, OMITTED1 is evaluated before OMITTED2. Otherwise, if neither has side effects, just do the conversion of RESULT to TYPE.
References fold_convert_loc(), and non_lvalue_loc().
Referenced by fold_binary_loc(), fold_builtin_memcmp(), fold_builtin_strncat(), fold_builtin_strncmp(), fold_builtin_strspn(), fold_builtin_unordered_cmp(), and fold_comparison().
Referenced by fold_cond_expr_with_comparison(), and fold_ternary_loc().
|
static |
Similar to operand_equal_p, but see if ARG0 might have been made by shorten_compare from ARG1 when ARG1 was being compared with OTHER. When in doubt, return 0.
References get_narrower(), operand_equal_p(), and signed_or_unsigned_type_for().
int operand_equal_p | ( | ) |
Return nonzero if two operands (typically of the same tree node) are necessarily equal. If either argument has side-effects this function returns zero. FLAGS modifies behavior as follows: If OEP_ONLY_CONST is set, only return nonzero for constants. This function tests whether the operands are indistinguishable; it does not test whether they are equal using C's == operation. The distinction is important for IEEE floating point, because (1) -0.0 and 0.0 are distinguishable, but -0.0==0.0, and (2) two NaNs may be indistinguishable, but NaN!=NaN. If OEP_ONLY_CONST is unset, a VAR_DECL is considered equal to itself even though it may hold multiple values during a function. This is because a GCC tree node guarantees that nothing else is executed between the evaluation of its "operands" (which may often be evaluated in arbitrary order). Hence if the operands themselves don't side-effect, the VAR_DECLs, PARM_DECLs etc... must hold the same value in each operand/subexpression. Hence leaving OEP_ONLY_CONST unset means assuming isochronic (or instantaneous) tree equivalence. Unless comparing arbitrary expression trees, such as from different statements, this flag can usually be left unset. If OEP_PURE_SAME is set, then pure functions with identical arguments are considered the same. It is used when the caller has other ways to ensure that global memory is unchanged in between.
Define macros to test an operand from arg0 and arg1 for equality and a variant that allows null and views null as being different from any non-null value. In the latter case, if either is null, the both must be; otherwise, do the normal comparison.
References call_expr_flags(), commutative_tree_code(), element_precision(), first_const_call_expr_arg(), FIXED_VALUES_IDENTICAL, next_const_call_expr_arg(), OEP_CONSTANT_ADDRESS_OF, OEP_ONLY_CONST, OEP_PURE_SAME, real_zerop(), swap_tree_comparison(), tcc_binary, tcc_comparison, tcc_declaration, tcc_expression, tcc_reference, tcc_unary, tcc_vl_exp, tree_int_cst_equal(), and types_compatible_p().
Referenced by add_candidate_1(), aff_combination_add_elt(), aff_combination_find_elt(), affine_function_equal_p(), all_phi_incrs_profitable(), analyze_evolution_in_loop(), analyze_overlapping_iterations(), and_comparisons_1(), associate_plusminus(), bound_difference(), build_classic_dist_vector_1(), build_range_check(), cand_increment(), classify_partition(), combine_cond_exprs(), compare_aff_trees(), compare_values_warnv(), cond_if_else_store_replacement(), cond_if_else_store_replacement_1(), constant_multiple_of(), constructor_contains_same_values_p(), copy_prop_visit_phi_node(), create_add_ssa_cand(), create_phi_basis(), degenerate_phi_result(), determine_offset(), determine_use_iv_cost_condition(), difference_cost(), distribute_bit_expr(), distribute_real_division(), dr_group_sort_cmp(), dr_same_base_object_p(), dse_optimize_stmt(), dse_possible_dead_store_p(), eliminate_bb(), eliminate_redundant_comparison(), eq_evolutions_p(), mem_ref_hasher::equal(), iv_inv_expr_hasher::equal(), val_ssa_equiv_hasher::equal(), asan_mem_ref_hasher::equal(), cand_chain_hasher::equal(), log_entry_hasher::equal(), tm_memop_hasher::equal(), eval_subst(), expand_assignment(), expand_builtin_memory_chk(), expand_omp_atomic_fetch_op(), expand_operands(), expr_equal_p(), expr_expected_value_1(), expressions_equal_p(), find_basis_for_base_expr(), find_or_create_group(), finish_bitfield_layout(), fold_addr_of_array_ref_difference(), fold_binary_loc(), fold_builtin_cabs(), fold_builtin_copysign(), fold_builtin_fmin_fmax(), fold_builtin_hypot(), fold_builtin_memcmp(), fold_builtin_memory_chk(), fold_builtin_memory_op(), fold_builtin_strcmp(), fold_builtin_strcpy(), fold_builtin_strncmp(), fold_builtin_stxcpy_chk(), fold_comparison(), fold_cond_expr_with_comparison(), fold_ctor_reference(), fold_minmax(), fold_plusminus_mult_expr(), fold_range_test(), fold_ternary_loc(), fold_truth_andor(), fold_truth_andor_1(), get_computation_cost_at(), get_loop_invariant_expr_id(), gimple_canonical_types_compatible_p(), gimple_compare_field_offset(), gimple_equal_p(), gimple_val_nonnegative_real_p(), handle_pointer_plus(), hashable_expr_equal_p(), hoist_adjacent_loads(), idx_infer_loop_bounds(), indirect_refs_may_alias_p(), initialize_data_dependence_relation(), initializer_constant_valid_p_1(), interpret_loop_phi(), intersect_ranges(), lower_vec_perm(), mark_aliased_reaching_defs_necessary_1(), mem_attrs_eq_p(), mem_expr_equal_p(), memrefs_read_or_written_unconditionally(), merge_truthop_with_opposite_arm(), move_hint_to_base(), move_variant_to_index(), multiple_of_p(), narrowing_initializer_constant_valid_p(), ncd_with_phi(), operand_equal_for_comparison_p(), operand_equal_for_phi_arg_p(), optimize_bitfield_assignment_op(), or_comparisons_1(), pdr_add_data_dimensions(), phi_args_equal_on_edges(), phi_contains_arg(), phi_incr_cost(), propagate_expr_outside_region(), ptr_difference_const(), range_predecessor(), range_successor(), record_increment(), record_phi_increments(), refine_bounds_using_guard(), register_new_assert_for(), remove_unused_ivs(), replace_mult_candidate(), replace_one_candidate(), replace_rhs_if_not_dup(), rewrite_cross_bb_scalar_dependence(), same_bool_comparison_p(), same_bool_result_p(), same_close_phi_node(), same_data_refs(), same_data_refs_base_objects(), same_handler_p(), same_phi_args_p(), set_copy_of_val(), set_ssa_val_to(), simplify_conversion_from_bitmask(), simplify_replace_tree(), simplify_using_entry_checks(), slsr_process_add(), slsr_process_phi(), statement_sink_location(), stmt_is_power_of_op(), suitable_cond_bb(), test_for_singularity(), tree_binary_nonnegative_warnv_p(), twoval_comparison_p(), uniform_vector_p(), union_ranges(), valid_initializer_p(), valid_lattice_transition(), value_range_constant_singleton(), values_equal_for_ipcp_p(), vect_analyze_data_ref_accesses(), vect_analyze_group_access(), vect_build_slp_tree_1(), vect_create_cond_for_alias_checks(), vect_find_same_alignment_drs(), vect_get_slp_defs(), vect_same_range_drs(), vect_slp_analyze_data_ref_dependence(), vectorizable_shift(), vn_reference_lookup_3(), vrp_operand_equal_p(), vrp_val_is_max(), vrp_val_is_min(), and vrp_valueize().
|
static |
Optimize a bit-field compare. There are two cases: First is a compare against a constant and the second is a comparison of two items where the fields are at the same bit position relative to the start of a chunk (byte, halfword, word) large enough to contain it. In these cases we can avoid the shift implicit in bitfield extractions. For constants, we emit a compare of the shifted constant with the BIT_AND_EXPR of a mask and a byte, halfword, or word of the operand being compared. For two fields at the same position, we do the ANDs with the similar mask and compare the result of the ANDs. CODE is the comparison code, known to be either NE_EXPR or EQ_EXPR. COMPARE_TYPE is the type of the comparison, and LHS and RHS are the left and right operands of the comparison, respectively. If the optimization described above can be done, we return the resulting tree. Otherwise we return zero.
References build_int_cst(), build_int_cst_type(), const_binop(), constant_boolean_node(), fold_convert_loc(), get_best_mode(), get_inner_reference(), HOST_WIDE_INT, integer_all_onesp(), integer_zerop(), make_bit_field_ref(), offset, lang_hooks_for_types::type_for_mode, lang_hooks::types, warning(), and word_mode.
Referenced by fold_binary_loc().
|
static |
Optimize T, which is a comparison of a MIN_EXPR or MAX_EXPR with a constant.
References fold_convert_loc(), invert_tree_comparison(), invert_truthvalue_loc(), omit_one_operand_loc(), tree_int_cst_equal(), and tree_int_cst_lt().
Referenced by fold_comparison().
|
static |
When pedantic, return an expr equal to X but certainly not valid as a pedantic lvalue. Otherwise, return X.
References non_lvalue_loc(), pedantic_lvalues, and protected_set_expr_location_unshare().
Referenced by fold_binary_loc(), fold_cond_expr_with_comparison(), fold_ternary_loc(), and pedantic_omit_one_operand_loc().
|
static |
Similar, but call pedantic_non_lvalue instead of non_lvalue.
References fold_convert_loc(), fold_ignored_result(), and pedantic_non_lvalue_loc().
Referenced by fold_ternary_loc().
|
static |
Return whether BASE + OFFSET + BITPOS may wrap around the address space. This is used to avoid issuing overflow warnings for expressions like &p->x which can not wrap.
References double_int::add_with_sign(), double_int::from_uhwi(), double_int::high, HOST_WIDE_INT, int_size_in_bytes(), and double_int::low.
Referenced by fold_comparison().
void print_fold_checksum | ( | const_tree | ) |
void print_fold_checksum | ( | ) |
|
inlinestatic |
Similar to protected_set_expr_location, but never modify x in place, if location can and needs to be set, unshare it.
References copy_node().
Referenced by fold_convert_loc(), and pedantic_non_lvalue_loc().
bool ptr_difference_const | ( | ) |
Returns true if addresses of E1 and E2 differ by a constant, false otherwise. If they do, E1 - E2 is stored in *DIFF.
References cst_and_fits_in_hwi(), HOST_WIDE_INT, int_cst_value(), operand_equal_p(), split_address_to_core_and_offset(), and type().
Referenced by fold_binary_loc(), and ptr_difference_cost().
|
static |
The following functions are subroutines to fold_range_test and allow it to try to change a logical combination of comparisons into a range test. For example, both X == 2 || X == 3 || X == 4 || X == 5 and X >= 2 && X <= 5 are converted to (unsigned) (X - 2) <= 3 We describe each set of comparisons as being either inside or outside a range, using a variable named like IN_P, and then describe the range with a lower and upper bound. If one of the bounds is omitted, it represents either the highest or lowest value of the type. In the comments below, we represent a range by two numbers in brackets preceded by a "+" to designate being inside that range, or a "-" to designate being outside that range, so the condition can be inverted by flipping the prefix. An omitted bound is represented by a "-". For example, "- [-, 10]" means being outside the range starting at the lowest possible value and ending at 10, in other words, being greater than 10. The range "+ [-, -]" is always true and hence the range "- [-, -]" is always false. We set up things so that the missing bounds are handled in a consistent manner so neither a missing bound nor "true" and "false" need to be handled using a special case.
Return the result of applying CODE to ARG0 and ARG1, but handle the case of ARG0 and/or ARG1 being omitted, meaning an unlimited range. UPPER0_P and UPPER1_P are nonzero if the respective argument is an upper bound and zero for a lower. TYPE, if nonzero, is the type of the result; it must be specified for a comparison. ARG1 will be converted to ARG0's type if both are specified.
References constant_boolean_node(), and tcc_comparison.
Referenced by build_range_check(), make_range(), make_range_step(), merge_ranges(), range_predecessor(), and range_successor().
Referenced by merge_ranges().
|
static |
Return the predecessor of VAL in its type, handling the infinite case.
References operand_equal_p(), and range_binop().
Referenced by merge_ranges().
|
static |
Return the successor of VAL in its type, handling the infinite case.
References operand_equal_p(), and range_binop().
|
static |
Referenced by fold_binary_loc(), fold_minmax(), fold_negate_expr(), and negate_expr_p().
|
static |
Check whether we are allowed to reorder operands arg0 and arg1, such that the evaluation of arg1 occurs before arg0.
tree round_down_loc | ( | ) |
Likewise, but round down.
References build_int_cst(), multiple_of_p(), and size_binop_loc().
tree round_up_loc | ( | ) |
Return the value of VALUE, rounded up to a multiple of DIVISOR. This can only be applied to objects of a sizetype.
References build_int_cst(), force_fit_type_double(), double_int::high, double_int::low, multiple_of_p(), size_binop_loc(), and tree_to_double_int().
|
static |
Referenced by fold_binary_loc(), fold_single_bit_test_into_sign_test(), fold_ternary_loc(), and sign_bit_p().
|
static |
Subroutine for fold: determine if VAL is the INTEGER_CONST that represents the sign bit of EXP's type. If EXP represents a sign or zero extension, also test VAL against the unextended type. The return value is the (sub)expression whose sign bit is VAL, or NULL_TREE otherwise.
References exp(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT_M1U, and sign_bit_p().
|
static |
Referenced by fold_range_test(), fold_truth_andor_1(), and simple_operand_p_2().
|
static |
Subroutine for fold_truth_andor_1: determine if an operand is simple enough to be evaluated unconditionally.
|
static |
Referenced by fold_truth_andor(), and simple_operand_p_2().
|
static |
Subroutine for fold_truth_andor: determine if an operand is simple enough to be evaluated unconditionally. I addition to simple_operand_p, we assume that comparisons, conversions, and logic-not operations are simple, if their operands are simple, too.
References simple_operand_p(), simple_operand_p_2(), tcc_comparison, and tree_could_trap_p().
tree size_binop_loc | ( | ) |
Combine operands OP1 and OP2 with arithmetic operation CODE. CODE is a tree code. The type of the result is taken from the operands. Both must be equivalent integer types, ala int_binop_types_match_p. If the operands are constant, so is the result.
References int_binop_types_match_p(), int_const_binop_1(), integer_onep(), and integer_zerop().
Referenced by array_ref_element_size(), build_addr_arg_loc(), component_ref_field_offset(), expand_builtin_stpcpy(), expand_builtin_strncmp(), expand_builtin_strncpy(), fold_builtin_stpcpy(), fold_builtin_strcpy(), fold_builtin_strncpy(), fold_builtin_stxcpy_chk(), fold_indirect_ref_1(), gimplify_compound_lval(), layout_decl(), mf_xform_derefs_1(), round_down_loc(), round_up_loc(), size_diffop_loc(), and store_expr().
tree size_diffop_loc | ( | ) |
Given two values, either both of sizetype or both of bitsizetype, compute the difference between the two values. Return the value in signed type corresponding to the type of the operands.
References build_int_cst(), fold_convert_loc(), int_binop_types_match_p(), signed_type_for(), size_binop_loc(), tree_int_cst_equal(), and tree_int_cst_lt().
Referenced by c_strlen(), expand_expr_real_1(), and fold_read_from_constant_string().
tree size_int_kind | ( | ) |
Create a sizetype INT_CST node with NUMBER sign extended. KIND indicates which particular sizetype to create.
References build_int_cst(), and sizetype_tab.
|
static |
Returns the pointer to the base of the object addressed by EXP and extracts the information about the offset of the access, storing it to PBITPOS and POFFSET.
References build_fold_addr_expr_loc(), exp(), get_inner_reference(), and HOST_WIDE_INT.
Referenced by ptr_difference_const().
|
static |
Split a tree IN into a constant, literal and variable parts that could be combined with CODE to make IN. "constant" means an expression with TREE_CONSTANT but that isn't an actual constant. CODE must be a commutative arithmetic operation. Store the constant part into *CONP, the literal in *LITP and return the variable part. If a part isn't present, set it to null. If the tree does not decompose in this way, return the entire tree as the variable part and the other parts as null. If CODE is PLUS_EXPR we also split trees that use MINUS_EXPR. In that case, we negate an operand that was subtracted. Except if it is a literal for which we use *MINUS_LITP instead. If NEGATE_P is true, we are negating all of IN, again except a literal for which we use *MINUS_LITP instead. If IN is itself a literal or constant, return it as appropriate. Note that we do not guarantee that any of the three values will be the same type as IN, but they will have the same signedness and mode.
References build_one_cst(), and negate_expr().
Referenced by fold_binary_loc().
enum tree_code swap_tree_comparison | ( | ) |
Similar, but return the comparison that results if the operands are swapped. This is safe for floating-point.
Referenced by and_comparisons_1(), bit_value_binop_1(), canonicalize_comparison(), extract_code_and_val_from_cond_with_ops(), extract_range_from_assert(), fold_comparison(), fold_div_compare(), fold_inf_compare(), fold_relational_const(), fold_truth_andor_1(), get_cmp_code(), maybe_canonicalize_comparison(), maybe_canonicalize_comparison_1(), number_of_iterations_cond(), operand_equal_p(), or_comparisons_1(), refine_bounds_using_guard(), simplify_control_stmt_condition(), vrp_evaluate_conditional_warnv_with_ops(), and vrp_evaluate_conditional_warnv_with_ops_using_ranges().
bool tree_binary_nonnegative_warnv_p | ( | enum tree_code | code, |
tree | type, | ||
tree | op0, | ||
tree | op1, | ||
bool * | strict_overflow_p | ||
) |
Return true if (CODE OP0 OP1) is known to be non-negative. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References operand_equal_p(), tree_expr_nonnegative_warnv_p(), tree_int_cst_min_precision(), tree_int_cst_sgn(), and tree_simple_nonnegative_warnv_p().
Referenced by gimple_assign_nonnegative_warnv_p(), and tree_expr_nonnegative_warnv_p().
bool tree_binary_nonzero_warnv_p | ( | enum tree_code | code, |
tree | type, | ||
tree | op0, | ||
tree | op1, | ||
bool * | strict_overflow_p | ||
) |
Return true when (CODE OP0 OP1) is an address and is known to be nonzero. For floating point we further ensure that T is not denormal. Similar logic is present in nonzero_address in rtlanal.h. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References tree_expr_nonnegative_warnv_p(), and tree_expr_nonzero_warnv_p().
Referenced by gimple_assign_nonzero_warnv_p(), and tree_expr_nonzero_warnv_p().
bool tree_call_nonnegative_warnv_p | ( | tree | type, |
tree | fndecl, | ||
tree | arg0, | ||
tree | arg1, | ||
bool * | strict_overflow_p | ||
) |
Return true if T is known to be non-negative. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References BUILT_IN_NORMAL, HOST_WIDE_INT, real_from_integer(), real_identical(), real_to_integer(), tree_expr_nonnegative_warnv_p(), and tree_simple_nonnegative_warnv_p().
Referenced by gimple_call_nonnegative_warnv_p(), and tree_invalid_nonnegative_warnv_p().
bool tree_expr_nonnegative_p | ( | ) |
Return true if `t' is known to be non-negative. Handle warnings about undefined signed overflow.
References fold_overflow_warning(), tree_expr_nonnegative_warnv_p(), and WARN_STRICT_OVERFLOW_MISC.
Referenced by derive_constant_upper_bound_ops(), expand_builtin_mathfn(), fold_binary_loc(), fold_builtin_cbrt(), fold_builtin_copysign(), fold_builtin_cproj(), fold_builtin_floor(), fold_builtin_int_roundingfn(), fold_builtin_pow(), fold_builtin_signbit(), fold_builtin_sqrt(), fold_unary_loc(), and gimple_val_nonnegative_real_p().
bool tree_expr_nonnegative_warnv_p | ( | ) |
Return true if T is known to be non-negative. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References tcc_binary, tcc_comparison, tcc_constant, tcc_declaration, tcc_reference, tcc_unary, tree_binary_nonnegative_warnv_p(), tree_invalid_nonnegative_warnv_p(), tree_single_nonnegative_warnv_p(), and tree_unary_nonnegative_warnv_p().
Referenced by create_iv(), fold_binary_loc(), tree_binary_nonnegative_warnv_p(), tree_binary_nonzero_warnv_p(), tree_call_nonnegative_warnv_p(), tree_expr_nonnegative_p(), tree_invalid_nonnegative_warnv_p(), tree_single_nonnegative_warnv_p(), and tree_unary_nonnegative_warnv_p().
bool tree_expr_nonzero_p | ( | ) |
Return true when T is an address and is known to be nonzero. Handle warnings about undefined signed overflow.
References fold_overflow_warning(), tree_expr_nonzero_warnv_p(), and WARN_STRICT_OVERFLOW_MISC.
Referenced by fold_binary_loc().
bool tree_expr_nonzero_warnv_p | ( | ) |
Return true when T is an address and is known to be nonzero. For floating point we further ensure that T is not denormal. Similar logic is present in nonzero_address in rtlanal.h. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References alloca_call_p(), tcc_binary, tcc_comparison, tcc_constant, tcc_declaration, tcc_reference, tcc_unary, tree_binary_nonzero_warnv_p(), tree_single_nonzero_warnv_p(), and tree_unary_nonzero_warnv_p().
Referenced by tree_binary_nonzero_warnv_p(), tree_expr_nonzero_p(), tree_single_nonzero_warnv_p(), and tree_unary_nonzero_warnv_p().
bool tree_invalid_nonnegative_warnv_p | ( | ) |
Return true if T is known to be non-negative. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References expr_last(), get_callee_fndecl(), tree_call_nonnegative_warnv_p(), tree_expr_nonnegative_warnv_p(), and tree_simple_nonnegative_warnv_p().
Referenced by tree_expr_nonnegative_warnv_p().
|
static |
Return true if CODE or TYPE is known to be non-negative.
References truth_value_p().
Referenced by tree_binary_nonnegative_warnv_p(), tree_call_nonnegative_warnv_p(), tree_invalid_nonnegative_warnv_p(), tree_single_nonnegative_warnv_p(), and tree_unary_nonnegative_warnv_p().
bool tree_single_nonnegative_warnv_p | ( | ) |
Return true if T is known to be non-negative. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References FIXED_VALUE_NEGATIVE, tree_expr_nonnegative_warnv_p(), tree_int_cst_sgn(), and tree_simple_nonnegative_warnv_p().
Referenced by gimple_assign_nonnegative_warnv_p(), and tree_expr_nonnegative_warnv_p().
bool tree_single_nonzero_warnv_p | ( | ) |
Return true when T is an address and is known to be nonzero. For floating point we further ensure that T is not denormal. Similar logic is present in nonzero_address in rtlanal.h. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References auto_var_in_fn_p(), get_base_address(), integer_zerop(), and tree_expr_nonzero_warnv_p().
Referenced by gimple_assign_nonzero_warnv_p(), and tree_expr_nonzero_warnv_p().
bool tree_swap_operands_p | ( | ) |
Test whether it is preferable two swap two operands, ARG0 and ARG1, for example because ARG0 is an integer constant and ARG1 isn't. If REORDER is true, only recommend swapping if we can evaluate the operands in reverse order.
References cfun, and optimize_function_for_size_p().
Referenced by canonicalize_comparison(), fold_binary_loc(), fold_comparison(), fold_stmt_1(), fold_ternary_loc(), simplify_control_stmt_condition(), and vn_nary_op_compute_hash().
bool tree_unary_nonnegative_warnv_p | ( | enum tree_code | code, |
tree | type, | ||
tree | op0, | ||
bool * | strict_overflow_p | ||
) |
Return true if (CODE OP0) is known to be non-negative. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References tree_expr_nonnegative_warnv_p(), tree_simple_nonnegative_warnv_p(), and type().
Referenced by gimple_assign_nonnegative_warnv_p(), and tree_expr_nonnegative_warnv_p().
bool tree_unary_nonzero_warnv_p | ( | enum tree_code | code, |
tree | type, | ||
tree | op0, | ||
bool * | strict_overflow_p | ||
) |
Return true when (CODE OP0) is an address and is known to be nonzero. For floating point we further ensure that T is not denormal. Similar logic is present in nonzero_address in rtlanal.h. If the return value is based on the assumption that signed overflow is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change *STRICT_OVERFLOW_P.
References tree_expr_nonzero_warnv_p(), and type().
Referenced by gimple_assign_nonzero_warnv_p(), and tree_expr_nonzero_warnv_p().
|
static |
Tries to replace &a[idx] p+ s * delta with &a[idx + delta], if s is step of the array. Reconstructs s and delta in the case of s * delta being an integer constant (and thus already folded). ADDR is the address. MULT is the multiplicative expression. If the function succeeds, the new address expression is returned. Otherwise NULL_TREE is returned. LOC is the location of the resulting expression.
References array_ref_element_size(), build_fold_addr_expr_loc(), copy_node(), div_if_zero_remainder(), fold_binary_loc(), fold_convert_loc(), handled_component_p(), pref, tree_int_cst_equal(), and tree_int_cst_lt().
Referenced by fold_binary_loc().
Referenced by fold_comparison(), and twoval_comparison_p().
|
static |
See if ARG is an expression that is either a comparison or is performing arithmetic on comparisons. The comparisons must only be comparing two different values, which will be stored in *CVAL1 and *CVAL2; if they are nonzero it means that some operands have already been found. No variables may be used anywhere else in the expression except in the comparisons. If SAVE_P is true it means we removed a SAVE_EXPR around the expression and save_expr needs to be called with CVAL1 and CVAL2. If this is true, return 1. Otherwise, return zero.
References operand_equal_p(), tcc_binary, tcc_comparison, tcc_constant, tcc_expression, tcc_unary, and twoval_comparison_p().
Referenced by fold_truth_andor_1().
|
static |
Subroutine for fold_truth_andor_1: C is an INTEGER_CST interpreted as a P bit value. Arrange things so the extra bits will be set to zero if and only if C is signed-extended to its full width. If MASK is nonzero, it is an INTEGER_CST that should be AND'ed with the extra bits.
References const_binop(), and signed_type_for().
Referenced by fold_binary_loc(), fold_unary_loc(), and fold_vec_perm().
|
static |
Helper function for fold_vec_perm. Store elements of VECTOR_CST or CONSTRUCTOR ARG into array ELTS and return true if successful.
References constructor_elt_d::value.
|
static |
If a warning about undefined overflow is deferred, this is the level at which the warning should be emitted.
Referenced by fold_overflow_warning(), and fold_undefer_overflow_warnings().
|
static |
If a warning about undefined overflow is deferred, this is the warning. Note that this may cause us to turn two warnings into one, but that is fine since it is sufficient to only give one warning per expression.
Referenced by fold_overflow_warning(), and fold_undefer_overflow_warnings().
|
static |
This is nonzero if we should defer warnings about undefined overflow. This facility exists because these warnings are a special case. The code to estimate loop iterations does not want to issue any warnings, since it works with expressions which do not occur in user code. Various bits of cleanup code call fold(), but only use the result if it has certain characteristics (e.g., is a constant); that code only wants to issue a warning if the result is used.
Referenced by fold_defer_overflow_warnings(), fold_deferring_overflow_warnings_p(), fold_overflow_warning(), and fold_undefer_overflow_warnings().
int folding_initializer = 0 |
@verbatim Fold a constant sub-tree into a single node for C-compiler
Copyright (C) 1987-2013 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/.
The entry points in this file are fold, size_int_wide and size_binop. fold takes a tree as argument and returns a simplified tree. size_binop takes a tree code for an arithmetic operation and two operands that are trees, and produces a tree for the result, assuming the type comes from `sizetype'. size_int takes an integer value, and creates a tree constant with type from `sizetype'. Note: Since the folders get called on non-gimple code as well as gimple code, we need to handle GIMPLE tuples as well as their corresponding tree equivalents.
Nonzero if we are folding constants inside an initializer; zero otherwise.
Referenced by const_binop(), and fold_builtin_constant_p().
int pedantic_lvalues |
Nonzero means lvalues are limited to those valid in pedantic ANSI C. Zero means allow extended lvalues.
Referenced by pedantic_non_lvalue_loc().