tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] can't build mob branch on x86 64


From: Daniel Glöckner
Subject: Re: [Tinycc-devel] can't build mob branch on x86 64
Date: Mon, 7 Feb 2011 23:48:30 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Feb 07, 2011 at 10:03:44PM +0100, Thomas Preud'homme wrote:
> Le lundi 07 février 2011 20:23:44, grischka a écrit :
> > In the spirit of tinyness I'd strongly suggest to cultivate the positive
> > power of strategical assumptions and to assume simply that tcc already
> > does support alloca everywhere.
> > 
> > --- grischka
> And what is the solution for architectures which don't support alloca *yet*. 
> FYI, adding the CONFIG_TCC_ALLOCA (which I renamed to TCC_AVAIL_ALLOCA) is 
> like 5-6 lines added.

Here is my four line version of alloca for ARM:

void *alloca(unsigned n)
{
        return (void *)((&n)[-2]=((&n)[-2]-n)&~7);
}

It relies heavily on the stackframe created by tcc.

The more compiler independent assembler version of it is this:

        .globl alloca
alloca: sub r0, sp, r0
        bic r0, r0, #7
        mov sp, r0
        mov pc, lr

  Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]