Continuation-passing in C?

Doug Gwyn gwyn at smoke.brl.mil
Fri Mar 29 08:24:34 AEST 1991


In article <1991Mar28.070649.1667 at visix.com> adam at visix.com writes:
>    foo( a, b, c );
>    baz( a, b, c );
>I want the compiler to emit code that
>(1) jumps directly from the end of foo to the start of baz, instead of
>returning to main only to jump to baz
>(2) leaves a, b, and c in registers instead of mucking around on a stack
>(or leaves them on the stack instead of popping and pushing them)

Really, why do you care?  If this is bottleneck code you should perhaps
look for other methods of optimizing it.  This degree of attention to
code generation is almost always pointless; the compiler will do the
best it can to optimize the code it generates, and unless you're
maintaining the compiler itself there's not much you can do about it.

Indeed some compilers perform that kind of optimization and some do not.



More information about the Comp.lang.c mailing list