diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-06-16 17:25:59 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-06-16 17:25:59 +0000 |
commit | 794ac4286c05ea60bbe06ad831d6951646aa1486 (patch) | |
tree | 7be1f30a757fbf8e49a1fc7381152de320956766 /gdb/spu-tdep.c | |
parent | 6707b003ad55c5bac71abe7ffbd406c381708f19 (diff) | |
download | gdb-794ac4286c05ea60bbe06ad831d6951646aa1486.zip gdb-794ac4286c05ea60bbe06ad831d6951646aa1486.tar.gz gdb-794ac4286c05ea60bbe06ad831d6951646aa1486.tar.bz2 |
* gdbtypes.c (builtin_type_v2_double, builtin_type_v4_float,
builtin_type_v2_int64, builtin_type_v4_int32, builtin_type_v8_int16,
builtin_type_v16_int8, builtin_type_v2_float, builtin_type_v2_int32,
builtin_type_v4_int16, builtin_type_v8_int8, builtin_type_v4sf,
builtin_type_v4si, builtin_type_v16qi, builtin_type_v8qi,
builtin_type_v8hi, builtin_type_v4hi, builtin_type_v2si,
builtin_type_vec64, builtin_type_vec128): Remove.
(init_simd_type): Remove.
(init_vector_type): Make global.
(build_builtin_type_vec64, build_builtin_type_vec128): Remove.
(build_gdbtypes): Do not build vector types.
(_initialize_gdbtypes): Do not swap vector types.
* gdbtypes.h (builtin_type_v2_double, builtin_type_v4_float,
builtin_type_v2_int64, builtin_type_v4_int32, builtin_type_v8_int16,
builtin_type_v16_int8, builtin_type_v2_float, builtin_type_v2_int32,
builtin_type_v4_int16, builtin_type_v8_int8, builtin_type_v4sf,
builtin_type_v4si, builtin_type_v16qi, builtin_type_v8qi,
builtin_type_v8hi, builtin_type_v4hi, builtin_type_v2si,
builtin_type_vec64, builtin_type_vec128): Remove declarations.
(init_vector_type): Add prototype.
* i386-tdep.h (struct gdbarch_tdep): Add i386_mmx_type and
i386_sse_type members.
(i386_mmx_type, i386_sse_type): Change from variables to functions.
* i386-tdep.c (i386_mmx_type, i386_sse_type): Remove variables.
(i386_init_types): Do not build vector types.
(i386_mmx_type, i386_sse_type): New functions.
(i386_register_type): Call them instead of using global variables.
(i386_gdbarch_init): Use XCALLOC to allocate tdep structure.
* amd64-tdep.c (amd64_register_type): Call i386_sse_type instead
of using global variable.
* rs6000-tdep.h (struct gdbarch_tdep): Add ppc_builtin_type_vec64
and ppc_builtin_type_vec128 members.
* rs6000-tdep.c (rs6000_builtin_type_vec64): New function.
(rs6000_builtin_type_vec128): Likewise.
(rs6000_register_type): Call them instead of using builtin_type_vec64
and builtin_type_vec128.
(rs6000_gdbarch_init): Use XCALLOC to allocate tdep structure.
* spu-tdep.c (struct gdbarch_tdep): New data type.
(spu_builtin_type_vec128): Remove variable.
(spu_builtin_type_vec128): New function.
(spu_register_type): Call it instead of using global variable.
(spu_gdbarch_init): Allocate tdep structure.
(spu_init_vector_type): Remove function.
(_initialize_spu_tdep): Do not call it.
Diffstat (limited to 'gdb/spu-tdep.c')
-rw-r--r-- | gdb/spu-tdep.c | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 7c8b045..bffab70 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -46,8 +46,49 @@ #include "spu-tdep.h" + +/* The tdep structure. */ +struct gdbarch_tdep +{ + /* SPU-specific vector type. */ + struct type *spu_builtin_type_vec128; +}; + + /* SPU-specific vector type. */ -struct type *spu_builtin_type_vec128; +static struct type * +spu_builtin_type_vec128 (struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + if (!tdep->spu_builtin_type_vec128) + { + struct type *t; + + t = init_composite_type ("__spu_builtin_type_vec128", TYPE_CODE_UNION); + append_composite_type_field (t, "uint128", builtin_type_int128); + append_composite_type_field (t, "v2_int64", + init_vector_type (builtin_type_int64, 2)); + append_composite_type_field (t, "v4_int32", + init_vector_type (builtin_type_int32, 4)); + append_composite_type_field (t, "v8_int16", + init_vector_type (builtin_type_int16, 8)); + append_composite_type_field (t, "v16_int8", + init_vector_type (builtin_type_int8, 16)); + append_composite_type_field (t, "v2_double", + init_vector_type (builtin_type_double, 2)); + append_composite_type_field (t, "v4_float", + init_vector_type (builtin_type_float, 4)); + + TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR; + TYPE_NAME (t) = "spu_builtin_type_vec128"; + + tdep->spu_builtin_type_vec128 = t; + } + + return tdep->spu_builtin_type_vec128; +} + /* The list of available "info spu " commands. */ static struct cmd_list_element *infospucmdlist = NULL; @@ -90,7 +131,7 @@ static struct type * spu_register_type (struct gdbarch *gdbarch, int reg_nr) { if (reg_nr < SPU_NUM_GPRS) - return spu_builtin_type_vec128; + return spu_builtin_type_vec128 (gdbarch); switch (reg_nr) { @@ -1920,6 +1961,7 @@ static struct gdbarch * spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; + struct gdbarch_tdep *tdep; /* Find a candidate among the list of pre-declared architectures. */ arches = gdbarch_list_lookup_by_info (arches, &info); @@ -1931,7 +1973,8 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return NULL; /* Yes, create a new architecture. */ - gdbarch = gdbarch_alloc (&info, NULL); + tdep = XCALLOC (1, struct gdbarch_tdep); + gdbarch = gdbarch_alloc (&info, tdep); /* Disassembler. */ set_gdbarch_print_insn (gdbarch, print_insn_spu); @@ -1995,34 +2038,11 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return gdbarch; } -/* Implement a SPU-specific vector type as replacement - for __gdb_builtin_type_vec128. */ -static void -spu_init_vector_type (void) -{ - struct type *type; - - type = init_composite_type ("__spu_builtin_type_vec128", TYPE_CODE_UNION); - append_composite_type_field (type, "uint128", builtin_type_int128); - append_composite_type_field (type, "v2_int64", builtin_type_v2_int64); - append_composite_type_field (type, "v4_int32", builtin_type_v4_int32); - append_composite_type_field (type, "v8_int16", builtin_type_v8_int16); - append_composite_type_field (type, "v16_int8", builtin_type_v16_int8); - append_composite_type_field (type, "v2_double", builtin_type_v2_double); - append_composite_type_field (type, "v4_float", builtin_type_v4_float); - - TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; - TYPE_NAME (type) = "spu_builtin_type_vec128"; - spu_builtin_type_vec128 = type; -} - void _initialize_spu_tdep (void) { register_gdbarch_init (bfd_arch_spu, spu_gdbarch_init); - spu_init_vector_type (); - /* Add ourselves to objfile event chain. */ observer_attach_new_objfile (spu_overlay_new_objfile); spu_overlay_data = register_objfile_data (); |