Add the push operation in code in compiler series

This commit is contained in:
2019-11-06 13:23:59 -08:00
parent 64227f2873
commit 2994f8983d
14 changed files with 67 additions and 7 deletions

View File

@@ -53,6 +53,7 @@ void definition_defn::compile() {
}
body->compile(new_env, instructions);
instructions.push_back(instruction_ptr(new instruction_update(params.size())));
instructions.push_back(instruction_ptr(new instruction_pop(params.size())));
}
void definition_defn::gen_llvm_first(llvm_context& ctx) {
generated_function = ctx.create_custom_function(name, params.size());
@@ -63,7 +64,6 @@ void definition_defn::gen_llvm_second(llvm_context& ctx) {
for(auto& instruction : instructions) {
instruction->gen_llvm(ctx, generated_function);
}
ctx.create_popn(generated_function, ctx.create_size(params.size()));
ctx.builder.CreateRetVoid();
}