From 8cbb1c710d6c8877dfc2871dc3f068b52598a884 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 15 May 2011 20:15:27 +0000 Subject: Generate code entirely via emitting flat IR (don't special case main/repl). git-svn-id: http://svn.drobilla.net/resp/trunk@427 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/llvm.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/llvm.cpp') diff --git a/src/llvm.cpp b/src/llvm.cpp index 3391cb7..c4744c3 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -78,7 +78,6 @@ struct LLVMEngine : public Engine { virtual ~LLVMEngine(); CFunc startFn(CEnv& cenv, const string& name, const ATuple* args, const ATuple* type); - void pushFnArgs(CEnv& cenv, const ATuple* prot, const ATuple* type, CFunc f); void finishFn(CEnv& cenv, CVal ret, const AST* retT); CFunc getFn(CEnv& cenv, const std::string& name); void eraseFn(CEnv& cenv, CFunc f); @@ -103,6 +102,8 @@ struct LLVMEngine : public Engine { const string call(CEnv& cenv, CFunc f, const AST* retT); private: + void pushFnArgs(CEnv& cenv, const ATuple* prot, const ATuple* type, CFunc f); + void appendBlock(LLVMEngine* engine, Function* function, BasicBlock* block) { function->getBasicBlockList().push_back(block); engine->builder.SetInsertPoint(block); @@ -403,6 +404,9 @@ LLVMEngine::startFn( builder.SetInsertPoint(bb); currentFn = f; + cenv.def(cenv.penv.sym(name), NULL, type, f); + pushFnArgs(cenv, args, type, f); + return f; } -- cgit v1.2.1