This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 3.3 0203 i386/{i386.c,{i386elf,ptx4-i,sysv4}.h} for UnixWare build failure.


> Jan Hubicka <jh@suse.cz> writes:
> 
> >> "Rodney D Brown" <rbrown64@csc.com.au> writes:
> >> 
> >> > I believe the patch is needed from this change. Jan seems to be
> >> > moving to using DEFAULT_PCC_STRUCT_RETURN over RETURN_IN_MEMORY.
> >> 
> >> This is not good.  As I said, DEFAULT_PCC_STRUCT_RETURN is obsolete,
> >> we need to be moving *away* from it.
> >
> > Agreed.
> > There is still problem in this code, even after changing i386 setting of 
> > flag_pcc_struct_return to DEFAULT_PCC_STRUCT_RETURN?  I think when
> > target overwrite RETURN_IN_MEMORY and DEFAULT_PCC_STRUCT_RETURN, it
> > should be safe...
> 
> I thought I explained the problem in the next two paragraphs.  What
> was unclear?

It is not clear to my why I am "moving to using
DEFAULT_PCC_STRUCT_RETURN over RETURN_IN_MEMORY".  I just have to
disable flag_pcc_struct_return for x86-64 that is enabled by default for
Linux. That was the only reason for that change.
I didn't intended to change anything else to be safe.

Currently flag_pcc_struct_return controls the PS-ABI compiliant behaviour
where each structure is returned in memory (used by Linux for instance), 
and the "gcc" way of returning small structs in registers (used by BSD).

I agree that it would be cleaner to have this decided in
x86_return_in_memory, but I wanted to first ensure whether you are
discussing some bug I introduced by the change, or future cleanup.

Honza
> 
> >> DEFAULT_PCC_STRUCT_RETURN sets the default value of
> >> flag_pcc_struct_return.  If flag_pcc_struct_return is on, it
> >> overrides the target's ABI (as defined by RETURN_IN_MEMORY) and forces
> >> all types for which AGGREGATE_TYPE_P is true to be returned in
> >> memory.  The default for DEFAULT_PCC_STRUCT_RETURN happens to be 1,
> >> which means any target with a nontrivial RETURN_IN_MEMORY (such as the
> >> x86) *must* set DEFAULT_PCC_STRUCT_RETURN to 0 unconditionally for GCC
> >> to get the ABI right.
> >> 
> >> Now, the definition of x86_return_in_memory is such that I doubt
> >> anyone has noticed this, but it's still a problem.  I am 99+% sure
> >> that if we went through config/i386, removed all of the definitions of
> >> RETURN_IN_MEMORY except the ones in i386.h, replaced all the existing
> >> definitions of DEFAULT_PCC_STRUCT_RETURN with just one in i386.h
> >> (defining it to 0), and ripped out the code in override_options that
> >> mucks with flag_pcc_struct_return, there would be *no* changes to the
> >> ABI on any i386 subtarget.  And if I'm wrong, the changes would
> >> probably correct corner cases of the ABI.
> 
> zw


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