This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Work in progress: "Super Sib Calls"; opinions sought
- From: "Simon Marlow" <simonmar at microsoft dot com>
- To: "'Jason Ozolins'" <jason dot ozolins at anu dot edu dot au>
- Cc: <gcc at gcc dot gnu dot org>,<pizka at in dot tum dot de>
- Date: Tue, 10 Sep 2002 13:59:25 +0100
- Subject: RE: Work in progress: "Super Sib Calls"; opinions sought
> From: Jason Ozolins [mailto:jason.ozolins@anu.edu.au]
>
> Doing the dependency analysis would be great, but it strikes
> me that if
> it were easy, someone would probably already have done it. :-) If it
> is the case that it's not done at all because it's hard to make it
> perfect, what's wrong with an effort to make tail-calls work with
> overlapping arguments in a way that is easier to verify correctness,
> leaving open the option to do the dependency analysis as an
> optimization later on?
No problem with that at all.
> In the worst case you may well need N temporaries anyway, so
> you do need
> to decide where to put the "argument marshalling area" for the
> super-sibcall; consider
>
> int foo (int a, b, c, d)
> {
> return bar (a*2+b*3+c*5+d*7, a*3+b*5+c*7+d*11,
> a*5+b*7+c*11+d*13, a*7+b*11+c*13+d*17);
> }
The argument marshalling area can be on the stack after the argument
list and any stack variables; in the worst case, this just degrades to
the copying implementation. But it degrades *smoothly*, and the bad
cases happen rarely (I conjecture). But, as I said, I'm aware that this
is not trivial to implement.
Cheers,
Simon