From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21520 invoked by alias); 11 Jan 2002 23:20:06 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 21483 invoked from network); 11 Jan 2002 23:20:02 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 11 Jan 2002 23:20:02 -0000 Received: from localhost.cygnus.com (cse.sfbay.redhat.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id PAA17729 for ; Fri, 11 Jan 2002 15:19:59 -0800 (PST) Received: (from ezannoni@localhost) by localhost.cygnus.com (8.11.2/8.11.2) id g0BMWlN01904; Fri, 11 Jan 2002 17:32:47 -0500 From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Message-ID: <15423.26637.972974.400390@localhost.cygnus.com> Date: Fri, 11 Jan 2002 15:20:00 -0000 To: gdb-patches@sources.redhat.com Subject: [RFA] gdbtypes.[ch] rs6000-tdep.c--AltiVec regs types X-Mailer: VM 7.00 under Emacs 20.7.1 X-SW-Source: 2002-01/txt/msg00309.txt.bz2 This patch provides a builtin union type for the AltiVec registers, so that the printing of such regs is a bit more enlightening, like: (gdb) p $vr0 $2 =3D {uint128 =3D 0x00000064000000c80000012c00000190,=20 v4sf =3D {f =3D {1.40129846e-43, 2.80259693e-43, 4.20389539e-43, 5.60= 519386e-43}},=20 v4si =3D {f =3D {100, 200, 300, 400}},=20 v8hi =3D {f =3D {0, 100, 0, 200, 0, 300, 0, 400}},=20 v16qi =3D {f =3D "\0\0\0d\0\0\0=C8\0\0\001,\0\0\001\220"}} (gdb) p $vr0.v4si $3 =3D {f =3D {100, 200, 300, 400}} (gdb) p $vr0.v4si.f[2] $4 =3D 300 (gdb) p $vr0.v4si.f[2]=3D444 $5 =3D 444 Elena 2002-01-11 Elena Zannoni [Based on work by Jim Blandy] * rs6000-tdep.c: Declare predifined type for AltiVec registers. (build_builtin_type_powerpc_altivec): New function. (rs6000_register_virtual_type): Change type of AltiVec register to new builtin type. (_initialize_rs6000_tdep): Create the altivec register builtin type structure. * gdbtypes.h (builtin_type_v16qi, builtin_type_v8hi): Export. * gdbtypes.c (builtin_type_v16qi, builtin_type_v8hi): New SIMD types. (build_gdbtypes): Initialize builtin_type_v16qi and builtin_type_v8hi. (_initialize_gdbtypes): Register builtin_type_v16qi and builtin_type_v8hi with gdbarch. Index: gdbtypes.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/uberbaum/gdb/gdbtypes.c,v retrieving revision 1.35 diff -u -p -r1.35 gdbtypes.c --- gdbtypes.c 2001/12/20 03:26:08 1.35 +++ gdbtypes.c 2002/01/11 21:56:13 @@ -73,7 +73,9 @@ struct type *builtin_type_uint128; struct type *builtin_type_bool; struct type *builtin_type_v4sf; struct type *builtin_type_v4si; +struct type *builtin_type_v16qi; struct type *builtin_type_v8qi; +struct type *builtin_type_v8hi; struct type *builtin_type_v4hi; struct type *builtin_type_v2si; struct type *builtin_type_ieee_single_big; @@ -3163,8 +3165,12 @@ build_gdbtypes (void) =3D init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4); builtin_type_v4si =3D init_simd_type ("__builtin_v4si", builtin_type_int32, "f", 4); + builtin_type_v16qi + =3D init_simd_type ("__builtin_v16qi", builtin_type_int8, "f", 16); builtin_type_v8qi =3D init_simd_type ("__builtin_v8qi", builtin_type_int8, "f", 8); + builtin_type_v8hi + =3D init_simd_type ("__builtin_v8hi", builtin_type_int16, "f", 8); builtin_type_v4hi =3D init_simd_type ("__builtin_v4hi", builtin_type_int16, "f", 4); builtin_type_v2si @@ -3252,7 +3258,9 @@ _initialize_gdbtypes (void) register_gdbarch_swap (&builtin_type_uint128, sizeof (struct type *), NU= LL); register_gdbarch_swap (&builtin_type_v4sf, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v4si, sizeof (struct type *), NULL); + register_gdbarch_swap (&builtin_type_v16qi, sizeof (struct type *), NULL= ); register_gdbarch_swap (&builtin_type_v8qi, sizeof (struct type *), NULL); + register_gdbarch_swap (&builtin_type_v8hi, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v4hi, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v2si, sizeof (struct type *), NULL); REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr); Index: gdbtypes.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/uberbaum/gdb/gdbtypes.h,v retrieving revision 1.21 diff -u -p -r1.21 gdbtypes.h --- gdbtypes.h 2001/12/10 06:17:01 1.21 +++ gdbtypes.h 2002/01/11 21:56:15 @@ -946,7 +946,9 @@ extern struct type *builtin_type_uint128 /* SIMD types. We inherit these names from GCC. */ extern struct type *builtin_type_v4sf; extern struct type *builtin_type_v4si; +extern struct type *builtin_type_v16qi; extern struct type *builtin_type_v8qi; +extern struct type *builtin_type_v8hi; extern struct type *builtin_type_v4hi; extern struct type *builtin_type_v2si; =20 Index: rs6000-tdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/uberbaum/gdb/rs6000-tdep.c,v retrieving revision 1.35 diff -u -p -r1.35 rs6000-tdep.c --- rs6000-tdep.c 2002/01/06 04:50:56 1.35 +++ rs6000-tdep.c 2002/01/11 21:56:17 @@ -83,6 +83,10 @@ struct reg unsigned char fpr; /* whether register is floating-point */ }; =20 +/* Create some pre-defined types. */ +static struct type *builtin_type_powerpc_altivec; + /* Return the current architecture's gdbarch_tdep structure. */ =20 #define TDEP gdbarch_tdep (current_gdbarch) @@ -1530,6 +1534,52 @@ rs6000_register_raw_size (int n) return regsize (reg, tdep->wordsize); } =20 +static struct type * +build_builtin_type_powerpc_altivec (void) +{ + /* Construct a type for the AltiVec registers. The type we're building + is this: */ +#if 0 + union __gdb_builtin_type_powerpc_altivec + { + struct __builtin_v16qi v16qi; + struct __builtin_v8hi v8hi; + struct __builtin_v4si v4si; + struct __builtin_v4sf v4sf; + uint128_t uint128; + }; +#endif + + struct type *t; + struct field *f; + + f =3D (struct field *) xmalloc (sizeof (*f) * 5); + memset (f, 0, sizeof (*f) * 5); + + FIELD_TYPE (f[0]) =3D builtin_type_int128; + FIELD_NAME (f[0]) =3D "uint128"; + + FIELD_TYPE (f[1]) =3D builtin_type_v4sf; + FIELD_NAME (f[1]) =3D "v4sf"; + + FIELD_TYPE (f[2]) =3D builtin_type_v4si; + FIELD_NAME (f[2]) =3D "v4si"; + + FIELD_TYPE (f[3]) =3D builtin_type_v8hi; + FIELD_NAME (f[3]) =3D "v8hi"; + + FIELD_TYPE (f[4]) =3D builtin_type_v16qi; + FIELD_NAME (f[4]) =3D "v16qi"; + + /* Build a union type with those fields. */ + t =3D init_type (TYPE_CODE_UNION, 16, 0, 0, 0); + TYPE_NFIELDS (t) =3D 5; + TYPE_FIELDS (t) =3D f; + TYPE_TAG_NAME (t) =3D "__gdb_builtin_type_powerpc_altivec"; + + return t; +} + /* Return the GDB type object for the "standard" data type of data in register N. */ =20 @@ -1550,7 +1600,7 @@ rs6000_register_virtual_type (int n) return builtin_type_int64; break; case 16: - return builtin_type_int128; + return builtin_type_powerpc_altivec; break; default: return builtin_type_int32; @@ -2653,6 +2703,8 @@ _initialize_rs6000_tdep (void) { register_gdbarch_init (bfd_arch_rs6000, rs6000_gdbarch_init); register_gdbarch_init (bfd_arch_powerpc, rs6000_gdbarch_init); + + builtin_type_powerpc_altivec =3D build_builtin_type_powerpc_altivec (); =20 /* Add root prefix command for "info powerpc" commands */ add_prefix_cmd ("powerpc", class_info, rs6000_info_powerpc_command,