This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

sibling call optimization


Hi all..

I'm trying to make a sibling call (or, rather making the GCC optimizer
make one) through a function pointer. This seems to be impossible?

I've read some old messages about the tailcall/siblingcalls that talked
about implementing an explicit __attribute__ or similar construct to tell
gcc to make a sibling call. This was never implemented, or?

Without knowing much about gcc internals, it seems to be this part of
gcc/calls.c responsible:

      /* If the register holding the address is a callee saved
	 register, then we lose.  We have no way to prevent that,
	 so we only allow calls to named functions.  */
      /* ??? This could be done by having the insn constraints
	 use a register class that is all call-clobbered.  Any
	 reload insns generated to fix things up would appear
	 before the sibcall_epilogue.  */
      || fndecl == NULL_TREE

Or maybe not, I've only looked at it very briefly.

- Morten

The only perfect science is hind-sight.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]