[rfa/arm] Eliminate REGISTER_CONVERTIBLE() from ARM

Fernando Nasser fnasser@redhat.com
Fri Nov 2 11:24:00 GMT 2001


Andrew Cagney wrote:
> 
> Hello,
> 
> The attatched eliminates the macros:
>         REGISTER_CONVERTIBLE()
>         REGISTER_CONVERT_TO_RAW()
>         REGISTER_CONVERT_TO_VIRTUAL()
> for the ARM target.  Instead REGISTER_VIRTUAL_TYPE() returns what I'm
> *guessing* is the true type of the register.
> 
> ok to commit?
> Andrew
> 

Andrew, I will have to apply your patch and run some tests.  And we need
to hear from the Linux/ARM folks as well.

Or have you run the testsuite against a, lets say, arm-elf target
already
(ARMulator is enough)?

Fernando



>   ------------------------------------------------------------------------
> 2001-11-10  Andrew Cagney  <ac131313@redhat.com>
> 
>         * arm-tdep.c (arm_register_type): New function.
>         (arm_register_convertible): Delete.
>         (arm_register_convert_to_virtual): Delete.
>         (arm_register_convert_to_raw): Delete.
>         * config/arm/tm-arm.h (REGISTER_CONVERTIBLE): Delete.
>         (REGISTER_CONVERT_TO_VIRTUAL): Delete.
>         (REGISTER_CONVERT_TO_RAW): Delete.
>         (REGISTER_VIRTUAL_TYPE): Redefine as call to arm_register_type.
>         (arm_register_type): Declare.
> 
> Index: arm-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/arm-tdep.c,v
> retrieving revision 1.16
> diff -p -r1.16 arm-tdep.c
> *** arm-tdep.c  2001/10/21 17:19:36     1.16
> --- arm-tdep.c  2001/11/11 00:20:27
> *************** arm_float_info (void)
> *** 1437,1442 ****
> --- 1437,1456 ----
>     print_fpu_flags (status);
>   }
> 
> + struct type *
> + arm_register_type (int regnum)
> + {
> +   if (regnum >= F0_REGNUM && regnum < F0_REGNUM + NUM_FREGS)
> +     {
> +       if (TARGET_BYTE_ORDER == BIG_ENDIAN)
> +       return builtin_type_arm_ext_big;
> +       else
> +       return builtin_type_arm_ext_littlebyte_bigword;
> +     }
> +   else
> +     return builtin_type_int32;
> + }
> +
>   /* NOTE: cagney/2001-08-20: Both convert_from_extended() and
>      convert_to_extended() use floatformat_arm_ext_littlebyte_bigword.
>      It is thought that this is is the floating-point register format on
> *************** convert_to_extended (void *dbl, void *pt
> *** 1464,1503 ****
>     else
>       floatformat_from_doublest (&floatformat_arm_ext_littlebyte_bigword,
>                                &d, dbl);
> - }
> -
> - /* Nonzero if register N requires conversion from raw format to
> -    virtual format.  */
> -
> - int
> - arm_register_convertible (unsigned int regnum)
> - {
> -   return ((regnum - F0_REGNUM) < 8);
> - }
> -
> - /* Convert data from raw format for register REGNUM in buffer FROM to
> -    virtual format with type TYPE in buffer TO.  */
> -
> - void
> - arm_register_convert_to_virtual (unsigned int regnum, struct type *type,
> -                                void *from, void *to)
> - {
> -   double val;
> -
> -   convert_from_extended (from, &val);
> -   store_floating (to, TYPE_LENGTH (type), val);
> - }
> -
> - /* Convert data from virtual format with type TYPE in buffer FROM to
> -    raw format for register REGNUM in buffer TO.  */
> -
> - void
> - arm_register_convert_to_raw (unsigned int regnum, struct type *type,
> -                            void *from, void *to)
> - {
> -   double val = extract_floating (from, TYPE_LENGTH (type));
> -
> -   convert_to_extended (&val, to);
>   }
> 
>   static int
> --- 1478,1483 ----
> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.92
> diff -p -r1.92 gdbarch.sh
> *** gdbarch.sh  2001/11/08 01:33:04     1.92
> --- gdbarch.sh  2001/11/11 00:20:39
> *************** do
> *** 334,339 ****
> --- 334,345 ----
> 
>         # If PRINT_P is empty, ``1'' is always used.
> 
> +     replaced_by ) : ;;
> +
> +       # An optional indicator of what has replaced this method
> +
> +       # If present the first use of the method will get a warning.
> +
>       description ) : ;;
> 
>         # Currently unused.
> Index: config/arm/tm-arm.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
> retrieving revision 1.7
> diff -p -r1.7 tm-arm.h
> *** tm-arm.h    2001/07/04 19:57:53     1.7
> --- tm-arm.h    2001/11/11 00:20:43
> *************** extern char **arm_register_names;
> *** 268,302 ****
>   /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
>   #define MAX_REGISTER_VIRTUAL_SIZE FP_REGISTER_VIRTUAL_SIZE
> 
> - /* Nonzero if register N requires conversion from raw format to
> -    virtual format. */
> - extern int arm_register_convertible (unsigned int);
> - #define REGISTER_CONVERTIBLE(REGNUM) (arm_register_convertible (REGNUM))
> -
> - /* Convert data from raw format for register REGNUM in buffer FROM to
> -    virtual format with type TYPE in buffer TO. */
> -
> - extern void arm_register_convert_to_virtual (unsigned int regnum,
> -                                            struct type *type,
> -                                            void *from, void *to);
> - #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
> -      arm_register_convert_to_virtual (REGNUM, TYPE, FROM, TO)
> -
> - /* Convert data from virtual format with type TYPE in buffer FROM to
> -    raw format for register REGNUM in buffer TO.  */
> -
> - extern void arm_register_convert_to_raw (unsigned int regnum,
> -                                        struct type *type,
> -                                        void *from, void *to);
> - #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
> -      arm_register_convert_to_raw (REGNUM, TYPE, FROM, TO)
> -
>   /* Return the GDB type object for the "standard" data type of data in
>      register N.  */
> 
> ! #define REGISTER_VIRTUAL_TYPE(N) \
> !      (((unsigned)(N) - F0_REGNUM) < NUM_FREGS \
> !       ? builtin_type_double : builtin_type_int)
> 
>   /* The system C compiler uses a similar structure return convention to gcc */
>   extern use_struct_convention_fn arm_use_struct_convention;
> --- 268,278 ----
>   /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
>   #define MAX_REGISTER_VIRTUAL_SIZE FP_REGISTER_VIRTUAL_SIZE
> 
>   /* Return the GDB type object for the "standard" data type of data in
>      register N.  */
> 
> ! extern struct type *arm_register_type (int regnum);
> ! #define REGISTER_VIRTUAL_TYPE(N) arm_register_type (N)
> 
>   /* The system C compiler uses a similar structure return convention to gcc */
>   extern use_struct_convention_fn arm_use_struct_convention;

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9



More information about the Gdb-patches mailing list