std::vector<stack_item_t> si;
};
+/* Helper function. Returns true if REGNUM is a tagged register, otherwise
+ returns false. */
+
+static bool
+morello_is_tagged_register (struct gdbarch *gdbarch, int regnum)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ /* Only Morello's registers have tags. */
+ if (!tdep->has_capability ())
+ return false;
+
+ /* The last two registers of the C register set don't have tags. */
+ if (regnum < tdep->cap_reg_base ||
+ regnum > tdep->cap_reg_last - 2)
+ return false;
+
+ return true;
+}
+
/* Implementation of the gdbarch_register_set_tag hook. */
static void
aarch64_register_set_tag (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, bool tag)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ if (!morello_is_tagged_register (gdbarch, regnum))
+ return;
CORE_ADDR tag_map = 0;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Read the tag register, adjust and write back. */
regcache->cooked_read (tdep->cap_reg_last - 1, (gdb_byte *) &tag_map);
if (aarch64_debug)
debug_printf ("%s: Entering\n", __func__);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- /* Only Morello's registers have tags. */
- if (!tdep->has_capability ())
- return false;
-
- /* The last two registers of the C register set don't have tags. */
- if (regnum < tdep->cap_reg_base ||
- regnum > tdep->cap_reg_last - 2)
+ if (!morello_is_tagged_register (gdbarch, regnum))
return false;
if (aarch64_debug)
if (aarch64_debug)
debug_printf ("%s: Entering\n", __func__);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- /* Only Morello's registers have tags. */
- if (!tdep->has_capability ())
+ if (!morello_is_tagged_register (gdbarch, regnum))
return false;
- /* The last two registers of the C register set don't have tags. */
- if (regnum < tdep->cap_reg_base ||
- regnum > tdep->cap_reg_last - 2)
- return false;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* The CSP/PCC tags are swapped in the tag_map because the ordering of CSP/PCC
in struct user_morello_state is different from GDB's register description.