GCC Middle and Back End API Reference
|
#include <fold-const.h>
Public Member Functions | |
virtual bool | operand_equal_p (const_tree, const_tree, unsigned int flags) |
virtual void | hash_operand (const_tree, inchash::hash &, unsigned flags) |
Protected Member Functions | |
bool | verify_hash_value (const_tree arg0, const_tree arg1, unsigned int flags, bool *ret) |
Class used to compare gimple operands.
|
virtual |
Generate a hash value for an expression. This can be used iteratively by passing a previous result as the HSTATE argument.
Reimplemented in ipa_icf_gimple::func_checker.
References inchash::hash::add(), inchash::hash::add_commutative(), inchash::add_expr(), inchash::hash::add_hwi(), inchash::hash::add_int(), inchash::hash::add_object(), inchash::hash::add_wide_int(), bitsize_int, BUILT_IN_NORMAL, builtin_decl_explicit(), builtin_decl_explicit_p(), CALL_EXPR_FN, CALL_EXPR_IFN, commutative_tree_code(), CONST_CAST_TREE, CONSTRUCTOR_ELTS, CONSTRUCTOR_NO_CLEARING, CONVERT_EXPR_CODE_P, count, DECL_ASSEMBLER_NAME, DECL_ASSEMBLER_NAME_SET_P, DECL_BUILT_IN_CLASS, DECL_FIELD_BIT_OFFSET, DECL_FIELD_OFFSET, DECL_FUNCTION_CODE(), DECL_P, DECL_UID, error_mark_node, fixed_hash(), FOR_EACH_CONSTRUCTOR_ELT, gcc_assert, gcc_checking_assert, hash_operand(), HONOR_SIGNED_ZEROS(), i, IDENTIFIER_HASH_VALUE, integer_zerop(), IS_EXPR_CODE_CLASS, inchash::hash::merge_hash(), NULL_TREE, NUM_POLY_INT_COEFFS, obj_type_ref_class(), OBJ_TYPE_REF_EXPR, OBJ_TYPE_REF_OBJECT, OBJ_TYPE_REF_TOKEN, OEP_ADDRESS_OF, OEP_HASH_CHECK, POLY_INT_CST_COEFF, POLY_INT_CST_P, RAW_DATA_LENGTH, RAW_DATA_POINTER, real_hash(), real_zerop(), rvc_zero, SSA_NAME_VERSION, STRIP_ANY_LOCATION_WRAPPER, STRIP_NOPS, swap_tree_comparison(), TARGET_EXPR_SLOT, tcc_comparison, tcc_declaration, wi::to_wide(), TREE_CHAIN, TREE_CODE, TREE_CODE_CLASS, TREE_FIXED_CST_PTR, TREE_IMAGPART, TREE_INT_CST_ELT, TREE_INT_CST_EXT_NUNITS, TREE_OPERAND, TREE_OPERAND_LENGTH, TREE_REAL_CST_PTR, TREE_REALPART, TREE_STRING_LENGTH, TREE_STRING_POINTER, TREE_TYPE, TREE_VALUE, TREE_VEC_ELT, TREE_VEC_LENGTH, tsi_end_p(), tsi_next(), tsi_start(), tsi_stmt(), TYPE_MAIN_VARIANT, TYPE_NAME, TYPE_UNSIGNED, VECTOR_CST_ENCODED_ELT, vector_cst_encoded_nelts(), VECTOR_CST_NELTS_PER_PATTERN, VECTOR_CST_NPATTERNS, and virtual_method_call_p().
Referenced by inchash::add_expr(), ao_compare::hash_ao_ref(), hash_operand(), and verify_hash_value().
|
virtual |
Return nonzero if two operands (typically of the same tree node) are necessarily equal. 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. If OEP_ADDRESS_OF is set, we are actually comparing addresses of objects, not values of expressions. If OEP_LEXICOGRAPHIC is set, then also handle expressions with side-effects such as MODIFY_EXPR, RETURN_EXPR, as well as STATEMENT_LISTs. If OEP_BITWISE is set, then require the values to be bitwise identical rather than simply numerically equal. Do not take advantage of things like math-related flags or undefined behavior; only return true for values that are provably bitwise identical in all circumstances. Unless OEP_MATCH_SIDE_EFFECTS is set, the function returns false on any operand with side effect. This is unnecesarily conservative in the case we know that arg0 and arg1 are in disjoint code paths (such as in ?: operator). In addition OEP_MATCH_SIDE_EFFECTS is used when comparing addresses with TREE_CONSTANT flag set so we know that &var == &var even if var is volatile.
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.
Reimplemented in ipa_icf_gimple::func_checker.
References alias_ptr_types_compatible_p(), array_ref_element_size(), array_ref_low_bound(), call_expr_flags(), CALL_EXPR_FN, CALL_EXPR_IFN, CASE_CONVERT, commutative_tree_code(), compare_tree_int(), COMPARISON_CLASS_P, CONST_CAST_TREE, CONSTRUCTOR_ELTS, CONSTRUCTOR_NELTS, CONSTRUCTOR_NO_CLEARING, CONVERT_EXPR_P, count, DECL_BUILT_IN_CLASS, DECL_FIELD_BIT_OFFSET, DECL_FIELD_OFFSET, DECL_NAME, DECL_P, DECL_UNCHECKED_FUNCTION_CODE, ECF_CONST, ECF_PURE, element_precision(), error_mark_node, first_const_call_expr_arg(), FIXED_VALUES_IDENTICAL, fndecl_built_in_p(), gcc_checking_assert, HONOR_SIGNED_ZEROS(), i, IDENTIFIER_POINTER, constructor_elt::index, int_size_in_bytes(), integer_zerop(), MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, NULL, NULL_TREE, obj_type_ref_class(), OBJ_TYPE_REF_EXPR, OBJ_TYPE_REF_OBJECT, OBJ_TYPE_REF_TOKEN, OEP_ADDRESS_OF, OEP_ADDRESS_OF_SAME_FIELD, OEP_BITWISE, OEP_DECL_NAME, OEP_LEXICOGRAPHIC, OEP_MATCH_SIDE_EFFECTS, OEP_NO_HASH_CHECK, OEP_ONLY_CONST, OEP_PURE_SAME, OP_SAME, OP_SAME_WITH_NULL, operand_equal_p(), POINTER_TYPE_P, r, RAW_DATA_LENGTH, RAW_DATA_POINTER, real_identical(), real_zerop(), STRIP_ANY_LOCATION_WRAPPER, STRIP_NOPS, swap_tree_comparison(), tcc_binary, tcc_comparison, tcc_declaration, tcc_exceptional, tcc_expression, tcc_reference, tcc_statement, tcc_unary, tcc_vl_exp, TREE_CODE, TREE_CODE_CLASS, TREE_CONSTANT, TREE_FIXED_CST, TREE_IMAGPART, tree_int_cst_equal(), tree_nop_conversion_p(), TREE_OPERAND, TREE_REAL_CST, TREE_REALPART, TREE_SIDE_EFFECTS, TREE_STRING_LENGTH, TREE_STRING_POINTER, tree_to_uhwi(), TREE_TYPE, tsi_end_p(), tsi_next(), tsi_start(), tsi_stmt(), TYPE_ADDR_SPACE, TYPE_ALIGN, TYPE_MAIN_VARIANT, TYPE_MODE, TYPE_PRECISION, TYPE_SIZE, TYPE_UNSIGNED, TYPE_VECTOR_SUBPARTS(), types_compatible_p(), types_same_for_odr(), constructor_elt::value, vec_safe_length(), VECTOR_CST_ENCODED_ELT, vector_cst_encoded_nelts(), VECTOR_CST_LOG2_NPATTERNS, VECTOR_CST_NELTS_PER_PATTERN, VECTOR_TYPE_P, verify_hash_value(), and virtual_method_call_p().
Referenced by ao_compare::compare_ao_refs(), ipa_icf_gimple::func_checker::operand_equal_p(), operand_equal_p(), operand_equal_p(), and verify_hash_value().
|
protected |
References inchash::hash::end(), gcc_assert, hash_operand(), OEP_DECL_NAME, OEP_HASH_CHECK, OEP_NO_HASH_CHECK, and operand_equal_p().
Referenced by ipa_icf_gimple::func_checker::operand_equal_p(), and operand_equal_p().