From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16386 invoked by alias); 15 Jan 2002 19:39:15 -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 16354 invoked from network); 15 Jan 2002 19:39:11 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 15 Jan 2002 19:39:11 -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 LAA06400; Tue, 15 Jan 2002 11:39:07 -0800 (PST) Received: (from ezannoni@localhost) by localhost.cygnus.com (8.11.2/8.11.2) id g0FIptC02317; Tue, 15 Jan 2002 13:51:55 -0500 From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15428.31307.13571.892505@localhost.cygnus.com> Date: Tue, 15 Jan 2002 11:39:00 -0000 To: Kevin Buettner Cc: Elena Zannoni , gdb-patches@sources.redhat.com Subject: Re: [RFA] gdbtypes.[ch] rs6000-tdep.c--AltiVec regs types In-Reply-To: <1020115021142.ZM31103@localhost.localdomain> References: <15423.26637.972974.400390@localhost.cygnus.com> <15427.28570.117546.88433@localhost.cygnus.com> <1020115021142.ZM31103@localhost.localdomain> X-Mailer: VM 7.00 under Emacs 20.7.1 X-SW-Source: 2002-01/txt/msg00423.txt.bz2 Kevin Buettner writes: > On Jan 14, 6:54pm, Elena Zannoni wrote: > > > Resubmitting, moved type creation code to gdbtypes.c, used xcalloc(). > > > > OK? > > The parts that I can approve are okay with me. > > Kevin OK, I checked in the following: I changed the name from builtin_type_powerpc_altivec to builtin_type_vec128, so that it can be used by other targets. Elena 2002-01-15 Elena Zannoni [Based on work by Jim Blandy] * gdbtypes.h (builtin_type_v16qi, builtin_type_v8hi): Export. (builtin_type_vec128): Export. * gdbtypes.c (builtin_type_v16qi, builtin_type_v8hi): New SIMD types. (builtin_type_vec128): New builtin type for 128 bit vector registers. (build_gdbtypes): Initialize builtin_type_v16qi and builtin_type_v8hi. Create the vec128 register builtin type structure. (build_builtin_type_vec128): New function. (_initialize_gdbtypes): Register builtin_type_v16qi and builtin_type_v8hi with gdbarch. Same for builtin_type_vec128. * rs6000-tdep.c (rs6000_register_virtual_type): Change type of AltiVec register to new builtin type. Index: gdbtypes.c =================================================================== 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/15 16:46:48 @@ -73,9 +73,12 @@ 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_vec128; struct type *builtin_type_ieee_single_big; struct type *builtin_type_ieee_single_little; struct type *builtin_type_ieee_double_big; @@ -785,7 +788,51 @@ init_simd_type (char *name, return t; } +static struct type * +build_builtin_type_vec128 (void) +{ + /* Construct a type for the 128 bit registers. The type we're + building is this: */ +#if 0 + union __gdb_builtin_type_vec128 + { + 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 = (struct field *) xcalloc (5, sizeof (*f)); + + FIELD_TYPE (f[0]) = builtin_type_int128; + FIELD_NAME (f[0]) = "uint128"; + FIELD_TYPE (f[1]) = builtin_type_v4sf; + FIELD_NAME (f[1]) = "v4sf"; + + FIELD_TYPE (f[2]) = builtin_type_v4si; + FIELD_NAME (f[2]) = "v4si"; + + FIELD_TYPE (f[3]) = builtin_type_v8hi; + FIELD_NAME (f[3]) = "v8hi"; + + FIELD_TYPE (f[4]) = builtin_type_v16qi; + FIELD_NAME (f[4]) = "v16qi"; + + /* Build a union type with those fields. */ + t = init_type (TYPE_CODE_UNION, 16, 0, 0, 0); + TYPE_NFIELDS (t) = 5; + TYPE_FIELDS (t) = f; + TYPE_TAG_NAME (t) = "__gdb_builtin_type_vec128"; + + return t; +} + /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE. A MEMBER is a wierd thing -- it amounts to a typed offset into a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't @@ -3163,13 +3210,21 @@ build_gdbtypes (void) = init_simd_type ("__builtin_v4sf", builtin_type_float, "f", 4); builtin_type_v4si = init_simd_type ("__builtin_v4si", builtin_type_int32, "f", 4); + builtin_type_v16qi + = init_simd_type ("__builtin_v16qi", builtin_type_int8, "f", 16); builtin_type_v8qi = init_simd_type ("__builtin_v8qi", builtin_type_int8, "f", 8); + builtin_type_v8hi + = init_simd_type ("__builtin_v8hi", builtin_type_int16, "f", 8); builtin_type_v4hi = init_simd_type ("__builtin_v4hi", builtin_type_int16, "f", 4); builtin_type_v2si = init_simd_type ("__builtin_v2si", builtin_type_int32, "f", 2); + /* Vector types. */ + builtin_type_vec128 + = build_builtin_type_vec128 (); + /* Pointer/Address types. */ /* NOTE: on some targets, addresses and pointers are not necessarily @@ -3252,9 +3307,12 @@ _initialize_gdbtypes (void) register_gdbarch_swap (&builtin_type_uint128, sizeof (struct type *), NULL); 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_vec128, sizeof (struct type *), NULL); REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr); REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr); REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR); Index: gdbtypes.h =================================================================== 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/15 16:46:49 @@ -946,9 +946,14 @@ 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; + +/* Type for 128 bit vectors. */ +extern struct type *builtin_type_vec128; /* Explicit floating-point formats. See "floatformat.h". */ extern struct type *builtin_type_ieee_single_big; Index: rs6000-tdep.c =================================================================== 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/15 16:46:51 @@ -1550,7 +1550,7 @@ rs6000_register_virtual_type (int n) return builtin_type_int64; break; case 16: - return builtin_type_int128; + return builtin_type_vec128; break; default: return builtin_type_int32;