Roll back optimization changes.

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

View File

@@ -237,7 +237,12 @@ Value* llvm_context::unwrap_gmachine_stack_ptr(Value* g) {
}
Value* llvm_context::unwrap_num(Value* v) {
return builder.CreatePtrToInt(v, IntegerType::getInt32Ty(ctx));
auto num_ptr_type = PointerType::getUnqual(struct_types.at("node_num"));
auto cast = builder.CreatePointerCast(v, num_ptr_type);
auto offset_0 = create_i32(0);
auto offset_1 = create_i32(1);
auto int_ptr = builder.CreateGEP(cast, { offset_0, offset_1 });
return builder.CreateLoad(int_ptr);
}
Value* llvm_context::create_num(Function* f, Value* v) {
auto alloc_num_f = functions.at("alloc_num");