Tail call optimization on PowerPC

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

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux