aboutsummaryrefslogtreecommitdiffstats
path: root/src/compile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile.cpp')
-rw-r--r--src/compile.cpp60
1 files changed, 1 insertions, 59 deletions
diff --git a/src/compile.cpp b/src/compile.cpp
index addad2b..5b6dacd 100644
--- a/src/compile.cpp
+++ b/src/compile.cpp
@@ -16,11 +16,7 @@
*/
/** @file
- * @brief Compile AST using generic backend interface
- *
- * Compilation pass functions (lift/compile) that don't require direct use
- * of any specific backend API are implemented here. Others are implemented
- * in e.g. llvm.cpp.
+ * @brief Compile all code (compilation pass 2)
*/
#include "tuplr.hpp"
@@ -41,27 +37,6 @@ ASymbol::compile(CEnv& cenv)
return cenv.vals.ref(this);
}
-void
-AFn::lift(CEnv& cenv)
-{
- cenv.push();
- for (const_iterator p = prot()->begin(); p != prot()->end(); ++p)
- cenv.def((*p)->as<ASymbol*>(), *p, NULL, NULL);
-
- // Lift body
- for (size_t i = 2; i < size(); ++i)
- at(i)->lift(cenv);
-
- cenv.pop();
-
- AType* type = cenv.type(this);
- if (impls.find(type) || !type->concrete())
- return;
-
- AType* protT = type->at(1)->as<AType*>();
- cenv.engine()->liftCall(cenv, this, *protT);
-}
-
CValue
AFn::compile(CEnv& cenv)
{
@@ -83,28 +58,6 @@ AFn::compile(CEnv& cenv)
return tupPtr;*/
}
-void
-ACall::lift(CEnv& cenv)
-{
- AFn* c = cenv.tenv.resolve(at(0))->to<AFn*>();
- AType argsT(loc);
-
- // Lift arguments
- for (size_t i = 1; i < size(); ++i) {
- at(i)->lift(cenv);
- argsT.push_back(cenv.type(at(i)));
- }
-
- if (!c) return; // Primitive
-
- if (c->prot()->size() < size() - 1)
- throw Error(loc, (format("too many arguments to function `%1%'") % at(0)->str()).str());
- if (c->prot()->size() > size() - 1)
- throw Error(loc, (format("too few arguments to function `%1%'") % at(0)->str()).str());
-
- cenv.engine()->liftCall(cenv, c, argsT); // Lift called closure
-}
-
CValue
ACall::compile(CEnv& cenv)
{
@@ -133,17 +86,6 @@ ACall::compile(CEnv& cenv)
return cenv.engine()->compileCall(cenv, f, args);
}
-void
-ADef::lift(CEnv& cenv)
-{
- // Define stub first for recursion
- cenv.def(sym(), at(2), cenv.type(at(2)), NULL);
- AFn* c = at(2)->to<AFn*>();
- if (c)
- c->name = sym()->str();
- at(2)->lift(cenv);
-}
-
CValue
ADef::compile(CEnv& cenv)
{