This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Tail call optimization on PowerPC
- From: "Robin Westberg" <robin at westberg dot se>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 20 May 2010 18:04:13 +0200
- Subject: Tail call optimization on PowerPC
Hello.
I have a question about tail call optimization and whether it is performed
when compiling code for the PowerPC architecture. When compiling the same
simple test program for the x86 and MIPS architectures, inspecting the
assembly code shows that tail call optimization is performed, and it can
also be turned off using -fno-optimize-sibling-calls (I'm using plain -O2
otherwise).
However, for PowerPC no tail call optimization is present in the assembly
code, and it makes no difference whether I use the
-fno-optimize-sibling-calls flag or not. So my question is: is this a known
limitation, a bug, or am I simply doing something wrong?
Here's the test program I'm using in case it is of interest (plain C):
---
int (*fn_ptr)(int);
extern int fn(int x);
int
simple(int x)
{
return fn(x);
}
int
ptr(int x)
{
return fn_ptr(x);
}
int
main(int argc, const char *argv[])
{
fn_ptr = &fn;
return simple(argc) + ptr(argc);
}
---
I'm using GCC 4.4.3 built as a cross-compiler for powerpc-eabi and compiling
on a 32 bit linux.
Best regards,
Robin