authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-17 17:12:06-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-17 17:12:06-04:00
log05680008445564d3b43fd720723c86b526ff97c3
treecbb1fd02ce15ad355e15320d9ee0cf2082dfb904
parent74250e434eb4ba0d752808e6a7b8d647e545c420
signaturelock-open Commit is signed but in an unrecognized format.

fix function calls


1 files changed, 9 insertions(+), 5 deletions(-)

src/ir.cpp+9-5
...@@ -15482,6 +15482,13 @@ static IrInstruction *ir_analyze_store_ptr(IrAnalyze *ira, IrInstruction *source...@@ -15482,6 +15482,13 @@ static IrInstruction *ir_analyze_store_ptr(IrAnalyze *ira, IrInstruction *source
15482 return result;15482 return result;
15483}15483}
1548415484
15485static void mark_inferred_ptr_runtime(IrInstruction *ptr) {
15486 ir_assert(ptr->value.type->id == ZigTypeIdPointer, ptr);
15487 if (ptr->value.data.x_ptr.mut == ConstPtrMutInfer) {
15488 ptr->value.special = ConstValSpecialRuntime;
15489 }
15490}
15491
15485static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *call_instruction,15492static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *call_instruction,
15486 ZigFn *fn_entry, ZigType *fn_type, IrInstruction *fn_ref,15493 ZigFn *fn_entry, ZigType *fn_type, IrInstruction *fn_ref,
15487 IrInstruction *first_arg_ptr, bool comptime_fn_call, FnInline fn_inline)15494 IrInstruction *first_arg_ptr, bool comptime_fn_call, FnInline fn_inline)
...@@ -15926,7 +15933,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c...@@ -15926,7 +15933,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c
15926 if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {15933 if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {
15927 return result_loc;15934 return result_loc;
15928 }15935 }
15929 call_instruction->result_loc->written = true;15936 mark_inferred_ptr_runtime(result_loc);
15930 } else {15937 } else {
15931 result_loc = nullptr;15938 result_loc = nullptr;
15932 }15939 }
...@@ -16047,7 +16054,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c...@@ -16047,7 +16054,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c
16047 if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {16054 if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) {
16048 return result_loc;16055 return result_loc;
16049 }16056 }
16050 call_instruction->result_loc->written = true;16057 mark_inferred_ptr_runtime(result_loc);
16051 } else {16058 } else {
16052 result_loc = nullptr;16059 result_loc = nullptr;
16053 }16060 }
...@@ -24820,9 +24827,6 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_...@@ -24820,9 +24827,6 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_
24820 continue;24827 continue;
24821 }24828 }
2482224829
24823 if (ira->codegen->verbose_ir) {
24824 fprintf(stderr, "analyze #%zu\n", old_instruction->debug_id);
24825 }
24826 IrInstruction *new_instruction = ir_analyze_instruction_base(ira, old_instruction);24830 IrInstruction *new_instruction = ir_analyze_instruction_base(ira, old_instruction);
24827 if (new_instruction != nullptr) {24831 if (new_instruction != nullptr) {
24828 ir_assert(new_instruction->value.type != nullptr || new_instruction->value.type != nullptr, old_instruction);24832 ir_assert(new_instruction->value.type != nullptr || new_instruction->value.type != nullptr, old_instruction);