parent
79f1ff574b
commit
d0f2eca106
@ -1613,6 +1613,7 @@ struct CodeGen {
|
|||||||
LLVMValueRef coro_id_fn_val;
|
LLVMValueRef coro_id_fn_val;
|
||||||
LLVMValueRef coro_alloc_fn_val;
|
LLVMValueRef coro_alloc_fn_val;
|
||||||
LLVMValueRef coro_size_fn_val;
|
LLVMValueRef coro_size_fn_val;
|
||||||
|
LLVMValueRef coro_begin_fn_val;
|
||||||
bool error_during_imports;
|
bool error_during_imports;
|
||||||
|
|
||||||
const char **clang_argv;
|
const char **clang_argv;
|
||||||
|
@ -987,6 +987,22 @@ static LLVMValueRef get_coro_size_fn_val(CodeGen *g) {
|
|||||||
return g->coro_size_fn_val;
|
return g->coro_size_fn_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LLVMValueRef get_coro_begin_fn_val(CodeGen *g) {
|
||||||
|
if (g->coro_begin_fn_val)
|
||||||
|
return g->coro_begin_fn_val;
|
||||||
|
|
||||||
|
LLVMTypeRef param_types[] = {
|
||||||
|
ZigLLVMTokenTypeInContext(LLVMGetGlobalContext()),
|
||||||
|
LLVMPointerType(LLVMInt8Type(), 0),
|
||||||
|
};
|
||||||
|
LLVMTypeRef fn_type = LLVMFunctionType(LLVMPointerType(LLVMInt8Type(), 0), param_types, 2, false);
|
||||||
|
Buf *name = buf_sprintf("llvm.coro.begin");
|
||||||
|
g->coro_begin_fn_val = LLVMAddFunction(g->module, buf_ptr(name), fn_type);
|
||||||
|
assert(LLVMGetIntrinsicID(g->coro_begin_fn_val));
|
||||||
|
|
||||||
|
return g->coro_begin_fn_val;
|
||||||
|
}
|
||||||
|
|
||||||
static LLVMValueRef get_return_address_fn_val(CodeGen *g) {
|
static LLVMValueRef get_return_address_fn_val(CodeGen *g) {
|
||||||
if (g->return_address_fn_val)
|
if (g->return_address_fn_val)
|
||||||
return g->return_address_fn_val;
|
return g->return_address_fn_val;
|
||||||
@ -3808,7 +3824,13 @@ static LLVMValueRef ir_render_coro_size(CodeGen *g, IrExecutable *executable, Ir
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LLVMValueRef ir_render_coro_begin(CodeGen *g, IrExecutable *executable, IrInstructionCoroBegin *instruction) {
|
static LLVMValueRef ir_render_coro_begin(CodeGen *g, IrExecutable *executable, IrInstructionCoroBegin *instruction) {
|
||||||
zig_panic("TODO ir_render_coro_begin");
|
LLVMValueRef coro_id = ir_llvm_value(g, instruction->coro_id);
|
||||||
|
LLVMValueRef coro_mem_ptr = ir_llvm_value(g, instruction->coro_mem_ptr);
|
||||||
|
LLVMValueRef params[] = {
|
||||||
|
coro_id,
|
||||||
|
coro_mem_ptr,
|
||||||
|
};
|
||||||
|
return LLVMBuildCall(g->builder, get_coro_begin_fn_val(g), params, 2, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static LLVMValueRef ir_render_coro_alloc_fail(CodeGen *g, IrExecutable *executable,
|
static LLVMValueRef ir_render_coro_alloc_fail(CodeGen *g, IrExecutable *executable,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user