feat: SCC analysis (thunk capture WIP)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use inkwell::values::{StructValue, FunctionValue};
|
||||
use inkwell::values::{FunctionValue, StructValue};
|
||||
|
||||
use crate::ir::*;
|
||||
use crate::ty::common as c;
|
||||
@@ -41,11 +41,18 @@ impl JITCompile for UnOp {
|
||||
let tag = ctx.get_tag(rhs);
|
||||
let fallback = ctx.context.append_basic_block(func, "fallback");
|
||||
let ret = ctx.context.append_basic_block(func, "fallback");
|
||||
let res = ctx.builder.build_alloca(ctx.helpers.value_type, "res_alloca").unwrap();
|
||||
let res = ctx
|
||||
.builder
|
||||
.build_alloca(ctx.helpers.value_type, "res_alloca")
|
||||
.unwrap();
|
||||
ctx.builder.build_switch(tag, fallback, &[]).unwrap();
|
||||
ctx.builder.position_at_end(fallback);
|
||||
ctx.builder.position_at_end(ret);
|
||||
ctx.builder.build_load(ctx.helpers.value_type, res, "load_res").unwrap().try_into().unwrap()
|
||||
ctx.builder
|
||||
.build_load(ctx.helpers.value_type, res, "load_res")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user