[llvm-dev] Nested function calls to mutually recursive functions

Jason Milionis via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 16 11:14:08 PDT 2020


Hello to all,

My situation is similar to this question over here:
http://lists.llvm.org/pipermail/llvm-dev/2010-June/032684.html.
Specifically, I would like to support a front-end that compiles from a
language with nested, probably mutually-recursive to LLVM IR. Before
reading the above thread, I was thinking about finding fixed points of free
variables, etc, but the static links seem to avoid all the fuss. However, I
have two further questions regarding that technique:

1) I am not very sure I have grasped the way the author suggests augmenting
the AST. I have the following thought problems: how would I augment a
Function Call to indicate the changes that arise from the nesting? Only
pass as an extra first argument the static link structure of the parent? Is
this enough, or something more is needed?

2) What kind of combination of LLVM passes (and in which turn, since this
seems to be important in some aspects) can I apply in order to get rid of
all those "getelementptr" instructions, and LLVM can replace arguments with
the correct ones, similar to the analysis I was intending to do, with
finding fixed points, etc? Or isn't that possible at all, or only to
some extent?

Thanks,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200416/85704910/attachment.html>


More information about the llvm-dev mailing list