This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFA] Update m68k function return value handling


Mark Kettenis wrote:
   Date: Tue, 04 May 2004 01:51:35 +0000
   From: Michael Snyder <msnyder@redhat.com>

Mark Kettenis wrote:
> Hi Andreas,
> > Here's a patch that converts the m68k to the new function return value
> handling mechanism. I tried very hard to make it possible to deal
> with all the different m68k ABI's. I'm pretty sure I've got it right
> for at least OpenBSD, NetBSD and Linux. On other systems it can't
> really be worse than the old code.


   Unfortunately, it can.  The problem is that when you use the new
   gdbarch_return_value_p method, print_return_value simply gives up
   on any function that returns a struct via a pointer argument
   (what we refer to as the "struct convention").  I don't know why
   it does (esp. in view of all the code you've added for determining
   eg. which register this pointer is passed in), but it does.

This has been discussed in the past. The problem is that on almost
every target, you cannot reliably tell where the return value is
stored. On some targets you can't even tell this when the call is
finished; I believe Andrew said this was the case on powerpc.

Well, but it's not the case on m68k, is it? It seems that the location is returned in the same register as any other return value.

Anyway,
most targets, and m68k might be one of them, can tell where the
structure is stored when the function is finished.  I've promised to
look into it some time ago (since i386 is in a similar situation).
Just didn't find the time yet...

Didn't mean to nag -- it's just that I hoped your changes would make the results better.


   This is especially bad for cross-m68k targets, since when
   pcc_struct_convention is used, m68k_reg_struct_return_p
   always returns false.  BTW this is wrong for gcc m68k-elf,
   so I don't understand why pcc_struct_convention is set for
   all cross targets...

Hmm.  I looked at GCC, to see what the "default" convention would be,
and config/m68k/m68k.h implicates that all structures would be
returned in static storage.  I somehow overlooked that the majority,
if not all, "embedded" targets use config/m68k/m68kemb.h, which
overrides the default in config/m68k/m68k.h to return small structures
in registers.  So it seems I've simply looked in the wrong place and
chose the wrong default.  Feel free to change it to reg_struct_return.
The Linux, OpenBSD and NetBSD targets should be immune to such a
change.  If you don't get to making the change I'll do so in a few
days.

OK, here are test results: ppc_struct_return: 91 fails reg_struct_return: 63 fails.

Not as big an improvement as I'd hoped, but it's an improvement.
I'll check it in.  Unfortunately I won't have time to look into
this further, I'm starting a new project (err) yesterday.

Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]