[LLVMdev] CPS

Erick Tryzelaar erick.tryzelaar at gmail.com
Fri Feb 4 16:01:36 PST 2011


On Fri, Feb 4, 2011 at 7:57 AM, Carlo Alberto Ferraris
<cafxx at strayorange.com> wrote:
> Hi everybody,
> I'd like to try implementing a pass that transforms all functions (and
> function calls, returns, etc.) to CPS, so that TCO can get rid of all
> (or most of) the function calling overhead (because, as you probably
> know, the side effect of using CPS is that all function calls become
> tail calls).
> That being said, and since I'm pretty new to LLVM, I'd like to ask a
> couple of things to the veterans:
> 1. Can you see anything really wrong with the general idea of having
> such a transformation?
> 2. Has anybody worked on something like this in the past? Are there any
> starting points you'd suggest I should take a look at?
> 3. Do you have any advice about which direction should I take?

Hi Carlo,

I haven't tried implementing CPS with llvm before, but I do know there
have been a couple conversations about it in the past. First off,
Chris Lattner wrote up about explicitly managed stack frames here:

http://www.nondot.org/sabre/LLVMNotes/ExplicitlyManagedStackFrames.txt

I'd also suggest googling around for "llvm cps" as perhaps your
questions have been answered elsewhere. I hope this helps.



More information about the llvm-dev mailing list