From 57e39dae03f5085a6d15e24aeaec289ae5215093 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Sat, 1 Jun 2013 17:37:18 +0200 Subject: [PATCH] More more more ... --- src/AST/CodeGenVisitor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/AST/CodeGenVisitor.cpp b/src/AST/CodeGenVisitor.cpp index 02e1d46..f3c5b92 100644 --- a/src/AST/CodeGenVisitor.cpp +++ b/src/AST/CodeGenVisitor.cpp @@ -45,8 +45,6 @@ void CodeGenVisitor::visit(BinOpExpression* e) { // TODO error break; } - - value_->dump(); } void CodeGenVisitor::visit(ConstantExpression* e) { @@ -85,7 +83,6 @@ void CodeGenVisitor::visit(FunctionCallExpression* e) { } value_ = builder_->CreateCall(cf, args, "calltmp"); - value_->dump(); } void CodeGenVisitor::visit(FunctionDefinition* e) { @@ -134,14 +131,15 @@ void CodeGenVisitor::visit(FunctionDefinition* e) { // put all arguments on the stack idx = 0; for(auto ai = f->arg_begin(); idx != params.size(); ++ai, ++idx) { - std::string name = params[idx].second; - // TODO ... + llvm::Value* alloca = builder_->CreateAlloca(typeToLLVMType(params[idx].first) ,0 , params[idx].second); + builder_->CreateStore(ai, alloca); + putNamedValue(params[idx].second, alloca); } // build code for the statements e->getSl()->accept(this); - // TODO implement ... + // TODO we might want to call verifyFunction ... value_ = f; } @@ -163,6 +161,9 @@ void CodeGenVisitor::visit(ReturnStatement* e) { } void CodeGenVisitor::visit(Scope* e) { + // TODO increment scope + e->getSl()->accept(this); + // TODO decrement scope } void CodeGenVisitor::visit(StatementList* e) {