authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-26 15:10:11-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-26 15:11:05-04:00
logaf95e1557214df4a1a34a712efc2f8dafb502c82
tree5d732211732bc7ef9fd7f4565c3d5e6668dcd2b8
parent8e714289cac55fd6f793cf21cea5fa1930edb985

rename get_maybe_type to get_optional_type


4 files changed, 27 insertions(+), 27 deletions(-)

src/all_types.hpp+1-1
...@@ -1233,7 +1233,7 @@ struct TypeTableEntry {...@@ -1233,7 +1233,7 @@ struct TypeTableEntry {
12331233
1234 // use these fields to make sure we don't duplicate type table entries for the same type1234 // use these fields to make sure we don't duplicate type table entries for the same type
1235 TypeTableEntry *pointer_parent[2]; // [0 - mut, 1 - const]1235 TypeTableEntry *pointer_parent[2]; // [0 - mut, 1 - const]
1236 TypeTableEntry *maybe_parent;1236 TypeTableEntry *optional_parent;
1237 TypeTableEntry *promise_parent;1237 TypeTableEntry *promise_parent;
1238 TypeTableEntry *promise_frame_parent;1238 TypeTableEntry *promise_frame_parent;
1239 // If we generate a constant name value for this type, we memoize it here.1239 // If we generate a constant name value for this type, we memoize it here.
src/analyze.cpp+6-6
...@@ -482,7 +482,7 @@ TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type)...@@ -482,7 +482,7 @@ TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type)
482 return return_type->promise_frame_parent;482 return return_type->promise_frame_parent;
483 }483 }
484484
485 TypeTableEntry *awaiter_handle_type = get_maybe_type(g, g->builtin_types.entry_promise);485 TypeTableEntry *awaiter_handle_type = get_optional_type(g, g->builtin_types.entry_promise);
486 TypeTableEntry *result_ptr_type = get_pointer_to_type(g, return_type, false);486 TypeTableEntry *result_ptr_type = get_pointer_to_type(g, return_type, false);
487487
488 ZigList<const char *> field_names = {};488 ZigList<const char *> field_names = {};
...@@ -513,9 +513,9 @@ TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type)...@@ -513,9 +513,9 @@ TypeTableEntry *get_promise_frame_type(CodeGen *g, TypeTableEntry *return_type)
513 return entry;513 return entry;
514}514}
515515
516TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) {516TypeTableEntry *get_optional_type(CodeGen *g, TypeTableEntry *child_type) {
517 if (child_type->maybe_parent) {517 if (child_type->optional_parent) {
518 TypeTableEntry *entry = child_type->maybe_parent;518 TypeTableEntry *entry = child_type->optional_parent;
519 return entry;519 return entry;
520 } else {520 } else {
521 ensure_complete_type(g, child_type);521 ensure_complete_type(g, child_type);
...@@ -592,7 +592,7 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) {...@@ -592,7 +592,7 @@ TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type) {
592592
593 entry->data.maybe.child_type = child_type;593 entry->data.maybe.child_type = child_type;
594594
595 child_type->maybe_parent = entry;595 child_type->optional_parent = entry;
596 return entry;596 return entry;
597 }597 }
598}598}
...@@ -2996,7 +2996,7 @@ static void typecheck_panic_fn(CodeGen *g, FnTableEntry *panic_fn) {...@@ -2996,7 +2996,7 @@ static void typecheck_panic_fn(CodeGen *g, FnTableEntry *panic_fn) {
2996 return wrong_panic_prototype(g, proto_node, fn_type);2996 return wrong_panic_prototype(g, proto_node, fn_type);
2997 }2997 }
29982998
2999 TypeTableEntry *optional_ptr_to_stack_trace_type = get_maybe_type(g, get_ptr_to_stack_trace_type(g));2999 TypeTableEntry *optional_ptr_to_stack_trace_type = get_optional_type(g, get_ptr_to_stack_trace_type(g));
3000 if (fn_type_id->param_info[1].type != optional_ptr_to_stack_trace_type) {3000 if (fn_type_id->param_info[1].type != optional_ptr_to_stack_trace_type) {
3001 return wrong_panic_prototype(g, proto_node, fn_type);3001 return wrong_panic_prototype(g, proto_node, fn_type);
3002 }3002 }
src/analyze.hpp+1-1
...@@ -24,7 +24,7 @@ TypeTableEntry *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);...@@ -24,7 +24,7 @@ TypeTableEntry *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits);
24TypeTableEntry **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type);24TypeTableEntry **get_c_int_type_ptr(CodeGen *g, CIntType c_int_type);
25TypeTableEntry *get_c_int_type(CodeGen *g, CIntType c_int_type);25TypeTableEntry *get_c_int_type(CodeGen *g, CIntType c_int_type);
26TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id);26TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id);
27TypeTableEntry *get_maybe_type(CodeGen *g, TypeTableEntry *child_type);27TypeTableEntry *get_optional_type(CodeGen *g, TypeTableEntry *child_type);
28TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t array_size);28TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t array_size);
29TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type);29TypeTableEntry *get_slice_type(CodeGen *g, TypeTableEntry *ptr_type);
30TypeTableEntry *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,30TypeTableEntry *get_partial_container_type(CodeGen *g, Scope *scope, ContainerKind kind,
src/ir.cpp+19-19
...@@ -3044,7 +3044,7 @@ static IrInstruction *ir_gen_async_return(IrBuilder *irb, Scope *scope, AstNode...@@ -3044,7 +3044,7 @@ static IrInstruction *ir_gen_async_return(IrBuilder *irb, Scope *scope, AstNode
30443044
3045 ir_build_store_ptr(irb, scope, node, irb->exec->coro_result_field_ptr, return_value);3045 ir_build_store_ptr(irb, scope, node, irb->exec->coro_result_field_ptr, return_value);
3046 IrInstruction *promise_type_val = ir_build_const_type(irb, scope, node,3046 IrInstruction *promise_type_val = ir_build_const_type(irb, scope, node,
3047 get_maybe_type(irb->codegen, irb->codegen->builtin_types.entry_promise));3047 get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise));
3048 // TODO replace replacement_value with @intToPtr(?promise, 0x1) when it doesn't crash zig3048 // TODO replace replacement_value with @intToPtr(?promise, 0x1) when it doesn't crash zig
3049 IrInstruction *replacement_value = irb->exec->coro_handle;3049 IrInstruction *replacement_value = irb->exec->coro_handle;
3050 IrInstruction *maybe_await_handle = ir_build_atomic_rmw(irb, scope, node,3050 IrInstruction *maybe_await_handle = ir_build_atomic_rmw(irb, scope, node,
...@@ -6654,7 +6654,7 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *parent_scope, Ast...@@ -6654,7 +6654,7 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *parent_scope, Ast
6654 ir_build_store_ptr(irb, parent_scope, node, result_ptr_field_ptr, my_result_var_ptr);6654 ir_build_store_ptr(irb, parent_scope, node, result_ptr_field_ptr, my_result_var_ptr);
6655 IrInstruction *save_token = ir_build_coro_save(irb, parent_scope, node, irb->exec->coro_handle);6655 IrInstruction *save_token = ir_build_coro_save(irb, parent_scope, node, irb->exec->coro_handle);
6656 IrInstruction *promise_type_val = ir_build_const_type(irb, parent_scope, node,6656 IrInstruction *promise_type_val = ir_build_const_type(irb, parent_scope, node,
6657 get_maybe_type(irb->codegen, irb->codegen->builtin_types.entry_promise));6657 get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise));
6658 IrInstruction *maybe_await_handle = ir_build_atomic_rmw(irb, parent_scope, node, 6658 IrInstruction *maybe_await_handle = ir_build_atomic_rmw(irb, parent_scope, node,
6659 promise_type_val, awaiter_field_ptr, nullptr, irb->exec->coro_handle, nullptr,6659 promise_type_val, awaiter_field_ptr, nullptr, irb->exec->coro_handle, nullptr,
6660 AtomicRmwOp_xchg, AtomicOrderSeqCst);6660 AtomicRmwOp_xchg, AtomicOrderSeqCst);
...@@ -6988,7 +6988,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec...@@ -6988,7 +6988,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec
6988 VariableTableEntry *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);6988 VariableTableEntry *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false);
6989 IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node);6989 IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node);
6990 IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node,6990 IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node,
6991 get_maybe_type(irb->codegen, irb->codegen->builtin_types.entry_promise));6991 get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise));
6992 ir_build_var_decl(irb, coro_scope, node, await_handle_var, await_handle_type_val, nullptr, null_value);6992 ir_build_var_decl(irb, coro_scope, node, await_handle_var, await_handle_type_val, nullptr, null_value);
6993 irb->exec->await_handle_var_ptr = ir_build_var_ptr(irb, coro_scope, node, await_handle_var);6993 irb->exec->await_handle_var_ptr = ir_build_var_ptr(irb, coro_scope, node, await_handle_var);
69946994
...@@ -8762,7 +8762,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod...@@ -8762,7 +8762,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
8762 } else if (prev_inst->value.type->id == TypeTableEntryIdOptional) {8762 } else if (prev_inst->value.type->id == TypeTableEntryIdOptional) {
8763 return prev_inst->value.type;8763 return prev_inst->value.type;
8764 } else {8764 } else {
8765 return get_maybe_type(ira->codegen, prev_inst->value.type);8765 return get_optional_type(ira->codegen, prev_inst->value.type);
8766 }8766 }
8767 } else {8767 } else {
8768 return prev_inst->value.type;8768 return prev_inst->value.type;
...@@ -12127,7 +12127,7 @@ static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira,...@@ -12127,7 +12127,7 @@ static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira,
12127{12127{
12128 if (instruction->optional == IrInstructionErrorReturnTrace::Null) {12128 if (instruction->optional == IrInstructionErrorReturnTrace::Null) {
12129 TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(ira->codegen);12129 TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(ira->codegen);
12130 TypeTableEntry *optional_type = get_maybe_type(ira->codegen, ptr_to_stack_trace_type);12130 TypeTableEntry *optional_type = get_optional_type(ira->codegen, ptr_to_stack_trace_type);
12131 if (!exec_has_err_ret_trace(ira->codegen, ira->new_irb.exec)) {12131 if (!exec_has_err_ret_trace(ira->codegen, ira->new_irb.exec)) {
12132 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);12132 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
12133 assert(get_codegen_ptr_type(optional_type) != nullptr);12133 assert(get_codegen_ptr_type(optional_type) != nullptr);
...@@ -13105,7 +13105,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op...@@ -13105,7 +13105,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op
13105 case TypeTableEntryIdPromise:13105 case TypeTableEntryIdPromise:
13106 {13106 {
13107 ConstExprValue *out_val = ir_build_const_from(ira, &un_op_instruction->base);13107 ConstExprValue *out_val = ir_build_const_from(ira, &un_op_instruction->base);
13108 out_val->data.x_type = get_maybe_type(ira->codegen, type_entry);13108 out_val->data.x_type = get_optional_type(ira->codegen, type_entry);
13109 return ira->codegen->builtin_types.entry_type;13109 return ira->codegen->builtin_types.entry_type;
13110 }13110 }
13111 case TypeTableEntryIdUnreachable:13111 case TypeTableEntryIdUnreachable:
...@@ -16326,7 +16326,7 @@ static bool ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop...@@ -16326,7 +16326,7 @@ static bool ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
16326 true, false, PtrLenUnknown,16326 true, false, PtrLenUnknown,
16327 get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8),16327 get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8),
16328 0, 0);16328 0, 0);
16329 fn_def_fields[6].type = get_maybe_type(ira->codegen, get_slice_type(ira->codegen, u8_ptr));16329 fn_def_fields[6].type = get_optional_type(ira->codegen, get_slice_type(ira->codegen, u8_ptr));
16330 if (fn_node->is_extern && buf_len(fn_node->lib_name) > 0) {16330 if (fn_node->is_extern && buf_len(fn_node->lib_name) > 0) {
16331 fn_def_fields[6].data.x_optional = create_const_vals(1);16331 fn_def_fields[6].data.x_optional = create_const_vals(1);
16332 ConstExprValue *lib_name = create_const_str_lit(ira->codegen, fn_node->lib_name);16332 ConstExprValue *lib_name = create_const_str_lit(ira->codegen, fn_node->lib_name);
...@@ -16609,7 +16609,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t...@@ -16609,7 +16609,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
16609 // child: ?type16609 // child: ?type
16610 ensure_field_index(result->type, "child", 0);16610 ensure_field_index(result->type, "child", 0);
16611 fields[0].special = ConstValSpecialStatic;16611 fields[0].special = ConstValSpecialStatic;
16612 fields[0].type = get_maybe_type(ira->codegen, ira->codegen->builtin_types.entry_type);16612 fields[0].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_type);
1661316613
16614 if (type_entry->data.promise.result_type == nullptr)16614 if (type_entry->data.promise.result_type == nullptr)
16615 fields[0].data.x_optional = nullptr;16615 fields[0].data.x_optional = nullptr;
...@@ -16763,7 +16763,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t...@@ -16763,7 +16763,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
16763 // tag_type: ?type16763 // tag_type: ?type
16764 ensure_field_index(result->type, "tag_type", 1);16764 ensure_field_index(result->type, "tag_type", 1);
16765 fields[1].special = ConstValSpecialStatic;16765 fields[1].special = ConstValSpecialStatic;
16766 fields[1].type = get_maybe_type(ira->codegen, ira->codegen->builtin_types.entry_type);16766 fields[1].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_type);
1676716767
16768 AstNode *union_decl_node = type_entry->data.unionation.decl_node;16768 AstNode *union_decl_node = type_entry->data.unionation.decl_node;
16769 if (union_decl_node->data.container_decl.auto_enum ||16769 if (union_decl_node->data.container_decl.auto_enum ||
...@@ -16803,7 +16803,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t...@@ -16803,7 +16803,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1680316803
16804 ConstExprValue *inner_fields = create_const_vals(3);16804 ConstExprValue *inner_fields = create_const_vals(3);
16805 inner_fields[1].special = ConstValSpecialStatic;16805 inner_fields[1].special = ConstValSpecialStatic;
16806 inner_fields[1].type = get_maybe_type(ira->codegen, type_info_enum_field_type);16806 inner_fields[1].type = get_optional_type(ira->codegen, type_info_enum_field_type);
1680716807
16808 if (fields[1].data.x_optional == nullptr) {16808 if (fields[1].data.x_optional == nullptr) {
16809 inner_fields[1].data.x_optional = nullptr;16809 inner_fields[1].data.x_optional = nullptr;
...@@ -16874,7 +16874,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t...@@ -16874,7 +16874,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
1687416874
16875 ConstExprValue *inner_fields = create_const_vals(3);16875 ConstExprValue *inner_fields = create_const_vals(3);
16876 inner_fields[1].special = ConstValSpecialStatic;16876 inner_fields[1].special = ConstValSpecialStatic;
16877 inner_fields[1].type = get_maybe_type(ira->codegen, ira->codegen->builtin_types.entry_usize);16877 inner_fields[1].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_usize);
1687816878
16879 if (!type_has_bits(struct_field->type_entry)) {16879 if (!type_has_bits(struct_field->type_entry)) {
16880 inner_fields[1].data.x_optional = nullptr;16880 inner_fields[1].data.x_optional = nullptr;
...@@ -16934,7 +16934,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t...@@ -16934,7 +16934,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
16934 // return_type: ?type16934 // return_type: ?type
16935 ensure_field_index(result->type, "return_type", 3);16935 ensure_field_index(result->type, "return_type", 3);
16936 fields[3].special = ConstValSpecialStatic;16936 fields[3].special = ConstValSpecialStatic;
16937 fields[3].type = get_maybe_type(ira->codegen, ira->codegen->builtin_types.entry_type);16937 fields[3].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_type);
16938 if (type_entry->data.fn.fn_type_id.return_type == nullptr)16938 if (type_entry->data.fn.fn_type_id.return_type == nullptr)
16939 fields[3].data.x_optional = nullptr;16939 fields[3].data.x_optional = nullptr;
16940 else {16940 else {
...@@ -16947,7 +16947,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t...@@ -16947,7 +16947,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
16947 // async_allocator_type: type16947 // async_allocator_type: type
16948 ensure_field_index(result->type, "async_allocator_type", 4);16948 ensure_field_index(result->type, "async_allocator_type", 4);
16949 fields[4].special = ConstValSpecialStatic;16949 fields[4].special = ConstValSpecialStatic;
16950 fields[4].type = get_maybe_type(ira->codegen, ira->codegen->builtin_types.entry_type);16950 fields[4].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_type);
16951 if (type_entry->data.fn.fn_type_id.async_allocator_type == nullptr)16951 if (type_entry->data.fn.fn_type_id.async_allocator_type == nullptr)
16952 fields[4].data.x_optional = nullptr;16952 fields[4].data.x_optional = nullptr;
16953 else {16953 else {
...@@ -16990,7 +16990,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t...@@ -16990,7 +16990,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t
16990 inner_fields[1].type = ira->codegen->builtin_types.entry_bool;16990 inner_fields[1].type = ira->codegen->builtin_types.entry_bool;
16991 inner_fields[1].data.x_bool = fn_param_info->is_noalias;16991 inner_fields[1].data.x_bool = fn_param_info->is_noalias;
16992 inner_fields[2].special = ConstValSpecialStatic;16992 inner_fields[2].special = ConstValSpecialStatic;
16993 inner_fields[2].type = get_maybe_type(ira->codegen, ira->codegen->builtin_types.entry_type);16993 inner_fields[2].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_type);
1699416994
16995 if (arg_is_generic)16995 if (arg_is_generic)
16996 inner_fields[2].data.x_optional = nullptr;16996 inner_fields[2].data.x_optional = nullptr;
...@@ -17342,7 +17342,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct...@@ -17342,7 +17342,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct
17342 IrInstruction *result = ir_build_cmpxchg(&ira->new_irb, instruction->base.scope, instruction->base.source_node,17342 IrInstruction *result = ir_build_cmpxchg(&ira->new_irb, instruction->base.scope, instruction->base.source_node,
17343 nullptr, casted_ptr, casted_cmp_value, casted_new_value, nullptr, nullptr, instruction->is_weak,17343 nullptr, casted_ptr, casted_cmp_value, casted_new_value, nullptr, nullptr, instruction->is_weak,
17344 operand_type, success_order, failure_order);17344 operand_type, success_order, failure_order);
17345 result->value.type = get_maybe_type(ira->codegen, operand_type);17345 result->value.type = get_optional_type(ira->codegen, operand_type);
17346 ir_link_new_instruction(result, &instruction->base);17346 ir_link_new_instruction(result, &instruction->base);
17347 ir_add_alloca(ira, result, result->value.type);17347 ir_add_alloca(ira, result, result->value.type);
17348 return result->value.type;17348 return result->value.type;
...@@ -19013,7 +19013,7 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3...@@ -19013,7 +19013,7 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3
19013 old_align_bytes = ptr_type->data.pointer.alignment;19013 old_align_bytes = ptr_type->data.pointer.alignment;
19014 TypeTableEntry *better_ptr_type = adjust_ptr_align(ira->codegen, ptr_type, align_bytes);19014 TypeTableEntry *better_ptr_type = adjust_ptr_align(ira->codegen, ptr_type, align_bytes);
1901519015
19016 result_type = get_maybe_type(ira->codegen, better_ptr_type);19016 result_type = get_optional_type(ira->codegen, better_ptr_type);
19017 } else if (target_type->id == TypeTableEntryIdOptional &&19017 } else if (target_type->id == TypeTableEntryIdOptional &&
19018 target_type->data.maybe.child_type->id == TypeTableEntryIdFn)19018 target_type->data.maybe.child_type->id == TypeTableEntryIdFn)
19019 {19019 {
...@@ -19021,7 +19021,7 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3...@@ -19021,7 +19021,7 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3
19021 old_align_bytes = fn_type_id.alignment;19021 old_align_bytes = fn_type_id.alignment;
19022 fn_type_id.alignment = align_bytes;19022 fn_type_id.alignment = align_bytes;
19023 TypeTableEntry *fn_type = get_fn_type(ira->codegen, &fn_type_id);19023 TypeTableEntry *fn_type = get_fn_type(ira->codegen, &fn_type_id);
19024 result_type = get_maybe_type(ira->codegen, fn_type);19024 result_type = get_optional_type(ira->codegen, fn_type);
19025 } else if (is_slice(target_type)) {19025 } else if (is_slice(target_type)) {
19026 TypeTableEntry *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry;19026 TypeTableEntry *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry;
19027 old_align_bytes = slice_ptr_type->data.pointer.alignment;19027 old_align_bytes = slice_ptr_type->data.pointer.alignment;
...@@ -19782,7 +19782,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstru...@@ -19782,7 +19782,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_free(IrAnalyze *ira, IrInstru
19782 instruction->base.source_node, coro_id, coro_handle);19782 instruction->base.source_node, coro_id, coro_handle);
19783 ir_link_new_instruction(result, &instruction->base);19783 ir_link_new_instruction(result, &instruction->base);
19784 TypeTableEntry *ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false);19784 TypeTableEntry *ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false);
19785 result->value.type = get_maybe_type(ira->codegen, ptr_type);19785 result->value.type = get_optional_type(ira->codegen, ptr_type);
19786 return result->value.type;19786 return result->value.type;
19787}19787}
1978819788
...@@ -19850,7 +19850,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira,...@@ -19850,7 +19850,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira,
19850 instruction->base.source_node, alloc_fn, coro_size);19850 instruction->base.source_node, alloc_fn, coro_size);
19851 ir_link_new_instruction(result, &instruction->base);19851 ir_link_new_instruction(result, &instruction->base);
19852 TypeTableEntry *u8_ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false);19852 TypeTableEntry *u8_ptr_type = get_pointer_to_type(ira->codegen, ira->codegen->builtin_types.entry_u8, false);
19853 result->value.type = get_maybe_type(ira->codegen, u8_ptr_type);19853 result->value.type = get_optional_type(ira->codegen, u8_ptr_type);
19854 return result->value.type;19854 return result->value.type;
19855}19855}
1985619856