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...@@ -4146,6 +4146,15 @@ static LLVMValueRef ir_render_frame_address(CodeGen *g, IrExecutable *executable
4146 return LLVMBuildCall(g->builder, get_frame_address_fn_val(g), &zero, 1, "");4146 return LLVMBuildCall(g->builder, get_frame_address_fn_val(g), &zero, 1, "");
4147}4147}
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
4149static LLVMValueRef render_shl_with_overflow(CodeGen *g, IrInstructionOverflowOp *instruction) {4158static LLVMValueRef render_shl_with_overflow(CodeGen *g, IrInstructionOverflowOp *instruction) {
4150 TypeTableEntry *int_type = instruction->result_ptr_type;4159 TypeTableEntry *int_type = instruction->result_ptr_type;
4151 assert(int_type->id == TypeTableEntryIdInt);4160 assert(int_type->id == TypeTableEntryIdInt);
...@@ -4910,6 +4919,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,...@@ -4910,6 +4919,8 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
4910 return ir_render_return_address(g, executable, (IrInstructionReturnAddress *)instruction);4919 return ir_render_return_address(g, executable, (IrInstructionReturnAddress *)instruction);
4911 case IrInstructionIdFrameAddress:4920 case IrInstructionIdFrameAddress:
4912 return ir_render_frame_address(g, executable, (IrInstructionFrameAddress *)instruction);4921 return ir_render_frame_address(g, executable, (IrInstructionFrameAddress *)instruction);
4922 case IrInstructionIdHandle:
4923 return ir_render_handle(g, executable, (IrInstructionHandle *)instruction);
4913 case IrInstructionIdOverflowOp:4924 case IrInstructionIdOverflowOp:
4914 return ir_render_overflow_op(g, executable, (IrInstructionOverflowOp *)instruction);4925 return ir_render_overflow_op(g, executable, (IrInstructionOverflowOp *)instruction);
4915 case IrInstructionIdTestErr:4926 case IrInstructionIdTestErr:
...@@ -6344,6 +6355,7 @@ static void define_builtin_fns(CodeGen *g) {...@@ -6344,6 +6355,7 @@ static void define_builtin_fns(CodeGen *g) {
6344 create_builtin_fn(g, BuiltinFnIdBreakpoint, "breakpoint", 0);6355 create_builtin_fn(g, BuiltinFnIdBreakpoint, "breakpoint", 0);
6345 create_builtin_fn(g, BuiltinFnIdReturnAddress, "returnAddress", 0);6356 create_builtin_fn(g, BuiltinFnIdReturnAddress, "returnAddress", 0);
6346 create_builtin_fn(g, BuiltinFnIdFrameAddress, "frameAddress", 0);6357 create_builtin_fn(g, BuiltinFnIdFrameAddress, "frameAddress", 0);
6358 create_builtin_fn(g, BuiltinFnIdHandle, "handle", 0);
6347 create_builtin_fn(g, BuiltinFnIdMemcpy, "memcpy", 3);6359 create_builtin_fn(g, BuiltinFnIdMemcpy, "memcpy", 3);
6348 create_builtin_fn(g, BuiltinFnIdMemset, "memset", 3);6360 create_builtin_fn(g, BuiltinFnIdMemset, "memset", 3);
6349 create_builtin_fn(g, BuiltinFnIdSizeof, "sizeOf", 1);6361 create_builtin_fn(g, BuiltinFnIdSizeof, "sizeOf", 1);