aboutsummaryrefslogtreecommitdiff
path: root/gdb/spu-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2011-02-08 13:30:10 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2011-02-08 13:30:10 +0000
commit54fcddd0ace6123d9dadc3040c39acd1b42ffd09 (patch)
tree52b8f2892f032070d495dd00b396659f1a88edb8 /gdb/spu-tdep.c
parentd6dafb7c8efcd4625de119bffece9907e5b69a8e (diff)
downloadgdb-54fcddd0ace6123d9dadc3040c39acd1b42ffd09.zip
gdb-54fcddd0ace6123d9dadc3040c39acd1b42ffd09.tar.gz
gdb-54fcddd0ace6123d9dadc3040c39acd1b42ffd09.tar.bz2
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.
Diffstat (limited to 'gdb/spu-tdep.c')
-rw-r--r--gdb/spu-tdep.c18
1 files changed, 16 insertions, 2 deletions
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: