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
This commit is contained in:
parent
a409645d13
commit
2062087b35
9 changed files with 29 additions and 13 deletions
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue