authorgravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-07-27 19:18:29+09:00
committergravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-08-02 16:50:08+09:00
logcd18186715bf532715c03d8e67096606fe0f2bee
treef85ca60d405f17150cd89acb9c08ad0077d05704
parenta9ea22d4f9816998cccfca4df2ef56d5069e1814

src/codegen.cpp: base handle builtin on `@frameAddress()`;

Tracking Issue #1296 ;

1 files changed, 12 insertions(+), 0 deletions(-)

src/codegen.cpp+12
......@@ -4146,6 +4146,15 @@ static LLVMValueRef ir_render_frame_address(CodeGen *g, IrExecutable *executable
41464146 return LLVMBuildCall(g->builder, get_frame_address_fn_val(g), &zero, 1, "");
41474147}
41484148
4149static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
4150 IrInstructionHandle *instruction)
4151{
4152 // @andrewrk, not sure what to place here ?
4153 // `get_promise_frame_type` ?
4154 LLVMValueRef handle = LLVMConstNull(g->builtin_types.entry_promise->type_ref);
4155 return LLVMBuildRet(g->builder, handle);
4156}
4157
41494158static LLVMValueRef render_shl_with_overflow(CodeGen *g, IrInstructionOverflowOp *instruction) {
41504159 TypeTableEntry *int_type = instruction->result_ptr_type;
41514160 assert(int_type->id == TypeTableEntryIdInt);
......@@ -4910,6 +4919,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
49104919 return ir_render_return_address(g, executable, (IrInstructionReturnAddress *)instruction);
49114920 case IrInstructionIdFrameAddress:
49124921 return ir_render_frame_address(g, executable, (IrInstructionFrameAddress *)instruction);
4922 case IrInstructionIdHandle:
4923 return ir_render_handle(g, executable, (IrInstructionHandle *)instruction);
49134924 case IrInstructionIdOverflowOp:
49144925 return ir_render_overflow_op(g, executable, (IrInstructionOverflowOp *)instruction);
49154926 case IrInstructionIdTestErr:
......@@ -6344,6 +6355,7 @@ static void define_builtin_fns(CodeGen *g) {
63446355 create_builtin_fn(g, BuiltinFnIdBreakpoint, "breakpoint", 0);
63456356 create_builtin_fn(g, BuiltinFnIdReturnAddress, "returnAddress", 0);
63466357 create_builtin_fn(g, BuiltinFnIdFrameAddress, "frameAddress", 0);
6358 create_builtin_fn(g, BuiltinFnIdHandle, "handle", 0);
63476359 create_builtin_fn(g, BuiltinFnIdMemcpy, "memcpy", 3);
63486360 create_builtin_fn(g, BuiltinFnIdMemset, "memset", 3);
63496361 create_builtin_fn(g, BuiltinFnIdSizeof, "sizeOf", 1);