From 5cfabba03b2fa414c6904f7986dd6b08c409bfae Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 6 Oct 2009 22:43:47 +0000 Subject: C backend. git-svn-id: http://svn.drobilla.net/resp/tuplr@199 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/llvm.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/llvm.cpp') diff --git a/src/llvm.cpp b/src/llvm.cpp index e2f7f1a..9e519a7 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -16,11 +16,7 @@ */ /** @file - * @brief Compile AST to LLVM IR - * - * Compilation pass functions (lift/compile) that require direct use of LLVM - * specific things are implemented here. Generic compilation pass functions - * are implemented in compile.cpp. + * @brief Compile to LLVM IR */ #include @@ -64,11 +60,10 @@ llType(const AType* t) const ATuple* prot = t->at(1)->to(); for (size_t i = 0; i < prot->size(); ++i) { const AType* at = prot->at(i)->to(); - const Type* lt = llType(at); - if (lt) - cprot.push_back(lt); - else + const Type* lt = llType(at); + if (!lt) return NULL; + cprot.push_back(lt); } FunctionType* fT = FunctionType::get(llType(retT), cprot, false); @@ -159,7 +154,7 @@ struct LLVMEngine : public Engine { return builder.CreateCall(llFunc(f), llArgs.begin(), llArgs.end()); } - void liftCall(CEnv& cenv, AFn* fn, const AType& argsT); + void liftCall(CEnv& cenv, AFn* fn, const AType& argsT); CValue compileLiteral(CEnv& cenv, AST* lit); CValue compilePrimitive(CEnv& cenv, APrimitive* prim); -- cgit v1.2.1