diff options
Diffstat (limited to 'gcc/fold-const.cc')
-rw-r--r-- | gcc/fold-const.cc | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index db54bfc..a73b972 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -573,7 +573,7 @@ negate_expr_p (tree t) case NOP_EXPR: /* Negate -((double)float) as (double)(-float). */ - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { tree tem = strip_float_extensions (t); if (tem != t) @@ -759,7 +759,7 @@ fold_negate_expr_1 (location_t loc, tree t) case NOP_EXPR: /* Convert -((double)float) into (double)(-float). */ - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { tem = strip_float_extensions (t); if (tem != t && negate_expr_p (tem)) @@ -2385,7 +2385,7 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) else if (TREE_CODE (arg1) == FIXED_CST) return fold_convert_const_int_from_fixed (type, arg1); } - else if (TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type)) { if (TREE_CODE (arg1) == INTEGER_CST) { @@ -2407,7 +2407,7 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) else if (TREE_CODE (arg1) == FIXED_CST) return fold_convert_const_real_from_fixed (type, arg1); } - else if (TREE_CODE (type) == FIXED_POINT_TYPE) + else if (FIXED_POINT_TYPE_P (type)) { if (TREE_CODE (arg1) == FIXED_CST) return fold_convert_const_fixed_from_fixed (type, arg1); @@ -2416,7 +2416,7 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) else if (TREE_CODE (arg1) == REAL_CST) return fold_convert_const_fixed_from_real (type, arg1); } - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) { if (TREE_CODE (arg1) == VECTOR_CST && known_eq (TYPE_VECTOR_SUBPARTS (type), VECTOR_CST_NELTS (arg1))) @@ -2545,7 +2545,7 @@ fold_convert_loc (location_t loc, tree type, tree arg) return fold_convert_loc (loc, type, fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg)); - gcc_assert (TREE_CODE (orig) == VECTOR_TYPE + gcc_assert (VECTOR_TYPE_P (orig) && tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig))); return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg); @@ -2658,7 +2658,7 @@ fold_convert_loc (location_t loc, tree type, tree arg) return build_zero_vector (type); gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig))); gcc_assert (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig) - || TREE_CODE (orig) == VECTOR_TYPE); + || VECTOR_TYPE_P (orig)); return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg); case VOID_TYPE: @@ -7184,7 +7184,7 @@ constant_boolean_node (bool value, tree type) return value ? integer_one_node : integer_zero_node; else if (type == boolean_type_node) return value ? boolean_true_node : boolean_false_node; - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) return build_vector_from_val (type, build_int_cst (TREE_TYPE (type), value ? -1 : 0)); @@ -7237,7 +7237,7 @@ fold_binary_op_with_conditional_arg (location_t loc, rhs = false_value; } else if (!(TREE_CODE (type) != VECTOR_TYPE - && TREE_CODE (TREE_TYPE (cond)) == VECTOR_TYPE)) + && VECTOR_TYPE_P (TREE_TYPE (cond)))) { tree testtype = TREE_TYPE (cond); test = cond; @@ -7248,7 +7248,7 @@ fold_binary_op_with_conditional_arg (location_t loc, /* Detect the case of mixing vector and scalar types - bail out. */ return NULL_TREE; - if (TREE_CODE (TREE_TYPE (test)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (test))) cond_code = VEC_COND_EXPR; /* This transformation is only worthwhile if we don't have to wrap ARG @@ -9289,7 +9289,7 @@ build_fold_addr_expr_with_type_loc (location_t loc, tree t, tree ptrtype) if (TREE_CODE (t) == WITH_SIZE_EXPR) t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) == INDIRECT_REF) + if (INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); @@ -10137,7 +10137,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (arg0, 0), &bitsize, &bitpos0, &offset0, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base0) == INDIRECT_REF) + if (INDIRECT_REF_P (base0)) base0 = TREE_OPERAND (base0, 0); else indirect_base0 = true; @@ -10152,7 +10152,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (base0, 0), &bitsize, &bitpos0, &offset0, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base0) == INDIRECT_REF) + if (INDIRECT_REF_P (base0)) base0 = TREE_OPERAND (base0, 0); else indirect_base0 = true; @@ -10180,7 +10180,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (arg1, 0), &bitsize, &bitpos1, &offset1, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base1) == INDIRECT_REF) + if (INDIRECT_REF_P (base1)) base1 = TREE_OPERAND (base1, 0); else indirect_base1 = true; @@ -10195,7 +10195,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, = get_inner_reference (TREE_OPERAND (base1, 0), &bitsize, &bitpos1, &offset1, &mode, &unsignedp, &reversep, &volatilep); - if (TREE_CODE (base1) == INDIRECT_REF) + if (INDIRECT_REF_P (base1)) base1 = TREE_OPERAND (base1, 0); else indirect_base1 = true; @@ -13763,9 +13763,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, fold_checksum_tree (TYPE_MAX_VALUE (expr), ctx, ht); } fold_checksum_tree (TYPE_MAIN_VARIANT (expr), ctx, ht); - if (TREE_CODE (expr) == RECORD_TYPE - || TREE_CODE (expr) == UNION_TYPE - || TREE_CODE (expr) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (expr)) fold_checksum_tree (TYPE_BINFO (expr), ctx, ht); fold_checksum_tree (TYPE_CONTEXT (expr), ctx, ht); break; @@ -14665,9 +14663,9 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0, tree inner_type = TREE_TYPE (op0); tree outer_type = type; - if (TREE_CODE (outer_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (outer_type)) { - if (TREE_CODE (inner_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (inner_type)) return RECURSE (op0); if (INTEGRAL_TYPE_P (inner_type)) { @@ -14678,7 +14676,7 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0, } else if (INTEGRAL_TYPE_P (outer_type)) { - if (TREE_CODE (inner_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (inner_type)) return RECURSE (op0); if (INTEGRAL_TYPE_P (inner_type)) return TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type) @@ -15442,7 +15440,7 @@ integer_valued_real_unary_p (tree_code code, tree op0, int depth) tree type = TREE_TYPE (op0); if (TREE_CODE (type) == INTEGER_TYPE) return true; - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) return RECURSE (op0); break; } @@ -15673,7 +15671,7 @@ fold_unary_to_constant (enum tree_code code, tree type, tree op0) tree fold_read_from_constant_string (tree exp) { - if ((TREE_CODE (exp) == INDIRECT_REF + if ((INDIRECT_REF_P (exp) || TREE_CODE (exp) == ARRAY_REF) && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE) { @@ -15682,7 +15680,7 @@ fold_read_from_constant_string (tree exp) tree string; location_t loc = EXPR_LOCATION (exp); - if (TREE_CODE (exp) == INDIRECT_REF) + if (INDIRECT_REF_P (exp)) string = string_constant (exp1, &index, NULL, NULL); else { |