Roll back optimization changes.

This commit is contained in:
2020-09-17 20:14:39 -07:00
parent 8a44109f93
commit 39bc6bb99e
14 changed files with 78 additions and 833 deletions

View File

@@ -100,7 +100,7 @@ void instruction_jump::print(int indent, std::ostream& to) const {
void instruction_jump::gen_llvm(llvm_context& ctx, Function* f) const {
auto top_node = ctx.create_peek(f, ctx.create_size(0));
auto tag = get_case_value(ctx, top_node);
auto tag = ctx.unwrap_data_tag(top_node);
auto safety_block = ctx.create_basic_block("safety", f);
auto switch_op = ctx.get_builder().CreateSwitch(tag, safety_block, tag_mappings.size());
std::vector<BasicBlock*> blocks;
@@ -122,14 +122,6 @@ void instruction_jump::gen_llvm(llvm_context& ctx, Function* f) const {
ctx.get_builder().SetInsertPoint(safety_block);
}
Value* instruction_jump::get_case_value(llvm_context& ctx, Value* v) const {
return ctx.unwrap_data_tag(v);
}
Value* instruction_ijump::get_case_value(llvm_context& ctx, Value* v) const {
return ctx.unwrap_num(v);
}
void instruction_slide::print(int indent, std::ostream& to) const {
print_indent(indent, to);
to << "Slide(" << offset << ")" << std::endl;
@@ -153,9 +145,6 @@ void instruction_binop::gen_llvm(llvm_context& ctx, Function* f) const {
case MINUS: result = ctx.get_builder().CreateSub(left_int, right_int); break;
case TIMES: result = ctx.get_builder().CreateMul(left_int, right_int); break;
case DIVIDE: result = ctx.get_builder().CreateSDiv(left_int, right_int); break;
case MODULO: result = ctx.get_builder().CreateSRem(left_int, right_int); break;
case EQUALS: result = ctx.get_builder().CreateICmpEQ(left_int, right_int); break;
case LESS_EQUALS: result = ctx.get_builder().CreateICmpSLE(left_int, right_int); break;
}
ctx.create_push(f, ctx.create_num(f, result));
}