[1/4,ARM] Refactor some constants

Message ID 20211005144521.1965198-2-luis.machado@linaro.org
State New
Headers show
Series
  • M-profile MVE extension support
Related show

Commit Message

Kuan-Ying Lee via Gdb-patches Oct. 5, 2021, 2:45 p.m.
In preparation for the MVE extension patch, this one refactors some of
the register-related constants we have for ARM.

Basically I'm separating counting constants from numbering constants.

For example, ARM_A1_REGNUM is a numbering constant, whereas ARM_NUM_ARG_REGS
is a counting constant.
---
 gdb/arch/arm.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

-- 
2.25.1

Comments

Kuan-Ying Lee via Gdb-patches Oct. 8, 2021, 4:03 p.m. | #1
Lgtm. Helpful regardless of MVE.


Alan.


> On 5 Oct 2021, at 15:45, Luis Machado <luis.machado@linaro.org> wrote:

> 

> In preparation for the MVE extension patch, this one refactors some of

> the register-related constants we have for ARM.

> 

> Basically I'm separating counting constants from numbering constants.

> 

> For example, ARM_A1_REGNUM is a numbering constant, whereas ARM_NUM_ARG_REGS

> is a counting constant.

> ---

> gdb/arch/arm.h | 14 ++++++++++----

> 1 file changed, 10 insertions(+), 4 deletions(-)

> 

> diff --git a/gdb/arch/arm.h b/gdb/arch/arm.h

> index fa589fd0582..f6a155d6376 100644

> --- a/gdb/arch/arm.h

> +++ b/gdb/arch/arm.h

> @@ -50,17 +50,23 @@ enum gdb_regnum {

>   ARM_D31_REGNUM = ARM_D0_REGNUM + 31,

>   ARM_FPSCR_REGNUM,

> 

> -  ARM_NUM_REGS,

> -

>   /* Other useful registers.  */

>   ARM_FP_REGNUM = 11,		/* Frame register in ARM code, if used.  */

>   THUMB_FP_REGNUM = 7,		/* Frame register in Thumb code, if used.  */

> -  ARM_NUM_ARG_REGS = 4, 

>   ARM_LAST_ARG_REGNUM = ARM_A4_REGNUM,

> -  ARM_NUM_FP_ARG_REGS = 4,

>   ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM

> };

> 

> +/* Register count constants.  */

> +enum arm_register_counts {

> +  /* Number of argument registers.  */

> +  ARM_NUM_ARG_REGS = 4,

> +  /* Number of floating point argument registers.  */

> +  ARM_NUM_FP_ARG_REGS = 4,

> +  /* Number of registers (old, defined as ARM_FPSCR_REGNUM + 1.  */

> +  ARM_NUM_REGS = ARM_FPSCR_REGNUM + 1

> +};

> +

> /* Enum describing the different kinds of breakpoints.  */

> enum arm_breakpoint_kinds

> {

> -- 

> 2.25.1

>

Patch

diff --git a/gdb/arch/arm.h b/gdb/arch/arm.h
index fa589fd0582..f6a155d6376 100644
--- a/gdb/arch/arm.h
+++ b/gdb/arch/arm.h
@@ -50,17 +50,23 @@  enum gdb_regnum {
   ARM_D31_REGNUM = ARM_D0_REGNUM + 31,
   ARM_FPSCR_REGNUM,
 
-  ARM_NUM_REGS,
-
   /* Other useful registers.  */
   ARM_FP_REGNUM = 11,		/* Frame register in ARM code, if used.  */
   THUMB_FP_REGNUM = 7,		/* Frame register in Thumb code, if used.  */
-  ARM_NUM_ARG_REGS = 4, 
   ARM_LAST_ARG_REGNUM = ARM_A4_REGNUM,
-  ARM_NUM_FP_ARG_REGS = 4,
   ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM
 };
 
+/* Register count constants.  */
+enum arm_register_counts {
+  /* Number of argument registers.  */
+  ARM_NUM_ARG_REGS = 4,
+  /* Number of floating point argument registers.  */
+  ARM_NUM_FP_ARG_REGS = 4,
+  /* Number of registers (old, defined as ARM_FPSCR_REGNUM + 1.  */
+  ARM_NUM_REGS = ARM_FPSCR_REGNUM + 1
+};
+
 /* Enum describing the different kinds of breakpoints.  */
 enum arm_breakpoint_kinds
 {