| ... | ... | @@ -3044,7 +3044,7 @@ static IrInstruction *ir_gen_async_return(IrBuilder *irb, Scope *scope, AstNode |
| 3044 | 3044 | |
| 3045 | 3045 | ir_build_store_ptr(irb, scope, node, irb->exec->coro_result_field_ptr, return_value); |
| 3046 | 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 | 3048 | // TODO replace replacement_value with @intToPtr(?promise, 0x1) when it doesn't crash zig |
| 3049 | 3049 | IrInstruction *replacement_value = irb->exec->coro_handle; |
| 3050 | 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 | 6654 | ir_build_store_ptr(irb, parent_scope, node, result_ptr_field_ptr, my_result_var_ptr); |
| 6655 | 6655 | IrInstruction *save_token = ir_build_coro_save(irb, parent_scope, node, irb->exec->coro_handle); |
| 6656 | 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 | 6658 | IrInstruction *maybe_await_handle = ir_build_atomic_rmw(irb, parent_scope, node, |
| 6659 | 6659 | promise_type_val, awaiter_field_ptr, nullptr, irb->exec->coro_handle, nullptr, |
| 6660 | 6660 | AtomicRmwOp_xchg, AtomicOrderSeqCst); |
| ... | ... | @@ -6988,7 +6988,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 6988 | 6988 | VariableTableEntry *await_handle_var = ir_create_var(irb, node, coro_scope, nullptr, false, false, true, const_bool_false); |
| 6989 | 6989 | IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node); |
| 6990 | 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 | 6992 | ir_build_var_decl(irb, coro_scope, node, await_handle_var, await_handle_type_val, nullptr, null_value); |
| 6993 | 6993 | irb->exec->await_handle_var_ptr = ir_build_var_ptr(irb, coro_scope, node, await_handle_var); |
| 6994 | 6994 | |
| ... | ... | @@ -8762,7 +8762,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 8762 | 8762 | } else if (prev_inst->value.type->id == TypeTableEntryIdOptional) { |
| 8763 | 8763 | return prev_inst->value.type; |
| 8764 | 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 | 8767 | } else { |
| 8768 | 8768 | return prev_inst->value.type; |
| ... | ... | @@ -12127,7 +12127,7 @@ static TypeTableEntry *ir_analyze_instruction_error_return_trace(IrAnalyze *ira, |
| 12127 | 12127 | { |
| 12128 | 12128 | if (instruction->optional == IrInstructionErrorReturnTrace::Null) { |
| 12129 | 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 | 12131 | if (!exec_has_err_ret_trace(ira->codegen, ira->new_irb.exec)) { |
| 12132 | 12132 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 12133 | 12133 | assert(get_codegen_ptr_type(optional_type) != nullptr); |
| ... | ... | @@ -13105,7 +13105,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op |
| 13105 | 13105 | case TypeTableEntryIdPromise: |
| 13106 | 13106 | { |
| 13107 | 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 | 13109 | return ira->codegen->builtin_types.entry_type; |
| 13110 | 13110 | } |
| 13111 | 13111 | case TypeTableEntryIdUnreachable: |
| ... | ... | @@ -16326,7 +16326,7 @@ static bool ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop |
| 16326 | 16326 | true, false, PtrLenUnknown, |
| 16327 | 16327 | get_abi_alignment(ira->codegen, ira->codegen->builtin_types.entry_u8), |
| 16328 | 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 | 16330 | if (fn_node->is_extern && buf_len(fn_node->lib_name) > 0) { |
| 16331 | 16331 | fn_def_fields[6].data.x_optional = create_const_vals(1); |
| 16332 | 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 | 16609 | // child: ?type |
| 16610 | 16610 | ensure_field_index(result->type, "child", 0); |
| 16611 | 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); |
| 16613 | 16613 | |
| 16614 | 16614 | if (type_entry->data.promise.result_type == nullptr) |
| 16615 | 16615 | fields[0].data.x_optional = nullptr; |
| ... | ... | @@ -16763,7 +16763,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16763 | 16763 | // tag_type: ?type |
| 16764 | 16764 | ensure_field_index(result->type, "tag_type", 1); |
| 16765 | 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); |
| 16767 | 16767 | |
| 16768 | 16768 | AstNode *union_decl_node = type_entry->data.unionation.decl_node; |
| 16769 | 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 | 16803 | |
| 16804 | 16804 | ConstExprValue *inner_fields = create_const_vals(3); |
| 16805 | 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); |
| 16807 | 16807 | |
| 16808 | 16808 | if (fields[1].data.x_optional == nullptr) { |
| 16809 | 16809 | inner_fields[1].data.x_optional = nullptr; |
| ... | ... | @@ -16874,7 +16874,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16874 | 16874 | |
| 16875 | 16875 | ConstExprValue *inner_fields = create_const_vals(3); |
| 16876 | 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); |
| 16878 | 16878 | |
| 16879 | 16879 | if (!type_has_bits(struct_field->type_entry)) { |
| 16880 | 16880 | inner_fields[1].data.x_optional = nullptr; |
| ... | ... | @@ -16934,7 +16934,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16934 | 16934 | // return_type: ?type |
| 16935 | 16935 | ensure_field_index(result->type, "return_type", 3); |
| 16936 | 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 | 16938 | if (type_entry->data.fn.fn_type_id.return_type == nullptr) |
| 16939 | 16939 | fields[3].data.x_optional = nullptr; |
| 16940 | 16940 | else { |
| ... | ... | @@ -16947,7 +16947,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16947 | 16947 | // async_allocator_type: type |
| 16948 | 16948 | ensure_field_index(result->type, "async_allocator_type", 4); |
| 16949 | 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 | 16951 | if (type_entry->data.fn.fn_type_id.async_allocator_type == nullptr) |
| 16952 | 16952 | fields[4].data.x_optional = nullptr; |
| 16953 | 16953 | else { |
| ... | ... | @@ -16990,7 +16990,7 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16990 | 16990 | inner_fields[1].type = ira->codegen->builtin_types.entry_bool; |
| 16991 | 16991 | inner_fields[1].data.x_bool = fn_param_info->is_noalias; |
| 16992 | 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); |
| 16994 | 16994 | |
| 16995 | 16995 | if (arg_is_generic) |
| 16996 | 16996 | inner_fields[2].data.x_optional = nullptr; |
| ... | ... | @@ -17342,7 +17342,7 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct |
| 17342 | 17342 | IrInstruction *result = ir_build_cmpxchg(&ira->new_irb, instruction->base.scope, instruction->base.source_node, |
| 17343 | 17343 | nullptr, casted_ptr, casted_cmp_value, casted_new_value, nullptr, nullptr, instruction->is_weak, |
| 17344 | 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 | 17346 | ir_link_new_instruction(result, &instruction->base); |
| 17347 | 17347 | ir_add_alloca(ira, result, result->value.type); |
| 17348 | 17348 | return result->value.type; |
| ... | ... | @@ -19013,7 +19013,7 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 |
| 19013 | 19013 | old_align_bytes = ptr_type->data.pointer.alignment; |
| 19014 | 19014 | TypeTableEntry *better_ptr_type = adjust_ptr_align(ira->codegen, ptr_type, align_bytes); |
| 19015 | 19015 | |
| 19016 | | result_type = get_maybe_type(ira->codegen, better_ptr_type); |
| 19016 | result_type = get_optional_type(ira->codegen, better_ptr_type); |
| 19017 | 19017 | } else if (target_type->id == TypeTableEntryIdOptional && |
| 19018 | 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 | 19021 | old_align_bytes = fn_type_id.alignment; |
| 19022 | 19022 | fn_type_id.alignment = align_bytes; |
| 19023 | 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 | 19025 | } else if (is_slice(target_type)) { |
| 19026 | 19026 | TypeTableEntry *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry; |
| 19027 | 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 | 19782 | instruction->base.source_node, coro_id, coro_handle); |
| 19783 | 19783 | ir_link_new_instruction(result, &instruction->base); |
| 19784 | 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 | 19786 | return result->value.type; |
| 19787 | 19787 | } |
| 19788 | 19788 | |
| ... | ... | @@ -19850,7 +19850,7 @@ static TypeTableEntry *ir_analyze_instruction_coro_alloc_helper(IrAnalyze *ira, |
| 19850 | 19850 | instruction->base.source_node, alloc_fn, coro_size); |
| 19851 | 19851 | ir_link_new_instruction(result, &instruction->base); |
| 19852 | 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 | 19854 | return result->value.type; |
| 19855 | 19855 | } |
| 19856 | 19856 | |