* ppc-sysv-tdep.c (ppc_sysv_use_opencl_abi): New function.
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 26 Oct 2011 17:21:53 +0000 (17:21 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Wed, 26 Oct 2011 17:21:53 +0000 (17:21 +0000)
(ppc_sysv_abi_push_dummy_call): Use it.
(do_ppc_sysv_return_value): Likewise.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(ppc64_sysv_abi_return_value): Likewise.

gdb/ChangeLog
gdb/ppc-sysv-tdep.c

index 3127093aa6edaccb9e43e0ea3e23504526d44989..a88b3874f56f9a5fb96fdf5d4b20a4b7306042cc 100644 (file)
@@ -1,3 +1,11 @@
+2011-10-26  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * ppc-sysv-tdep.c (ppc_sysv_use_opencl_abi): New function.
+       (ppc_sysv_abi_push_dummy_call): Use it.
+       (do_ppc_sysv_return_value): Likewise.
+       (ppc64_sysv_abi_push_dummy_call): Likewise.
+       (ppc64_sysv_abi_return_value): Likewise.
+
 2011-10-26  Paul Koning  <paul_koning@dell.com>
 
        * python/lib/gdb/types.py (deepitems): New function.
index bda45446ac840cdd022b2e23e3cfe7b8a4a2333f..4234f28ab63f26c8c5ed9ce8f33375f338aa41c2 100644 (file)
 #include "infcall.h"
 #include "dwarf2.h"
 
+
+/* Check whether FTPYE is a (pointer to) function type that should use
+   the OpenCL vector ABI.  */
+
+static int
+ppc_sysv_use_opencl_abi (struct type *ftype)
+{
+  ftype = check_typedef (ftype);
+
+  if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+    ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
+
+  return (TYPE_CODE (ftype) == TYPE_CODE_FUNC
+         && TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL);
+}
+
 /* Pass the arguments in either registers, or in the stack.  Using the
    ppc sysv ABI, the first eight words of the argument list (that might
    be less than eight parameters if some parameters occupy more than one
@@ -51,8 +67,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  struct type *ftype;
-  int opencl_abi = 0;
+  int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function));
   ULONGEST saved_sp;
   int argspace = 0;            /* 0 is an initial wrong guess.  */
   int write_pass;
@@ -62,13 +77,6 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
                                 &saved_sp);
 
-  ftype = check_typedef (value_type (function));
-  if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
-    ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
-  if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
-      && TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL)
-    opencl_abi = 1;
-
   /* Go through the argument list twice.
 
      Pass 1: Figure out how much new stack space is required for
@@ -689,12 +697,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  int opencl_abi = 0;
-
-  if (func_type
-      && TYPE_CODE (func_type) == TYPE_CODE_FUNC
-      && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GDB_IBM_OpenCL)
-    opencl_abi = 1;
+  int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
 
   gdb_assert (tdep->wordsize == 4);
 
@@ -1115,8 +1118,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
   CORE_ADDR func_addr = find_function_addr (function, NULL);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  struct type *ftype;
-  int opencl_abi = 0;
+  int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function));
   ULONGEST back_chain;
   /* See for-loop comment below.  */
   int write_pass;
@@ -1146,13 +1148,6 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
   regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
                                 &back_chain);
 
-  ftype = check_typedef (value_type (function));
-  if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
-    ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
-  if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
-      && TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL)
-    opencl_abi = 1;
-
   /* Go through the argument list twice.
 
      Pass 1: Compute the function call's stack space and register
@@ -1721,11 +1716,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  int opencl_abi = 0;
-
-  if (func_type
-      && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GDB_IBM_OpenCL)
-    opencl_abi = 1;
+  int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
 
   /* This function exists to support a calling convention that
      requires floating-point registers.  It shouldn't be used on
This page took 0.032143 seconds and 4 git commands to generate.