avr-gcc-list
[Top][All Lists]
Advanced

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

RE: [avr-gcc-list] Stack usage under heavy inlining


From: Stu Bell
Subject: RE: [avr-gcc-list] Stack usage under heavy inlining
Date: Mon, 8 Sep 2008 09:27:20 -0600

Oh, I see.  The inlining causes an "almost" static definition for the
locals in the functions.  As someone else said, the reuse of the stack
is disabled. 

Wow, that's a good reason to avoid use of local variables in inlined
functions.  If it's possible.  :(  Yuck!

Best regards, 

Stu Bell 
DataPlay (DPHI, Inc.) 


-----Original Message-----
From: Paulo Marques [mailto:address@hidden 
Sent: Monday, September 08, 2008 9:07 AM
To: Stu Bell
Cc: address@hidden
Subject: Re: [avr-gcc-list] Stack usage under heavy inlining


Hi, Stu

Stu Bell wrote:
> I don't understand your problem.  If I understand your situation, you
> have:

You missed the "..._then_ function C _and then_ function D..." part :)

So my example would look more like:

static int functionB(void) {
        uint8_t localB[32];
...
}
static int functionC(void) {
        uint8_t localC[32];
...
}
static int functionD(void) {
        uint8_t localD[32];
...
}
int functionA( int a ) {
        functionB();
        functionC();
        functionD();
}

When gcc inlines all the functions into functionA it allocates 96 bytes
of stack, because it isn't capable of reusing the stack space anymore.

--
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"Who is general Failure and why is he reading my disk?"




reply via email to

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