I've submitted 207175 for a clang 3.8.0 va_list handling problem for powerpc
Roman Divacky
rdivacky at vlakno.cz
Mon Feb 15 20:20:24 UTC 2016
On Mon, Feb 15, 2016 at 12:17:50PM -0800, Mark Millard wrote:
> On 2016-Feb-15, at 11:11 AM, Roman Divacky <rdivacky at vlakno.cz> wrote:
> >
> > Mark, I believe you're right. What do you think about this patch?
> >
> > Index: tools/clang/lib/CodeGen/TargetInfo.cpp
> > ===================================================================
> > --- tools/clang/lib/CodeGen/TargetInfo.cpp (revision 260852)
> > +++ tools/clang/lib/CodeGen/TargetInfo.cpp (working copy)
> > @@ -3599,6 +3599,8 @@
> > {
> > CGF.EmitBlock(UsingOverflow);
> >
> > + Builder.CreateStore(Builder.getInt8(11), NumRegsAddr);
> > +
> > // Everything in the overflow area is rounded up to a size of at least 4.
> > CharUnits OverflowAreaAlign = CharUnits::fromQuantity(4);
> >
> >
> > Can you test it?
>
> It may be later today before I can start the the test process.
>
> While your change is not wrong as presented, it does seem to be based on the ABI document's numbering with the range 3 <= gr <12, where 3 <= gr < 11 cover r3-r10 use and gr=11 implies overflow stack area use. (gr being the ABI documents name.)
>
> The clang code generation that I saw while analyzing the problem and the clang source that you had me look at did not use that numbering. Instead it seems to be based on 0 <= gpr < 9, where 0 <= gpr < 8 cover r3-r10 use and gpr=8 implies overflow stack area use. (gpr being what gdb showed me as I remember.) In other words: clang counts the number of "parameter registers" already in use as it goes along instead of tracking register numbers that have been used.
>
> So assigning any value that appears to be positive and >= 8 should work, such as:
>
> Builder.CreateStore(Builder.getInt8(8), NumRegsAddr);
Can you check what number gcc uses? We want to be interoperable with gcc.
Anyway, thanks for testing!
Roman
More information about the freebsd-toolchain
mailing list