Open Memorytaco opened 1 year ago
This is required for writing JIT functionality for REPL. Before we go deep into a formal definition of this structure, we need to define a "usable" structure to help translating partial IR into LLVM IR for supporting JIT in REPL and also further studying in this IR form.
As far as i know, there are three choices for the middle language and they are SSA, CPS and ANF. Since LLVM IR is represented in SSA form, and since it is not obvious on how to translate a surface language directly to SSA, we are left with SSA and ANF. Both of them seems to be common practice for a functional language compiler and i believe ANF should be a better choice in this code base because of
Expr
structure used in project.Use
Expr
to represent an ANF Node is trivial and defining pass betweenExpr
is straightforward. (see pass definition and a taste for codegen)This seems to be a good choice but more experience is required to verify this.