return sve_vq_from_vl (vl);
}
-/* Add all the expected register sets into GDBARCH. */
-
-static void
-aarch64_add_reggroups (struct gdbarch *gdbarch)
-{
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
-}
-
/* Implement the "cannot_store_register" gdbarch method. */
static int
/* Virtual tables. */
set_gdbarch_vbit_in_delta (gdbarch, 1);
- /* Register architecture. */
- aarch64_add_reggroups (gdbarch);
-
/* Hook in the ABI-specific overrides, if they have been registered. */
info.target_desc = tdesc;
info.tdesc_data = tdesc_data.get ();
arc_frame_base_address
};
-/* Add all the expected register sets into GDBARCH. */
-
-static void
-arc_add_reggroups (struct gdbarch *gdbarch)
-{
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
-}
-
static enum arc_isa
mach_type_to_arc_isa (const unsigned long mach)
{
/* This doesn't include possible long-immediate value. */
set_gdbarch_max_insn_length (gdbarch, 4);
- /* Add default register groups. */
- arc_add_reggroups (gdbarch);
-
/* Frame unwinders and sniffers. */
dwarf2_frame_set_init_reg (gdbarch, arc_dwarf2_frame_init_reg);
dwarf2_append_unwinders (gdbarch);
static void
csky_add_reggroups (struct gdbarch *gdbarch)
{
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, general_reggroup);
reggroup_add (gdbarch, cr_reggroup);
reggroup_add (gdbarch, fr_reggroup);
reggroup_add (gdbarch, vr_reggroup);
{
reggroup_add (gdbarch, i386_sse_reggroup);
reggroup_add (gdbarch, i386_mmx_reggroup);
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, system_reggroup);
}
int
trad_frame_saved_reg *saved_regs;
};
-/* Add the available register groups. */
-
-static void
-lm32_add_reggroups (struct gdbarch *gdbarch)
-{
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, system_reggroup);
-}
-
/* Return whether a given register is in a given group. */
static int
set_gdbarch_push_dummy_call (gdbarch, lm32_push_dummy_call);
set_gdbarch_return_value (gdbarch, lm32_return_value);
- lm32_add_reggroups (gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, lm32_register_reggroup_p);
return gdbarch;
set_gdbarch_dwarf2_reg_to_regnum (arch, m32c_debug_info_reg_to_regnum);
set_gdbarch_register_reggroup_p (arch, m32c_register_reggroup_p);
- reggroup_add (arch, general_reggroup);
- reggroup_add (arch, all_reggroup);
- reggroup_add (arch, save_reggroup);
- reggroup_add (arch, restore_reggroup);
- reggroup_add (arch, system_reggroup);
reggroup_add (arch, m32c_dma_reggroup);
}
{
reggroup_add (gdbarch, m68hc11_hard_reggroup);
reggroup_add (gdbarch, m68hc11_soft_reggroup);
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, system_reggroup);
}
static int
set_gdbarch_stab_reg_to_regnum (gdbarch, mep_debug_reg_to_regnum);
set_gdbarch_register_reggroup_p (gdbarch, mep_register_reggroup_p);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
reggroup_add (gdbarch, mep_csr_reggroup);
reggroup_add (gdbarch, mep_cr_reggroup);
reggroup_add (gdbarch, mep_ccr_reggroup);
static void
nds32_add_reggroups (struct gdbarch *gdbarch)
{
- /* Add pre-defined register groups. */
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
-
/* Add NDS32 register groups. */
reggroup_add (gdbarch, nds32_cr_reggroup);
reggroup_add (gdbarch, nds32_ir_reggroup);
}
if (tdesc_data != NULL)
- {
- /* If we are using tdesc, register our own reggroups, otherwise we
- will used the defaults. */
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, float_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
-
- tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
- }
+ tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
static struct gdbarch_data *reggroups_data;
-static void *
-reggroups_init (struct obstack *obstack)
-{
- struct reggroups *groups = OBSTACK_ZALLOC (obstack, struct reggroups);
-
- groups->last = &groups->first;
- return groups;
-}
-
/* Add a register group (with attribute values) to the pre-defined
list. */
struct reggroups *groups
= (struct reggroups *) gdbarch_data (gdbarch, reggroups_data);
+ /* The same reggroup should not be added multiple times. */
+ gdb_assert (groups != nullptr);
+ for (struct reggroup_el *el = groups->first; el != nullptr; el = el->next)
+ gdb_assert (group != el->group);
+
add_group (groups, group,
GDBARCH_OBSTACK_ZALLOC (gdbarch, struct reggroup_el));
}
-/* The default register groups for an architecture. */
+/* Called to initialize the per-gdbarch register group information. */
-static struct reggroups default_groups = { NULL, &default_groups.first };
+static void *
+reggroups_init (struct obstack *obstack)
+{
+ struct reggroups *groups = OBSTACK_ZALLOC (obstack, struct reggroups);
+
+ groups->last = &groups->first;
+
+ /* Add the default groups. */
+ add_group (groups, general_reggroup,
+ OBSTACK_ZALLOC (obstack, struct reggroup_el));
+ add_group (groups, float_reggroup,
+ OBSTACK_ZALLOC (obstack, struct reggroup_el));
+ add_group (groups, system_reggroup,
+ OBSTACK_ZALLOC (obstack, struct reggroup_el));
+ add_group (groups, vector_reggroup,
+ OBSTACK_ZALLOC (obstack, struct reggroup_el));
+ add_group (groups, all_reggroup,
+ OBSTACK_ZALLOC (obstack, struct reggroup_el));
+ add_group (groups, save_reggroup,
+ OBSTACK_ZALLOC (obstack, struct reggroup_el));
+ add_group (groups, restore_reggroup,
+ OBSTACK_ZALLOC (obstack, struct reggroup_el));
+
+ return groups;
+}
/* A register group iterator. */
creation. If there are no groups, use the default groups list. */
groups = (struct reggroups *) gdbarch_data (gdbarch, reggroups_data);
gdb_assert (groups != NULL);
- if (groups->first == NULL)
- groups = &default_groups;
+ gdb_assert (groups->first != NULL);
/* Return the first/next reggroup. */
if (last == NULL)
creation. If there are no groups, use the default groups list. */
groups = (struct reggroups *) gdbarch_data (gdbarch, reggroups_data);
gdb_assert (groups != NULL);
- if (groups->first == NULL)
- groups = &default_groups;
+ gdb_assert (groups->first != NULL);
prev = NULL;
for (el = groups->first; el != NULL; el = el->next)
{
reggroups_data = gdbarch_data_register_pre_init (reggroups_init);
- /* The pre-defined list of groups. */
- add_group (&default_groups, general_reggroup, XNEW (struct reggroup_el));
- add_group (&default_groups, float_reggroup, XNEW (struct reggroup_el));
- add_group (&default_groups, system_reggroup, XNEW (struct reggroup_el));
- add_group (&default_groups, vector_reggroup, XNEW (struct reggroup_el));
- add_group (&default_groups, all_reggroup, XNEW (struct reggroup_el));
- add_group (&default_groups, save_reggroup, XNEW (struct reggroup_el));
- add_group (&default_groups, restore_reggroup, XNEW (struct reggroup_el));
-
add_cmd ("reggroups", class_maintenance,
maintenance_print_reggroups, _("\
Print the internal register group names.\n\
return riscv_lookup_target_description (features);
}
-/* Add all the expected register sets into GDBARCH. */
+/* Add all the RISC-V specific register groups into GDBARCH. */
static void
riscv_add_reggroups (struct gdbarch *gdbarch)
{
- /* Add predefined register groups. */
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
-
- /* Add RISC-V specific register groups. */
reggroup_add (gdbarch, csr_reggroup);
}
static void
xtensa_add_reggroups (struct gdbarch *gdbarch)
{
- int i;
-
- /* Predefined groups. */
- reggroup_add (gdbarch, all_reggroup);
- reggroup_add (gdbarch, save_reggroup);
- reggroup_add (gdbarch, restore_reggroup);
- reggroup_add (gdbarch, system_reggroup);
- reggroup_add (gdbarch, vector_reggroup);
- reggroup_add (gdbarch, general_reggroup);
- reggroup_add (gdbarch, float_reggroup);
-
/* Xtensa-specific groups. */
reggroup_add (gdbarch, xtensa_ar_reggroup);
reggroup_add (gdbarch, xtensa_user_reggroup);
reggroup_add (gdbarch, xtensa_vectra_reggroup);
- for (i = 0; i < XTENSA_MAX_COPROCESSOR; i++)
+ for (int i = 0; i < XTENSA_MAX_COPROCESSOR; i++)
reggroup_add (gdbarch, xtensa_cp[i]);
}