[LLVMdev] recursive nested functions

Nicolas Ojeda Bar nojb at math.harvard.edu
Fri Jun 25 10:46:13 PDT 2010


This is a little off-topic. But I am writing a compiler to llvm ir
for a language that admits recursive nested functions and am stuck
as to how to translate them. Concretely, I'm trying to lift them all
to the topmost level and pass all their free variables explicitly as
arguments. To do this, I have to determine all their free variables
in their bodies. In particular when I come across a function call,
I have to add _its_ free variables to the list of free variables of
the enclosing function. You can see how this will not work if we
allow recursive functions.

Any pointers would be greatly appreciated.


More information about the llvm-dev mailing list