diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:08:02 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:08:02 -0400 |
commit | 2062087b358cc5320d52b32c50866dbd08fb2631 (patch) | |
tree | bbf2de8f0df655ce90cbc94e2edbab7b0082919e | |
parent | a409645d13f6cddef4827cf7240c01ec3e09559c (diff) | |
download | gdb-2062087b358cc5320d52b32c50866dbd08fb2631.zip gdb-2062087b358cc5320d52b32c50866dbd08fb2631.tar.gz gdb-2062087b358cc5320d52b32c50866dbd08fb2631.tar.bz2 |
gdb: add type::is_vector / type::set_is_vector
Add the `is_vector` and `set_is_vector` methods on `struct type`, in
order to remove the `TYPE_VECTOR` macro. In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly. The
next patch will remove the macro completely.
gdb/ChangeLog:
* gdbtypes.h (struct type) <is_vector, set_is_vector>: New methods.
(TYPE_VECTOR): Use type::is_vector, change all write call sites to
use type::set_is_vector.
Change-Id: I415e8d169f058662e0750329bfa4017bea3ca0cb
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 4 | ||||
-rw-r--r-- | gdb/csky-tdep.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 14 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 6 | ||||
-rw-r--r-- | gdb/riscv-tdep.c | 2 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 4 | ||||
-rw-r--r-- | gdb/target-descriptions.c | 2 |
9 files changed, 29 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cde84e1..b28de5b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2020-09-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (struct type) <is_vector, set_is_vector>: New methods. + (TYPE_VECTOR): Use type::is_vector, change all write call sites to + use type::set_is_vector. + +2020-09-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (TYPE_VARARGS): Remove, replace all uses with type::has_varargs. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 1eeaea3..ecf65f2 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -4030,7 +4030,7 @@ arm_neon_double_type (struct gdbarch *gdbarch) elem = builtin_type (gdbarch)->builtin_double; append_composite_type_field (t, "f64", elem); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("neon_d"); tdep->neon_double_type = t; } @@ -4069,7 +4069,7 @@ arm_neon_quad_type (struct gdbarch *gdbarch) elem = builtin_type (gdbarch)->builtin_double; append_composite_type_field (t, "f64", init_vector_type (elem, 2)); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("neon_q"); tdep->neon_quad_type = t; } diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index 7e5b71e..c9245fc 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -266,7 +266,7 @@ csky_vector_type (struct gdbarch *gdbarch) append_composite_type_field (t, "u8", init_vector_type (bt->builtin_int8, 16)); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("builtin_type_vec128i"); return t; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 5927f50..d822930 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1428,7 +1428,7 @@ make_vector_type (struct type *array_type) TYPE_TARGET_TYPE (inner_array) = elt_type; } - TYPE_VECTOR (array_type) = 1; + array_type->set_is_vector (true); } struct type * diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 86d2f8c..760d536 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -219,7 +219,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); /* * 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) (TYPE_MAIN_TYPE (t)->flag_vector) +#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 @@ -824,7 +824,7 @@ struct main_type unsigned int m_flag_target_stub : 1; unsigned int m_flag_prototyped : 1; unsigned int m_flag_varargs : 1; - unsigned int flag_vector : 1; + unsigned int m_flag_vector : 1; unsigned int flag_stub_supported : 1; unsigned int flag_gnu_ifunc : 1; unsigned int flag_fixed_instance : 1; @@ -1116,6 +1116,16 @@ struct type this->main_type->m_flag_varargs = has_varargs; } + bool is_vector () const + { + return this->main_type->m_flag_vector; + } + + void set_is_vector (bool is_vector) + { + this->main_type->m_flag_vector = is_vector; + } + /* * Return the dynamic property of the requested KIND from this type's list of dynamic properties. */ dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 1b7971c..98aaa14 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -3137,7 +3137,7 @@ i386_zmm_type (struct gdbarch *gdbarch) append_composite_type_field (t, "v4_int128", init_vector_type (bt->builtin_int128, 4)); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("builtin_type_vec512i"); tdep->i386_zmm_type = t; } @@ -3193,7 +3193,7 @@ i386_ymm_type (struct gdbarch *gdbarch) append_composite_type_field (t, "v2_int128", init_vector_type (bt->builtin_int128, 2)); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("builtin_type_vec256i"); tdep->i386_ymm_type = t; } @@ -3235,7 +3235,7 @@ i386_mmx_type (struct gdbarch *gdbarch) append_composite_type_field (t, "v8_int8", init_vector_type (bt->builtin_int8, 8)); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("builtin_type_vec64i"); tdep->i386_mmx_type = t; } diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index a79b5f5..0e8cf38 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -674,7 +674,7 @@ riscv_fpreg_d_type (struct gdbarch *gdbarch) "__gdb_builtin_type_fpreg_d", TYPE_CODE_UNION); append_composite_type_field (t, "float", bt->builtin_float); append_composite_type_field (t, "double", bt->builtin_double); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("builtin_type_fpreg_d"); tdep->riscv_fpreg_d_type = t; } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 84278e7..adb39d9 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2273,7 +2273,7 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch) append_composite_type_field (t, "v8_int8", init_vector_type (bt->builtin_int8, 8)); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("ppc_builtin_type_vec64"); tdep->ppc_builtin_type_vec64 = t; } @@ -2320,7 +2320,7 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch) append_composite_type_field (t, "v16_int8", init_vector_type (bt->builtin_int8, 16)); - TYPE_VECTOR (t) = 1; + t->set_is_vector (true); t->set_name ("ppc_builtin_type_vec128"); tdep->ppc_builtin_type_vec128 = t; } diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 611cb9c..9d2d053 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -264,7 +264,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype) 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)) - TYPE_VECTOR (m_type) = 1; + m_type->set_is_vector (true); } } |