From 54fcddd0ace6123d9dadc3040c39acd1b42ffd09 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Tue, 8 Feb 2011 13:30:10 +0000 Subject: include/ChangeLog: * dwarf2.h (enum dwarf_calling_convention): Add DW_CC_GDB_IBM_OpenCL. gdb/ChangeLog: * dwarf2read.c (read_subroutine_type): Set special calling convention flag for functions compiled by IBM XL C for OpenCL. * ppc-sysv-tdep.c: Include "dwarf2.h" (ppc_sysv_abi_push_dummy_call): Implement IBM OpenCL vector types calling convention. (do_ppc_sysv_return_value): Add FUNC_TYPE argument. Implement IBM OpenCL vector types calling convention. (ppc_sysv_abi_return_value): Pass through FUNC_TYPE. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_push_dummy_call): Implement IBM OpenCL vector types calling convention. (ppc64_sysv_abi_return_value): Likewise. * spu-tdep.c: Include "dwarf2.h" (spu_return_value): Implement IBM OpenCL vector types calling convention. gdb/testsuite/ChangeLog: * gdb.opencl/callfuncs.cl: New file. * gdb.opencl/callfuncs.exp: New test. * gdb.opencl/Makefile.in (EXECUTABLES): Add callfuncs. --- gdb/spu-tdep.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'gdb/spu-tdep.c') diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index d424659..0b0ea4e 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -44,6 +44,7 @@ #include "block.h" #include "observer.h" #include "infcall.h" +#include "dwarf2.h" #include "spu-tdep.h" @@ -1448,6 +1449,13 @@ spu_return_value (struct gdbarch *gdbarch, struct type *func_type, gdb_byte *out, const gdb_byte *in) { enum return_value_convention rvc; + int opencl_vector = 0; + + if (func_type + && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GDB_IBM_OpenCL + && TYPE_CODE (type) == TYPE_CODE_ARRAY + && TYPE_VECTOR (type)) + opencl_vector = 1; if (TYPE_LENGTH (type) <= (SPU_ARGN_REGNUM - SPU_ARG1_REGNUM + 1) * 16) rvc = RETURN_VALUE_REGISTER_CONVENTION; @@ -1459,7 +1467,10 @@ spu_return_value (struct gdbarch *gdbarch, struct type *func_type, switch (rvc) { case RETURN_VALUE_REGISTER_CONVENTION: - spu_value_to_regcache (regcache, SPU_ARG1_REGNUM, type, in); + if (opencl_vector && TYPE_LENGTH (type) == 2) + regcache_cooked_write_part (regcache, SPU_ARG1_REGNUM, 2, 2, in); + else + spu_value_to_regcache (regcache, SPU_ARG1_REGNUM, type, in); break; case RETURN_VALUE_STRUCT_CONVENTION: @@ -1472,7 +1483,10 @@ spu_return_value (struct gdbarch *gdbarch, struct type *func_type, switch (rvc) { case RETURN_VALUE_REGISTER_CONVENTION: - spu_regcache_to_value (regcache, SPU_ARG1_REGNUM, type, out); + if (opencl_vector && TYPE_LENGTH (type) == 2) + regcache_cooked_read_part (regcache, SPU_ARG1_REGNUM, 2, 2, out); + else + spu_regcache_to_value (regcache, SPU_ARG1_REGNUM, type, out); break; case RETURN_VALUE_STRUCT_CONVENTION: -- cgit v1.1