From: Simon Marchi Date: Mon, 14 Sep 2020 15:08:03 +0000 (-0400) Subject: gdb: remove TYPE_VECTOR X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd63c870088388fc55efbf50f2dfc0592fe874e5;p=binutils-gdb.git gdb: remove TYPE_VECTOR gdb/ChangeLog: * gdbtypes.h (TYPE_VECTOR): Remove, replace all uses with type::is_vector. Change-Id: I1ac28755af44b1585c190553f9961288c8fb9137 --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b28de5b6ad0..b8f2361b905 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-09-14 Simon Marchi + + * gdbtypes.h (TYPE_VECTOR): Remove, replace all + uses with type::is_vector. + 2020-09-14 Simon Marchi * gdbtypes.h (struct type) : New methods. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 61e8e57552c..a2547d12dc6 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1393,7 +1393,7 @@ static ULONGEST aarch64_type_align (gdbarch *gdbarch, struct type *t) { t = check_typedef (t); - if (t->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (t)) + if (t->code () == TYPE_CODE_ARRAY && t->is_vector ()) { /* Use the natural alignment for vector types (the same for scalar type), but the maximum alignment is 128-bit. */ @@ -1453,7 +1453,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type, case TYPE_CODE_ARRAY: { - if (TYPE_VECTOR (type)) + if (type->is_vector ()) { if (TYPE_LENGTH (type) != 8 && TYPE_LENGTH (type) != 16) return -1; @@ -1760,7 +1760,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache, } case TYPE_CODE_ARRAY: - if (TYPE_VECTOR (arg_type)) + if (arg_type->is_vector ()) return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (arg_type), value_contents (arg)); /* fall through. */ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index ecf65f24a19..5470332e1c1 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3417,7 +3417,7 @@ static ULONGEST arm_type_align (gdbarch *gdbarch, struct type *t) { t = check_typedef (t); - if (t->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (t)) + if (t->code () == TYPE_CODE_ARRAY && t->is_vector ()) { /* Use the natural alignment for vector types (the same for scalar type), but the maximum alignment is 64-bit. */ @@ -3562,7 +3562,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, case TYPE_CODE_ARRAY: { - if (TYPE_VECTOR (t)) + if (t->is_vector ()) { /* A 64-bit or 128-bit containerized vector type are VFP CPRCs. */ @@ -8017,7 +8017,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct type *type) && TYPE_CODE_ARRAY != code && TYPE_CODE_COMPLEX != code) return 0; - if (TYPE_CODE_ARRAY == code && TYPE_VECTOR (type)) + if (TYPE_CODE_ARRAY == code && type->is_vector ()) { /* Vector values should be returned using ARM registers if they are not over 16 bytes. */ diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 0c2268f8d0a..b642c881787 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -133,7 +133,7 @@ c_print_type_1 (struct type *type, && (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD || (code == TYPE_CODE_ARRAY - && !TYPE_VECTOR (type)) + && !type->is_vector ()) || code == TYPE_CODE_MEMBERPTR || code == TYPE_CODE_METHODPTR || TYPE_IS_REFERENCE (type)))) @@ -772,7 +772,7 @@ c_type_print_varspec_suffix (struct type *type, case TYPE_CODE_ARRAY: { LONGEST low_bound, high_bound; - int is_vector = TYPE_VECTOR (type); + int is_vector = type->is_vector (); if (passed_a_ptr) fprintf_filtered (stream, ")"); diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index 03536c0ca33..6d9bb37b17c 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -56,7 +56,7 @@ convert_array (compile_c_instance *context, struct type *type) { gcc_type result; - if (TYPE_VECTOR (type)) + if (type->is_vector ()) return context->plugin ().error (_("variably-sized vector type" " is not supported")); @@ -78,7 +78,7 @@ convert_array (compile_c_instance *context, struct type *type) count = high_bound + 1; } - if (TYPE_VECTOR (type)) + if (type->is_vector ()) return context->plugin ().build_vector_type (element_type, count); return context->plugin ().build_array_type (element_type, count); } diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 8270defa17c..bb4b267e9af 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -475,7 +475,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance, if (range->bounds ()->high.kind () == PROP_LOCEXPR || range->bounds ()->high.kind () == PROP_LOCLIST) { - if (TYPE_VECTOR (type)) + if (type->is_vector ()) { const char *s = _("variably-sized vector type is not supported"); @@ -499,7 +499,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance, count = high_bound + 1; } - if (TYPE_VECTOR (type)) + if (type->is_vector ()) return instance->plugin ().build_vector_type (element_type, count); return instance->plugin ().build_array_type (element_type, count); diff --git a/gdb/eval.c b/gdb/eval.c index d87b8dae110..2d271981626 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -622,7 +622,7 @@ ptrmath_type_p (const struct language_defn *lang, struct type *type) return 1; case TYPE_CODE_ARRAY: - return TYPE_VECTOR (type) ? 0 : lang->c_style_arrays; + return type->is_vector () ? 0 : lang->c_style_arrays; default: return 0; @@ -3137,7 +3137,7 @@ evaluate_subexp_with_coercion (struct expression *exp, var = exp->elts[pc + 2].symbol; type = check_typedef (SYMBOL_TYPE (var)); if (type->code () == TYPE_CODE_ARRAY - && !TYPE_VECTOR (type) + && !type->is_vector () && CAST_IS_CONVERSION (exp->language_defn)) { (*pos) += 4; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d8229309dc8..89f428faf21 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3993,7 +3993,7 @@ check_types_equal (struct type *type1, struct type *type2, || type1->has_no_signedness () != type2->has_no_signedness () || TYPE_ENDIANITY_NOT_DEFAULT (type1) != TYPE_ENDIANITY_NOT_DEFAULT (type2) || type1->has_varargs () != type2->has_varargs () - || TYPE_VECTOR (type1) != TYPE_VECTOR (type2) + || type1->is_vector () != type2->is_vector () || TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2) || TYPE_INSTANCE_FLAGS (type1) != TYPE_INSTANCE_FLAGS (type2) || type1->num_fields () != type2->num_fields ()) @@ -5095,7 +5095,7 @@ recursive_dump_type (struct type *type, int spaces) /* This is used for things like AltiVec registers on ppc. Gcc emits an attribute for the array type, which tells whether or not we have a vector, instead of a regular array. */ - if (TYPE_VECTOR (type)) + if (type->is_vector ()) { puts_filtered (" TYPE_VECTOR"); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 760d536dd04..4d567e42ab7 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -216,11 +216,6 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); #define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default) -/* * Identify a vector type. Gcc is handling this by adding an extra - attribute to the array type. We slurp that in as a new flag of a - type. This is used only in dwarf2read.c. */ -#define TYPE_VECTOR(t) ((t)->is_vector ()) - /* * The debugging formats (especially STABS) do not contain enough information to represent all Ada types---especially those whose size depends on dynamic quantities. Therefore, the GNAT Ada @@ -1116,6 +1111,10 @@ struct type this->main_type->m_flag_varargs = has_varargs; } + /* Identify a vector type. Gcc is handling this by adding an extra + attribute to the array type. We slurp that in as a new flag of a + type. This is used only in dwarf2read.c. */ + bool is_vector () const { return this->main_type->m_flag_vector; diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c index 88f5757b98b..82b28af62b3 100644 --- a/gdb/i386-darwin-tdep.c +++ b/gdb/i386-darwin-tdep.c @@ -109,7 +109,7 @@ darwin_dwarf_signal_frame_p (struct gdbarch *gdbarch, static int i386_m128_p (struct type *type) { - return (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + return (type->code () == TYPE_CODE_ARRAY && type->is_vector () && TYPE_LENGTH (type) == 16); } @@ -124,7 +124,7 @@ i386_darwin_arg_type_alignment (struct type *type) aligned to 8-byte boundaries. 7. [...] The caller aligns 128-bit vectors in the parameter area to 16-byte boundaries. */ - if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) return TYPE_LENGTH (type); /* 4. The caller places all the fields of structures (or unions) with no vector elements in the parameter area. These structures are 4-byte diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 98aaa140858..64e42dcbfe6 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2636,7 +2636,7 @@ i386_16_byte_align_p (struct type *type) { type = check_typedef (type); if ((type->code () == TYPE_CODE_DECFLOAT - || (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))) + || (type->code () == TYPE_CODE_ARRAY && type->is_vector ())) && TYPE_LENGTH (type) == 16) return 1; if (type->code () == TYPE_CODE_ARRAY) diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 5d68f7fb4ff..6abf8336954 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -329,7 +329,7 @@ ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum, int raw_p; if (group == all_reggroup) return 1; - vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); + vector_p = register_type (gdbarch, regnum)->is_vector (); float_p = register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT; raw_p = regnum < NUM_IA64_RAW_REGS; if (group == float_reggroup) diff --git a/gdb/infcall.c b/gdb/infcall.c index a158cb5d085..9539d381428 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -220,7 +220,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, they are vectors, in which case we want to leave them alone, because they are passed by value. */ if (current_language->c_style_arrays) - if (!TYPE_VECTOR (type)) + if (!type->is_vector ()) type = lookup_pointer_type (TYPE_TARGET_TYPE (type)); break; case TYPE_CODE_UNDEF: diff --git a/gdb/infcmd.c b/gdb/infcmd.c index cfc31699925..6f20b7d1eed 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2134,7 +2134,7 @@ default_print_one_register_info (struct ui_file *file, common_val_print (val, &format_stream, 0, &opts, current_language); /* If not a vector register, print it also according to its natural format. */ - if (print_raw_format && TYPE_VECTOR (regtype) == 0) + if (print_raw_format && regtype->is_vector () == 0) { pad_to_column (format_stream, value_column_2); get_user_print_options (&opts); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index b55bfbaa4c8..9e2a9cba529 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -686,7 +686,7 @@ mips_register_reggroup_p (struct gdbarch *gdbarch, int regnum, int pseudo = regnum / gdbarch_num_regs (gdbarch); if (reggroup == all_reggroup) return pseudo; - vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); + vector_p = register_type (gdbarch, regnum)->is_vector (); float_p = register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT; /* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs (gdbarch), as not all architectures are multi-arch. */ diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 9b9ce183293..2d5ae17c36d 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -96,7 +96,7 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code, { LONGEST lowb, highb; - if (types[i]->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (types[i]) + if (types[i]->code () == TYPE_CODE_ARRAY && types[i]->is_vector () && get_array_bounds (types[i], &lowb, &highb) && TYPE_TARGET_TYPE (types[i])->code () == code && TYPE_TARGET_TYPE (types[i])->is_unsigned () == flag_unsigned @@ -497,7 +497,7 @@ opencl_logical_not (struct expression *exp, struct value *arg) struct type *rettype; struct value *ret; - if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) { struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); LONGEST lowb, highb; @@ -586,8 +586,8 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2, type1 = check_typedef (value_type (val1)); type2 = check_typedef (value_type (val2)); - t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)); - t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)); + t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()); + t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ()); if (!t1_is_vec || !t2_is_vec) error (_("Vector operations are not supported on scalar types")); @@ -658,7 +658,7 @@ opencl_value_cast (struct type *type, struct value *arg) || code2 == TYPE_CODE_DECFLOAT || code2 == TYPE_CODE_ENUM || code2 == TYPE_CODE_RANGE); - if (code1 == TYPE_CODE_ARRAY && TYPE_VECTOR (to_type) && scalar) + if (code1 == TYPE_CODE_ARRAY && to_type->is_vector () && scalar) { struct type *eltype; @@ -688,9 +688,9 @@ opencl_relop (struct expression *exp, struct value *arg1, struct value *arg2, struct type *type1 = check_typedef (value_type (arg1)); struct type *type2 = check_typedef (value_type (arg2)); int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type1)); + && type1->is_vector ()); int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type2)); + && type2->is_vector ()); if (!t1_is_vec && !t2_is_vec) { @@ -831,8 +831,8 @@ evaluate_subexp_opencl (struct type *expect_type, struct expression *exp, type1 = check_typedef (value_type (arg1)); type2 = check_typedef (value_type (arg2)); - if ((type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) - || (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2))) + if ((type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) + || (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ())) { arg2 = evaluate_subexp (nullptr, exp, pos, noside); @@ -867,7 +867,7 @@ evaluate_subexp_opencl (struct type *expect_type, struct expression *exp, (*pos)++; arg1 = evaluate_subexp (nullptr, exp, pos, noside); type1 = check_typedef (value_type (arg1)); - if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) + if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) { struct value *arg3, *tmp, *ret; struct type *eltype2, *type3, *eltype3; @@ -879,9 +879,9 @@ evaluate_subexp_opencl (struct type *expect_type, struct expression *exp, type2 = check_typedef (value_type (arg2)); type3 = check_typedef (value_type (arg3)); t2_is_vec - = type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2); + = type2->code () == TYPE_CODE_ARRAY && type2->is_vector (); t3_is_vec - = type3->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type3); + = type3->code () == TYPE_CODE_ARRAY && type3->is_vector (); /* Widen the scalar operand to a vector if necessary. */ if (t2_is_vec || !t3_is_vec) @@ -970,7 +970,7 @@ Cannot perform conditional operation on vectors with different sizes")); return value_from_longest (builtin_type (exp->gdbarch)-> builtin_int, 1); } - else if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) + else if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) { return opencl_component_ref (exp, arg1, &exp->elts[pc + 2].string, noside); @@ -1062,7 +1062,7 @@ public: if (show > 0) { type = check_typedef (type); - if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + if (type->code () == TYPE_CODE_ARRAY && type->is_vector () && type->name () != NULL) show = 0; } diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 4c4bdacf4d1..91b20668125 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -253,7 +253,7 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function, if ((valtype->code () == TYPE_CODE_STRUCT || valtype->code () == TYPE_CODE_UNION) && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8) - && TYPE_VECTOR (valtype))) + && valtype->is_vector ())) return RETURN_VALUE_STRUCT_CONVENTION; else return ppc_sysv_abi_return_value (gdbarch, function, valtype, regcache, diff --git a/gdb/ppc-nbsd-tdep.c b/gdb/ppc-nbsd-tdep.c index ba4e943a01a..fa90243d964 100644 --- a/gdb/ppc-nbsd-tdep.c +++ b/gdb/ppc-nbsd-tdep.c @@ -78,7 +78,7 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function, if ((valtype->code () == TYPE_CODE_STRUCT || valtype->code () == TYPE_CODE_UNION) && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8) - && TYPE_VECTOR (valtype)) + && valtype->is_vector ()) && !(TYPE_LENGTH (valtype) == 1 || TYPE_LENGTH (valtype) == 2 || TYPE_LENGTH (valtype) == 4 diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index f0f618c5eba..08c65cff2ff 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -335,7 +335,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else if (len < 16 && type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && opencl_abi) { /* OpenCL vectors shorter than 16 bytes are passed as if @@ -422,7 +422,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else if (len >= 16 && type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && opencl_abi) { /* OpenCL vectors 16 bytes or longer are passed as if @@ -451,7 +451,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else if (len == 16 && type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && tdep->vector_abi == POWERPC_VEC_ALTIVEC) { /* Vector parameter passed in an Altivec register, or @@ -472,7 +472,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else if (len == 8 && type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && tdep->vector_abi == POWERPC_VEC_SPE) { /* Vector parameter passed in an e500 register, or when @@ -509,7 +509,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Structs and large values are put in an aligned stack slot ... */ if (type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && len >= 16) structoffset = align_up (structoffset, 16); else @@ -804,7 +804,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, /* OpenCL vectors < 16 bytes are returned as distinct scalars in f1..f2 or r3..r10. */ if (type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && TYPE_LENGTH (type) < 16 && opencl_abi) { @@ -858,7 +858,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } /* OpenCL vectors >= 16 bytes are returned in v2..v9. */ if (type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && TYPE_LENGTH (type) >= 16 && opencl_abi) { @@ -880,7 +880,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } if (TYPE_LENGTH (type) == 16 && type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && tdep->vector_abi == POWERPC_VEC_ALTIVEC) { if (readbuf) @@ -897,7 +897,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } if (TYPE_LENGTH (type) == 16 && type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && tdep->vector_abi == POWERPC_VEC_GENERIC) { /* GCC -maltivec -mabi=no-altivec returns vectors in r3/r4/r5/r6. @@ -921,7 +921,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type, } if (TYPE_LENGTH (type) == 8 && type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type) + && type->is_vector () && tdep->vector_abi == POWERPC_VEC_SPE) { /* The e500 ABI places return values for the 64-bit DSP types @@ -1101,7 +1101,7 @@ ppc64_aggregate_candidate (struct type *type, break; case TYPE_CODE_ARRAY: - if (TYPE_VECTOR (type)) + if (type->is_vector ()) { if (!*field_type) *field_type = type; @@ -1186,7 +1186,7 @@ ppc64_elfv2_abi_homogeneous_aggregate (struct type *type, complex types can be elements of homogeneous aggregates. */ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION - || (type->code () == TYPE_CODE_ARRAY && !TYPE_VECTOR (type))) + || (type->code () == TYPE_CODE_ARRAY && !type->is_vector ())) { struct type *field_type = NULL; LONGEST field_count = ppc64_aggregate_candidate (type, &field_type); @@ -1428,7 +1428,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos); ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); } - else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + else if (type->code () == TYPE_CODE_ARRAY && type->is_vector () && tdep->vector_abi == POWERPC_VEC_ALTIVEC && TYPE_LENGTH (type) == 16) { @@ -1436,7 +1436,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 16, argpos); ppc64_sysv_abi_push_vreg (gdbarch, val, argpos); } - else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + else if (type->code () == TYPE_CODE_ARRAY && type->is_vector () && TYPE_LENGTH (type) >= 16) { /* Non-Altivec vectors are passed by reference. */ @@ -1520,7 +1520,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, || eltype->code () == TYPE_CODE_DECFLOAT) ppc64_sysv_abi_push_freg (gdbarch, eltype, elval, argpos); else if (eltype->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (eltype) + && eltype->is_vector () && tdep->vector_abi == POWERPC_VEC_ALTIVEC && TYPE_LENGTH (eltype) == 16) ppc64_sysv_abi_push_vreg (gdbarch, elval, argpos); @@ -1644,7 +1644,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, ppc64_sysv_abi_push_param (gdbarch, eltype, val + TYPE_LENGTH (eltype), &argpos); } - else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type) + else if (type->code () == TYPE_CODE_ARRAY && type->is_vector () && opencl_abi) { /* OpenCL vectors shorter than 16 bytes are passed as if @@ -1856,7 +1856,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* AltiVec vectors are returned in VRs starting at v2. */ if (TYPE_LENGTH (valtype) == 16 - && valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + && valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector () && tdep->vector_abi == POWERPC_VEC_ALTIVEC) { int regnum = tdep->ppc_vr0_regnum + 2 + index; @@ -1870,7 +1870,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, /* Short vectors are returned in GPRs starting at r3. */ if (TYPE_LENGTH (valtype) <= 8 - && valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) + && valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ()) { int regnum = tdep->ppc_gp0_regnum + 3 + index; int offset = 0; @@ -1938,7 +1938,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, /* OpenCL vectors shorter than 16 bytes are returned as if a series of independent scalars; OpenCL vectors 16 bytes or longer are returned as if a series of AltiVec vectors. */ - if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector () && opencl_abi) { if (TYPE_LENGTH (valtype) < 16) @@ -1975,7 +1975,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, /* Small character arrays are returned, right justified, in r3. */ if (valtype->code () == TYPE_CODE_ARRAY - && !TYPE_VECTOR (valtype) + && !valtype->is_vector () && TYPE_LENGTH (valtype) <= 8 && TYPE_TARGET_TYPE (valtype)->code () == TYPE_CODE_INT && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) @@ -1999,7 +1999,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, && (eltype->code () == TYPE_CODE_FLT || eltype->code () == TYPE_CODE_DECFLOAT || (eltype->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (eltype) + && eltype->is_vector () && tdep->vector_abi == POWERPC_VEC_ALTIVEC && TYPE_LENGTH (eltype) == 16))) { @@ -2025,7 +2025,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, && (valtype->code () == TYPE_CODE_STRUCT || valtype->code () == TYPE_CODE_UNION || (valtype->code () == TYPE_CODE_ARRAY - && !TYPE_VECTOR (valtype)))) + && !valtype->is_vector ()))) { int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1) / tdep->wordsize); diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 83d7b49e330..c092c9c30b9 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -201,7 +201,7 @@ default_register_reggroup_p (struct gdbarch *gdbarch, int regnum, return 0; if (group == all_reggroup) return 1; - vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); + vector_p = register_type (gdbarch, regnum)->is_vector (); float_p = (register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT || (register_type (gdbarch, regnum)->code () == TYPE_CODE_DECFLOAT)); diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 0e8cf38e50c..a7c25642d03 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -935,7 +935,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch, { /* If not a vector register, print it also according to its natural format. */ - if (TYPE_VECTOR (regtype) == 0) + if (regtype->is_vector () == 0) { get_user_print_options (&opts); opts.deref_ref = 1; @@ -1772,7 +1772,7 @@ static ULONGEST riscv_type_align (gdbarch *gdbarch, type *type) { type = check_typedef (type); - if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) return std::min (TYPE_LENGTH (type), (ULONGEST) BIGGEST_ALIGNMENT); /* Anything else will be aligned by the generic code. */ diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index 66b75a70249..730dd98f67c 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -527,7 +527,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function, /* AltiVec extension: Functions that declare a vector data type as a return value place that return value in VR2. */ - if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector () && TYPE_LENGTH (valtype) == 16) { if (readbuf) diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c index 7f1825dc453..54a1bdcb952 100644 --- a/gdb/rs6000-lynx178-tdep.c +++ b/gdb/rs6000-lynx178-tdep.c @@ -274,7 +274,7 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function, /* AltiVec extension: Functions that declare a vector data type as a return value place that return value in VR2. */ - if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + if (valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector () && TYPE_LENGTH (valtype) == 16) { if (readbuf) diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index efe650ae036..fc374bcd560 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -75,7 +75,7 @@ s390_type_align (gdbarch *gdbarch, struct type *t) return 8; case TYPE_CODE_ARRAY: - if (TYPE_VECTOR (t)) + if (t->is_vector ()) return 8; break; } @@ -1697,7 +1697,7 @@ s390_function_arg_vector (struct type *type) /* Structs containing just a vector are passed like a vector. */ type = s390_effective_inner_type (type, TYPE_LENGTH (type)); - return type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type); + return type->code () == TYPE_CODE_ARRAY && type->is_vector (); } /* Determine whether N is a power of two. */ @@ -2093,7 +2093,7 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function, break; case TYPE_CODE_ARRAY: rvc = (gdbarch_tdep (gdbarch)->vector_abi == S390_VECTOR_ABI_128 - && TYPE_LENGTH (type) <= 16 && TYPE_VECTOR (type)) + && TYPE_LENGTH (type) <= 16 && type->is_vector ()) ? RETURN_VALUE_REGISTER_CONVENTION : RETURN_VALUE_STRUCT_CONVENTION; break; diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 9e00a678a19..681b8009008 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -303,7 +303,7 @@ sparc_structure_or_union_p (const struct type *type) static bool sparc_structure_return_p (const struct type *type) { - if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) { /* Float vectors are always returned by memory. */ if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type)))) @@ -331,7 +331,7 @@ sparc_structure_return_p (const struct type *type) static bool sparc_arg_by_memory_p (const struct type *type) { - if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) { /* Float vectors are always passed by memory. */ if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type)))) diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 9d2d053545c..eadad86cce1 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -263,7 +263,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype) /* If any of the children of a union are vectors, flag the union as a vector also. This allows e.g. a union of two vector types to show up automatically in "info vector". */ - if (TYPE_VECTOR (field_gdb_type)) + if (field_gdb_type->is_vector ()) m_type->set_is_vector (true); } } diff --git a/gdb/valarith.c b/gdb/valarith.c index 82f11db3d56..c418fc6f55a 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -1440,7 +1440,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type) vector_type = check_typedef (vector_type); gdb_assert (vector_type->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (vector_type)); + && vector_type->is_vector ()); if (!get_array_bounds (vector_type, &low_bound, &high_bound)) error (_("Could not determine the vector bounds")); @@ -1480,9 +1480,9 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op) type2 = check_typedef (value_type (val2)); t1_is_vec = (type1->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type1)) ? 1 : 0; + && type1->is_vector ()) ? 1 : 0; t2_is_vec = (type2->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type2)) ? 1 : 0; + && type2->is_vector ()) ? 1 : 0; if (!t1_is_vec || !t2_is_vec) error (_("Vector operations are only supported among vectors")); @@ -1525,9 +1525,9 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) struct type *type1 = check_typedef (value_type (arg1)); struct type *type2 = check_typedef (value_type (arg2)); int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type1)); + && type1->is_vector ()); int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY - && TYPE_VECTOR (type2)); + && type2->is_vector ()); if (!t1_is_vec && !t2_is_vec) val = scalar_binop (arg1, arg2, op); @@ -1767,7 +1767,7 @@ value_pos (struct value *arg1) type = check_typedef (value_type (arg1)); if (is_integral_type (type) || is_floating_value (arg1) - || (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + || (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) || type->code () == TYPE_CODE_COMPLEX) return value_from_contents (type, value_contents (arg1)); else @@ -1784,7 +1784,7 @@ value_neg (struct value *arg1) if (is_integral_type (type) || is_floating_type (type)) return value_binop (value_from_longest (type, 0), arg1, BINOP_SUB); - else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) { struct value *tmp, *val = allocate_value (type); struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); @@ -1826,7 +1826,7 @@ value_complement (struct value *arg1) if (is_integral_type (type)) val = value_from_longest (type, ~value_as_long (arg1)); - else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) + else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()) { struct value *tmp; struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); diff --git a/gdb/valops.c b/gdb/valops.c index aba4c70d45e..da2881a3469 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -416,7 +416,7 @@ value_cast (struct type *type, struct value *arg2) if (current_language->c_style_arrays && type2->code () == TYPE_CODE_ARRAY - && !TYPE_VECTOR (type2)) + && !type2->is_vector ()) arg2 = value_coerce_array (arg2); if (type2->code () == TYPE_CODE_FUNC) @@ -529,11 +529,11 @@ value_cast (struct type *type, struct value *arg2) minus one, instead of biasing the normal case. */ return value_from_longest (to_type, -1); } - else if (code1 == TYPE_CODE_ARRAY && TYPE_VECTOR (type) - && code2 == TYPE_CODE_ARRAY && TYPE_VECTOR (type2) + else if (code1 == TYPE_CODE_ARRAY && type->is_vector () + && code2 == TYPE_CODE_ARRAY && type2->is_vector () && TYPE_LENGTH (type) != TYPE_LENGTH (type2)) error (_("Cannot convert between vector values of different sizes")); - else if (code1 == TYPE_CODE_ARRAY && TYPE_VECTOR (type) && scalar + else if (code1 == TYPE_CODE_ARRAY && type->is_vector () && scalar && TYPE_LENGTH (type) != TYPE_LENGTH (type2)) error (_("can only cast scalar to vector of same size")); else if (code1 == TYPE_CODE_VOID) @@ -854,7 +854,7 @@ value_one (struct type *type) { val = value_from_longest (type, (LONGEST) 1); } - else if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1)) + else if (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) { struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type1)); int i; @@ -1361,7 +1361,7 @@ value_must_coerce_to_target (struct value *val) switch (valtype->code ()) { case TYPE_CODE_ARRAY: - return TYPE_VECTOR (valtype) ? 0 : 1; + return valtype->is_vector () ? 0 : 1; case TYPE_CODE_STRING: return true; default: diff --git a/gdb/value.c b/gdb/value.c index f5eb5641d9b..8f4030e90b2 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3687,7 +3687,7 @@ coerce_array (struct value *arg) switch (type->code ()) { case TYPE_CODE_ARRAY: - if (!TYPE_VECTOR (type) && current_language->c_style_arrays) + if (!type->is_vector () && current_language->c_style_arrays) arg = value_coerce_array (arg); break; case TYPE_CODE_FUNC: