mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
src/codegen.cpp: base handle builtin on @frameAddress();
Tracking Issue #1296 ;
This commit is contained in:
parent
a9ea22d4f9
commit
cd18186715
@ -4146,6 +4146,15 @@ static LLVMValueRef ir_render_frame_address(CodeGen *g, IrExecutable *executable
|
||||
return LLVMBuildCall(g->builder, get_frame_address_fn_val(g), &zero, 1, "");
|
||||
}
|
||||
|
||||
static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
|
||||
IrInstructionHandle *instruction)
|
||||
{
|
||||
// @andrewrk, not sure what to place here ?
|
||||
// `get_promise_frame_type` ?
|
||||
LLVMValueRef handle = LLVMConstNull(g->builtin_types.entry_promise->type_ref);
|
||||
return LLVMBuildRet(g->builder, handle);
|
||||
}
|
||||
|
||||
static LLVMValueRef render_shl_with_overflow(CodeGen *g, IrInstructionOverflowOp *instruction) {
|
||||
TypeTableEntry *int_type = instruction->result_ptr_type;
|
||||
assert(int_type->id == TypeTableEntryIdInt);
|
||||
@ -4910,6 +4919,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
|
||||
return ir_render_return_address(g, executable, (IrInstructionReturnAddress *)instruction);
|
||||
case IrInstructionIdFrameAddress:
|
||||
return ir_render_frame_address(g, executable, (IrInstructionFrameAddress *)instruction);
|
||||
case IrInstructionIdHandle:
|
||||
return ir_render_handle(g, executable, (IrInstructionHandle *)instruction);
|
||||
case IrInstructionIdOverflowOp:
|
||||
return ir_render_overflow_op(g, executable, (IrInstructionOverflowOp *)instruction);
|
||||
case IrInstructionIdTestErr:
|
||||
@ -6344,6 +6355,7 @@ static void define_builtin_fns(CodeGen *g) {
|
||||
create_builtin_fn(g, BuiltinFnIdBreakpoint, "breakpoint", 0);
|
||||
create_builtin_fn(g, BuiltinFnIdReturnAddress, "returnAddress", 0);
|
||||
create_builtin_fn(g, BuiltinFnIdFrameAddress, "frameAddress", 0);
|
||||
create_builtin_fn(g, BuiltinFnIdHandle, "handle", 0);
|
||||
create_builtin_fn(g, BuiltinFnIdMemcpy, "memcpy", 3);
|
||||
create_builtin_fn(g, BuiltinFnIdMemset, "memset", 3);
|
||||
create_builtin_fn(g, BuiltinFnIdSizeof, "sizeOf", 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user