| ... | @@ -21,15 +21,15 @@ struct Stage1AstGen { | ... | @@ -21,15 +21,15 @@ struct Stage1AstGen { |
| 21 | bool in_c_import_scope; | 21 | bool in_c_import_scope; |
| 22 | }; | 22 | }; |
| 23 | | 23 | |
| 24 | static IrInstSrc *ir_gen_node(Stage1AstGen *ag, AstNode *node, Scope *scope); | 24 | static IrInstSrc *astgen_node(Stage1AstGen *ag, AstNode *node, Scope *scope); |
| 25 | static IrInstSrc *ir_gen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scope, LVal lval, | 25 | static IrInstSrc *astgen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scope, LVal lval, |
| 26 | ResultLoc *result_loc); | 26 | ResultLoc *result_loc); |
| 27 | | 27 | |
| 28 | static IrInstSrc *ir_lval_wrap(Stage1AstGen *ag, Scope *scope, IrInstSrc *value, LVal lval, | 28 | static IrInstSrc *ir_lval_wrap(Stage1AstGen *ag, Scope *scope, IrInstSrc *value, LVal lval, |
| 29 | ResultLoc *result_loc); | 29 | ResultLoc *result_loc); |
| 30 | static IrInstSrc *ir_expr_wrap(Stage1AstGen *ag, Scope *scope, IrInstSrc *inst, | 30 | static IrInstSrc *ir_expr_wrap(Stage1AstGen *ag, Scope *scope, IrInstSrc *inst, |
| 31 | ResultLoc *result_loc); | 31 | ResultLoc *result_loc); |
| 32 | static IrInstSrc *ir_gen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode *source_node, | 32 | static IrInstSrc *astgen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode *source_node, |
| 33 | IrInstSrc *union_type, IrInstSrc *field_name, AstNode *expr_node, | 33 | IrInstSrc *union_type, IrInstSrc *field_name, AstNode *expr_node, |
| 34 | LVal lval, ResultLoc *parent_result_loc); | 34 | LVal lval, ResultLoc *parent_result_loc); |
| 35 | static ResultLocCast *ir_build_cast_result_loc(Stage1AstGen *ag, IrInstSrc *dest_type, | 35 | static ResultLocCast *ir_build_cast_result_loc(Stage1AstGen *ag, IrInstSrc *dest_type, |
| ... | @@ -2890,7 +2890,7 @@ static IrInstSrc *ir_mark_gen(IrInstSrc *instruction) { | ... | @@ -2890,7 +2890,7 @@ static IrInstSrc *ir_mark_gen(IrInstSrc *instruction) { |
| 2890 | return instruction; | 2890 | return instruction; |
| 2891 | } | 2891 | } |
| 2892 | | 2892 | |
| 2893 | static bool ir_gen_defers_for_block(Stage1AstGen *ag, Scope *inner_scope, Scope *outer_scope, bool *is_noreturn, IrInstSrc *err_value) { | 2893 | static bool astgen_defers_for_block(Stage1AstGen *ag, Scope *inner_scope, Scope *outer_scope, bool *is_noreturn, IrInstSrc *err_value) { |
| 2894 | Scope *scope = inner_scope; | 2894 | Scope *scope = inner_scope; |
| 2895 | if (is_noreturn != nullptr) *is_noreturn = false; | 2895 | if (is_noreturn != nullptr) *is_noreturn = false; |
| 2896 | while (scope != outer_scope) { | 2896 | while (scope != outer_scope) { |
| ... | @@ -2941,7 +2941,7 @@ static bool ir_gen_defers_for_block(Stage1AstGen *ag, Scope *inner_scope, Scope | ... | @@ -2941,7 +2941,7 @@ static bool ir_gen_defers_for_block(Stage1AstGen *ag, Scope *inner_scope, Scope |
| 2941 | defer_expr_scope = err_var->child_scope; | 2941 | defer_expr_scope = err_var->child_scope; |
| 2942 | } | 2942 | } |
| 2943 | | 2943 | |
| 2944 | IrInstSrc *defer_expr_value = ir_gen_node(ag, defer_expr_node, defer_expr_scope); | 2944 | IrInstSrc *defer_expr_value = astgen_node(ag, defer_expr_node, defer_expr_scope); |
| 2945 | if (defer_expr_value == ag->codegen->invalid_inst_src) | 2945 | if (defer_expr_value == ag->codegen->invalid_inst_src) |
| 2946 | return ag->codegen->invalid_inst_src; | 2946 | return ag->codegen->invalid_inst_src; |
| 2947 | | 2947 | |
| ... | @@ -3011,7 +3011,7 @@ static ScopeDeferExpr *get_scope_defer_expr(Scope *scope) { | ... | @@ -3011,7 +3011,7 @@ static ScopeDeferExpr *get_scope_defer_expr(Scope *scope) { |
| 3011 | return nullptr; | 3011 | return nullptr; |
| 3012 | } | 3012 | } |
| 3013 | | 3013 | |
| 3014 | static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { | 3014 | static IrInstSrc *astgen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { |
| 3015 | assert(node->type == NodeTypeReturnExpr); | 3015 | assert(node->type == NodeTypeReturnExpr); |
| 3016 | | 3016 | |
| 3017 | ScopeDeferExpr *scope_defer_expr = get_scope_defer_expr(scope); | 3017 | ScopeDeferExpr *scope_defer_expr = get_scope_defer_expr(scope); |
| ... | @@ -3038,7 +3038,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3038,7 +3038,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3038 | // Temporarily set this so that if we return a type it gets the name of the function | 3038 | // Temporarily set this so that if we return a type it gets the name of the function |
| 3039 | ZigFn *prev_name_fn = ag->exec->name_fn; | 3039 | ZigFn *prev_name_fn = ag->exec->name_fn; |
| 3040 | ag->exec->name_fn = ag->fn; | 3040 | ag->exec->name_fn = ag->fn; |
| 3041 | return_value = ir_gen_node_extra(ag, expr_node, scope, LValNone, &result_loc_ret->base); | 3041 | return_value = astgen_node_extra(ag, expr_node, scope, LValNone, &result_loc_ret->base); |
| 3042 | ag->exec->name_fn = prev_name_fn; | 3042 | ag->exec->name_fn = prev_name_fn; |
| 3043 | if (return_value == ag->codegen->invalid_inst_src) | 3043 | if (return_value == ag->codegen->invalid_inst_src) |
| 3044 | return ag->codegen->invalid_inst_src; | 3044 | return ag->codegen->invalid_inst_src; |
| ... | @@ -3054,7 +3054,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3054,7 +3054,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3054 | bool have_err_defers = defer_counts[ReturnKindError] > 0; | 3054 | bool have_err_defers = defer_counts[ReturnKindError] > 0; |
| 3055 | if (!have_err_defers && !ag->codegen->have_err_ret_tracing) { | 3055 | if (!have_err_defers && !ag->codegen->have_err_ret_tracing) { |
| 3056 | // only generate unconditional defers | 3056 | // only generate unconditional defers |
| 3057 | if (!ir_gen_defers_for_block(ag, scope, outer_scope, nullptr, nullptr)) | 3057 | if (!astgen_defers_for_block(ag, scope, outer_scope, nullptr, nullptr)) |
| 3058 | return ag->codegen->invalid_inst_src; | 3058 | return ag->codegen->invalid_inst_src; |
| 3059 | IrInstSrc *result = ir_build_return_src(ag, scope, node, nullptr); | 3059 | IrInstSrc *result = ir_build_return_src(ag, scope, node, nullptr); |
| 3060 | result_loc_ret->base.source_instruction = result; | 3060 | result_loc_ret->base.source_instruction = result; |
| ... | @@ -3078,7 +3078,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3078,7 +3078,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3078 | Stage1ZirBasicBlock *ret_stmt_block = ir_create_basic_block(ag, scope, "RetStmt"); | 3078 | Stage1ZirBasicBlock *ret_stmt_block = ir_create_basic_block(ag, scope, "RetStmt"); |
| 3079 | | 3079 | |
| 3080 | ir_set_cursor_at_end_and_append_block(ag, err_block); | 3080 | ir_set_cursor_at_end_and_append_block(ag, err_block); |
| 3081 | if (!ir_gen_defers_for_block(ag, scope, outer_scope, nullptr, return_value)) | 3081 | if (!astgen_defers_for_block(ag, scope, outer_scope, nullptr, return_value)) |
| 3082 | return ag->codegen->invalid_inst_src; | 3082 | return ag->codegen->invalid_inst_src; |
| 3083 | if (ag->codegen->have_err_ret_tracing && !should_inline) { | 3083 | if (ag->codegen->have_err_ret_tracing && !should_inline) { |
| 3084 | ir_build_save_err_ret_addr_src(ag, scope, node); | 3084 | ir_build_save_err_ret_addr_src(ag, scope, node); |
| ... | @@ -3086,7 +3086,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3086,7 +3086,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3086 | ir_build_br(ag, scope, node, ret_stmt_block, is_comptime); | 3086 | ir_build_br(ag, scope, node, ret_stmt_block, is_comptime); |
| 3087 | | 3087 | |
| 3088 | ir_set_cursor_at_end_and_append_block(ag, ok_block); | 3088 | ir_set_cursor_at_end_and_append_block(ag, ok_block); |
| 3089 | if (!ir_gen_defers_for_block(ag, scope, outer_scope, nullptr, nullptr)) | 3089 | if (!astgen_defers_for_block(ag, scope, outer_scope, nullptr, nullptr)) |
| 3090 | return ag->codegen->invalid_inst_src; | 3090 | return ag->codegen->invalid_inst_src; |
| 3091 | ir_build_br(ag, scope, node, ret_stmt_block, is_comptime); | 3091 | ir_build_br(ag, scope, node, ret_stmt_block, is_comptime); |
| 3092 | | 3092 | |
| ... | @@ -3098,7 +3098,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3098,7 +3098,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3098 | case ReturnKindError: | 3098 | case ReturnKindError: |
| 3099 | { | 3099 | { |
| 3100 | assert(expr_node); | 3100 | assert(expr_node); |
| 3101 | IrInstSrc *err_union_ptr = ir_gen_node_extra(ag, expr_node, scope, LValPtr, nullptr); | 3101 | IrInstSrc *err_union_ptr = astgen_node_extra(ag, expr_node, scope, LValPtr, nullptr); |
| 3102 | if (err_union_ptr == ag->codegen->invalid_inst_src) | 3102 | if (err_union_ptr == ag->codegen->invalid_inst_src) |
| 3103 | return ag->codegen->invalid_inst_src; | 3103 | return ag->codegen->invalid_inst_src; |
| 3104 | IrInstSrc *is_err_val = ir_build_test_err_src(ag, scope, node, err_union_ptr, true, false); | 3104 | IrInstSrc *is_err_val = ir_build_test_err_src(ag, scope, node, err_union_ptr, true, false); |
| ... | @@ -3126,7 +3126,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3126,7 +3126,7 @@ static IrInstSrc *ir_gen_return(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3126 | ir_build_end_expr(ag, scope, node, err_val, &result_loc_ret->base); | 3126 | ir_build_end_expr(ag, scope, node, err_val, &result_loc_ret->base); |
| 3127 | | 3127 | |
| 3128 | bool is_noreturn = false; | 3128 | bool is_noreturn = false; |
| 3129 | if (!ir_gen_defers_for_block(ag, scope, outer_scope, &is_noreturn, err_val)) { | 3129 | if (!astgen_defers_for_block(ag, scope, outer_scope, &is_noreturn, err_val)) { |
| 3130 | return ag->codegen->invalid_inst_src; | 3130 | return ag->codegen->invalid_inst_src; |
| 3131 | } | 3131 | } |
| 3132 | if (!is_noreturn) { | 3132 | if (!is_noreturn) { |
| ... | @@ -3260,7 +3260,7 @@ static bool is_duplicate_label(CodeGen *g, Scope *scope, AstNode *node, Buf *nam | ... | @@ -3260,7 +3260,7 @@ static bool is_duplicate_label(CodeGen *g, Scope *scope, AstNode *node, Buf *nam |
| 3260 | return false; | 3260 | return false; |
| 3261 | } | 3261 | } |
| 3262 | | 3262 | |
| 3263 | static IrInstSrc *ir_gen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *block_node, LVal lval, | 3263 | static IrInstSrc *astgen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *block_node, LVal lval, |
| 3264 | ResultLoc *result_loc) | 3264 | ResultLoc *result_loc) |
| 3265 | { | 3265 | { |
| 3266 | assert(block_node->type == NodeTypeBlock); | 3266 | assert(block_node->type == NodeTypeBlock); |
| ... | @@ -3313,7 +3313,7 @@ static IrInstSrc *ir_gen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *b | ... | @@ -3313,7 +3313,7 @@ static IrInstSrc *ir_gen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *b |
| 3313 | for (size_t i = 0; i < block_node->data.block.statements.length; i += 1) { | 3313 | for (size_t i = 0; i < block_node->data.block.statements.length; i += 1) { |
| 3314 | AstNode *statement_node = block_node->data.block.statements.at(i); | 3314 | AstNode *statement_node = block_node->data.block.statements.at(i); |
| 3315 | | 3315 | |
| 3316 | IrInstSrc *statement_value = ir_gen_node(ag, statement_node, child_scope); | 3316 | IrInstSrc *statement_value = astgen_node(ag, statement_node, child_scope); |
| 3317 | if (statement_value == ag->codegen->invalid_inst_src) { | 3317 | if (statement_value == ag->codegen->invalid_inst_src) { |
| 3318 | // keep generating all the elements of the block in case of error, | 3318 | // keep generating all the elements of the block in case of error, |
| 3319 | // we want to collect other compile errors | 3319 | // we want to collect other compile errors |
| ... | @@ -3381,7 +3381,7 @@ static IrInstSrc *ir_gen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *b | ... | @@ -3381,7 +3381,7 @@ static IrInstSrc *ir_gen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *b |
| 3381 | | 3381 | |
| 3382 | bool is_return_from_fn = block_node == ag->main_block_node; | 3382 | bool is_return_from_fn = block_node == ag->main_block_node; |
| 3383 | if (!is_return_from_fn) { | 3383 | if (!is_return_from_fn) { |
| 3384 | if (!ir_gen_defers_for_block(ag, child_scope, outer_block_scope, nullptr, nullptr)) | 3384 | if (!astgen_defers_for_block(ag, child_scope, outer_block_scope, nullptr, nullptr)) |
| 3385 | return ag->codegen->invalid_inst_src; | 3385 | return ag->codegen->invalid_inst_src; |
| 3386 | } | 3386 | } |
| 3387 | | 3387 | |
| ... | @@ -3407,19 +3407,19 @@ static IrInstSrc *ir_gen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *b | ... | @@ -3407,19 +3407,19 @@ static IrInstSrc *ir_gen_block(Stage1AstGen *ag, Scope *parent_scope, AstNode *b |
| 3407 | result_loc_ret->base.id = ResultLocIdReturn; | 3407 | result_loc_ret->base.id = ResultLocIdReturn; |
| 3408 | ir_build_reset_result(ag, parent_scope, block_node, &result_loc_ret->base); | 3408 | ir_build_reset_result(ag, parent_scope, block_node, &result_loc_ret->base); |
| 3409 | ir_mark_gen(ir_build_end_expr(ag, parent_scope, block_node, result, &result_loc_ret->base)); | 3409 | ir_mark_gen(ir_build_end_expr(ag, parent_scope, block_node, result, &result_loc_ret->base)); |
| 3410 | if (!ir_gen_defers_for_block(ag, child_scope, outer_block_scope, nullptr, nullptr)) | 3410 | if (!astgen_defers_for_block(ag, child_scope, outer_block_scope, nullptr, nullptr)) |
| 3411 | return ag->codegen->invalid_inst_src; | 3411 | return ag->codegen->invalid_inst_src; |
| 3412 | return ir_mark_gen(ir_build_return_src(ag, child_scope, result->base.source_node, result)); | 3412 | return ir_mark_gen(ir_build_return_src(ag, child_scope, result->base.source_node, result)); |
| 3413 | } | 3413 | } |
| 3414 | | 3414 | |
| 3415 | static IrInstSrc *ir_gen_bin_op_id(Stage1AstGen *ag, Scope *scope, AstNode *node, IrBinOp op_id) { | 3415 | static IrInstSrc *astgen_bin_op_id(Stage1AstGen *ag, Scope *scope, AstNode *node, IrBinOp op_id) { |
| 3416 | Scope *inner_scope = scope; | 3416 | Scope *inner_scope = scope; |
| 3417 | if (op_id == IrBinOpArrayCat || op_id == IrBinOpArrayMult) { | 3417 | if (op_id == IrBinOpArrayCat || op_id == IrBinOpArrayMult) { |
| 3418 | inner_scope = create_comptime_scope(ag->codegen, node, scope); | 3418 | inner_scope = create_comptime_scope(ag->codegen, node, scope); |
| 3419 | } | 3419 | } |
| 3420 | | 3420 | |
| 3421 | IrInstSrc *op1 = ir_gen_node(ag, node->data.bin_op_expr.op1, inner_scope); | 3421 | IrInstSrc *op1 = astgen_node(ag, node->data.bin_op_expr.op1, inner_scope); |
| 3422 | IrInstSrc *op2 = ir_gen_node(ag, node->data.bin_op_expr.op2, inner_scope); | 3422 | IrInstSrc *op2 = astgen_node(ag, node->data.bin_op_expr.op2, inner_scope); |
| 3423 | | 3423 | |
| 3424 | if (op1 == ag->codegen->invalid_inst_src || op2 == ag->codegen->invalid_inst_src) | 3424 | if (op1 == ag->codegen->invalid_inst_src || op2 == ag->codegen->invalid_inst_src) |
| 3425 | return ag->codegen->invalid_inst_src; | 3425 | return ag->codegen->invalid_inst_src; |
| ... | @@ -3427,9 +3427,9 @@ static IrInstSrc *ir_gen_bin_op_id(Stage1AstGen *ag, Scope *scope, AstNode *node | ... | @@ -3427,9 +3427,9 @@ static IrInstSrc *ir_gen_bin_op_id(Stage1AstGen *ag, Scope *scope, AstNode *node |
| 3427 | return ir_build_bin_op(ag, scope, node, op_id, op1, op2, true); | 3427 | return ir_build_bin_op(ag, scope, node, op_id, op1, op2, true); |
| 3428 | } | 3428 | } |
| 3429 | | 3429 | |
| 3430 | static IrInstSrc *ir_gen_merge_err_sets(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3430 | static IrInstSrc *astgen_merge_err_sets(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3431 | IrInstSrc *op1 = ir_gen_node(ag, node->data.bin_op_expr.op1, scope); | 3431 | IrInstSrc *op1 = astgen_node(ag, node->data.bin_op_expr.op1, scope); |
| 3432 | IrInstSrc *op2 = ir_gen_node(ag, node->data.bin_op_expr.op2, scope); | 3432 | IrInstSrc *op2 = astgen_node(ag, node->data.bin_op_expr.op2, scope); |
| 3433 | | 3433 | |
| 3434 | if (op1 == ag->codegen->invalid_inst_src || op2 == ag->codegen->invalid_inst_src) | 3434 | if (op1 == ag->codegen->invalid_inst_src || op2 == ag->codegen->invalid_inst_src) |
| 3435 | return ag->codegen->invalid_inst_src; | 3435 | return ag->codegen->invalid_inst_src; |
| ... | @@ -3441,8 +3441,8 @@ static IrInstSrc *ir_gen_merge_err_sets(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -3441,8 +3441,8 @@ static IrInstSrc *ir_gen_merge_err_sets(Stage1AstGen *ag, Scope *scope, AstNode |
| 3441 | return ir_build_merge_err_sets(ag, scope, node, op1, op2, type_name); | 3441 | return ir_build_merge_err_sets(ag, scope, node, op1, op2, type_name); |
| 3442 | } | 3442 | } |
| 3443 | | 3443 | |
| 3444 | static IrInstSrc *ir_gen_assign(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3444 | static IrInstSrc *astgen_assign(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3445 | IrInstSrc *lvalue = ir_gen_node_extra(ag, node->data.bin_op_expr.op1, scope, LValAssign, nullptr); | 3445 | IrInstSrc *lvalue = astgen_node_extra(ag, node->data.bin_op_expr.op1, scope, LValAssign, nullptr); |
| 3446 | if (lvalue == ag->codegen->invalid_inst_src) | 3446 | if (lvalue == ag->codegen->invalid_inst_src) |
| 3447 | return ag->codegen->invalid_inst_src; | 3447 | return ag->codegen->invalid_inst_src; |
| 3448 | | 3448 | |
| ... | @@ -3452,7 +3452,7 @@ static IrInstSrc *ir_gen_assign(Stage1AstGen *ag, Scope *scope, AstNode *node) { | ... | @@ -3452,7 +3452,7 @@ static IrInstSrc *ir_gen_assign(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3452 | ir_ref_instruction(lvalue, ag->current_basic_block); | 3452 | ir_ref_instruction(lvalue, ag->current_basic_block); |
| 3453 | ir_build_reset_result(ag, scope, node, &result_loc_inst->base); | 3453 | ir_build_reset_result(ag, scope, node, &result_loc_inst->base); |
| 3454 | | 3454 | |
| 3455 | IrInstSrc *rvalue = ir_gen_node_extra(ag, node->data.bin_op_expr.op2, scope, LValNone, | 3455 | IrInstSrc *rvalue = astgen_node_extra(ag, node->data.bin_op_expr.op2, scope, LValNone, |
| 3456 | &result_loc_inst->base); | 3456 | &result_loc_inst->base); |
| 3457 | if (rvalue == ag->codegen->invalid_inst_src) | 3457 | if (rvalue == ag->codegen->invalid_inst_src) |
| 3458 | return ag->codegen->invalid_inst_src; | 3458 | return ag->codegen->invalid_inst_src; |
| ... | @@ -3460,12 +3460,12 @@ static IrInstSrc *ir_gen_assign(Stage1AstGen *ag, Scope *scope, AstNode *node) { | ... | @@ -3460,12 +3460,12 @@ static IrInstSrc *ir_gen_assign(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3460 | return ir_build_const_void(ag, scope, node); | 3460 | return ir_build_const_void(ag, scope, node); |
| 3461 | } | 3461 | } |
| 3462 | | 3462 | |
| 3463 | static IrInstSrc *ir_gen_assign_op(Stage1AstGen *ag, Scope *scope, AstNode *node, IrBinOp op_id) { | 3463 | static IrInstSrc *astgen_assign_op(Stage1AstGen *ag, Scope *scope, AstNode *node, IrBinOp op_id) { |
| 3464 | IrInstSrc *lvalue = ir_gen_node_extra(ag, node->data.bin_op_expr.op1, scope, LValAssign, nullptr); | 3464 | IrInstSrc *lvalue = astgen_node_extra(ag, node->data.bin_op_expr.op1, scope, LValAssign, nullptr); |
| 3465 | if (lvalue == ag->codegen->invalid_inst_src) | 3465 | if (lvalue == ag->codegen->invalid_inst_src) |
| 3466 | return lvalue; | 3466 | return lvalue; |
| 3467 | IrInstSrc *op1 = ir_build_load_ptr(ag, scope, node->data.bin_op_expr.op1, lvalue); | 3467 | IrInstSrc *op1 = ir_build_load_ptr(ag, scope, node->data.bin_op_expr.op1, lvalue); |
| 3468 | IrInstSrc *op2 = ir_gen_node(ag, node->data.bin_op_expr.op2, scope); | 3468 | IrInstSrc *op2 = astgen_node(ag, node->data.bin_op_expr.op2, scope); |
| 3469 | if (op2 == ag->codegen->invalid_inst_src) | 3469 | if (op2 == ag->codegen->invalid_inst_src) |
| 3470 | return op2; | 3470 | return op2; |
| 3471 | IrInstSrc *result = ir_build_bin_op(ag, scope, node, op_id, op1, op2, true); | 3471 | IrInstSrc *result = ir_build_bin_op(ag, scope, node, op_id, op1, op2, true); |
| ... | @@ -3473,10 +3473,10 @@ static IrInstSrc *ir_gen_assign_op(Stage1AstGen *ag, Scope *scope, AstNode *node | ... | @@ -3473,10 +3473,10 @@ static IrInstSrc *ir_gen_assign_op(Stage1AstGen *ag, Scope *scope, AstNode *node |
| 3473 | return ir_build_const_void(ag, scope, node); | 3473 | return ir_build_const_void(ag, scope, node); |
| 3474 | } | 3474 | } |
| 3475 | | 3475 | |
| 3476 | static IrInstSrc *ir_gen_bool_or(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3476 | static IrInstSrc *astgen_bool_or(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3477 | assert(node->type == NodeTypeBinOpExpr); | 3477 | assert(node->type == NodeTypeBinOpExpr); |
| 3478 | | 3478 | |
| 3479 | IrInstSrc *val1 = ir_gen_node(ag, node->data.bin_op_expr.op1, scope); | 3479 | IrInstSrc *val1 = astgen_node(ag, node->data.bin_op_expr.op1, scope); |
| 3480 | if (val1 == ag->codegen->invalid_inst_src) | 3480 | if (val1 == ag->codegen->invalid_inst_src) |
| 3481 | return ag->codegen->invalid_inst_src; | 3481 | return ag->codegen->invalid_inst_src; |
| 3482 | Stage1ZirBasicBlock *post_val1_block = ag->current_basic_block; | 3482 | Stage1ZirBasicBlock *post_val1_block = ag->current_basic_block; |
| ... | @@ -3496,7 +3496,7 @@ static IrInstSrc *ir_gen_bool_or(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -3496,7 +3496,7 @@ static IrInstSrc *ir_gen_bool_or(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 3496 | ir_build_cond_br(ag, scope, node, val1, true_block, false_block, is_comptime); | 3496 | ir_build_cond_br(ag, scope, node, val1, true_block, false_block, is_comptime); |
| 3497 | | 3497 | |
| 3498 | ir_set_cursor_at_end_and_append_block(ag, false_block); | 3498 | ir_set_cursor_at_end_and_append_block(ag, false_block); |
| 3499 | IrInstSrc *val2 = ir_gen_node(ag, node->data.bin_op_expr.op2, scope); | 3499 | IrInstSrc *val2 = astgen_node(ag, node->data.bin_op_expr.op2, scope); |
| 3500 | if (val2 == ag->codegen->invalid_inst_src) | 3500 | if (val2 == ag->codegen->invalid_inst_src) |
| 3501 | return ag->codegen->invalid_inst_src; | 3501 | return ag->codegen->invalid_inst_src; |
| 3502 | Stage1ZirBasicBlock *post_val2_block = ag->current_basic_block; | 3502 | Stage1ZirBasicBlock *post_val2_block = ag->current_basic_block; |
| ... | @@ -3515,10 +3515,10 @@ static IrInstSrc *ir_gen_bool_or(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -3515,10 +3515,10 @@ static IrInstSrc *ir_gen_bool_or(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 3515 | return ir_build_phi(ag, scope, node, 2, incoming_blocks, incoming_values, nullptr); | 3515 | return ir_build_phi(ag, scope, node, 2, incoming_blocks, incoming_values, nullptr); |
| 3516 | } | 3516 | } |
| 3517 | | 3517 | |
| 3518 | static IrInstSrc *ir_gen_bool_and(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3518 | static IrInstSrc *astgen_bool_and(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3519 | assert(node->type == NodeTypeBinOpExpr); | 3519 | assert(node->type == NodeTypeBinOpExpr); |
| 3520 | | 3520 | |
| 3521 | IrInstSrc *val1 = ir_gen_node(ag, node->data.bin_op_expr.op1, scope); | 3521 | IrInstSrc *val1 = astgen_node(ag, node->data.bin_op_expr.op1, scope); |
| 3522 | if (val1 == ag->codegen->invalid_inst_src) | 3522 | if (val1 == ag->codegen->invalid_inst_src) |
| 3523 | return ag->codegen->invalid_inst_src; | 3523 | return ag->codegen->invalid_inst_src; |
| 3524 | Stage1ZirBasicBlock *post_val1_block = ag->current_basic_block; | 3524 | Stage1ZirBasicBlock *post_val1_block = ag->current_basic_block; |
| ... | @@ -3538,7 +3538,7 @@ static IrInstSrc *ir_gen_bool_and(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -3538,7 +3538,7 @@ static IrInstSrc *ir_gen_bool_and(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 3538 | ir_build_cond_br(ag, scope, node, val1, true_block, false_block, is_comptime); | 3538 | ir_build_cond_br(ag, scope, node, val1, true_block, false_block, is_comptime); |
| 3539 | | 3539 | |
| 3540 | ir_set_cursor_at_end_and_append_block(ag, true_block); | 3540 | ir_set_cursor_at_end_and_append_block(ag, true_block); |
| 3541 | IrInstSrc *val2 = ir_gen_node(ag, node->data.bin_op_expr.op2, scope); | 3541 | IrInstSrc *val2 = astgen_node(ag, node->data.bin_op_expr.op2, scope); |
| 3542 | if (val2 == ag->codegen->invalid_inst_src) | 3542 | if (val2 == ag->codegen->invalid_inst_src) |
| 3543 | return ag->codegen->invalid_inst_src; | 3543 | return ag->codegen->invalid_inst_src; |
| 3544 | Stage1ZirBasicBlock *post_val2_block = ag->current_basic_block; | 3544 | Stage1ZirBasicBlock *post_val2_block = ag->current_basic_block; |
| ... | @@ -3591,7 +3591,7 @@ static ResultLocPeerParent *ir_build_binary_result_peers(Stage1AstGen *ag, IrIns | ... | @@ -3591,7 +3591,7 @@ static ResultLocPeerParent *ir_build_binary_result_peers(Stage1AstGen *ag, IrIns |
| 3591 | return peer_parent; | 3591 | return peer_parent; |
| 3592 | } | 3592 | } |
| 3593 | | 3593 | |
| 3594 | static IrInstSrc *ir_gen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval, | 3594 | static IrInstSrc *astgen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval, |
| 3595 | ResultLoc *result_loc) | 3595 | ResultLoc *result_loc) |
| 3596 | { | 3596 | { |
| 3597 | assert(node->type == NodeTypeBinOpExpr); | 3597 | assert(node->type == NodeTypeBinOpExpr); |
| ... | @@ -3599,7 +3599,7 @@ static IrInstSrc *ir_gen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode * | ... | @@ -3599,7 +3599,7 @@ static IrInstSrc *ir_gen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode * |
| 3599 | AstNode *op1_node = node->data.bin_op_expr.op1; | 3599 | AstNode *op1_node = node->data.bin_op_expr.op1; |
| 3600 | AstNode *op2_node = node->data.bin_op_expr.op2; | 3600 | AstNode *op2_node = node->data.bin_op_expr.op2; |
| 3601 | | 3601 | |
| 3602 | IrInstSrc *maybe_ptr = ir_gen_node_extra(ag, op1_node, parent_scope, LValPtr, nullptr); | 3602 | IrInstSrc *maybe_ptr = astgen_node_extra(ag, op1_node, parent_scope, LValPtr, nullptr); |
| 3603 | if (maybe_ptr == ag->codegen->invalid_inst_src) | 3603 | if (maybe_ptr == ag->codegen->invalid_inst_src) |
| 3604 | return ag->codegen->invalid_inst_src; | 3604 | return ag->codegen->invalid_inst_src; |
| 3605 | | 3605 | |
| ... | @@ -3622,7 +3622,7 @@ static IrInstSrc *ir_gen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode * | ... | @@ -3622,7 +3622,7 @@ static IrInstSrc *ir_gen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode * |
| 3622 | result_loc, is_comptime); | 3622 | result_loc, is_comptime); |
| 3623 | | 3623 | |
| 3624 | ir_set_cursor_at_end_and_append_block(ag, null_block); | 3624 | ir_set_cursor_at_end_and_append_block(ag, null_block); |
| 3625 | IrInstSrc *null_result = ir_gen_node_extra(ag, op2_node, parent_scope, LValNone, | 3625 | IrInstSrc *null_result = astgen_node_extra(ag, op2_node, parent_scope, LValNone, |
| 3626 | &peer_parent->peers.at(0)->base); | 3626 | &peer_parent->peers.at(0)->base); |
| 3627 | if (null_result == ag->codegen->invalid_inst_src) | 3627 | if (null_result == ag->codegen->invalid_inst_src) |
| 3628 | return ag->codegen->invalid_inst_src; | 3628 | return ag->codegen->invalid_inst_src; |
| ... | @@ -3648,24 +3648,24 @@ static IrInstSrc *ir_gen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode * | ... | @@ -3648,24 +3648,24 @@ static IrInstSrc *ir_gen_orelse(Stage1AstGen *ag, Scope *parent_scope, AstNode * |
| 3648 | return ir_lval_wrap(ag, parent_scope, phi, lval, result_loc); | 3648 | return ir_lval_wrap(ag, parent_scope, phi, lval, result_loc); |
| 3649 | } | 3649 | } |
| 3650 | | 3650 | |
| 3651 | static IrInstSrc *ir_gen_error_union(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { | 3651 | static IrInstSrc *astgen_error_union(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { |
| 3652 | assert(node->type == NodeTypeBinOpExpr); | 3652 | assert(node->type == NodeTypeBinOpExpr); |
| 3653 | | 3653 | |
| 3654 | AstNode *op1_node = node->data.bin_op_expr.op1; | 3654 | AstNode *op1_node = node->data.bin_op_expr.op1; |
| 3655 | AstNode *op2_node = node->data.bin_op_expr.op2; | 3655 | AstNode *op2_node = node->data.bin_op_expr.op2; |
| 3656 | | 3656 | |
| 3657 | IrInstSrc *err_set = ir_gen_node(ag, op1_node, parent_scope); | 3657 | IrInstSrc *err_set = astgen_node(ag, op1_node, parent_scope); |
| 3658 | if (err_set == ag->codegen->invalid_inst_src) | 3658 | if (err_set == ag->codegen->invalid_inst_src) |
| 3659 | return ag->codegen->invalid_inst_src; | 3659 | return ag->codegen->invalid_inst_src; |
| 3660 | | 3660 | |
| 3661 | IrInstSrc *payload = ir_gen_node(ag, op2_node, parent_scope); | 3661 | IrInstSrc *payload = astgen_node(ag, op2_node, parent_scope); |
| 3662 | if (payload == ag->codegen->invalid_inst_src) | 3662 | if (payload == ag->codegen->invalid_inst_src) |
| 3663 | return ag->codegen->invalid_inst_src; | 3663 | return ag->codegen->invalid_inst_src; |
| 3664 | | 3664 | |
| 3665 | return ir_build_error_union(ag, parent_scope, node, err_set, payload); | 3665 | return ir_build_error_union(ag, parent_scope, node, err_set, payload); |
| 3666 | } | 3666 | } |
| 3667 | | 3667 | |
| 3668 | static IrInstSrc *ir_gen_bin_op(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { | 3668 | static IrInstSrc *astgen_bin_op(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { |
| 3669 | assert(node->type == NodeTypeBinOpExpr); | 3669 | assert(node->type == NodeTypeBinOpExpr); |
| 3670 | | 3670 | |
| 3671 | BinOpType bin_op_type = node->data.bin_op_expr.bin_op; | 3671 | BinOpType bin_op_type = node->data.bin_op_expr.bin_op; |
| ... | @@ -3673,90 +3673,90 @@ static IrInstSrc *ir_gen_bin_op(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3673,90 +3673,90 @@ static IrInstSrc *ir_gen_bin_op(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3673 | case BinOpTypeInvalid: | 3673 | case BinOpTypeInvalid: |
| 3674 | zig_unreachable(); | 3674 | zig_unreachable(); |
| 3675 | case BinOpTypeAssign: | 3675 | case BinOpTypeAssign: |
| 3676 | return ir_lval_wrap(ag, scope, ir_gen_assign(ag, scope, node), lval, result_loc); | 3676 | return ir_lval_wrap(ag, scope, astgen_assign(ag, scope, node), lval, result_loc); |
| 3677 | case BinOpTypeAssignTimes: | 3677 | case BinOpTypeAssignTimes: |
| 3678 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpMult), lval, result_loc); | 3678 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpMult), lval, result_loc); |
| 3679 | case BinOpTypeAssignTimesWrap: | 3679 | case BinOpTypeAssignTimesWrap: |
| 3680 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpMultWrap), lval, result_loc); | 3680 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpMultWrap), lval, result_loc); |
| 3681 | case BinOpTypeAssignDiv: | 3681 | case BinOpTypeAssignDiv: |
| 3682 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpDivUnspecified), lval, result_loc); | 3682 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpDivUnspecified), lval, result_loc); |
| 3683 | case BinOpTypeAssignMod: | 3683 | case BinOpTypeAssignMod: |
| 3684 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpRemUnspecified), lval, result_loc); | 3684 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpRemUnspecified), lval, result_loc); |
| 3685 | case BinOpTypeAssignPlus: | 3685 | case BinOpTypeAssignPlus: |
| 3686 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpAdd), lval, result_loc); | 3686 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpAdd), lval, result_loc); |
| 3687 | case BinOpTypeAssignPlusWrap: | 3687 | case BinOpTypeAssignPlusWrap: |
| 3688 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpAddWrap), lval, result_loc); | 3688 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpAddWrap), lval, result_loc); |
| 3689 | case BinOpTypeAssignMinus: | 3689 | case BinOpTypeAssignMinus: |
| 3690 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpSub), lval, result_loc); | 3690 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpSub), lval, result_loc); |
| 3691 | case BinOpTypeAssignMinusWrap: | 3691 | case BinOpTypeAssignMinusWrap: |
| 3692 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpSubWrap), lval, result_loc); | 3692 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpSubWrap), lval, result_loc); |
| 3693 | case BinOpTypeAssignBitShiftLeft: | 3693 | case BinOpTypeAssignBitShiftLeft: |
| 3694 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpBitShiftLeftLossy), lval, result_loc); | 3694 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpBitShiftLeftLossy), lval, result_loc); |
| 3695 | case BinOpTypeAssignBitShiftRight: | 3695 | case BinOpTypeAssignBitShiftRight: |
| 3696 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpBitShiftRightLossy), lval, result_loc); | 3696 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpBitShiftRightLossy), lval, result_loc); |
| 3697 | case BinOpTypeAssignBitAnd: | 3697 | case BinOpTypeAssignBitAnd: |
| 3698 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpBinAnd), lval, result_loc); | 3698 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpBinAnd), lval, result_loc); |
| 3699 | case BinOpTypeAssignBitXor: | 3699 | case BinOpTypeAssignBitXor: |
| 3700 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpBinXor), lval, result_loc); | 3700 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpBinXor), lval, result_loc); |
| 3701 | case BinOpTypeAssignBitOr: | 3701 | case BinOpTypeAssignBitOr: |
| 3702 | return ir_lval_wrap(ag, scope, ir_gen_assign_op(ag, scope, node, IrBinOpBinOr), lval, result_loc); | 3702 | return ir_lval_wrap(ag, scope, astgen_assign_op(ag, scope, node, IrBinOpBinOr), lval, result_loc); |
| 3703 | case BinOpTypeBoolOr: | 3703 | case BinOpTypeBoolOr: |
| 3704 | return ir_lval_wrap(ag, scope, ir_gen_bool_or(ag, scope, node), lval, result_loc); | 3704 | return ir_lval_wrap(ag, scope, astgen_bool_or(ag, scope, node), lval, result_loc); |
| 3705 | case BinOpTypeBoolAnd: | 3705 | case BinOpTypeBoolAnd: |
| 3706 | return ir_lval_wrap(ag, scope, ir_gen_bool_and(ag, scope, node), lval, result_loc); | 3706 | return ir_lval_wrap(ag, scope, astgen_bool_and(ag, scope, node), lval, result_loc); |
| 3707 | case BinOpTypeCmpEq: | 3707 | case BinOpTypeCmpEq: |
| 3708 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpCmpEq), lval, result_loc); | 3708 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpCmpEq), lval, result_loc); |
| 3709 | case BinOpTypeCmpNotEq: | 3709 | case BinOpTypeCmpNotEq: |
| 3710 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpCmpNotEq), lval, result_loc); | 3710 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpCmpNotEq), lval, result_loc); |
| 3711 | case BinOpTypeCmpLessThan: | 3711 | case BinOpTypeCmpLessThan: |
| 3712 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpCmpLessThan), lval, result_loc); | 3712 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpCmpLessThan), lval, result_loc); |
| 3713 | case BinOpTypeCmpGreaterThan: | 3713 | case BinOpTypeCmpGreaterThan: |
| 3714 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpCmpGreaterThan), lval, result_loc); | 3714 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpCmpGreaterThan), lval, result_loc); |
| 3715 | case BinOpTypeCmpLessOrEq: | 3715 | case BinOpTypeCmpLessOrEq: |
| 3716 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpCmpLessOrEq), lval, result_loc); | 3716 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpCmpLessOrEq), lval, result_loc); |
| 3717 | case BinOpTypeCmpGreaterOrEq: | 3717 | case BinOpTypeCmpGreaterOrEq: |
| 3718 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpCmpGreaterOrEq), lval, result_loc); | 3718 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpCmpGreaterOrEq), lval, result_loc); |
| 3719 | case BinOpTypeBinOr: | 3719 | case BinOpTypeBinOr: |
| 3720 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpBinOr), lval, result_loc); | 3720 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpBinOr), lval, result_loc); |
| 3721 | case BinOpTypeBinXor: | 3721 | case BinOpTypeBinXor: |
| 3722 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpBinXor), lval, result_loc); | 3722 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpBinXor), lval, result_loc); |
| 3723 | case BinOpTypeBinAnd: | 3723 | case BinOpTypeBinAnd: |
| 3724 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpBinAnd), lval, result_loc); | 3724 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpBinAnd), lval, result_loc); |
| 3725 | case BinOpTypeBitShiftLeft: | 3725 | case BinOpTypeBitShiftLeft: |
| 3726 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpBitShiftLeftLossy), lval, result_loc); | 3726 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpBitShiftLeftLossy), lval, result_loc); |
| 3727 | case BinOpTypeBitShiftRight: | 3727 | case BinOpTypeBitShiftRight: |
| 3728 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpBitShiftRightLossy), lval, result_loc); | 3728 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpBitShiftRightLossy), lval, result_loc); |
| 3729 | case BinOpTypeAdd: | 3729 | case BinOpTypeAdd: |
| 3730 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpAdd), lval, result_loc); | 3730 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpAdd), lval, result_loc); |
| 3731 | case BinOpTypeAddWrap: | 3731 | case BinOpTypeAddWrap: |
| 3732 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpAddWrap), lval, result_loc); | 3732 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpAddWrap), lval, result_loc); |
| 3733 | case BinOpTypeSub: | 3733 | case BinOpTypeSub: |
| 3734 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpSub), lval, result_loc); | 3734 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpSub), lval, result_loc); |
| 3735 | case BinOpTypeSubWrap: | 3735 | case BinOpTypeSubWrap: |
| 3736 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpSubWrap), lval, result_loc); | 3736 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpSubWrap), lval, result_loc); |
| 3737 | case BinOpTypeMult: | 3737 | case BinOpTypeMult: |
| 3738 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpMult), lval, result_loc); | 3738 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpMult), lval, result_loc); |
| 3739 | case BinOpTypeMultWrap: | 3739 | case BinOpTypeMultWrap: |
| 3740 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpMultWrap), lval, result_loc); | 3740 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpMultWrap), lval, result_loc); |
| 3741 | case BinOpTypeDiv: | 3741 | case BinOpTypeDiv: |
| 3742 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpDivUnspecified), lval, result_loc); | 3742 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpDivUnspecified), lval, result_loc); |
| 3743 | case BinOpTypeMod: | 3743 | case BinOpTypeMod: |
| 3744 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpRemUnspecified), lval, result_loc); | 3744 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpRemUnspecified), lval, result_loc); |
| 3745 | case BinOpTypeArrayCat: | 3745 | case BinOpTypeArrayCat: |
| 3746 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpArrayCat), lval, result_loc); | 3746 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpArrayCat), lval, result_loc); |
| 3747 | case BinOpTypeArrayMult: | 3747 | case BinOpTypeArrayMult: |
| 3748 | return ir_lval_wrap(ag, scope, ir_gen_bin_op_id(ag, scope, node, IrBinOpArrayMult), lval, result_loc); | 3748 | return ir_lval_wrap(ag, scope, astgen_bin_op_id(ag, scope, node, IrBinOpArrayMult), lval, result_loc); |
| 3749 | case BinOpTypeMergeErrorSets: | 3749 | case BinOpTypeMergeErrorSets: |
| 3750 | return ir_lval_wrap(ag, scope, ir_gen_merge_err_sets(ag, scope, node), lval, result_loc); | 3750 | return ir_lval_wrap(ag, scope, astgen_merge_err_sets(ag, scope, node), lval, result_loc); |
| 3751 | case BinOpTypeUnwrapOptional: | 3751 | case BinOpTypeUnwrapOptional: |
| 3752 | return ir_gen_orelse(ag, scope, node, lval, result_loc); | 3752 | return astgen_orelse(ag, scope, node, lval, result_loc); |
| 3753 | case BinOpTypeErrorUnion: | 3753 | case BinOpTypeErrorUnion: |
| 3754 | return ir_lval_wrap(ag, scope, ir_gen_error_union(ag, scope, node), lval, result_loc); | 3754 | return ir_lval_wrap(ag, scope, astgen_error_union(ag, scope, node), lval, result_loc); |
| 3755 | } | 3755 | } |
| 3756 | zig_unreachable(); | 3756 | zig_unreachable(); |
| 3757 | } | 3757 | } |
| 3758 | | 3758 | |
| 3759 | static IrInstSrc *ir_gen_int_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3759 | static IrInstSrc *astgen_int_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3760 | assert(node->type == NodeTypeIntLiteral); | 3760 | assert(node->type == NodeTypeIntLiteral); |
| 3761 | | 3761 | |
| 3762 | RootStruct *root_struct = node->owner->data.structure.root_struct; | 3762 | RootStruct *root_struct = node->owner->data.structure.root_struct; |
| ... | @@ -3765,7 +3765,7 @@ static IrInstSrc *ir_gen_int_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -3765,7 +3765,7 @@ static IrInstSrc *ir_gen_int_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 3765 | return ir_build_const_bigint(ag, scope, node, bigint); | 3765 | return ir_build_const_bigint(ag, scope, node, bigint); |
| 3766 | } | 3766 | } |
| 3767 | | 3767 | |
| 3768 | static IrInstSrc *ir_gen_float_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3768 | static IrInstSrc *astgen_float_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3769 | Error err; | 3769 | Error err; |
| 3770 | assert(node->type == NodeTypeFloatLiteral); | 3770 | assert(node->type == NodeTypeFloatLiteral); |
| 3771 | | 3771 | |
| ... | @@ -3782,7 +3782,7 @@ static IrInstSrc *ir_gen_float_lit(Stage1AstGen *ag, Scope *scope, AstNode *node | ... | @@ -3782,7 +3782,7 @@ static IrInstSrc *ir_gen_float_lit(Stage1AstGen *ag, Scope *scope, AstNode *node |
| 3782 | return ir_build_const_bigfloat(ag, scope, node, bigfloat); | 3782 | return ir_build_const_bigfloat(ag, scope, node, bigfloat); |
| 3783 | } | 3783 | } |
| 3784 | | 3784 | |
| 3785 | static IrInstSrc *ir_gen_char_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3785 | static IrInstSrc *astgen_char_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3786 | Error err; | 3786 | Error err; |
| 3787 | assert(node->type == NodeTypeCharLiteral); | 3787 | assert(node->type == NodeTypeCharLiteral); |
| 3788 | | 3788 | |
| ... | @@ -3802,13 +3802,15 @@ static IrInstSrc *ir_gen_char_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -3802,13 +3802,15 @@ static IrInstSrc *ir_gen_char_lit(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 3802 | return ir_build_const_uint(ag, scope, node, codepoint); | 3802 | return ir_build_const_uint(ag, scope, node, codepoint); |
| 3803 | } | 3803 | } |
| 3804 | | 3804 | |
| 3805 | static IrInstSrc *ir_gen_null_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3805 | static IrInstSrc *astgen_null_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3806 | assert(node->type == NodeTypeNullLiteral); | 3806 | assert(node->type == NodeTypeNullLiteral); |
| 3807 | | 3807 | |
| 3808 | return ir_build_const_null(ag, scope, node); | 3808 | return ir_build_const_null(ag, scope, node); |
| 3809 | } | 3809 | } |
| 3810 | | 3810 | |
| 3811 | static IrInstSrc *ir_gen_symbol(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { | 3811 | static IrInstSrc *astgen_identifier(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| | 3812 | ResultLoc *result_loc) |
| | 3813 | { |
| 3812 | Error err; | 3814 | Error err; |
| 3813 | assert(node->type == NodeTypeIdentifier); | 3815 | assert(node->type == NodeTypeIdentifier); |
| 3814 | | 3816 | |
| ... | @@ -3877,13 +3879,13 @@ static IrInstSrc *ir_gen_symbol(Stage1AstGen *ag, Scope *scope, AstNode *node, L | ... | @@ -3877,13 +3879,13 @@ static IrInstSrc *ir_gen_symbol(Stage1AstGen *ag, Scope *scope, AstNode *node, L |
| 3877 | return ir_build_undeclared_identifier(ag, scope, node, variable_name); | 3879 | return ir_build_undeclared_identifier(ag, scope, node, variable_name); |
| 3878 | } | 3880 | } |
| 3879 | | 3881 | |
| 3880 | static IrInstSrc *ir_gen_array_access(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 3882 | static IrInstSrc *astgen_array_access(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 3881 | ResultLoc *result_loc) | 3883 | ResultLoc *result_loc) |
| 3882 | { | 3884 | { |
| 3883 | assert(node->type == NodeTypeArrayAccessExpr); | 3885 | assert(node->type == NodeTypeArrayAccessExpr); |
| 3884 | | 3886 | |
| 3885 | AstNode *array_ref_node = node->data.array_access_expr.array_ref_expr; | 3887 | AstNode *array_ref_node = node->data.array_access_expr.array_ref_expr; |
| 3886 | IrInstSrc *array_ref_instruction = ir_gen_node_extra(ag, array_ref_node, scope, LValPtr, nullptr); | 3888 | IrInstSrc *array_ref_instruction = astgen_node_extra(ag, array_ref_node, scope, LValPtr, nullptr); |
| 3887 | if (array_ref_instruction == ag->codegen->invalid_inst_src) | 3889 | if (array_ref_instruction == ag->codegen->invalid_inst_src) |
| 3888 | return array_ref_instruction; | 3890 | return array_ref_instruction; |
| 3889 | | 3891 | |
| ... | @@ -3894,7 +3896,7 @@ static IrInstSrc *ir_gen_array_access(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -3894,7 +3896,7 @@ static IrInstSrc *ir_gen_array_access(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 3894 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, usize_type_inst, no_result_loc()); | 3896 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, usize_type_inst, no_result_loc()); |
| 3895 | | 3897 | |
| 3896 | AstNode *subscript_node = node->data.array_access_expr.subscript; | 3898 | AstNode *subscript_node = node->data.array_access_expr.subscript; |
| 3897 | IrInstSrc *subscript_value = ir_gen_node_extra(ag, subscript_node, scope, LValNone, &result_loc_cast->base); | 3899 | IrInstSrc *subscript_value = astgen_node_extra(ag, subscript_node, scope, LValNone, &result_loc_cast->base); |
| 3898 | if (subscript_value == ag->codegen->invalid_inst_src) | 3900 | if (subscript_value == ag->codegen->invalid_inst_src) |
| 3899 | return ag->codegen->invalid_inst_src; | 3901 | return ag->codegen->invalid_inst_src; |
| 3900 | | 3902 | |
| ... | @@ -3909,20 +3911,20 @@ static IrInstSrc *ir_gen_array_access(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -3909,20 +3911,20 @@ static IrInstSrc *ir_gen_array_access(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 3909 | return ir_expr_wrap(ag, scope, load_ptr, result_loc); | 3911 | return ir_expr_wrap(ag, scope, load_ptr, result_loc); |
| 3910 | } | 3912 | } |
| 3911 | | 3913 | |
| 3912 | static IrInstSrc *ir_gen_field_access(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3914 | static IrInstSrc *astgen_field_access(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3913 | assert(node->type == NodeTypeFieldAccessExpr); | 3915 | assert(node->type == NodeTypeFieldAccessExpr); |
| 3914 | | 3916 | |
| 3915 | AstNode *container_ref_node = node->data.field_access_expr.struct_expr; | 3917 | AstNode *container_ref_node = node->data.field_access_expr.struct_expr; |
| 3916 | Buf *field_name = node->data.field_access_expr.field_name; | 3918 | Buf *field_name = node->data.field_access_expr.field_name; |
| 3917 | | 3919 | |
| 3918 | IrInstSrc *container_ref_instruction = ir_gen_node_extra(ag, container_ref_node, scope, LValPtr, nullptr); | 3920 | IrInstSrc *container_ref_instruction = astgen_node_extra(ag, container_ref_node, scope, LValPtr, nullptr); |
| 3919 | if (container_ref_instruction == ag->codegen->invalid_inst_src) | 3921 | if (container_ref_instruction == ag->codegen->invalid_inst_src) |
| 3920 | return container_ref_instruction; | 3922 | return container_ref_instruction; |
| 3921 | | 3923 | |
| 3922 | return ir_build_field_ptr(ag, scope, node, container_ref_instruction, field_name, false); | 3924 | return ir_build_field_ptr(ag, scope, node, container_ref_instruction, field_name, false); |
| 3923 | } | 3925 | } |
| 3924 | | 3926 | |
| 3925 | static IrInstSrc *ir_gen_overflow_op(Stage1AstGen *ag, Scope *scope, AstNode *node, IrOverflowOp op) { | 3927 | static IrInstSrc *astgen_overflow_op(Stage1AstGen *ag, Scope *scope, AstNode *node, IrOverflowOp op) { |
| 3926 | assert(node->type == NodeTypeFnCallExpr); | 3928 | assert(node->type == NodeTypeFnCallExpr); |
| 3927 | | 3929 | |
| 3928 | AstNode *type_node = node->data.fn_call_expr.params.at(0); | 3930 | AstNode *type_node = node->data.fn_call_expr.params.at(0); |
| ... | @@ -3931,26 +3933,26 @@ static IrInstSrc *ir_gen_overflow_op(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -3931,26 +3933,26 @@ static IrInstSrc *ir_gen_overflow_op(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 3931 | AstNode *result_ptr_node = node->data.fn_call_expr.params.at(3); | 3933 | AstNode *result_ptr_node = node->data.fn_call_expr.params.at(3); |
| 3932 | | 3934 | |
| 3933 | | 3935 | |
| 3934 | IrInstSrc *type_value = ir_gen_node(ag, type_node, scope); | 3936 | IrInstSrc *type_value = astgen_node(ag, type_node, scope); |
| 3935 | if (type_value == ag->codegen->invalid_inst_src) | 3937 | if (type_value == ag->codegen->invalid_inst_src) |
| 3936 | return ag->codegen->invalid_inst_src; | 3938 | return ag->codegen->invalid_inst_src; |
| 3937 | | 3939 | |
| 3938 | IrInstSrc *op1 = ir_gen_node(ag, op1_node, scope); | 3940 | IrInstSrc *op1 = astgen_node(ag, op1_node, scope); |
| 3939 | if (op1 == ag->codegen->invalid_inst_src) | 3941 | if (op1 == ag->codegen->invalid_inst_src) |
| 3940 | return ag->codegen->invalid_inst_src; | 3942 | return ag->codegen->invalid_inst_src; |
| 3941 | | 3943 | |
| 3942 | IrInstSrc *op2 = ir_gen_node(ag, op2_node, scope); | 3944 | IrInstSrc *op2 = astgen_node(ag, op2_node, scope); |
| 3943 | if (op2 == ag->codegen->invalid_inst_src) | 3945 | if (op2 == ag->codegen->invalid_inst_src) |
| 3944 | return ag->codegen->invalid_inst_src; | 3946 | return ag->codegen->invalid_inst_src; |
| 3945 | | 3947 | |
| 3946 | IrInstSrc *result_ptr = ir_gen_node(ag, result_ptr_node, scope); | 3948 | IrInstSrc *result_ptr = astgen_node(ag, result_ptr_node, scope); |
| 3947 | if (result_ptr == ag->codegen->invalid_inst_src) | 3949 | if (result_ptr == ag->codegen->invalid_inst_src) |
| 3948 | return ag->codegen->invalid_inst_src; | 3950 | return ag->codegen->invalid_inst_src; |
| 3949 | | 3951 | |
| 3950 | return ir_build_overflow_op_src(ag, scope, node, op, type_value, op1, op2, result_ptr); | 3952 | return ir_build_overflow_op_src(ag, scope, node, op, type_value, op1, op2, result_ptr); |
| 3951 | } | 3953 | } |
| 3952 | | 3954 | |
| 3953 | static IrInstSrc *ir_gen_mul_add(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 3955 | static IrInstSrc *astgen_mul_add(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 3954 | assert(node->type == NodeTypeFnCallExpr); | 3956 | assert(node->type == NodeTypeFnCallExpr); |
| 3955 | | 3957 | |
| 3956 | AstNode *type_node = node->data.fn_call_expr.params.at(0); | 3958 | AstNode *type_node = node->data.fn_call_expr.params.at(0); |
| ... | @@ -3958,26 +3960,26 @@ static IrInstSrc *ir_gen_mul_add(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -3958,26 +3960,26 @@ static IrInstSrc *ir_gen_mul_add(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 3958 | AstNode *op2_node = node->data.fn_call_expr.params.at(2); | 3960 | AstNode *op2_node = node->data.fn_call_expr.params.at(2); |
| 3959 | AstNode *op3_node = node->data.fn_call_expr.params.at(3); | 3961 | AstNode *op3_node = node->data.fn_call_expr.params.at(3); |
| 3960 | | 3962 | |
| 3961 | IrInstSrc *type_value = ir_gen_node(ag, type_node, scope); | 3963 | IrInstSrc *type_value = astgen_node(ag, type_node, scope); |
| 3962 | if (type_value == ag->codegen->invalid_inst_src) | 3964 | if (type_value == ag->codegen->invalid_inst_src) |
| 3963 | return ag->codegen->invalid_inst_src; | 3965 | return ag->codegen->invalid_inst_src; |
| 3964 | | 3966 | |
| 3965 | IrInstSrc *op1 = ir_gen_node(ag, op1_node, scope); | 3967 | IrInstSrc *op1 = astgen_node(ag, op1_node, scope); |
| 3966 | if (op1 == ag->codegen->invalid_inst_src) | 3968 | if (op1 == ag->codegen->invalid_inst_src) |
| 3967 | return ag->codegen->invalid_inst_src; | 3969 | return ag->codegen->invalid_inst_src; |
| 3968 | | 3970 | |
| 3969 | IrInstSrc *op2 = ir_gen_node(ag, op2_node, scope); | 3971 | IrInstSrc *op2 = astgen_node(ag, op2_node, scope); |
| 3970 | if (op2 == ag->codegen->invalid_inst_src) | 3972 | if (op2 == ag->codegen->invalid_inst_src) |
| 3971 | return ag->codegen->invalid_inst_src; | 3973 | return ag->codegen->invalid_inst_src; |
| 3972 | | 3974 | |
| 3973 | IrInstSrc *op3 = ir_gen_node(ag, op3_node, scope); | 3975 | IrInstSrc *op3 = astgen_node(ag, op3_node, scope); |
| 3974 | if (op3 == ag->codegen->invalid_inst_src) | 3976 | if (op3 == ag->codegen->invalid_inst_src) |
| 3975 | return ag->codegen->invalid_inst_src; | 3977 | return ag->codegen->invalid_inst_src; |
| 3976 | | 3978 | |
| 3977 | return ir_build_mul_add_src(ag, scope, node, type_value, op1, op2, op3); | 3979 | return ir_build_mul_add_src(ag, scope, node, type_value, op1, op2, op3); |
| 3978 | } | 3980 | } |
| 3979 | | 3981 | |
| 3980 | static IrInstSrc *ir_gen_this(Stage1AstGen *ag, Scope *orig_scope, AstNode *node) { | 3982 | static IrInstSrc *astgen_this(Stage1AstGen *ag, Scope *orig_scope, AstNode *node) { |
| 3981 | for (Scope *it_scope = orig_scope; it_scope != nullptr; it_scope = it_scope->parent) { | 3983 | for (Scope *it_scope = orig_scope; it_scope != nullptr; it_scope = it_scope->parent) { |
| 3982 | if (it_scope->id == ScopeIdDecls) { | 3984 | if (it_scope->id == ScopeIdDecls) { |
| 3983 | ScopeDecls *decls_scope = (ScopeDecls *)it_scope; | 3985 | ScopeDecls *decls_scope = (ScopeDecls *)it_scope; |
| ... | @@ -3992,7 +3994,7 @@ static IrInstSrc *ir_gen_this(Stage1AstGen *ag, Scope *orig_scope, AstNode *node | ... | @@ -3992,7 +3994,7 @@ static IrInstSrc *ir_gen_this(Stage1AstGen *ag, Scope *orig_scope, AstNode *node |
| 3992 | zig_unreachable(); | 3994 | zig_unreachable(); |
| 3993 | } | 3995 | } |
| 3994 | | 3996 | |
| 3995 | static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *await_node, AstNode *call_node, | 3997 | static IrInstSrc *astgen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *await_node, AstNode *call_node, |
| 3996 | LVal lval, ResultLoc *result_loc) | 3998 | LVal lval, ResultLoc *result_loc) |
| 3997 | { | 3999 | { |
| 3998 | if (call_node->data.fn_call_expr.params.length != 4) { | 4000 | if (call_node->data.fn_call_expr.params.length != 4) { |
| ... | @@ -4003,17 +4005,17 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa | ... | @@ -4003,17 +4005,17 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa |
| 4003 | } | 4005 | } |
| 4004 | | 4006 | |
| 4005 | AstNode *bytes_node = call_node->data.fn_call_expr.params.at(0); | 4007 | AstNode *bytes_node = call_node->data.fn_call_expr.params.at(0); |
| 4006 | IrInstSrc *bytes = ir_gen_node(ag, bytes_node, scope); | 4008 | IrInstSrc *bytes = astgen_node(ag, bytes_node, scope); |
| 4007 | if (bytes == ag->codegen->invalid_inst_src) | 4009 | if (bytes == ag->codegen->invalid_inst_src) |
| 4008 | return bytes; | 4010 | return bytes; |
| 4009 | | 4011 | |
| 4010 | AstNode *ret_ptr_node = call_node->data.fn_call_expr.params.at(1); | 4012 | AstNode *ret_ptr_node = call_node->data.fn_call_expr.params.at(1); |
| 4011 | IrInstSrc *ret_ptr = ir_gen_node(ag, ret_ptr_node, scope); | 4013 | IrInstSrc *ret_ptr = astgen_node(ag, ret_ptr_node, scope); |
| 4012 | if (ret_ptr == ag->codegen->invalid_inst_src) | 4014 | if (ret_ptr == ag->codegen->invalid_inst_src) |
| 4013 | return ret_ptr; | 4015 | return ret_ptr; |
| 4014 | | 4016 | |
| 4015 | AstNode *fn_ref_node = call_node->data.fn_call_expr.params.at(2); | 4017 | AstNode *fn_ref_node = call_node->data.fn_call_expr.params.at(2); |
| 4016 | IrInstSrc *fn_ref = ir_gen_node(ag, fn_ref_node, scope); | 4018 | IrInstSrc *fn_ref = astgen_node(ag, fn_ref_node, scope); |
| 4017 | if (fn_ref == ag->codegen->invalid_inst_src) | 4019 | if (fn_ref == ag->codegen->invalid_inst_src) |
| 4018 | return fn_ref; | 4020 | return fn_ref; |
| 4019 | | 4021 | |
| ... | @@ -4028,7 +4030,7 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa | ... | @@ -4028,7 +4030,7 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa |
| 4028 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(arg_count); | 4030 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(arg_count); |
| 4029 | for (size_t i = 0; i < arg_count; i += 1) { | 4031 | for (size_t i = 0; i < arg_count; i += 1) { |
| 4030 | AstNode *arg_node = args_node->data.container_init_expr.entries.at(i); | 4032 | AstNode *arg_node = args_node->data.container_init_expr.entries.at(i); |
| 4031 | IrInstSrc *arg = ir_gen_node(ag, arg_node, scope); | 4033 | IrInstSrc *arg = astgen_node(ag, arg_node, scope); |
| 4032 | if (arg == ag->codegen->invalid_inst_src) | 4034 | if (arg == ag->codegen->invalid_inst_src) |
| 4033 | return arg; | 4035 | return arg; |
| 4034 | args[i] = arg; | 4036 | args[i] = arg; |
| ... | @@ -4043,7 +4045,7 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa | ... | @@ -4043,7 +4045,7 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa |
| 4043 | return ag->codegen->invalid_inst_src; | 4045 | return ag->codegen->invalid_inst_src; |
| 4044 | } | 4046 | } |
| 4045 | } | 4047 | } |
| 4046 | IrInstSrc *args = ir_gen_node(ag, args_node, scope); | 4048 | IrInstSrc *args = astgen_node(ag, args_node, scope); |
| 4047 | if (args == ag->codegen->invalid_inst_src) | 4049 | if (args == ag->codegen->invalid_inst_src) |
| 4048 | return args; | 4050 | return args; |
| 4049 | | 4051 | |
| ... | @@ -4051,11 +4053,11 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa | ... | @@ -4051,11 +4053,11 @@ static IrInstSrc *ir_gen_async_call(Stage1AstGen *ag, Scope *scope, AstNode *awa |
| 4051 | return ir_lval_wrap(ag, scope, call, lval, result_loc); | 4053 | return ir_lval_wrap(ag, scope, call, lval, result_loc); |
| 4052 | } | 4054 | } |
| 4053 | | 4055 | |
| 4054 | static IrInstSrc *ir_gen_fn_call_with_args(Stage1AstGen *ag, Scope *scope, AstNode *source_node, | 4056 | static IrInstSrc *astgen_fn_call_with_args(Stage1AstGen *ag, Scope *scope, AstNode *source_node, |
| 4055 | AstNode *fn_ref_node, CallModifier modifier, IrInstSrc *options, | 4057 | AstNode *fn_ref_node, CallModifier modifier, IrInstSrc *options, |
| 4056 | AstNode **args_ptr, size_t args_len, LVal lval, ResultLoc *result_loc) | 4058 | AstNode **args_ptr, size_t args_len, LVal lval, ResultLoc *result_loc) |
| 4057 | { | 4059 | { |
| 4058 | IrInstSrc *fn_ref = ir_gen_node(ag, fn_ref_node, scope); | 4060 | IrInstSrc *fn_ref = astgen_node(ag, fn_ref_node, scope); |
| 4059 | if (fn_ref == ag->codegen->invalid_inst_src) | 4061 | if (fn_ref == ag->codegen->invalid_inst_src) |
| 4060 | return fn_ref; | 4062 | return fn_ref; |
| 4061 | | 4063 | |
| ... | @@ -4071,7 +4073,7 @@ static IrInstSrc *ir_gen_fn_call_with_args(Stage1AstGen *ag, Scope *scope, AstNo | ... | @@ -4071,7 +4073,7 @@ static IrInstSrc *ir_gen_fn_call_with_args(Stage1AstGen *ag, Scope *scope, AstNo |
| 4071 | ir_build_reset_result(ag, scope, source_node, no_result); | 4073 | ir_build_reset_result(ag, scope, source_node, no_result); |
| 4072 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, arg_type, no_result); | 4074 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, arg_type, no_result); |
| 4073 | | 4075 | |
| 4074 | IrInstSrc *arg = ir_gen_node_extra(ag, arg_node, scope, LValNone, &result_loc_cast->base); | 4076 | IrInstSrc *arg = astgen_node_extra(ag, arg_node, scope, LValNone, &result_loc_cast->base); |
| 4075 | if (arg == ag->codegen->invalid_inst_src) | 4077 | if (arg == ag->codegen->invalid_inst_src) |
| 4076 | return arg; | 4078 | return arg; |
| 4077 | | 4079 | |
| ... | @@ -4088,7 +4090,7 @@ static IrInstSrc *ir_gen_fn_call_with_args(Stage1AstGen *ag, Scope *scope, AstNo | ... | @@ -4088,7 +4090,7 @@ static IrInstSrc *ir_gen_fn_call_with_args(Stage1AstGen *ag, Scope *scope, AstNo |
| 4088 | return ir_lval_wrap(ag, scope, fn_call, lval, result_loc); | 4090 | return ir_lval_wrap(ag, scope, fn_call, lval, result_loc); |
| 4089 | } | 4091 | } |
| 4090 | | 4092 | |
| 4091 | static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 4093 | static IrInstSrc *astgen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 4092 | ResultLoc *result_loc) | 4094 | ResultLoc *result_loc) |
| 4093 | { | 4095 | { |
| 4094 | assert(node->type == NodeTypeFnCallExpr); | 4096 | assert(node->type == NodeTypeFnCallExpr); |
| ... | @@ -4130,7 +4132,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4130,7 +4132,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4130 | return ag->codegen->invalid_inst_src; | 4132 | return ag->codegen->invalid_inst_src; |
| 4131 | } else if (arg_count == 1) { | 4133 | } else if (arg_count == 1) { |
| 4132 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4134 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4133 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, sub_scope); | 4135 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, sub_scope); |
| 4134 | if (arg0_value == ag->codegen->invalid_inst_src) | 4136 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4135 | return arg0_value; | 4137 | return arg0_value; |
| 4136 | | 4138 | |
| ... | @@ -4139,7 +4141,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4139,7 +4141,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4139 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(arg_count); | 4141 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(arg_count); |
| 4140 | for (size_t i = 0; i < arg_count; i += 1) { | 4142 | for (size_t i = 0; i < arg_count; i += 1) { |
| 4141 | AstNode *arg_node = node->data.fn_call_expr.params.at(i); | 4143 | AstNode *arg_node = node->data.fn_call_expr.params.at(i); |
| 4142 | IrInstSrc *arg = ir_gen_node(ag, arg_node, sub_scope); | 4144 | IrInstSrc *arg = astgen_node(ag, arg_node, sub_scope); |
| 4143 | if (arg == ag->codegen->invalid_inst_src) | 4145 | if (arg == ag->codegen->invalid_inst_src) |
| 4144 | return ag->codegen->invalid_inst_src; | 4146 | return ag->codegen->invalid_inst_src; |
| 4145 | args[i] = arg; | 4147 | args[i] = arg; |
| ... | @@ -4152,7 +4154,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4152,7 +4154,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4152 | case BuiltinFnIdSetCold: | 4154 | case BuiltinFnIdSetCold: |
| 4153 | { | 4155 | { |
| 4154 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4156 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4155 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4157 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4156 | if (arg0_value == ag->codegen->invalid_inst_src) | 4158 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4157 | return arg0_value; | 4159 | return arg0_value; |
| 4158 | | 4160 | |
| ... | @@ -4162,7 +4164,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4162,7 +4164,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4162 | case BuiltinFnIdSetRuntimeSafety: | 4164 | case BuiltinFnIdSetRuntimeSafety: |
| 4163 | { | 4165 | { |
| 4164 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4166 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4165 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4167 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4166 | if (arg0_value == ag->codegen->invalid_inst_src) | 4168 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4167 | return arg0_value; | 4169 | return arg0_value; |
| 4168 | | 4170 | |
| ... | @@ -4172,7 +4174,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4172,7 +4174,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4172 | case BuiltinFnIdSetFloatMode: | 4174 | case BuiltinFnIdSetFloatMode: |
| 4173 | { | 4175 | { |
| 4174 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4176 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4175 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4177 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4176 | if (arg0_value == ag->codegen->invalid_inst_src) | 4178 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4177 | return arg0_value; | 4179 | return arg0_value; |
| 4178 | | 4180 | |
| ... | @@ -4183,7 +4185,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4183,7 +4185,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4183 | case BuiltinFnIdBitSizeof: | 4185 | case BuiltinFnIdBitSizeof: |
| 4184 | { | 4186 | { |
| 4185 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4187 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4186 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4188 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4187 | if (arg0_value == ag->codegen->invalid_inst_src) | 4189 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4188 | return arg0_value; | 4190 | return arg0_value; |
| 4189 | | 4191 | |
| ... | @@ -4193,7 +4195,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4193,7 +4195,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4193 | case BuiltinFnIdImport: | 4195 | case BuiltinFnIdImport: |
| 4194 | { | 4196 | { |
| 4195 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4197 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4196 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4198 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4197 | if (arg0_value == ag->codegen->invalid_inst_src) | 4199 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4198 | return arg0_value; | 4200 | return arg0_value; |
| 4199 | | 4201 | |
| ... | @@ -4208,7 +4210,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4208,7 +4210,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4208 | case BuiltinFnIdCInclude: | 4210 | case BuiltinFnIdCInclude: |
| 4209 | { | 4211 | { |
| 4210 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4212 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4211 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4213 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4212 | if (arg0_value == ag->codegen->invalid_inst_src) | 4214 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4213 | return arg0_value; | 4215 | return arg0_value; |
| 4214 | | 4216 | |
| ... | @@ -4223,12 +4225,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4223,12 +4225,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4223 | case BuiltinFnIdCDefine: | 4225 | case BuiltinFnIdCDefine: |
| 4224 | { | 4226 | { |
| 4225 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4227 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4226 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4228 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4227 | if (arg0_value == ag->codegen->invalid_inst_src) | 4229 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4228 | return arg0_value; | 4230 | return arg0_value; |
| 4229 | | 4231 | |
| 4230 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4232 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4231 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4233 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4232 | if (arg1_value == ag->codegen->invalid_inst_src) | 4234 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4233 | return arg1_value; | 4235 | return arg1_value; |
| 4234 | | 4236 | |
| ... | @@ -4243,7 +4245,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4243,7 +4245,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4243 | case BuiltinFnIdCUndef: | 4245 | case BuiltinFnIdCUndef: |
| 4244 | { | 4246 | { |
| 4245 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4247 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4246 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4248 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4247 | if (arg0_value == ag->codegen->invalid_inst_src) | 4249 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4248 | return arg0_value; | 4250 | return arg0_value; |
| 4249 | | 4251 | |
| ... | @@ -4258,7 +4260,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4258,7 +4260,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4258 | case BuiltinFnIdCompileErr: | 4260 | case BuiltinFnIdCompileErr: |
| 4259 | { | 4261 | { |
| 4260 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4262 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4261 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4263 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4262 | if (arg0_value == ag->codegen->invalid_inst_src) | 4264 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4263 | return arg0_value; | 4265 | return arg0_value; |
| 4264 | | 4266 | |
| ... | @@ -4271,7 +4273,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4271,7 +4273,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4271 | | 4273 | |
| 4272 | for (size_t i = 0; i < actual_param_count; i += 1) { | 4274 | for (size_t i = 0; i < actual_param_count; i += 1) { |
| 4273 | AstNode *arg_node = node->data.fn_call_expr.params.at(i); | 4275 | AstNode *arg_node = node->data.fn_call_expr.params.at(i); |
| 4274 | args[i] = ir_gen_node(ag, arg_node, scope); | 4276 | args[i] = astgen_node(ag, arg_node, scope); |
| 4275 | if (args[i] == ag->codegen->invalid_inst_src) | 4277 | if (args[i] == ag->codegen->invalid_inst_src) |
| 4276 | return ag->codegen->invalid_inst_src; | 4278 | return ag->codegen->invalid_inst_src; |
| 4277 | } | 4279 | } |
| ... | @@ -4282,7 +4284,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4282,7 +4284,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4282 | case BuiltinFnIdErrName: | 4284 | case BuiltinFnIdErrName: |
| 4283 | { | 4285 | { |
| 4284 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4286 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4285 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4287 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4286 | if (arg0_value == ag->codegen->invalid_inst_src) | 4288 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4287 | return arg0_value; | 4289 | return arg0_value; |
| 4288 | | 4290 | |
| ... | @@ -4292,7 +4294,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4292,7 +4294,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4292 | case BuiltinFnIdEmbedFile: | 4294 | case BuiltinFnIdEmbedFile: |
| 4293 | { | 4295 | { |
| 4294 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4296 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4295 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4297 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4296 | if (arg0_value == ag->codegen->invalid_inst_src) | 4298 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4297 | return arg0_value; | 4299 | return arg0_value; |
| 4298 | | 4300 | |
| ... | @@ -4303,32 +4305,32 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4303,32 +4305,32 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4303 | case BuiltinFnIdCmpxchgStrong: | 4305 | case BuiltinFnIdCmpxchgStrong: |
| 4304 | { | 4306 | { |
| 4305 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4307 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4306 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4308 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4307 | if (arg0_value == ag->codegen->invalid_inst_src) | 4309 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4308 | return arg0_value; | 4310 | return arg0_value; |
| 4309 | | 4311 | |
| 4310 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4312 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4311 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4313 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4312 | if (arg1_value == ag->codegen->invalid_inst_src) | 4314 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4313 | return arg1_value; | 4315 | return arg1_value; |
| 4314 | | 4316 | |
| 4315 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 4317 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 4316 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 4318 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 4317 | if (arg2_value == ag->codegen->invalid_inst_src) | 4319 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 4318 | return arg2_value; | 4320 | return arg2_value; |
| 4319 | | 4321 | |
| 4320 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); | 4322 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); |
| 4321 | IrInstSrc *arg3_value = ir_gen_node(ag, arg3_node, scope); | 4323 | IrInstSrc *arg3_value = astgen_node(ag, arg3_node, scope); |
| 4322 | if (arg3_value == ag->codegen->invalid_inst_src) | 4324 | if (arg3_value == ag->codegen->invalid_inst_src) |
| 4323 | return arg3_value; | 4325 | return arg3_value; |
| 4324 | | 4326 | |
| 4325 | AstNode *arg4_node = node->data.fn_call_expr.params.at(4); | 4327 | AstNode *arg4_node = node->data.fn_call_expr.params.at(4); |
| 4326 | IrInstSrc *arg4_value = ir_gen_node(ag, arg4_node, scope); | 4328 | IrInstSrc *arg4_value = astgen_node(ag, arg4_node, scope); |
| 4327 | if (arg4_value == ag->codegen->invalid_inst_src) | 4329 | if (arg4_value == ag->codegen->invalid_inst_src) |
| 4328 | return arg4_value; | 4330 | return arg4_value; |
| 4329 | | 4331 | |
| 4330 | AstNode *arg5_node = node->data.fn_call_expr.params.at(5); | 4332 | AstNode *arg5_node = node->data.fn_call_expr.params.at(5); |
| 4331 | IrInstSrc *arg5_value = ir_gen_node(ag, arg5_node, scope); | 4333 | IrInstSrc *arg5_value = astgen_node(ag, arg5_node, scope); |
| 4332 | if (arg5_value == ag->codegen->invalid_inst_src) | 4334 | if (arg5_value == ag->codegen->invalid_inst_src) |
| 4333 | return arg5_value; | 4335 | return arg5_value; |
| 4334 | | 4336 | |
| ... | @@ -4340,7 +4342,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4340,7 +4342,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4340 | case BuiltinFnIdFence: | 4342 | case BuiltinFnIdFence: |
| 4341 | { | 4343 | { |
| 4342 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4344 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4343 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4345 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4344 | if (arg0_value == ag->codegen->invalid_inst_src) | 4346 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4345 | return arg0_value; | 4347 | return arg0_value; |
| 4346 | | 4348 | |
| ... | @@ -4350,12 +4352,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4350,12 +4352,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4350 | case BuiltinFnIdReduce: | 4352 | case BuiltinFnIdReduce: |
| 4351 | { | 4353 | { |
| 4352 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4354 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4353 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4355 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4354 | if (arg0_value == ag->codegen->invalid_inst_src) | 4356 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4355 | return arg0_value; | 4357 | return arg0_value; |
| 4356 | | 4358 | |
| 4357 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4359 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4358 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4360 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4359 | if (arg1_value == ag->codegen->invalid_inst_src) | 4361 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4360 | return arg1_value; | 4362 | return arg1_value; |
| 4361 | | 4363 | |
| ... | @@ -4365,12 +4367,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4365,12 +4367,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4365 | case BuiltinFnIdDivExact: | 4367 | case BuiltinFnIdDivExact: |
| 4366 | { | 4368 | { |
| 4367 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4369 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4368 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4370 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4369 | if (arg0_value == ag->codegen->invalid_inst_src) | 4371 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4370 | return arg0_value; | 4372 | return arg0_value; |
| 4371 | | 4373 | |
| 4372 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4374 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4373 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4375 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4374 | if (arg1_value == ag->codegen->invalid_inst_src) | 4376 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4375 | return arg1_value; | 4377 | return arg1_value; |
| 4376 | | 4378 | |
| ... | @@ -4380,12 +4382,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4380,12 +4382,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4380 | case BuiltinFnIdDivTrunc: | 4382 | case BuiltinFnIdDivTrunc: |
| 4381 | { | 4383 | { |
| 4382 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4384 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4383 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4385 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4384 | if (arg0_value == ag->codegen->invalid_inst_src) | 4386 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4385 | return arg0_value; | 4387 | return arg0_value; |
| 4386 | | 4388 | |
| 4387 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4389 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4388 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4390 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4389 | if (arg1_value == ag->codegen->invalid_inst_src) | 4391 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4390 | return arg1_value; | 4392 | return arg1_value; |
| 4391 | | 4393 | |
| ... | @@ -4395,12 +4397,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4395,12 +4397,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4395 | case BuiltinFnIdDivFloor: | 4397 | case BuiltinFnIdDivFloor: |
| 4396 | { | 4398 | { |
| 4397 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4399 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4398 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4400 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4399 | if (arg0_value == ag->codegen->invalid_inst_src) | 4401 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4400 | return arg0_value; | 4402 | return arg0_value; |
| 4401 | | 4403 | |
| 4402 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4404 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4403 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4405 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4404 | if (arg1_value == ag->codegen->invalid_inst_src) | 4406 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4405 | return arg1_value; | 4407 | return arg1_value; |
| 4406 | | 4408 | |
| ... | @@ -4410,12 +4412,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4410,12 +4412,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4410 | case BuiltinFnIdRem: | 4412 | case BuiltinFnIdRem: |
| 4411 | { | 4413 | { |
| 4412 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4414 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4413 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4415 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4414 | if (arg0_value == ag->codegen->invalid_inst_src) | 4416 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4415 | return arg0_value; | 4417 | return arg0_value; |
| 4416 | | 4418 | |
| 4417 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4419 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4418 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4420 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4419 | if (arg1_value == ag->codegen->invalid_inst_src) | 4421 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4420 | return arg1_value; | 4422 | return arg1_value; |
| 4421 | | 4423 | |
| ... | @@ -4425,12 +4427,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4425,12 +4427,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4425 | case BuiltinFnIdMod: | 4427 | case BuiltinFnIdMod: |
| 4426 | { | 4428 | { |
| 4427 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4429 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4428 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4430 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4429 | if (arg0_value == ag->codegen->invalid_inst_src) | 4431 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4430 | return arg0_value; | 4432 | return arg0_value; |
| 4431 | | 4433 | |
| 4432 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4434 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4433 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4435 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4434 | if (arg1_value == ag->codegen->invalid_inst_src) | 4436 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4435 | return arg1_value; | 4437 | return arg1_value; |
| 4436 | | 4438 | |
| ... | @@ -4453,7 +4455,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4453,7 +4455,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4453 | case BuiltinFnIdRound: | 4455 | case BuiltinFnIdRound: |
| 4454 | { | 4456 | { |
| 4455 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4457 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4456 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4458 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4457 | if (arg0_value == ag->codegen->invalid_inst_src) | 4459 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4458 | return arg0_value; | 4460 | return arg0_value; |
| 4459 | | 4461 | |
| ... | @@ -4463,12 +4465,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4463,12 +4465,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4463 | case BuiltinFnIdTruncate: | 4465 | case BuiltinFnIdTruncate: |
| 4464 | { | 4466 | { |
| 4465 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4467 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4466 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4468 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4467 | if (arg0_value == ag->codegen->invalid_inst_src) | 4469 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4468 | return arg0_value; | 4470 | return arg0_value; |
| 4469 | | 4471 | |
| 4470 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4472 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4471 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4473 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4472 | if (arg1_value == ag->codegen->invalid_inst_src) | 4474 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4473 | return arg1_value; | 4475 | return arg1_value; |
| 4474 | | 4476 | |
| ... | @@ -4478,12 +4480,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4478,12 +4480,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4478 | case BuiltinFnIdIntCast: | 4480 | case BuiltinFnIdIntCast: |
| 4479 | { | 4481 | { |
| 4480 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4482 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4481 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4483 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4482 | if (arg0_value == ag->codegen->invalid_inst_src) | 4484 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4483 | return arg0_value; | 4485 | return arg0_value; |
| 4484 | | 4486 | |
| 4485 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4487 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4486 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4488 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4487 | if (arg1_value == ag->codegen->invalid_inst_src) | 4489 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4488 | return arg1_value; | 4490 | return arg1_value; |
| 4489 | | 4491 | |
| ... | @@ -4493,12 +4495,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4493,12 +4495,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4493 | case BuiltinFnIdFloatCast: | 4495 | case BuiltinFnIdFloatCast: |
| 4494 | { | 4496 | { |
| 4495 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4497 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4496 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4498 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4497 | if (arg0_value == ag->codegen->invalid_inst_src) | 4499 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4498 | return arg0_value; | 4500 | return arg0_value; |
| 4499 | | 4501 | |
| 4500 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4502 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4501 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4503 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4502 | if (arg1_value == ag->codegen->invalid_inst_src) | 4504 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4503 | return arg1_value; | 4505 | return arg1_value; |
| 4504 | | 4506 | |
| ... | @@ -4508,12 +4510,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4508,12 +4510,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4508 | case BuiltinFnIdErrSetCast: | 4510 | case BuiltinFnIdErrSetCast: |
| 4509 | { | 4511 | { |
| 4510 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4512 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4511 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4513 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4512 | if (arg0_value == ag->codegen->invalid_inst_src) | 4514 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4513 | return arg0_value; | 4515 | return arg0_value; |
| 4514 | | 4516 | |
| 4515 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4517 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4516 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4518 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4517 | if (arg1_value == ag->codegen->invalid_inst_src) | 4519 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4518 | return arg1_value; | 4520 | return arg1_value; |
| 4519 | | 4521 | |
| ... | @@ -4523,12 +4525,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4523,12 +4525,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4523 | case BuiltinFnIdIntToFloat: | 4525 | case BuiltinFnIdIntToFloat: |
| 4524 | { | 4526 | { |
| 4525 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4527 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4526 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4528 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4527 | if (arg0_value == ag->codegen->invalid_inst_src) | 4529 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4528 | return arg0_value; | 4530 | return arg0_value; |
| 4529 | | 4531 | |
| 4530 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4532 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4531 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4533 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4532 | if (arg1_value == ag->codegen->invalid_inst_src) | 4534 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4533 | return arg1_value; | 4535 | return arg1_value; |
| 4534 | | 4536 | |
| ... | @@ -4538,12 +4540,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4538,12 +4540,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4538 | case BuiltinFnIdFloatToInt: | 4540 | case BuiltinFnIdFloatToInt: |
| 4539 | { | 4541 | { |
| 4540 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4542 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4541 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4543 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4542 | if (arg0_value == ag->codegen->invalid_inst_src) | 4544 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4543 | return arg0_value; | 4545 | return arg0_value; |
| 4544 | | 4546 | |
| 4545 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4547 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4546 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4548 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4547 | if (arg1_value == ag->codegen->invalid_inst_src) | 4549 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4548 | return arg1_value; | 4550 | return arg1_value; |
| 4549 | | 4551 | |
| ... | @@ -4553,7 +4555,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4553,7 +4555,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4553 | case BuiltinFnIdErrToInt: | 4555 | case BuiltinFnIdErrToInt: |
| 4554 | { | 4556 | { |
| 4555 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4557 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4556 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4558 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4557 | if (arg0_value == ag->codegen->invalid_inst_src) | 4559 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4558 | return arg0_value; | 4560 | return arg0_value; |
| 4559 | | 4561 | |
| ... | @@ -4563,7 +4565,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4563,7 +4565,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4563 | case BuiltinFnIdIntToErr: | 4565 | case BuiltinFnIdIntToErr: |
| 4564 | { | 4566 | { |
| 4565 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4567 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4566 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4568 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4567 | if (arg0_value == ag->codegen->invalid_inst_src) | 4569 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4568 | return arg0_value; | 4570 | return arg0_value; |
| 4569 | | 4571 | |
| ... | @@ -4573,7 +4575,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4573,7 +4575,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4573 | case BuiltinFnIdBoolToInt: | 4575 | case BuiltinFnIdBoolToInt: |
| 4574 | { | 4576 | { |
| 4575 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4577 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4576 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4578 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4577 | if (arg0_value == ag->codegen->invalid_inst_src) | 4579 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4578 | return arg0_value; | 4580 | return arg0_value; |
| 4579 | | 4581 | |
| ... | @@ -4583,12 +4585,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4583,12 +4585,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4583 | case BuiltinFnIdVectorType: | 4585 | case BuiltinFnIdVectorType: |
| 4584 | { | 4586 | { |
| 4585 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4587 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4586 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4588 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4587 | if (arg0_value == ag->codegen->invalid_inst_src) | 4589 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4588 | return arg0_value; | 4590 | return arg0_value; |
| 4589 | | 4591 | |
| 4590 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4592 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4591 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4593 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4592 | if (arg1_value == ag->codegen->invalid_inst_src) | 4594 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4593 | return arg1_value; | 4595 | return arg1_value; |
| 4594 | | 4596 | |
| ... | @@ -4598,22 +4600,22 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4598,22 +4600,22 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4598 | case BuiltinFnIdShuffle: | 4600 | case BuiltinFnIdShuffle: |
| 4599 | { | 4601 | { |
| 4600 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4602 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4601 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4603 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4602 | if (arg0_value == ag->codegen->invalid_inst_src) | 4604 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4603 | return arg0_value; | 4605 | return arg0_value; |
| 4604 | | 4606 | |
| 4605 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4607 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4606 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4608 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4607 | if (arg1_value == ag->codegen->invalid_inst_src) | 4609 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4608 | return arg1_value; | 4610 | return arg1_value; |
| 4609 | | 4611 | |
| 4610 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 4612 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 4611 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 4613 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 4612 | if (arg2_value == ag->codegen->invalid_inst_src) | 4614 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 4613 | return arg2_value; | 4615 | return arg2_value; |
| 4614 | | 4616 | |
| 4615 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); | 4617 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); |
| 4616 | IrInstSrc *arg3_value = ir_gen_node(ag, arg3_node, scope); | 4618 | IrInstSrc *arg3_value = astgen_node(ag, arg3_node, scope); |
| 4617 | if (arg3_value == ag->codegen->invalid_inst_src) | 4619 | if (arg3_value == ag->codegen->invalid_inst_src) |
| 4618 | return arg3_value; | 4620 | return arg3_value; |
| 4619 | | 4621 | |
| ... | @@ -4624,12 +4626,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4624,12 +4626,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4624 | case BuiltinFnIdSplat: | 4626 | case BuiltinFnIdSplat: |
| 4625 | { | 4627 | { |
| 4626 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4628 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4627 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4629 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4628 | if (arg0_value == ag->codegen->invalid_inst_src) | 4630 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4629 | return arg0_value; | 4631 | return arg0_value; |
| 4630 | | 4632 | |
| 4631 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4633 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4632 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4634 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4633 | if (arg1_value == ag->codegen->invalid_inst_src) | 4635 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4634 | return arg1_value; | 4636 | return arg1_value; |
| 4635 | | 4637 | |
| ... | @@ -4640,17 +4642,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4640,17 +4642,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4640 | case BuiltinFnIdMemcpy: | 4642 | case BuiltinFnIdMemcpy: |
| 4641 | { | 4643 | { |
| 4642 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4644 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4643 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4645 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4644 | if (arg0_value == ag->codegen->invalid_inst_src) | 4646 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4645 | return arg0_value; | 4647 | return arg0_value; |
| 4646 | | 4648 | |
| 4647 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4649 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4648 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4650 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4649 | if (arg1_value == ag->codegen->invalid_inst_src) | 4651 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4650 | return arg1_value; | 4652 | return arg1_value; |
| 4651 | | 4653 | |
| 4652 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 4654 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 4653 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 4655 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 4654 | if (arg2_value == ag->codegen->invalid_inst_src) | 4656 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 4655 | return arg2_value; | 4657 | return arg2_value; |
| 4656 | | 4658 | |
| ... | @@ -4660,17 +4662,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4660,17 +4662,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4660 | case BuiltinFnIdMemset: | 4662 | case BuiltinFnIdMemset: |
| 4661 | { | 4663 | { |
| 4662 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4664 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4663 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4665 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4664 | if (arg0_value == ag->codegen->invalid_inst_src) | 4666 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4665 | return arg0_value; | 4667 | return arg0_value; |
| 4666 | | 4668 | |
| 4667 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4669 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4668 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4670 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4669 | if (arg1_value == ag->codegen->invalid_inst_src) | 4671 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4670 | return arg1_value; | 4672 | return arg1_value; |
| 4671 | | 4673 | |
| 4672 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 4674 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 4673 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 4675 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 4674 | if (arg2_value == ag->codegen->invalid_inst_src) | 4676 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 4675 | return arg2_value; | 4677 | return arg2_value; |
| 4676 | | 4678 | |
| ... | @@ -4680,7 +4682,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4680,7 +4682,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4680 | case BuiltinFnIdWasmMemorySize: | 4682 | case BuiltinFnIdWasmMemorySize: |
| 4681 | { | 4683 | { |
| 4682 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4684 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4683 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4685 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4684 | if (arg0_value == ag->codegen->invalid_inst_src) | 4686 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4685 | return arg0_value; | 4687 | return arg0_value; |
| 4686 | | 4688 | |
| ... | @@ -4690,12 +4692,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4690,12 +4692,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4690 | case BuiltinFnIdWasmMemoryGrow: | 4692 | case BuiltinFnIdWasmMemoryGrow: |
| 4691 | { | 4693 | { |
| 4692 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4694 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4693 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4695 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4694 | if (arg0_value == ag->codegen->invalid_inst_src) | 4696 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4695 | return arg0_value; | 4697 | return arg0_value; |
| 4696 | | 4698 | |
| 4697 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4699 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4698 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4700 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4699 | if (arg1_value == ag->codegen->invalid_inst_src) | 4701 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4700 | return arg1_value; | 4702 | return arg1_value; |
| 4701 | | 4703 | |
| ... | @@ -4705,12 +4707,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4705,12 +4707,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4705 | case BuiltinFnIdField: | 4707 | case BuiltinFnIdField: |
| 4706 | { | 4708 | { |
| 4707 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4709 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4708 | IrInstSrc *arg0_value = ir_gen_node_extra(ag, arg0_node, scope, LValPtr, nullptr); | 4710 | IrInstSrc *arg0_value = astgen_node_extra(ag, arg0_node, scope, LValPtr, nullptr); |
| 4709 | if (arg0_value == ag->codegen->invalid_inst_src) | 4711 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4710 | return arg0_value; | 4712 | return arg0_value; |
| 4711 | | 4713 | |
| 4712 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4714 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4713 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4715 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4714 | if (arg1_value == ag->codegen->invalid_inst_src) | 4716 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4715 | return arg1_value; | 4717 | return arg1_value; |
| 4716 | | 4718 | |
| ... | @@ -4726,12 +4728,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4726,12 +4728,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4726 | case BuiltinFnIdHasField: | 4728 | case BuiltinFnIdHasField: |
| 4727 | { | 4729 | { |
| 4728 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4730 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4729 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4731 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4730 | if (arg0_value == ag->codegen->invalid_inst_src) | 4732 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4731 | return arg0_value; | 4733 | return arg0_value; |
| 4732 | | 4734 | |
| 4733 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4735 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4734 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4736 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4735 | if (arg1_value == ag->codegen->invalid_inst_src) | 4737 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4736 | return arg1_value; | 4738 | return arg1_value; |
| 4737 | | 4739 | |
| ... | @@ -4741,7 +4743,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4741,7 +4743,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4741 | case BuiltinFnIdTypeInfo: | 4743 | case BuiltinFnIdTypeInfo: |
| 4742 | { | 4744 | { |
| 4743 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4745 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4744 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4746 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4745 | if (arg0_value == ag->codegen->invalid_inst_src) | 4747 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4746 | return arg0_value; | 4748 | return arg0_value; |
| 4747 | | 4749 | |
| ... | @@ -4751,7 +4753,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4751,7 +4753,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4751 | case BuiltinFnIdType: | 4753 | case BuiltinFnIdType: |
| 4752 | { | 4754 | { |
| 4753 | AstNode *arg_node = node->data.fn_call_expr.params.at(0); | 4755 | AstNode *arg_node = node->data.fn_call_expr.params.at(0); |
| 4754 | IrInstSrc *arg = ir_gen_node(ag, arg_node, scope); | 4756 | IrInstSrc *arg = astgen_node(ag, arg_node, scope); |
| 4755 | if (arg == ag->codegen->invalid_inst_src) | 4757 | if (arg == ag->codegen->invalid_inst_src) |
| 4756 | return arg; | 4758 | return arg; |
| 4757 | | 4759 | |
| ... | @@ -4773,7 +4775,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4773,7 +4775,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4773 | return ir_lval_wrap(ag, scope, ir_build_handle_src(ag, scope, node), lval, result_loc); | 4775 | return ir_lval_wrap(ag, scope, ir_build_handle_src(ag, scope, node), lval, result_loc); |
| 4774 | case BuiltinFnIdFrameType: { | 4776 | case BuiltinFnIdFrameType: { |
| 4775 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4777 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4776 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4778 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4777 | if (arg0_value == ag->codegen->invalid_inst_src) | 4779 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4778 | return arg0_value; | 4780 | return arg0_value; |
| 4779 | | 4781 | |
| ... | @@ -4782,7 +4784,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4782,7 +4784,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4782 | } | 4784 | } |
| 4783 | case BuiltinFnIdFrameSize: { | 4785 | case BuiltinFnIdFrameSize: { |
| 4784 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4786 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4785 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4787 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4786 | if (arg0_value == ag->codegen->invalid_inst_src) | 4788 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4787 | return arg0_value; | 4789 | return arg0_value; |
| 4788 | | 4790 | |
| ... | @@ -4792,7 +4794,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4792,7 +4794,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4792 | case BuiltinFnIdAlignOf: | 4794 | case BuiltinFnIdAlignOf: |
| 4793 | { | 4795 | { |
| 4794 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4796 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4795 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4797 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4796 | if (arg0_value == ag->codegen->invalid_inst_src) | 4798 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4797 | return arg0_value; | 4799 | return arg0_value; |
| 4798 | | 4800 | |
| ... | @@ -4800,19 +4802,19 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4800,19 +4802,19 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4800 | return ir_lval_wrap(ag, scope, align_of, lval, result_loc); | 4802 | return ir_lval_wrap(ag, scope, align_of, lval, result_loc); |
| 4801 | } | 4803 | } |
| 4802 | case BuiltinFnIdAddWithOverflow: | 4804 | case BuiltinFnIdAddWithOverflow: |
| 4803 | return ir_lval_wrap(ag, scope, ir_gen_overflow_op(ag, scope, node, IrOverflowOpAdd), lval, result_loc); | 4805 | return ir_lval_wrap(ag, scope, astgen_overflow_op(ag, scope, node, IrOverflowOpAdd), lval, result_loc); |
| 4804 | case BuiltinFnIdSubWithOverflow: | 4806 | case BuiltinFnIdSubWithOverflow: |
| 4805 | return ir_lval_wrap(ag, scope, ir_gen_overflow_op(ag, scope, node, IrOverflowOpSub), lval, result_loc); | 4807 | return ir_lval_wrap(ag, scope, astgen_overflow_op(ag, scope, node, IrOverflowOpSub), lval, result_loc); |
| 4806 | case BuiltinFnIdMulWithOverflow: | 4808 | case BuiltinFnIdMulWithOverflow: |
| 4807 | return ir_lval_wrap(ag, scope, ir_gen_overflow_op(ag, scope, node, IrOverflowOpMul), lval, result_loc); | 4809 | return ir_lval_wrap(ag, scope, astgen_overflow_op(ag, scope, node, IrOverflowOpMul), lval, result_loc); |
| 4808 | case BuiltinFnIdShlWithOverflow: | 4810 | case BuiltinFnIdShlWithOverflow: |
| 4809 | return ir_lval_wrap(ag, scope, ir_gen_overflow_op(ag, scope, node, IrOverflowOpShl), lval, result_loc); | 4811 | return ir_lval_wrap(ag, scope, astgen_overflow_op(ag, scope, node, IrOverflowOpShl), lval, result_loc); |
| 4810 | case BuiltinFnIdMulAdd: | 4812 | case BuiltinFnIdMulAdd: |
| 4811 | return ir_lval_wrap(ag, scope, ir_gen_mul_add(ag, scope, node), lval, result_loc); | 4813 | return ir_lval_wrap(ag, scope, astgen_mul_add(ag, scope, node), lval, result_loc); |
| 4812 | case BuiltinFnIdTypeName: | 4814 | case BuiltinFnIdTypeName: |
| 4813 | { | 4815 | { |
| 4814 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4816 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4815 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4817 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4816 | if (arg0_value == ag->codegen->invalid_inst_src) | 4818 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4817 | return arg0_value; | 4819 | return arg0_value; |
| 4818 | | 4820 | |
| ... | @@ -4822,7 +4824,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4822,7 +4824,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4822 | case BuiltinFnIdPanic: | 4824 | case BuiltinFnIdPanic: |
| 4823 | { | 4825 | { |
| 4824 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4826 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4825 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4827 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4826 | if (arg0_value == ag->codegen->invalid_inst_src) | 4828 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4827 | return arg0_value; | 4829 | return arg0_value; |
| 4828 | | 4830 | |
| ... | @@ -4832,12 +4834,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4832,12 +4834,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4832 | case BuiltinFnIdPtrCast: | 4834 | case BuiltinFnIdPtrCast: |
| 4833 | { | 4835 | { |
| 4834 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4836 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4835 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4837 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4836 | if (arg0_value == ag->codegen->invalid_inst_src) | 4838 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4837 | return arg0_value; | 4839 | return arg0_value; |
| 4838 | | 4840 | |
| 4839 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4841 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4840 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4842 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4841 | if (arg1_value == ag->codegen->invalid_inst_src) | 4843 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4842 | return arg1_value; | 4844 | return arg1_value; |
| 4843 | | 4845 | |
| ... | @@ -4847,7 +4849,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4847,7 +4849,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4847 | case BuiltinFnIdBitCast: | 4849 | case BuiltinFnIdBitCast: |
| 4848 | { | 4850 | { |
| 4849 | AstNode *dest_type_node = node->data.fn_call_expr.params.at(0); | 4851 | AstNode *dest_type_node = node->data.fn_call_expr.params.at(0); |
| 4850 | IrInstSrc *dest_type = ir_gen_node(ag, dest_type_node, scope); | 4852 | IrInstSrc *dest_type = astgen_node(ag, dest_type_node, scope); |
| 4851 | if (dest_type == ag->codegen->invalid_inst_src) | 4853 | if (dest_type == ag->codegen->invalid_inst_src) |
| 4852 | return dest_type; | 4854 | return dest_type; |
| 4853 | | 4855 | |
| ... | @@ -4861,7 +4863,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4861,7 +4863,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4861 | ir_build_reset_result(ag, scope, node, &result_loc_bit_cast->base); | 4863 | ir_build_reset_result(ag, scope, node, &result_loc_bit_cast->base); |
| 4862 | | 4864 | |
| 4863 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4865 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4864 | IrInstSrc *arg1_value = ir_gen_node_extra(ag, arg1_node, scope, LValNone, | 4866 | IrInstSrc *arg1_value = astgen_node_extra(ag, arg1_node, scope, LValNone, |
| 4865 | &result_loc_bit_cast->base); | 4867 | &result_loc_bit_cast->base); |
| 4866 | if (arg1_value == ag->codegen->invalid_inst_src) | 4868 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4867 | return arg1_value; | 4869 | return arg1_value; |
| ... | @@ -4872,14 +4874,14 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4872,14 +4874,14 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4872 | case BuiltinFnIdAs: | 4874 | case BuiltinFnIdAs: |
| 4873 | { | 4875 | { |
| 4874 | AstNode *dest_type_node = node->data.fn_call_expr.params.at(0); | 4876 | AstNode *dest_type_node = node->data.fn_call_expr.params.at(0); |
| 4875 | IrInstSrc *dest_type = ir_gen_node(ag, dest_type_node, scope); | 4877 | IrInstSrc *dest_type = astgen_node(ag, dest_type_node, scope); |
| 4876 | if (dest_type == ag->codegen->invalid_inst_src) | 4878 | if (dest_type == ag->codegen->invalid_inst_src) |
| 4877 | return dest_type; | 4879 | return dest_type; |
| 4878 | | 4880 | |
| 4879 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, dest_type, result_loc); | 4881 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, dest_type, result_loc); |
| 4880 | | 4882 | |
| 4881 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4883 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4882 | IrInstSrc *arg1_value = ir_gen_node_extra(ag, arg1_node, scope, LValNone, | 4884 | IrInstSrc *arg1_value = astgen_node_extra(ag, arg1_node, scope, LValNone, |
| 4883 | &result_loc_cast->base); | 4885 | &result_loc_cast->base); |
| 4884 | if (arg1_value == ag->codegen->invalid_inst_src) | 4886 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4885 | return arg1_value; | 4887 | return arg1_value; |
| ... | @@ -4890,12 +4892,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4890,12 +4892,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4890 | case BuiltinFnIdIntToPtr: | 4892 | case BuiltinFnIdIntToPtr: |
| 4891 | { | 4893 | { |
| 4892 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4894 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4893 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4895 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4894 | if (arg0_value == ag->codegen->invalid_inst_src) | 4896 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4895 | return arg0_value; | 4897 | return arg0_value; |
| 4896 | | 4898 | |
| 4897 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4899 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4898 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4900 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4899 | if (arg1_value == ag->codegen->invalid_inst_src) | 4901 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4900 | return arg1_value; | 4902 | return arg1_value; |
| 4901 | | 4903 | |
| ... | @@ -4905,7 +4907,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4905,7 +4907,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4905 | case BuiltinFnIdPtrToInt: | 4907 | case BuiltinFnIdPtrToInt: |
| 4906 | { | 4908 | { |
| 4907 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4909 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4908 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4910 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4909 | if (arg0_value == ag->codegen->invalid_inst_src) | 4911 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4910 | return arg0_value; | 4912 | return arg0_value; |
| 4911 | | 4913 | |
| ... | @@ -4915,7 +4917,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4915,7 +4917,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4915 | case BuiltinFnIdTagName: | 4917 | case BuiltinFnIdTagName: |
| 4916 | { | 4918 | { |
| 4917 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4919 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4918 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4920 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4919 | if (arg0_value == ag->codegen->invalid_inst_src) | 4921 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4920 | return arg0_value; | 4922 | return arg0_value; |
| 4921 | | 4923 | |
| ... | @@ -4925,17 +4927,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4925,17 +4927,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4925 | case BuiltinFnIdFieldParentPtr: | 4927 | case BuiltinFnIdFieldParentPtr: |
| 4926 | { | 4928 | { |
| 4927 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4929 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4928 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4930 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4929 | if (arg0_value == ag->codegen->invalid_inst_src) | 4931 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4930 | return arg0_value; | 4932 | return arg0_value; |
| 4931 | | 4933 | |
| 4932 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4934 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4933 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4935 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4934 | if (arg1_value == ag->codegen->invalid_inst_src) | 4936 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4935 | return arg1_value; | 4937 | return arg1_value; |
| 4936 | | 4938 | |
| 4937 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 4939 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 4938 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 4940 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 4939 | if (arg2_value == ag->codegen->invalid_inst_src) | 4941 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 4940 | return arg2_value; | 4942 | return arg2_value; |
| 4941 | | 4943 | |
| ... | @@ -4946,12 +4948,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4946,12 +4948,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4946 | case BuiltinFnIdByteOffsetOf: | 4948 | case BuiltinFnIdByteOffsetOf: |
| 4947 | { | 4949 | { |
| 4948 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4950 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4949 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4951 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4950 | if (arg0_value == ag->codegen->invalid_inst_src) | 4952 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4951 | return arg0_value; | 4953 | return arg0_value; |
| 4952 | | 4954 | |
| 4953 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4955 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4954 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4956 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4955 | if (arg1_value == ag->codegen->invalid_inst_src) | 4957 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4956 | return arg1_value; | 4958 | return arg1_value; |
| 4957 | | 4959 | |
| ... | @@ -4961,12 +4963,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4961,12 +4963,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4961 | case BuiltinFnIdBitOffsetOf: | 4963 | case BuiltinFnIdBitOffsetOf: |
| 4962 | { | 4964 | { |
| 4963 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4965 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 4964 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 4966 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 4965 | if (arg0_value == ag->codegen->invalid_inst_src) | 4967 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 4966 | return arg0_value; | 4968 | return arg0_value; |
| 4967 | | 4969 | |
| 4968 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 4970 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 4969 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 4971 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 4970 | if (arg1_value == ag->codegen->invalid_inst_src) | 4972 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4971 | return arg1_value; | 4973 | return arg1_value; |
| 4972 | | 4974 | |
| ... | @@ -4980,7 +4982,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4980,7 +4982,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4980 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, options_type_inst, no_result_loc()); | 4982 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, options_type_inst, no_result_loc()); |
| 4981 | | 4983 | |
| 4982 | AstNode *options_node = node->data.fn_call_expr.params.at(0); | 4984 | AstNode *options_node = node->data.fn_call_expr.params.at(0); |
| 4983 | IrInstSrc *options_inner = ir_gen_node_extra(ag, options_node, scope, | 4985 | IrInstSrc *options_inner = astgen_node_extra(ag, options_node, scope, |
| 4984 | LValNone, &result_loc_cast->base); | 4986 | LValNone, &result_loc_cast->base); |
| 4985 | if (options_inner == ag->codegen->invalid_inst_src) | 4987 | if (options_inner == ag->codegen->invalid_inst_src) |
| 4986 | return options_inner; | 4988 | return options_inner; |
| ... | @@ -4992,7 +4994,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -4992,7 +4994,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 4992 | if (args_node->data.container_init_expr.kind == ContainerInitKindArray || | 4994 | if (args_node->data.container_init_expr.kind == ContainerInitKindArray || |
| 4993 | args_node->data.container_init_expr.entries.length == 0) | 4995 | args_node->data.container_init_expr.entries.length == 0) |
| 4994 | { | 4996 | { |
| 4995 | return ir_gen_fn_call_with_args(ag, scope, node, | 4997 | return astgen_fn_call_with_args(ag, scope, node, |
| 4996 | fn_ref_node, CallModifierNone, options, | 4998 | fn_ref_node, CallModifierNone, options, |
| 4997 | args_node->data.container_init_expr.entries.items, | 4999 | args_node->data.container_init_expr.entries.items, |
| 4998 | args_node->data.container_init_expr.entries.length, | 5000 | args_node->data.container_init_expr.entries.length, |
| ... | @@ -5003,11 +5005,11 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5003,11 +5005,11 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5003 | return ag->codegen->invalid_inst_src; | 5005 | return ag->codegen->invalid_inst_src; |
| 5004 | } | 5006 | } |
| 5005 | } else { | 5007 | } else { |
| 5006 | IrInstSrc *fn_ref = ir_gen_node(ag, fn_ref_node, scope); | 5008 | IrInstSrc *fn_ref = astgen_node(ag, fn_ref_node, scope); |
| 5007 | if (fn_ref == ag->codegen->invalid_inst_src) | 5009 | if (fn_ref == ag->codegen->invalid_inst_src) |
| 5008 | return fn_ref; | 5010 | return fn_ref; |
| 5009 | | 5011 | |
| 5010 | IrInstSrc *args = ir_gen_node(ag, args_node, scope); | 5012 | IrInstSrc *args = astgen_node(ag, args_node, scope); |
| 5011 | if (args == ag->codegen->invalid_inst_src) | 5013 | if (args == ag->codegen->invalid_inst_src) |
| 5012 | return args; | 5014 | return args; |
| 5013 | | 5015 | |
| ... | @@ -5016,16 +5018,16 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5016,16 +5018,16 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5016 | } | 5018 | } |
| 5017 | } | 5019 | } |
| 5018 | case BuiltinFnIdAsyncCall: | 5020 | case BuiltinFnIdAsyncCall: |
| 5019 | return ir_gen_async_call(ag, scope, nullptr, node, lval, result_loc); | 5021 | return astgen_async_call(ag, scope, nullptr, node, lval, result_loc); |
| 5020 | case BuiltinFnIdShlExact: | 5022 | case BuiltinFnIdShlExact: |
| 5021 | { | 5023 | { |
| 5022 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5024 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5023 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5025 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5024 | if (arg0_value == ag->codegen->invalid_inst_src) | 5026 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5025 | return arg0_value; | 5027 | return arg0_value; |
| 5026 | | 5028 | |
| 5027 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5029 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5028 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5030 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5029 | if (arg1_value == ag->codegen->invalid_inst_src) | 5031 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5030 | return arg1_value; | 5032 | return arg1_value; |
| 5031 | | 5033 | |
| ... | @@ -5035,12 +5037,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5035,12 +5037,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5035 | case BuiltinFnIdShrExact: | 5037 | case BuiltinFnIdShrExact: |
| 5036 | { | 5038 | { |
| 5037 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5039 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5038 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5040 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5039 | if (arg0_value == ag->codegen->invalid_inst_src) | 5041 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5040 | return arg0_value; | 5042 | return arg0_value; |
| 5041 | | 5043 | |
| 5042 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5044 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5043 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5045 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5044 | if (arg1_value == ag->codegen->invalid_inst_src) | 5046 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5045 | return arg1_value; | 5047 | return arg1_value; |
| 5046 | | 5048 | |
| ... | @@ -5050,7 +5052,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5050,7 +5052,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5050 | case BuiltinFnIdSetEvalBranchQuota: | 5052 | case BuiltinFnIdSetEvalBranchQuota: |
| 5051 | { | 5053 | { |
| 5052 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5054 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5053 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5055 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5054 | if (arg0_value == ag->codegen->invalid_inst_src) | 5056 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5055 | return arg0_value; | 5057 | return arg0_value; |
| 5056 | | 5058 | |
| ... | @@ -5060,12 +5062,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5060,12 +5062,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5060 | case BuiltinFnIdAlignCast: | 5062 | case BuiltinFnIdAlignCast: |
| 5061 | { | 5063 | { |
| 5062 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5064 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5063 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5065 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5064 | if (arg0_value == ag->codegen->invalid_inst_src) | 5066 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5065 | return arg0_value; | 5067 | return arg0_value; |
| 5066 | | 5068 | |
| 5067 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5069 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5068 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5070 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5069 | if (arg1_value == ag->codegen->invalid_inst_src) | 5071 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5070 | return arg1_value; | 5072 | return arg1_value; |
| 5071 | | 5073 | |
| ... | @@ -5074,13 +5076,13 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5074,13 +5076,13 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5074 | } | 5076 | } |
| 5075 | case BuiltinFnIdThis: | 5077 | case BuiltinFnIdThis: |
| 5076 | { | 5078 | { |
| 5077 | IrInstSrc *this_inst = ir_gen_this(ag, scope, node); | 5079 | IrInstSrc *this_inst = astgen_this(ag, scope, node); |
| 5078 | return ir_lval_wrap(ag, scope, this_inst, lval, result_loc); | 5080 | return ir_lval_wrap(ag, scope, this_inst, lval, result_loc); |
| 5079 | } | 5081 | } |
| 5080 | case BuiltinFnIdSetAlignStack: | 5082 | case BuiltinFnIdSetAlignStack: |
| 5081 | { | 5083 | { |
| 5082 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5084 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5083 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5085 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5084 | if (arg0_value == ag->codegen->invalid_inst_src) | 5086 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5085 | return arg0_value; | 5087 | return arg0_value; |
| 5086 | | 5088 | |
| ... | @@ -5095,12 +5097,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5095,12 +5097,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5095 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, options_type_inst, no_result_loc()); | 5097 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, options_type_inst, no_result_loc()); |
| 5096 | | 5098 | |
| 5097 | AstNode *target_node = node->data.fn_call_expr.params.at(0); | 5099 | AstNode *target_node = node->data.fn_call_expr.params.at(0); |
| 5098 | IrInstSrc *target_value = ir_gen_node(ag, target_node, scope); | 5100 | IrInstSrc *target_value = astgen_node(ag, target_node, scope); |
| 5099 | if (target_value == ag->codegen->invalid_inst_src) | 5101 | if (target_value == ag->codegen->invalid_inst_src) |
| 5100 | return target_value; | 5102 | return target_value; |
| 5101 | | 5103 | |
| 5102 | AstNode *options_node = node->data.fn_call_expr.params.at(1); | 5104 | AstNode *options_node = node->data.fn_call_expr.params.at(1); |
| 5103 | IrInstSrc *options_value = ir_gen_node_extra(ag, options_node, | 5105 | IrInstSrc *options_value = astgen_node_extra(ag, options_node, |
| 5104 | scope, LValNone, &result_loc_cast->base); | 5106 | scope, LValNone, &result_loc_cast->base); |
| 5105 | if (options_value == ag->codegen->invalid_inst_src) | 5107 | if (options_value == ag->codegen->invalid_inst_src) |
| 5106 | return options_value; | 5108 | return options_value; |
| ... | @@ -5119,12 +5121,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5119,12 +5121,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5119 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, options_type_inst, no_result_loc()); | 5121 | ResultLocCast *result_loc_cast = ir_build_cast_result_loc(ag, options_type_inst, no_result_loc()); |
| 5120 | | 5122 | |
| 5121 | AstNode *type_node = node->data.fn_call_expr.params.at(0); | 5123 | AstNode *type_node = node->data.fn_call_expr.params.at(0); |
| 5122 | IrInstSrc *type_value = ir_gen_node(ag, type_node, scope); | 5124 | IrInstSrc *type_value = astgen_node(ag, type_node, scope); |
| 5123 | if (type_value == ag->codegen->invalid_inst_src) | 5125 | if (type_value == ag->codegen->invalid_inst_src) |
| 5124 | return type_value; | 5126 | return type_value; |
| 5125 | | 5127 | |
| 5126 | AstNode *options_node = node->data.fn_call_expr.params.at(1); | 5128 | AstNode *options_node = node->data.fn_call_expr.params.at(1); |
| 5127 | IrInstSrc *options_value = ir_gen_node_extra(ag, options_node, | 5129 | IrInstSrc *options_value = astgen_node_extra(ag, options_node, |
| 5128 | scope, LValNone, &result_loc_cast->base); | 5130 | scope, LValNone, &result_loc_cast->base); |
| 5129 | if (options_value == ag->codegen->invalid_inst_src) | 5131 | if (options_value == ag->codegen->invalid_inst_src) |
| 5130 | return options_value; | 5132 | return options_value; |
| ... | @@ -5144,27 +5146,27 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5144,27 +5146,27 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5144 | case BuiltinFnIdAtomicRmw: | 5146 | case BuiltinFnIdAtomicRmw: |
| 5145 | { | 5147 | { |
| 5146 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5148 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5147 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5149 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5148 | if (arg0_value == ag->codegen->invalid_inst_src) | 5150 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5149 | return arg0_value; | 5151 | return arg0_value; |
| 5150 | | 5152 | |
| 5151 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5153 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5152 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5154 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5153 | if (arg1_value == ag->codegen->invalid_inst_src) | 5155 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5154 | return arg1_value; | 5156 | return arg1_value; |
| 5155 | | 5157 | |
| 5156 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 5158 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 5157 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 5159 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 5158 | if (arg2_value == ag->codegen->invalid_inst_src) | 5160 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 5159 | return arg2_value; | 5161 | return arg2_value; |
| 5160 | | 5162 | |
| 5161 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); | 5163 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); |
| 5162 | IrInstSrc *arg3_value = ir_gen_node(ag, arg3_node, scope); | 5164 | IrInstSrc *arg3_value = astgen_node(ag, arg3_node, scope); |
| 5163 | if (arg3_value == ag->codegen->invalid_inst_src) | 5165 | if (arg3_value == ag->codegen->invalid_inst_src) |
| 5164 | return arg3_value; | 5166 | return arg3_value; |
| 5165 | | 5167 | |
| 5166 | AstNode *arg4_node = node->data.fn_call_expr.params.at(4); | 5168 | AstNode *arg4_node = node->data.fn_call_expr.params.at(4); |
| 5167 | IrInstSrc *arg4_value = ir_gen_node(ag, arg4_node, scope); | 5169 | IrInstSrc *arg4_value = astgen_node(ag, arg4_node, scope); |
| 5168 | if (arg4_value == ag->codegen->invalid_inst_src) | 5170 | if (arg4_value == ag->codegen->invalid_inst_src) |
| 5169 | return arg4_value; | 5171 | return arg4_value; |
| 5170 | | 5172 | |
| ... | @@ -5175,17 +5177,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5175,17 +5177,17 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5175 | case BuiltinFnIdAtomicLoad: | 5177 | case BuiltinFnIdAtomicLoad: |
| 5176 | { | 5178 | { |
| 5177 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5179 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5178 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5180 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5179 | if (arg0_value == ag->codegen->invalid_inst_src) | 5181 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5180 | return arg0_value; | 5182 | return arg0_value; |
| 5181 | | 5183 | |
| 5182 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5184 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5183 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5185 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5184 | if (arg1_value == ag->codegen->invalid_inst_src) | 5186 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5185 | return arg1_value; | 5187 | return arg1_value; |
| 5186 | | 5188 | |
| 5187 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 5189 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 5188 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 5190 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 5189 | if (arg2_value == ag->codegen->invalid_inst_src) | 5191 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 5190 | return arg2_value; | 5192 | return arg2_value; |
| 5191 | | 5193 | |
| ... | @@ -5195,22 +5197,22 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5195,22 +5197,22 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5195 | case BuiltinFnIdAtomicStore: | 5197 | case BuiltinFnIdAtomicStore: |
| 5196 | { | 5198 | { |
| 5197 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5199 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5198 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5200 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5199 | if (arg0_value == ag->codegen->invalid_inst_src) | 5201 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5200 | return arg0_value; | 5202 | return arg0_value; |
| 5201 | | 5203 | |
| 5202 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5204 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5203 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5205 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5204 | if (arg1_value == ag->codegen->invalid_inst_src) | 5206 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5205 | return arg1_value; | 5207 | return arg1_value; |
| 5206 | | 5208 | |
| 5207 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); | 5209 | AstNode *arg2_node = node->data.fn_call_expr.params.at(2); |
| 5208 | IrInstSrc *arg2_value = ir_gen_node(ag, arg2_node, scope); | 5210 | IrInstSrc *arg2_value = astgen_node(ag, arg2_node, scope); |
| 5209 | if (arg2_value == ag->codegen->invalid_inst_src) | 5211 | if (arg2_value == ag->codegen->invalid_inst_src) |
| 5210 | return arg2_value; | 5212 | return arg2_value; |
| 5211 | | 5213 | |
| 5212 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); | 5214 | AstNode *arg3_node = node->data.fn_call_expr.params.at(3); |
| 5213 | IrInstSrc *arg3_value = ir_gen_node(ag, arg3_node, scope); | 5215 | IrInstSrc *arg3_value = astgen_node(ag, arg3_node, scope); |
| 5214 | if (arg3_value == ag->codegen->invalid_inst_src) | 5216 | if (arg3_value == ag->codegen->invalid_inst_src) |
| 5215 | return arg3_value; | 5217 | return arg3_value; |
| 5216 | | 5218 | |
| ... | @@ -5221,12 +5223,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5221,12 +5223,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5221 | case BuiltinFnIdIntToEnum: | 5223 | case BuiltinFnIdIntToEnum: |
| 5222 | { | 5224 | { |
| 5223 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5225 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5224 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5226 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5225 | if (arg0_value == ag->codegen->invalid_inst_src) | 5227 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5226 | return arg0_value; | 5228 | return arg0_value; |
| 5227 | | 5229 | |
| 5228 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5230 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5229 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5231 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5230 | if (arg1_value == ag->codegen->invalid_inst_src) | 5232 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5231 | return arg1_value; | 5233 | return arg1_value; |
| 5232 | | 5234 | |
| ... | @@ -5236,7 +5238,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5236,7 +5238,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5236 | case BuiltinFnIdEnumToInt: | 5238 | case BuiltinFnIdEnumToInt: |
| 5237 | { | 5239 | { |
| 5238 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5240 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5239 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5241 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5240 | if (arg0_value == ag->codegen->invalid_inst_src) | 5242 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5241 | return arg0_value; | 5243 | return arg0_value; |
| 5242 | | 5244 | |
| ... | @@ -5250,12 +5252,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5250,12 +5252,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5250 | case BuiltinFnIdBitReverse: | 5252 | case BuiltinFnIdBitReverse: |
| 5251 | { | 5253 | { |
| 5252 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5254 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5253 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5255 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5254 | if (arg0_value == ag->codegen->invalid_inst_src) | 5256 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5255 | return arg0_value; | 5257 | return arg0_value; |
| 5256 | | 5258 | |
| 5257 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5259 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5258 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5260 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5259 | if (arg1_value == ag->codegen->invalid_inst_src) | 5261 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5260 | return arg1_value; | 5262 | return arg1_value; |
| 5261 | | 5263 | |
| ... | @@ -5284,12 +5286,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5284,12 +5286,12 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5284 | case BuiltinFnIdHasDecl: | 5286 | case BuiltinFnIdHasDecl: |
| 5285 | { | 5287 | { |
| 5286 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 5288 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| 5287 | IrInstSrc *arg0_value = ir_gen_node(ag, arg0_node, scope); | 5289 | IrInstSrc *arg0_value = astgen_node(ag, arg0_node, scope); |
| 5288 | if (arg0_value == ag->codegen->invalid_inst_src) | 5290 | if (arg0_value == ag->codegen->invalid_inst_src) |
| 5289 | return arg0_value; | 5291 | return arg0_value; |
| 5290 | | 5292 | |
| 5291 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); | 5293 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| 5292 | IrInstSrc *arg1_value = ir_gen_node(ag, arg1_node, scope); | 5294 | IrInstSrc *arg1_value = astgen_node(ag, arg1_node, scope); |
| 5293 | if (arg1_value == ag->codegen->invalid_inst_src) | 5295 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 5294 | return arg1_value; | 5296 | return arg1_value; |
| 5295 | | 5297 | |
| ... | @@ -5299,18 +5301,18 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5299,18 +5301,18 @@ static IrInstSrc *ir_gen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, AstNode |
| 5299 | case BuiltinFnIdUnionInit: | 5301 | case BuiltinFnIdUnionInit: |
| 5300 | { | 5302 | { |
| 5301 | AstNode *union_type_node = node->data.fn_call_expr.params.at(0); | 5303 | AstNode *union_type_node = node->data.fn_call_expr.params.at(0); |
| 5302 | IrInstSrc *union_type_inst = ir_gen_node(ag, union_type_node, scope); | 5304 | IrInstSrc *union_type_inst = astgen_node(ag, union_type_node, scope); |
| 5303 | if (union_type_inst == ag->codegen->invalid_inst_src) | 5305 | if (union_type_inst == ag->codegen->invalid_inst_src) |
| 5304 | return union_type_inst; | 5306 | return union_type_inst; |
| 5305 | | 5307 | |
| 5306 | AstNode *name_node = node->data.fn_call_expr.params.at(1); | 5308 | AstNode *name_node = node->data.fn_call_expr.params.at(1); |
| 5307 | IrInstSrc *name_inst = ir_gen_node(ag, name_node, scope); | 5309 | IrInstSrc *name_inst = astgen_node(ag, name_node, scope); |
| 5308 | if (name_inst == ag->codegen->invalid_inst_src) | 5310 | if (name_inst == ag->codegen->invalid_inst_src) |
| 5309 | return name_inst; | 5311 | return name_inst; |
| 5310 | | 5312 | |
| 5311 | AstNode *init_node = node->data.fn_call_expr.params.at(2); | 5313 | AstNode *init_node = node->data.fn_call_expr.params.at(2); |
| 5312 | | 5314 | |
| 5313 | return ir_gen_union_init_expr(ag, scope, node, union_type_inst, name_inst, init_node, | 5315 | return astgen_union_init_expr(ag, scope, node, union_type_inst, name_inst, init_node, |
| 5314 | lval, result_loc); | 5316 | lval, result_loc); |
| 5315 | } | 5317 | } |
| 5316 | case BuiltinFnIdSrc: | 5318 | case BuiltinFnIdSrc: |
| ... | @@ -5334,13 +5336,13 @@ static ScopeNoSuspend *get_scope_nosuspend(Scope *scope) { | ... | @@ -5334,13 +5336,13 @@ static ScopeNoSuspend *get_scope_nosuspend(Scope *scope) { |
| 5334 | return nullptr; | 5336 | return nullptr; |
| 5335 | } | 5337 | } |
| 5336 | | 5338 | |
| 5337 | static IrInstSrc *ir_gen_fn_call(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 5339 | static IrInstSrc *astgen_fn_call(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 5338 | ResultLoc *result_loc) | 5340 | ResultLoc *result_loc) |
| 5339 | { | 5341 | { |
| 5340 | assert(node->type == NodeTypeFnCallExpr); | 5342 | assert(node->type == NodeTypeFnCallExpr); |
| 5341 | | 5343 | |
| 5342 | if (node->data.fn_call_expr.modifier == CallModifierBuiltin) | 5344 | if (node->data.fn_call_expr.modifier == CallModifierBuiltin) |
| 5343 | return ir_gen_builtin_fn_call(ag, scope, node, lval, result_loc); | 5345 | return astgen_builtin_fn_call(ag, scope, node, lval, result_loc); |
| 5344 | | 5346 | |
| 5345 | bool is_nosuspend = get_scope_nosuspend(scope) != nullptr; | 5347 | bool is_nosuspend = get_scope_nosuspend(scope) != nullptr; |
| 5346 | CallModifier modifier = node->data.fn_call_expr.modifier; | 5348 | CallModifier modifier = node->data.fn_call_expr.modifier; |
| ... | @@ -5349,16 +5351,16 @@ static IrInstSrc *ir_gen_fn_call(Stage1AstGen *ag, Scope *scope, AstNode *node, | ... | @@ -5349,16 +5351,16 @@ static IrInstSrc *ir_gen_fn_call(Stage1AstGen *ag, Scope *scope, AstNode *node, |
| 5349 | } | 5351 | } |
| 5350 | | 5352 | |
| 5351 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; | 5353 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; |
| 5352 | return ir_gen_fn_call_with_args(ag, scope, node, fn_ref_node, modifier, | 5354 | return astgen_fn_call_with_args(ag, scope, node, fn_ref_node, modifier, |
| 5353 | nullptr, node->data.fn_call_expr.params.items, node->data.fn_call_expr.params.length, lval, result_loc); | 5355 | nullptr, node->data.fn_call_expr.params.items, node->data.fn_call_expr.params.length, lval, result_loc); |
| 5354 | } | 5356 | } |
| 5355 | | 5357 | |
| 5356 | static IrInstSrc *ir_gen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 5358 | static IrInstSrc *astgen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 5357 | ResultLoc *result_loc) | 5359 | ResultLoc *result_loc) |
| 5358 | { | 5360 | { |
| 5359 | assert(node->type == NodeTypeIfBoolExpr); | 5361 | assert(node->type == NodeTypeIfBoolExpr); |
| 5360 | | 5362 | |
| 5361 | IrInstSrc *condition = ir_gen_node(ag, node->data.if_bool_expr.condition, scope); | 5363 | IrInstSrc *condition = astgen_node(ag, node->data.if_bool_expr.condition, scope); |
| 5362 | if (condition == ag->codegen->invalid_inst_src) | 5364 | if (condition == ag->codegen->invalid_inst_src) |
| 5363 | return ag->codegen->invalid_inst_src; | 5365 | return ag->codegen->invalid_inst_src; |
| 5364 | | 5366 | |
| ... | @@ -5384,7 +5386,7 @@ static IrInstSrc *ir_gen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -5384,7 +5386,7 @@ static IrInstSrc *ir_gen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 5384 | ir_set_cursor_at_end_and_append_block(ag, then_block); | 5386 | ir_set_cursor_at_end_and_append_block(ag, then_block); |
| 5385 | | 5387 | |
| 5386 | Scope *subexpr_scope = create_runtime_scope(ag->codegen, node, scope, is_comptime); | 5388 | Scope *subexpr_scope = create_runtime_scope(ag->codegen, node, scope, is_comptime); |
| 5387 | IrInstSrc *then_expr_result = ir_gen_node_extra(ag, then_node, subexpr_scope, lval, | 5389 | IrInstSrc *then_expr_result = astgen_node_extra(ag, then_node, subexpr_scope, lval, |
| 5388 | &peer_parent->peers.at(0)->base); | 5390 | &peer_parent->peers.at(0)->base); |
| 5389 | if (then_expr_result == ag->codegen->invalid_inst_src) | 5391 | if (then_expr_result == ag->codegen->invalid_inst_src) |
| 5390 | return ag->codegen->invalid_inst_src; | 5392 | return ag->codegen->invalid_inst_src; |
| ... | @@ -5395,7 +5397,7 @@ static IrInstSrc *ir_gen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -5395,7 +5397,7 @@ static IrInstSrc *ir_gen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 5395 | ir_set_cursor_at_end_and_append_block(ag, else_block); | 5397 | ir_set_cursor_at_end_and_append_block(ag, else_block); |
| 5396 | IrInstSrc *else_expr_result; | 5398 | IrInstSrc *else_expr_result; |
| 5397 | if (else_node) { | 5399 | if (else_node) { |
| 5398 | else_expr_result = ir_gen_node_extra(ag, else_node, subexpr_scope, lval, &peer_parent->peers.at(1)->base); | 5400 | else_expr_result = astgen_node_extra(ag, else_node, subexpr_scope, lval, &peer_parent->peers.at(1)->base); |
| 5399 | if (else_expr_result == ag->codegen->invalid_inst_src) | 5401 | if (else_expr_result == ag->codegen->invalid_inst_src) |
| 5400 | return ag->codegen->invalid_inst_src; | 5402 | return ag->codegen->invalid_inst_src; |
| 5401 | } else { | 5403 | } else { |
| ... | @@ -5418,19 +5420,19 @@ static IrInstSrc *ir_gen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -5418,19 +5420,19 @@ static IrInstSrc *ir_gen_if_bool_expr(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 5418 | return ir_expr_wrap(ag, scope, phi, result_loc); | 5420 | return ir_expr_wrap(ag, scope, phi, result_loc); |
| 5419 | } | 5421 | } |
| 5420 | | 5422 | |
| 5421 | static IrInstSrc *ir_gen_prefix_op_id_lval(Stage1AstGen *ag, Scope *scope, AstNode *node, IrUnOp op_id, LVal lval) { | 5423 | static IrInstSrc *astgen_prefix_op_id_lval(Stage1AstGen *ag, Scope *scope, AstNode *node, IrUnOp op_id, LVal lval) { |
| 5422 | assert(node->type == NodeTypePrefixOpExpr); | 5424 | assert(node->type == NodeTypePrefixOpExpr); |
| 5423 | AstNode *expr_node = node->data.prefix_op_expr.primary_expr; | 5425 | AstNode *expr_node = node->data.prefix_op_expr.primary_expr; |
| 5424 | | 5426 | |
| 5425 | IrInstSrc *value = ir_gen_node_extra(ag, expr_node, scope, lval, nullptr); | 5427 | IrInstSrc *value = astgen_node_extra(ag, expr_node, scope, lval, nullptr); |
| 5426 | if (value == ag->codegen->invalid_inst_src) | 5428 | if (value == ag->codegen->invalid_inst_src) |
| 5427 | return value; | 5429 | return value; |
| 5428 | | 5430 | |
| 5429 | return ir_build_un_op(ag, scope, node, op_id, value); | 5431 | return ir_build_un_op(ag, scope, node, op_id, value); |
| 5430 | } | 5432 | } |
| 5431 | | 5433 | |
| 5432 | static IrInstSrc *ir_gen_prefix_op_id(Stage1AstGen *ag, Scope *scope, AstNode *node, IrUnOp op_id) { | 5434 | static IrInstSrc *astgen_prefix_op_id(Stage1AstGen *ag, Scope *scope, AstNode *node, IrUnOp op_id) { |
| 5433 | return ir_gen_prefix_op_id_lval(ag, scope, node, op_id, LValNone); | 5435 | return astgen_prefix_op_id_lval(ag, scope, node, op_id, LValNone); |
| 5434 | } | 5436 | } |
| 5435 | | 5437 | |
| 5436 | static IrInstSrc *ir_expr_wrap(Stage1AstGen *ag, Scope *scope, IrInstSrc *inst, ResultLoc *result_loc) { | 5438 | static IrInstSrc *ir_expr_wrap(Stage1AstGen *ag, Scope *scope, IrInstSrc *inst, ResultLoc *result_loc) { |
| ... | @@ -5499,7 +5501,7 @@ static Error token_number_literal_u32(Stage1AstGen *ag, AstNode *source_node, | ... | @@ -5499,7 +5501,7 @@ static Error token_number_literal_u32(Stage1AstGen *ag, AstNode *source_node, |
| 5499 | | 5501 | |
| 5500 | } | 5502 | } |
| 5501 | | 5503 | |
| 5502 | static IrInstSrc *ir_gen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 5504 | static IrInstSrc *astgen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 5503 | Error err; | 5505 | Error err; |
| 5504 | assert(node->type == NodeTypePointerType); | 5506 | assert(node->type == NodeTypePointerType); |
| 5505 | | 5507 | |
| ... | @@ -5516,7 +5518,7 @@ static IrInstSrc *ir_gen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -5516,7 +5518,7 @@ static IrInstSrc *ir_gen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 5516 | | 5518 | |
| 5517 | IrInstSrc *sentinel; | 5519 | IrInstSrc *sentinel; |
| 5518 | if (sentinel_expr != nullptr) { | 5520 | if (sentinel_expr != nullptr) { |
| 5519 | sentinel = ir_gen_node(ag, sentinel_expr, scope); | 5521 | sentinel = astgen_node(ag, sentinel_expr, scope); |
| 5520 | if (sentinel == ag->codegen->invalid_inst_src) | 5522 | if (sentinel == ag->codegen->invalid_inst_src) |
| 5521 | return sentinel; | 5523 | return sentinel; |
| 5522 | } else { | 5524 | } else { |
| ... | @@ -5525,14 +5527,14 @@ static IrInstSrc *ir_gen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -5525,14 +5527,14 @@ static IrInstSrc *ir_gen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 5525 | | 5527 | |
| 5526 | IrInstSrc *align_value; | 5528 | IrInstSrc *align_value; |
| 5527 | if (align_expr != nullptr) { | 5529 | if (align_expr != nullptr) { |
| 5528 | align_value = ir_gen_node(ag, align_expr, scope); | 5530 | align_value = astgen_node(ag, align_expr, scope); |
| 5529 | if (align_value == ag->codegen->invalid_inst_src) | 5531 | if (align_value == ag->codegen->invalid_inst_src) |
| 5530 | return align_value; | 5532 | return align_value; |
| 5531 | } else { | 5533 | } else { |
| 5532 | align_value = nullptr; | 5534 | align_value = nullptr; |
| 5533 | } | 5535 | } |
| 5534 | | 5536 | |
| 5535 | IrInstSrc *child_type = ir_gen_node(ag, expr_node, scope); | 5537 | IrInstSrc *child_type = astgen_node(ag, expr_node, scope); |
| 5536 | if (child_type == ag->codegen->invalid_inst_src) | 5538 | if (child_type == ag->codegen->invalid_inst_src) |
| 5537 | return child_type; | 5539 | return child_type; |
| 5538 | | 5540 | |
| ... | @@ -5564,10 +5566,10 @@ static IrInstSrc *ir_gen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *n | ... | @@ -5564,10 +5566,10 @@ static IrInstSrc *ir_gen_pointer_type(Stage1AstGen *ag, Scope *scope, AstNode *n |
| 5564 | ptr_len, sentinel, align_value, bit_offset_start, host_int_bytes, is_allow_zero); | 5566 | ptr_len, sentinel, align_value, bit_offset_start, host_int_bytes, is_allow_zero); |
| 5565 | } | 5567 | } |
| 5566 | | 5568 | |
| 5567 | static IrInstSrc *ir_gen_catch_unreachable(Stage1AstGen *ag, Scope *scope, AstNode *source_node, | 5569 | static IrInstSrc *astgen_catch_unreachable(Stage1AstGen *ag, Scope *scope, AstNode *source_node, |
| 5568 | AstNode *expr_node, LVal lval, ResultLoc *result_loc) | 5570 | AstNode *expr_node, LVal lval, ResultLoc *result_loc) |
| 5569 | { | 5571 | { |
| 5570 | IrInstSrc *err_union_ptr = ir_gen_node_extra(ag, expr_node, scope, LValPtr, nullptr); | 5572 | IrInstSrc *err_union_ptr = astgen_node_extra(ag, expr_node, scope, LValPtr, nullptr); |
| 5571 | if (err_union_ptr == ag->codegen->invalid_inst_src) | 5573 | if (err_union_ptr == ag->codegen->invalid_inst_src) |
| 5572 | return ag->codegen->invalid_inst_src; | 5574 | return ag->codegen->invalid_inst_src; |
| 5573 | | 5575 | |
| ... | @@ -5582,18 +5584,18 @@ static IrInstSrc *ir_gen_catch_unreachable(Stage1AstGen *ag, Scope *scope, AstNo | ... | @@ -5582,18 +5584,18 @@ static IrInstSrc *ir_gen_catch_unreachable(Stage1AstGen *ag, Scope *scope, AstNo |
| 5582 | return ir_expr_wrap(ag, scope, load_ptr, result_loc); | 5584 | return ir_expr_wrap(ag, scope, load_ptr, result_loc); |
| 5583 | } | 5585 | } |
| 5584 | | 5586 | |
| 5585 | static IrInstSrc *ir_gen_bool_not(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 5587 | static IrInstSrc *astgen_bool_not(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 5586 | assert(node->type == NodeTypePrefixOpExpr); | 5588 | assert(node->type == NodeTypePrefixOpExpr); |
| 5587 | AstNode *expr_node = node->data.prefix_op_expr.primary_expr; | 5589 | AstNode *expr_node = node->data.prefix_op_expr.primary_expr; |
| 5588 | | 5590 | |
| 5589 | IrInstSrc *value = ir_gen_node(ag, expr_node, scope); | 5591 | IrInstSrc *value = astgen_node(ag, expr_node, scope); |
| 5590 | if (value == ag->codegen->invalid_inst_src) | 5592 | if (value == ag->codegen->invalid_inst_src) |
| 5591 | return ag->codegen->invalid_inst_src; | 5593 | return ag->codegen->invalid_inst_src; |
| 5592 | | 5594 | |
| 5593 | return ir_build_bool_not(ag, scope, node, value); | 5595 | return ir_build_bool_not(ag, scope, node, value); |
| 5594 | } | 5596 | } |
| 5595 | | 5597 | |
| 5596 | static IrInstSrc *ir_gen_prefix_op_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 5598 | static IrInstSrc *astgen_prefix_op_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 5597 | ResultLoc *result_loc) | 5599 | ResultLoc *result_loc) |
| 5598 | { | 5600 | { |
| 5599 | assert(node->type == NodeTypePrefixOpExpr); | 5601 | assert(node->type == NodeTypePrefixOpExpr); |
| ... | @@ -5604,24 +5606,24 @@ static IrInstSrc *ir_gen_prefix_op_expr(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5604,24 +5606,24 @@ static IrInstSrc *ir_gen_prefix_op_expr(Stage1AstGen *ag, Scope *scope, AstNode |
| 5604 | case PrefixOpInvalid: | 5606 | case PrefixOpInvalid: |
| 5605 | zig_unreachable(); | 5607 | zig_unreachable(); |
| 5606 | case PrefixOpBoolNot: | 5608 | case PrefixOpBoolNot: |
| 5607 | return ir_lval_wrap(ag, scope, ir_gen_bool_not(ag, scope, node), lval, result_loc); | 5609 | return ir_lval_wrap(ag, scope, astgen_bool_not(ag, scope, node), lval, result_loc); |
| 5608 | case PrefixOpBinNot: | 5610 | case PrefixOpBinNot: |
| 5609 | return ir_lval_wrap(ag, scope, ir_gen_prefix_op_id(ag, scope, node, IrUnOpBinNot), lval, result_loc); | 5611 | return ir_lval_wrap(ag, scope, astgen_prefix_op_id(ag, scope, node, IrUnOpBinNot), lval, result_loc); |
| 5610 | case PrefixOpNegation: | 5612 | case PrefixOpNegation: |
| 5611 | return ir_lval_wrap(ag, scope, ir_gen_prefix_op_id(ag, scope, node, IrUnOpNegation), lval, result_loc); | 5613 | return ir_lval_wrap(ag, scope, astgen_prefix_op_id(ag, scope, node, IrUnOpNegation), lval, result_loc); |
| 5612 | case PrefixOpNegationWrap: | 5614 | case PrefixOpNegationWrap: |
| 5613 | return ir_lval_wrap(ag, scope, ir_gen_prefix_op_id(ag, scope, node, IrUnOpNegationWrap), lval, result_loc); | 5615 | return ir_lval_wrap(ag, scope, astgen_prefix_op_id(ag, scope, node, IrUnOpNegationWrap), lval, result_loc); |
| 5614 | case PrefixOpOptional: | 5616 | case PrefixOpOptional: |
| 5615 | return ir_lval_wrap(ag, scope, ir_gen_prefix_op_id(ag, scope, node, IrUnOpOptional), lval, result_loc); | 5617 | return ir_lval_wrap(ag, scope, astgen_prefix_op_id(ag, scope, node, IrUnOpOptional), lval, result_loc); |
| 5616 | case PrefixOpAddrOf: { | 5618 | case PrefixOpAddrOf: { |
| 5617 | AstNode *expr_node = node->data.prefix_op_expr.primary_expr; | 5619 | AstNode *expr_node = node->data.prefix_op_expr.primary_expr; |
| 5618 | return ir_lval_wrap(ag, scope, ir_gen_node_extra(ag, expr_node, scope, LValPtr, nullptr), lval, result_loc); | 5620 | return ir_lval_wrap(ag, scope, astgen_node_extra(ag, expr_node, scope, LValPtr, nullptr), lval, result_loc); |
| 5619 | } | 5621 | } |
| 5620 | } | 5622 | } |
| 5621 | zig_unreachable(); | 5623 | zig_unreachable(); |
| 5622 | } | 5624 | } |
| 5623 | | 5625 | |
| 5624 | static IrInstSrc *ir_gen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode *source_node, | 5626 | static IrInstSrc *astgen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode *source_node, |
| 5625 | IrInstSrc *union_type, IrInstSrc *field_name, AstNode *expr_node, | 5627 | IrInstSrc *union_type, IrInstSrc *field_name, AstNode *expr_node, |
| 5626 | LVal lval, ResultLoc *parent_result_loc) | 5628 | LVal lval, ResultLoc *parent_result_loc) |
| 5627 | { | 5629 | { |
| ... | @@ -5635,7 +5637,7 @@ static IrInstSrc *ir_gen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5635,7 +5637,7 @@ static IrInstSrc *ir_gen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode |
| 5635 | ir_ref_instruction(field_ptr, ag->current_basic_block); | 5637 | ir_ref_instruction(field_ptr, ag->current_basic_block); |
| 5636 | ir_build_reset_result(ag, scope, expr_node, &result_loc_inst->base); | 5638 | ir_build_reset_result(ag, scope, expr_node, &result_loc_inst->base); |
| 5637 | | 5639 | |
| 5638 | IrInstSrc *expr_value = ir_gen_node_extra(ag, expr_node, scope, LValNone, | 5640 | IrInstSrc *expr_value = astgen_node_extra(ag, expr_node, scope, LValNone, |
| 5639 | &result_loc_inst->base); | 5641 | &result_loc_inst->base); |
| 5640 | if (expr_value == ag->codegen->invalid_inst_src) | 5642 | if (expr_value == ag->codegen->invalid_inst_src) |
| 5641 | return expr_value; | 5643 | return expr_value; |
| ... | @@ -5646,7 +5648,7 @@ static IrInstSrc *ir_gen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -5646,7 +5648,7 @@ static IrInstSrc *ir_gen_union_init_expr(Stage1AstGen *ag, Scope *scope, AstNode |
| 5646 | return ir_lval_wrap(ag, scope, init_union, lval, parent_result_loc); | 5648 | return ir_lval_wrap(ag, scope, init_union, lval, parent_result_loc); |
| 5647 | } | 5649 | } |
| 5648 | | 5650 | |
| 5649 | static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 5651 | static IrInstSrc *astgen_container_init_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 5650 | ResultLoc *parent_result_loc) | 5652 | ResultLoc *parent_result_loc) |
| 5651 | { | 5653 | { |
| 5652 | assert(node->type == NodeTypeContainerInitExpr); | 5654 | assert(node->type == NodeTypeContainerInitExpr); |
| ... | @@ -5667,14 +5669,14 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast | ... | @@ -5667,14 +5669,14 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast |
| 5667 | } | 5669 | } |
| 5668 | IrInstSrc *sentinel; | 5670 | IrInstSrc *sentinel; |
| 5669 | if (container_init_expr->type->data.inferred_array_type.sentinel != nullptr) { | 5671 | if (container_init_expr->type->data.inferred_array_type.sentinel != nullptr) { |
| 5670 | sentinel = ir_gen_node(ag, container_init_expr->type->data.inferred_array_type.sentinel, scope); | 5672 | sentinel = astgen_node(ag, container_init_expr->type->data.inferred_array_type.sentinel, scope); |
| 5671 | if (sentinel == ag->codegen->invalid_inst_src) | 5673 | if (sentinel == ag->codegen->invalid_inst_src) |
| 5672 | return sentinel; | 5674 | return sentinel; |
| 5673 | } else { | 5675 | } else { |
| 5674 | sentinel = nullptr; | 5676 | sentinel = nullptr; |
| 5675 | } | 5677 | } |
| 5676 | | 5678 | |
| 5677 | IrInstSrc *elem_type = ir_gen_node(ag, | 5679 | IrInstSrc *elem_type = astgen_node(ag, |
| 5678 | container_init_expr->type->data.inferred_array_type.child_type, scope); | 5680 | container_init_expr->type->data.inferred_array_type.child_type, scope); |
| 5679 | if (elem_type == ag->codegen->invalid_inst_src) | 5681 | if (elem_type == ag->codegen->invalid_inst_src) |
| 5680 | return elem_type; | 5682 | return elem_type; |
| ... | @@ -5682,7 +5684,7 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast | ... | @@ -5682,7 +5684,7 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast |
| 5682 | IrInstSrc *item_count_inst = ir_build_const_usize(ag, scope, node, item_count); | 5684 | IrInstSrc *item_count_inst = ir_build_const_usize(ag, scope, node, item_count); |
| 5683 | container_type = ir_build_array_type(ag, scope, node, item_count_inst, sentinel, elem_type); | 5685 | container_type = ir_build_array_type(ag, scope, node, item_count_inst, sentinel, elem_type); |
| 5684 | } else { | 5686 | } else { |
| 5685 | container_type = ir_gen_node(ag, container_init_expr->type, scope); | 5687 | container_type = astgen_node(ag, container_init_expr->type, scope); |
| 5686 | if (container_type == ag->codegen->invalid_inst_src) | 5688 | if (container_type == ag->codegen->invalid_inst_src) |
| 5687 | return container_type; | 5689 | return container_type; |
| 5688 | } | 5690 | } |
| ... | @@ -5721,7 +5723,7 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast | ... | @@ -5721,7 +5723,7 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast |
| 5721 | ir_ref_instruction(field_ptr, ag->current_basic_block); | 5723 | ir_ref_instruction(field_ptr, ag->current_basic_block); |
| 5722 | ir_build_reset_result(ag, scope, expr_node, &result_loc_inst->base); | 5724 | ir_build_reset_result(ag, scope, expr_node, &result_loc_inst->base); |
| 5723 | | 5725 | |
| 5724 | IrInstSrc *expr_value = ir_gen_node_extra(ag, expr_node, scope, LValNone, | 5726 | IrInstSrc *expr_value = astgen_node_extra(ag, expr_node, scope, LValNone, |
| 5725 | &result_loc_inst->base); | 5727 | &result_loc_inst->base); |
| 5726 | if (expr_value == ag->codegen->invalid_inst_src) | 5728 | if (expr_value == ag->codegen->invalid_inst_src) |
| 5727 | return expr_value; | 5729 | return expr_value; |
| ... | @@ -5758,7 +5760,7 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast | ... | @@ -5758,7 +5760,7 @@ static IrInstSrc *ir_gen_container_init_expr(Stage1AstGen *ag, Scope *scope, Ast |
| 5758 | ir_ref_instruction(elem_ptr, ag->current_basic_block); | 5760 | ir_ref_instruction(elem_ptr, ag->current_basic_block); |
| 5759 | ir_build_reset_result(ag, scope, expr_node, &result_loc_inst->base); | 5761 | ir_build_reset_result(ag, scope, expr_node, &result_loc_inst->base); |
| 5760 | | 5762 | |
| 5761 | IrInstSrc *expr_value = ir_gen_node_extra(ag, expr_node, scope, LValNone, | 5763 | IrInstSrc *expr_value = astgen_node_extra(ag, expr_node, scope, LValNone, |
| 5762 | &result_loc_inst->base); | 5764 | &result_loc_inst->base); |
| 5763 | if (expr_value == ag->codegen->invalid_inst_src) | 5765 | if (expr_value == ag->codegen->invalid_inst_src) |
| 5764 | return expr_value; | 5766 | return expr_value; |
| ... | @@ -5812,7 +5814,7 @@ static void build_decl_var_and_init(Stage1AstGen *ag, Scope *scope, AstNode *sou | ... | @@ -5812,7 +5814,7 @@ static void build_decl_var_and_init(Stage1AstGen *ag, Scope *scope, AstNode *sou |
| 5812 | ir_build_var_decl_src(ag, scope, source_node, var, nullptr, alloca); | 5814 | ir_build_var_decl_src(ag, scope, source_node, var, nullptr, alloca); |
| 5813 | } | 5815 | } |
| 5814 | | 5816 | |
| 5815 | static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 5817 | static IrInstSrc *astgen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 5816 | assert(node->type == NodeTypeVariableDeclaration); | 5818 | assert(node->type == NodeTypeVariableDeclaration); |
| 5817 | | 5819 | |
| 5818 | AstNodeVariableDeclaration *variable_declaration = &node->data.variable_declaration; | 5820 | AstNodeVariableDeclaration *variable_declaration = &node->data.variable_declaration; |
| ... | @@ -5827,7 +5829,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -5827,7 +5829,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 5827 | | 5829 | |
| 5828 | IrInstSrc *type_instruction; | 5830 | IrInstSrc *type_instruction; |
| 5829 | if (variable_declaration->type != nullptr) { | 5831 | if (variable_declaration->type != nullptr) { |
| 5830 | type_instruction = ir_gen_node(ag, variable_declaration->type, comptime_scope); | 5832 | type_instruction = astgen_node(ag, variable_declaration->type, comptime_scope); |
| 5831 | if (type_instruction == ag->codegen->invalid_inst_src) | 5833 | if (type_instruction == ag->codegen->invalid_inst_src) |
| 5832 | return type_instruction; | 5834 | return type_instruction; |
| 5833 | } else { | 5835 | } else { |
| ... | @@ -5853,7 +5855,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -5853,7 +5855,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 5853 | | 5855 | |
| 5854 | IrInstSrc *align_value = nullptr; | 5856 | IrInstSrc *align_value = nullptr; |
| 5855 | if (variable_declaration->align_expr != nullptr) { | 5857 | if (variable_declaration->align_expr != nullptr) { |
| 5856 | align_value = ir_gen_node(ag, variable_declaration->align_expr, comptime_scope); | 5858 | align_value = astgen_node(ag, variable_declaration->align_expr, comptime_scope); |
| 5857 | if (align_value == ag->codegen->invalid_inst_src) | 5859 | if (align_value == ag->codegen->invalid_inst_src) |
| 5858 | return align_value; | 5860 | return align_value; |
| 5859 | } | 5861 | } |
| ... | @@ -5888,7 +5890,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -5888,7 +5890,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 5888 | // so that the struct or enum from the init expression inherits the name. | 5890 | // so that the struct or enum from the init expression inherits the name. |
| 5889 | Buf *old_exec_name = ag->exec->name; | 5891 | Buf *old_exec_name = ag->exec->name; |
| 5890 | ag->exec->name = variable_declaration->symbol; | 5892 | ag->exec->name = variable_declaration->symbol; |
| 5891 | IrInstSrc *init_value = ir_gen_node_extra(ag, variable_declaration->expr, init_scope, | 5893 | IrInstSrc *init_value = astgen_node_extra(ag, variable_declaration->expr, init_scope, |
| 5892 | LValNone, init_result_loc); | 5894 | LValNone, init_result_loc); |
| 5893 | ag->exec->name = old_exec_name; | 5895 | ag->exec->name = old_exec_name; |
| 5894 | | 5896 | |
| ... | @@ -5904,7 +5906,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -5904,7 +5906,7 @@ static IrInstSrc *ir_gen_var_decl(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 5904 | return ir_build_var_decl_src(ag, scope, node, var, align_value, alloca); | 5906 | return ir_build_var_decl_src(ag, scope, node, var, align_value, alloca); |
| 5905 | } | 5907 | } |
| 5906 | | 5908 | |
| 5907 | static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 5909 | static IrInstSrc *astgen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 5908 | ResultLoc *result_loc) | 5910 | ResultLoc *result_loc) |
| 5909 | { | 5911 | { |
| 5910 | assert(node->type == NodeTypeWhileExpr); | 5912 | assert(node->type == NodeTypeWhileExpr); |
| ... | @@ -5942,7 +5944,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -5942,7 +5944,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 5942 | payload_scope = subexpr_scope; | 5944 | payload_scope = subexpr_scope; |
| 5943 | } | 5945 | } |
| 5944 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, node, payload_scope); | 5946 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, node, payload_scope); |
| 5945 | IrInstSrc *err_val_ptr = ir_gen_node_extra(ag, node->data.while_expr.condition, subexpr_scope, | 5947 | IrInstSrc *err_val_ptr = astgen_node_extra(ag, node->data.while_expr.condition, subexpr_scope, |
| 5946 | LValPtr, nullptr); | 5948 | LValPtr, nullptr); |
| 5947 | if (err_val_ptr == ag->codegen->invalid_inst_src) | 5949 | if (err_val_ptr == ag->codegen->invalid_inst_src) |
| 5948 | return err_val_ptr; | 5950 | return err_val_ptr; |
| ... | @@ -5990,8 +5992,8 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -5990,8 +5992,8 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 5990 | | 5992 | |
| 5991 | // Note the body block of the loop is not the place that lval and result_loc are used - | 5993 | // Note the body block of the loop is not the place that lval and result_loc are used - |
| 5992 | // it's actually in break statements, handled similarly to return statements. | 5994 | // it's actually in break statements, handled similarly to return statements. |
| 5993 | // That is why we set those values in loop_scope above and not in this ir_gen_node call. | 5995 | // That is why we set those values in loop_scope above and not in this astgen_node call. |
| 5994 | IrInstSrc *body_result = ir_gen_node(ag, node->data.while_expr.body, &loop_scope->base); | 5996 | IrInstSrc *body_result = astgen_node(ag, node->data.while_expr.body, &loop_scope->base); |
| 5995 | if (body_result == ag->codegen->invalid_inst_src) | 5997 | if (body_result == ag->codegen->invalid_inst_src) |
| 5996 | return body_result; | 5998 | return body_result; |
| 5997 | | 5999 | |
| ... | @@ -6006,7 +6008,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6006,7 +6008,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6006 | | 6008 | |
| 6007 | if (continue_expr_node) { | 6009 | if (continue_expr_node) { |
| 6008 | ir_set_cursor_at_end_and_append_block(ag, continue_block); | 6010 | ir_set_cursor_at_end_and_append_block(ag, continue_block); |
| 6009 | IrInstSrc *expr_result = ir_gen_node(ag, continue_expr_node, payload_scope); | 6011 | IrInstSrc *expr_result = astgen_node(ag, continue_expr_node, payload_scope); |
| 6010 | if (expr_result == ag->codegen->invalid_inst_src) | 6012 | if (expr_result == ag->codegen->invalid_inst_src) |
| 6011 | return expr_result; | 6013 | return expr_result; |
| 6012 | if (!instr_is_unreachable(expr_result)) { | 6014 | if (!instr_is_unreachable(expr_result)) { |
| ... | @@ -6032,7 +6034,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6032,7 +6034,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6032 | } | 6034 | } |
| 6033 | ResultLocPeer *peer_result = create_peer_result(peer_parent); | 6035 | ResultLocPeer *peer_result = create_peer_result(peer_parent); |
| 6034 | peer_parent->peers.append(peer_result); | 6036 | peer_parent->peers.append(peer_result); |
| 6035 | IrInstSrc *else_result = ir_gen_node_extra(ag, else_node, err_scope, lval, &peer_result->base); | 6037 | IrInstSrc *else_result = astgen_node_extra(ag, else_node, err_scope, lval, &peer_result->base); |
| 6036 | if (else_result == ag->codegen->invalid_inst_src) | 6038 | if (else_result == ag->codegen->invalid_inst_src) |
| 6037 | return else_result; | 6039 | return else_result; |
| 6038 | if (!instr_is_unreachable(else_result)) | 6040 | if (!instr_is_unreachable(else_result)) |
| ... | @@ -6063,7 +6065,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6063,7 +6065,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6063 | true, false, false, is_comptime); | 6065 | true, false, false, is_comptime); |
| 6064 | Scope *child_scope = payload_var->child_scope; | 6066 | Scope *child_scope = payload_var->child_scope; |
| 6065 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, node, child_scope); | 6067 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, node, child_scope); |
| 6066 | IrInstSrc *maybe_val_ptr = ir_gen_node_extra(ag, node->data.while_expr.condition, subexpr_scope, | 6068 | IrInstSrc *maybe_val_ptr = astgen_node_extra(ag, node->data.while_expr.condition, subexpr_scope, |
| 6067 | LValPtr, nullptr); | 6069 | LValPtr, nullptr); |
| 6068 | if (maybe_val_ptr == ag->codegen->invalid_inst_src) | 6070 | if (maybe_val_ptr == ag->codegen->invalid_inst_src) |
| 6069 | return maybe_val_ptr; | 6071 | return maybe_val_ptr; |
| ... | @@ -6108,8 +6110,8 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6108,8 +6110,8 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6108 | | 6110 | |
| 6109 | // Note the body block of the loop is not the place that lval and result_loc are used - | 6111 | // Note the body block of the loop is not the place that lval and result_loc are used - |
| 6110 | // it's actually in break statements, handled similarly to return statements. | 6112 | // it's actually in break statements, handled similarly to return statements. |
| 6111 | // That is why we set those values in loop_scope above and not in this ir_gen_node call. | 6113 | // That is why we set those values in loop_scope above and not in this astgen_node call. |
| 6112 | IrInstSrc *body_result = ir_gen_node(ag, node->data.while_expr.body, &loop_scope->base); | 6114 | IrInstSrc *body_result = astgen_node(ag, node->data.while_expr.body, &loop_scope->base); |
| 6113 | if (body_result == ag->codegen->invalid_inst_src) | 6115 | if (body_result == ag->codegen->invalid_inst_src) |
| 6114 | return body_result; | 6116 | return body_result; |
| 6115 | | 6117 | |
| ... | @@ -6124,7 +6126,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6124,7 +6126,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6124 | | 6126 | |
| 6125 | if (continue_expr_node) { | 6127 | if (continue_expr_node) { |
| 6126 | ir_set_cursor_at_end_and_append_block(ag, continue_block); | 6128 | ir_set_cursor_at_end_and_append_block(ag, continue_block); |
| 6127 | IrInstSrc *expr_result = ir_gen_node(ag, continue_expr_node, child_scope); | 6129 | IrInstSrc *expr_result = astgen_node(ag, continue_expr_node, child_scope); |
| 6128 | if (expr_result == ag->codegen->invalid_inst_src) | 6130 | if (expr_result == ag->codegen->invalid_inst_src) |
| 6129 | return expr_result; | 6131 | return expr_result; |
| 6130 | if (!instr_is_unreachable(expr_result)) { | 6132 | if (!instr_is_unreachable(expr_result)) { |
| ... | @@ -6142,7 +6144,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6142,7 +6144,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6142 | } | 6144 | } |
| 6143 | ResultLocPeer *peer_result = create_peer_result(peer_parent); | 6145 | ResultLocPeer *peer_result = create_peer_result(peer_parent); |
| 6144 | peer_parent->peers.append(peer_result); | 6146 | peer_parent->peers.append(peer_result); |
| 6145 | else_result = ir_gen_node_extra(ag, else_node, scope, lval, &peer_result->base); | 6147 | else_result = astgen_node_extra(ag, else_node, scope, lval, &peer_result->base); |
| 6146 | if (else_result == ag->codegen->invalid_inst_src) | 6148 | if (else_result == ag->codegen->invalid_inst_src) |
| 6147 | return else_result; | 6149 | return else_result; |
| 6148 | if (!instr_is_unreachable(else_result)) | 6150 | if (!instr_is_unreachable(else_result)) |
| ... | @@ -6166,7 +6168,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6166,7 +6168,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6166 | return ir_expr_wrap(ag, scope, phi, result_loc); | 6168 | return ir_expr_wrap(ag, scope, phi, result_loc); |
| 6167 | } else { | 6169 | } else { |
| 6168 | ir_set_cursor_at_end_and_append_block(ag, cond_block); | 6170 | ir_set_cursor_at_end_and_append_block(ag, cond_block); |
| 6169 | IrInstSrc *cond_val = ir_gen_node(ag, node->data.while_expr.condition, scope); | 6171 | IrInstSrc *cond_val = astgen_node(ag, node->data.while_expr.condition, scope); |
| 6170 | if (cond_val == ag->codegen->invalid_inst_src) | 6172 | if (cond_val == ag->codegen->invalid_inst_src) |
| 6171 | return cond_val; | 6173 | return cond_val; |
| 6172 | Stage1ZirBasicBlock *after_cond_block = ag->current_basic_block; | 6174 | Stage1ZirBasicBlock *after_cond_block = ag->current_basic_block; |
| ... | @@ -6204,8 +6206,8 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6204,8 +6206,8 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6204 | | 6206 | |
| 6205 | // Note the body block of the loop is not the place that lval and result_loc are used - | 6207 | // Note the body block of the loop is not the place that lval and result_loc are used - |
| 6206 | // it's actually in break statements, handled similarly to return statements. | 6208 | // it's actually in break statements, handled similarly to return statements. |
| 6207 | // That is why we set those values in loop_scope above and not in this ir_gen_node call. | 6209 | // That is why we set those values in loop_scope above and not in this astgen_node call. |
| 6208 | IrInstSrc *body_result = ir_gen_node(ag, node->data.while_expr.body, &loop_scope->base); | 6210 | IrInstSrc *body_result = astgen_node(ag, node->data.while_expr.body, &loop_scope->base); |
| 6209 | if (body_result == ag->codegen->invalid_inst_src) | 6211 | if (body_result == ag->codegen->invalid_inst_src) |
| 6210 | return body_result; | 6212 | return body_result; |
| 6211 | | 6213 | |
| ... | @@ -6220,7 +6222,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6220,7 +6222,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6220 | | 6222 | |
| 6221 | if (continue_expr_node) { | 6223 | if (continue_expr_node) { |
| 6222 | ir_set_cursor_at_end_and_append_block(ag, continue_block); | 6224 | ir_set_cursor_at_end_and_append_block(ag, continue_block); |
| 6223 | IrInstSrc *expr_result = ir_gen_node(ag, continue_expr_node, subexpr_scope); | 6225 | IrInstSrc *expr_result = astgen_node(ag, continue_expr_node, subexpr_scope); |
| 6224 | if (expr_result == ag->codegen->invalid_inst_src) | 6226 | if (expr_result == ag->codegen->invalid_inst_src) |
| 6225 | return expr_result; | 6227 | return expr_result; |
| 6226 | if (!instr_is_unreachable(expr_result)) { | 6228 | if (!instr_is_unreachable(expr_result)) { |
| ... | @@ -6239,7 +6241,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6239,7 +6241,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6239 | ResultLocPeer *peer_result = create_peer_result(peer_parent); | 6241 | ResultLocPeer *peer_result = create_peer_result(peer_parent); |
| 6240 | peer_parent->peers.append(peer_result); | 6242 | peer_parent->peers.append(peer_result); |
| 6241 | | 6243 | |
| 6242 | else_result = ir_gen_node_extra(ag, else_node, subexpr_scope, lval, &peer_result->base); | 6244 | else_result = astgen_node_extra(ag, else_node, subexpr_scope, lval, &peer_result->base); |
| 6243 | if (else_result == ag->codegen->invalid_inst_src) | 6245 | if (else_result == ag->codegen->invalid_inst_src) |
| 6244 | return else_result; | 6246 | return else_result; |
| 6245 | if (!instr_is_unreachable(else_result)) | 6247 | if (!instr_is_unreachable(else_result)) |
| ... | @@ -6264,7 +6266,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6264,7 +6266,7 @@ static IrInstSrc *ir_gen_while_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6264 | } | 6266 | } |
| 6265 | } | 6267 | } |
| 6266 | | 6268 | |
| 6267 | static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval, | 6269 | static IrInstSrc *astgen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval, |
| 6268 | ResultLoc *result_loc) | 6270 | ResultLoc *result_loc) |
| 6269 | { | 6271 | { |
| 6270 | assert(node->type == NodeTypeForExpr); | 6272 | assert(node->type == NodeTypeForExpr); |
| ... | @@ -6283,7 +6285,7 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -6283,7 +6285,7 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 6283 | | 6285 | |
| 6284 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, node, parent_scope); | 6286 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, node, parent_scope); |
| 6285 | | 6287 | |
| 6286 | IrInstSrc *array_val_ptr = ir_gen_node_extra(ag, array_node, &spill_scope->base, LValPtr, nullptr); | 6288 | IrInstSrc *array_val_ptr = astgen_node_extra(ag, array_node, &spill_scope->base, LValPtr, nullptr); |
| 6287 | if (array_val_ptr == ag->codegen->invalid_inst_src) | 6289 | if (array_val_ptr == ag->codegen->invalid_inst_src) |
| 6288 | return array_val_ptr; | 6290 | return array_val_ptr; |
| 6289 | | 6291 | |
| ... | @@ -6362,8 +6364,8 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -6362,8 +6364,8 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 6362 | | 6364 | |
| 6363 | // Note the body block of the loop is not the place that lval and result_loc are used - | 6365 | // Note the body block of the loop is not the place that lval and result_loc are used - |
| 6364 | // it's actually in break statements, handled similarly to return statements. | 6366 | // it's actually in break statements, handled similarly to return statements. |
| 6365 | // That is why we set those values in loop_scope above and not in this ir_gen_node call. | 6367 | // That is why we set those values in loop_scope above and not in this astgen_node call. |
| 6366 | IrInstSrc *body_result = ir_gen_node(ag, body_node, &loop_scope->base); | 6368 | IrInstSrc *body_result = astgen_node(ag, body_node, &loop_scope->base); |
| 6367 | if (body_result == ag->codegen->invalid_inst_src) | 6369 | if (body_result == ag->codegen->invalid_inst_src) |
| 6368 | return ag->codegen->invalid_inst_src; | 6370 | return ag->codegen->invalid_inst_src; |
| 6369 | | 6371 | |
| ... | @@ -6390,7 +6392,7 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -6390,7 +6392,7 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 6390 | } | 6392 | } |
| 6391 | ResultLocPeer *peer_result = create_peer_result(peer_parent); | 6393 | ResultLocPeer *peer_result = create_peer_result(peer_parent); |
| 6392 | peer_parent->peers.append(peer_result); | 6394 | peer_parent->peers.append(peer_result); |
| 6393 | else_result = ir_gen_node_extra(ag, else_node, parent_scope, LValNone, &peer_result->base); | 6395 | else_result = astgen_node_extra(ag, else_node, parent_scope, LValNone, &peer_result->base); |
| 6394 | if (else_result == ag->codegen->invalid_inst_src) | 6396 | if (else_result == ag->codegen->invalid_inst_src) |
| 6395 | return else_result; | 6397 | return else_result; |
| 6396 | if (!instr_is_unreachable(else_result)) | 6398 | if (!instr_is_unreachable(else_result)) |
| ... | @@ -6415,19 +6417,25 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -6415,19 +6417,25 @@ static IrInstSrc *ir_gen_for_expr(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 6415 | return ir_lval_wrap(ag, parent_scope, phi, lval, result_loc); | 6417 | return ir_lval_wrap(ag, parent_scope, phi, lval, result_loc); |
| 6416 | } | 6418 | } |
| 6417 | | 6419 | |
| 6418 | static IrInstSrc *ir_gen_bool_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 6420 | static IrInstSrc *astgen_bool_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 6419 | assert(node->type == NodeTypeBoolLiteral); | 6421 | assert(node->type == NodeTypeBoolLiteral); |
| 6420 | return ir_build_const_bool(ag, scope, node, node->data.bool_literal.value); | 6422 | return ir_build_const_bool(ag, scope, node, node->data.bool_literal.value); |
| 6421 | } | 6423 | } |
| 6422 | | 6424 | |
| 6423 | static IrInstSrc *ir_gen_enum_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 6425 | static IrInstSrc *astgen_enum_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 6424 | assert(node->type == NodeTypeEnumLiteral); | 6426 | assert(node->type == NodeTypeEnumLiteral); |
| 6425 | RootStruct *root_struct = node->owner->data.structure.root_struct; | 6427 | // Currently, stage1 runs astgen for every comptime function call, |
| 6426 | Buf *name = token_identifier_buf(root_struct, node->main_token + 1); | 6428 | // resulting the allocation here wasting memory. As a workaround until |
| 6427 | return ir_build_const_enum_literal(ag, scope, node, name); | 6429 | // the code is adjusted to make astgen run only once per source node, |
| | 6430 | // we memoize the result into the AST here. |
| | 6431 | if (node->data.enum_literal.name == nullptr) { |
| | 6432 | RootStruct *root_struct = node->owner->data.structure.root_struct; |
| | 6433 | node->data.enum_literal.name = token_identifier_buf(root_struct, node->main_token + 1); |
| | 6434 | } |
| | 6435 | return ir_build_const_enum_literal(ag, scope, node, node->data.enum_literal.name); |
| 6428 | } | 6436 | } |
| 6429 | | 6437 | |
| 6430 | static IrInstSrc *ir_gen_string_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 6438 | static IrInstSrc *astgen_string_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 6431 | Error err; | 6439 | Error err; |
| 6432 | assert(node->type == NodeTypeStringLiteral); | 6440 | assert(node->type == NodeTypeStringLiteral); |
| 6433 | | 6441 | |
| ... | @@ -6465,10 +6473,11 @@ static IrInstSrc *ir_gen_string_literal(Stage1AstGen *ag, Scope *scope, AstNode | ... | @@ -6465,10 +6473,11 @@ static IrInstSrc *ir_gen_string_literal(Stage1AstGen *ag, Scope *scope, AstNode |
| 6465 | } else { | 6473 | } else { |
| 6466 | zig_unreachable(); | 6474 | zig_unreachable(); |
| 6467 | } | 6475 | } |
| | 6476 | |
| 6468 | return ir_build_const_str_lit(ag, scope, node, str); | 6477 | return ir_build_const_str_lit(ag, scope, node, str); |
| 6469 | } | 6478 | } |
| 6470 | | 6479 | |
| 6471 | static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 6480 | static IrInstSrc *astgen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 6472 | assert(node->type == NodeTypeArrayType); | 6481 | assert(node->type == NodeTypeArrayType); |
| 6473 | | 6482 | |
| 6474 | AstNode *size_node = node->data.array_type.size; | 6483 | AstNode *size_node = node->data.array_type.size; |
| ... | @@ -6483,7 +6492,7 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6483,7 +6492,7 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6483 | | 6492 | |
| 6484 | IrInstSrc *sentinel; | 6493 | IrInstSrc *sentinel; |
| 6485 | if (sentinel_expr != nullptr) { | 6494 | if (sentinel_expr != nullptr) { |
| 6486 | sentinel = ir_gen_node(ag, sentinel_expr, comptime_scope); | 6495 | sentinel = astgen_node(ag, sentinel_expr, comptime_scope); |
| 6487 | if (sentinel == ag->codegen->invalid_inst_src) | 6496 | if (sentinel == ag->codegen->invalid_inst_src) |
| 6488 | return sentinel; | 6497 | return sentinel; |
| 6489 | } else { | 6498 | } else { |
| ... | @@ -6508,11 +6517,11 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6508,11 +6517,11 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6508 | return ag->codegen->invalid_inst_src; | 6517 | return ag->codegen->invalid_inst_src; |
| 6509 | } | 6518 | } |
| 6510 | | 6519 | |
| 6511 | IrInstSrc *size_value = ir_gen_node(ag, size_node, comptime_scope); | 6520 | IrInstSrc *size_value = astgen_node(ag, size_node, comptime_scope); |
| 6512 | if (size_value == ag->codegen->invalid_inst_src) | 6521 | if (size_value == ag->codegen->invalid_inst_src) |
| 6513 | return size_value; | 6522 | return size_value; |
| 6514 | | 6523 | |
| 6515 | IrInstSrc *child_type = ir_gen_node(ag, child_type_node, comptime_scope); | 6524 | IrInstSrc *child_type = astgen_node(ag, child_type_node, comptime_scope); |
| 6516 | if (child_type == ag->codegen->invalid_inst_src) | 6525 | if (child_type == ag->codegen->invalid_inst_src) |
| 6517 | return child_type; | 6526 | return child_type; |
| 6518 | | 6527 | |
| ... | @@ -6520,14 +6529,14 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6520,14 +6529,14 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6520 | } else { | 6529 | } else { |
| 6521 | IrInstSrc *align_value; | 6530 | IrInstSrc *align_value; |
| 6522 | if (align_expr != nullptr) { | 6531 | if (align_expr != nullptr) { |
| 6523 | align_value = ir_gen_node(ag, align_expr, comptime_scope); | 6532 | align_value = astgen_node(ag, align_expr, comptime_scope); |
| 6524 | if (align_value == ag->codegen->invalid_inst_src) | 6533 | if (align_value == ag->codegen->invalid_inst_src) |
| 6525 | return align_value; | 6534 | return align_value; |
| 6526 | } else { | 6535 | } else { |
| 6527 | align_value = nullptr; | 6536 | align_value = nullptr; |
| 6528 | } | 6537 | } |
| 6529 | | 6538 | |
| 6530 | IrInstSrc *child_type = ir_gen_node(ag, child_type_node, comptime_scope); | 6539 | IrInstSrc *child_type = astgen_node(ag, child_type_node, comptime_scope); |
| 6531 | if (child_type == ag->codegen->invalid_inst_src) | 6540 | if (child_type == ag->codegen->invalid_inst_src) |
| 6532 | return child_type; | 6541 | return child_type; |
| 6533 | | 6542 | |
| ... | @@ -6536,14 +6545,14 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -6536,14 +6545,14 @@ static IrInstSrc *ir_gen_array_type(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 6536 | } | 6545 | } |
| 6537 | } | 6546 | } |
| 6538 | | 6547 | |
| 6539 | static IrInstSrc *ir_gen_anyframe_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 6548 | static IrInstSrc *astgen_anyframe_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 6540 | assert(node->type == NodeTypeAnyFrameType); | 6549 | assert(node->type == NodeTypeAnyFrameType); |
| 6541 | | 6550 | |
| 6542 | AstNode *payload_type_node = node->data.anyframe_type.payload_type; | 6551 | AstNode *payload_type_node = node->data.anyframe_type.payload_type; |
| 6543 | IrInstSrc *payload_type_value = nullptr; | 6552 | IrInstSrc *payload_type_value = nullptr; |
| 6544 | | 6553 | |
| 6545 | if (payload_type_node != nullptr) { | 6554 | if (payload_type_node != nullptr) { |
| 6546 | payload_type_value = ir_gen_node(ag, payload_type_node, scope); | 6555 | payload_type_value = astgen_node(ag, payload_type_node, scope); |
| 6547 | if (payload_type_value == ag->codegen->invalid_inst_src) | 6556 | if (payload_type_value == ag->codegen->invalid_inst_src) |
| 6548 | return payload_type_value; | 6557 | return payload_type_value; |
| 6549 | | 6558 | |
| ... | @@ -6552,16 +6561,16 @@ static IrInstSrc *ir_gen_anyframe_type(Stage1AstGen *ag, Scope *scope, AstNode * | ... | @@ -6552,16 +6561,16 @@ static IrInstSrc *ir_gen_anyframe_type(Stage1AstGen *ag, Scope *scope, AstNode * |
| 6552 | return ir_build_anyframe_type(ag, scope, node, payload_type_value); | 6561 | return ir_build_anyframe_type(ag, scope, node, payload_type_value); |
| 6553 | } | 6562 | } |
| 6554 | | 6563 | |
| 6555 | static IrInstSrc *ir_gen_undefined_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 6564 | static IrInstSrc *astgen_undefined_literal(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 6556 | assert(node->type == NodeTypeUndefinedLiteral); | 6565 | assert(node->type == NodeTypeUndefinedLiteral); |
| 6557 | return ir_build_const_undefined(ag, scope, node); | 6566 | return ir_build_const_undefined(ag, scope, node); |
| 6558 | } | 6567 | } |
| 6559 | | 6568 | |
| 6560 | static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 6569 | static IrInstSrc *astgen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 6561 | assert(node->type == NodeTypeAsmExpr); | 6570 | assert(node->type == NodeTypeAsmExpr); |
| 6562 | AstNodeAsmExpr *asm_expr = &node->data.asm_expr; | 6571 | AstNodeAsmExpr *asm_expr = &node->data.asm_expr; |
| 6563 | | 6572 | |
| 6564 | IrInstSrc *asm_template = ir_gen_node(ag, asm_expr->asm_template, scope); | 6573 | IrInstSrc *asm_template = astgen_node(ag, asm_expr->asm_template, scope); |
| 6565 | if (asm_template == ag->codegen->invalid_inst_src) | 6574 | if (asm_template == ag->codegen->invalid_inst_src) |
| 6566 | return ag->codegen->invalid_inst_src; | 6575 | return ag->codegen->invalid_inst_src; |
| 6567 | | 6576 | |
| ... | @@ -6601,7 +6610,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -6601,7 +6610,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 6601 | if (asm_output->return_type) { | 6610 | if (asm_output->return_type) { |
| 6602 | return_count += 1; | 6611 | return_count += 1; |
| 6603 | | 6612 | |
| 6604 | IrInstSrc *return_type = ir_gen_node(ag, asm_output->return_type, scope); | 6613 | IrInstSrc *return_type = astgen_node(ag, asm_output->return_type, scope); |
| 6605 | if (return_type == ag->codegen->invalid_inst_src) | 6614 | if (return_type == ag->codegen->invalid_inst_src) |
| 6606 | return ag->codegen->invalid_inst_src; | 6615 | return ag->codegen->invalid_inst_src; |
| 6607 | if (return_count > 1) { | 6616 | if (return_count > 1) { |
| ... | @@ -6612,7 +6621,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -6612,7 +6621,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 6612 | output_types[i] = return_type; | 6621 | output_types[i] = return_type; |
| 6613 | } else { | 6622 | } else { |
| 6614 | Buf *variable_name = asm_output->variable_name; | 6623 | Buf *variable_name = asm_output->variable_name; |
| 6615 | // TODO there is some duplication here with ir_gen_symbol. I need to do a full audit of how | 6624 | // TODO there is some duplication here with astgen_identifier. I need to do a full audit of how |
| 6616 | // inline assembly works. https://github.com/ziglang/zig/issues/215 | 6625 | // inline assembly works. https://github.com/ziglang/zig/issues/215 |
| 6617 | ZigVar *var = find_variable(ag->codegen, scope, variable_name, nullptr); | 6626 | ZigVar *var = find_variable(ag->codegen, scope, variable_name, nullptr); |
| 6618 | if (var) { | 6627 | if (var) { |
| ... | @@ -6635,7 +6644,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -6635,7 +6644,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 6635 | } | 6644 | } |
| 6636 | for (size_t i = 0; i < asm_expr->input_list.length; i += 1) { | 6645 | for (size_t i = 0; i < asm_expr->input_list.length; i += 1) { |
| 6637 | AsmInput *asm_input = asm_expr->input_list.at(i); | 6646 | AsmInput *asm_input = asm_expr->input_list.at(i); |
| 6638 | IrInstSrc *input_value = ir_gen_node(ag, asm_input->expr, scope); | 6647 | IrInstSrc *input_value = astgen_node(ag, asm_input->expr, scope); |
| 6639 | if (input_value == ag->codegen->invalid_inst_src) | 6648 | if (input_value == ag->codegen->invalid_inst_src) |
| 6640 | return ag->codegen->invalid_inst_src; | 6649 | return ag->codegen->invalid_inst_src; |
| 6641 | | 6650 | |
| ... | @@ -6646,7 +6655,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) | ... | @@ -6646,7 +6655,7 @@ static IrInstSrc *ir_gen_asm_expr(Stage1AstGen *ag, Scope *scope, AstNode *node) |
| 6646 | output_vars, return_count, is_volatile, false); | 6655 | output_vars, return_count, is_volatile, false); |
| 6647 | } | 6656 | } |
| 6648 | | 6657 | |
| 6649 | static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 6658 | static IrInstSrc *astgen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 6650 | ResultLoc *result_loc) | 6659 | ResultLoc *result_loc) |
| 6651 | { | 6660 | { |
| 6652 | assert(node->type == NodeTypeIfOptional); | 6661 | assert(node->type == NodeTypeIfOptional); |
| ... | @@ -6660,7 +6669,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod | ... | @@ -6660,7 +6669,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod |
| 6660 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, expr_node, scope); | 6669 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, expr_node, scope); |
| 6661 | spill_scope->spill_harder = true; | 6670 | spill_scope->spill_harder = true; |
| 6662 | | 6671 | |
| 6663 | IrInstSrc *maybe_val_ptr = ir_gen_node_extra(ag, expr_node, &spill_scope->base, LValPtr, nullptr); | 6672 | IrInstSrc *maybe_val_ptr = astgen_node_extra(ag, expr_node, &spill_scope->base, LValPtr, nullptr); |
| 6664 | if (maybe_val_ptr == ag->codegen->invalid_inst_src) | 6673 | if (maybe_val_ptr == ag->codegen->invalid_inst_src) |
| 6665 | return maybe_val_ptr; | 6674 | return maybe_val_ptr; |
| 6666 | | 6675 | |
| ... | @@ -6701,7 +6710,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod | ... | @@ -6701,7 +6710,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod |
| 6701 | } else { | 6710 | } else { |
| 6702 | var_scope = subexpr_scope; | 6711 | var_scope = subexpr_scope; |
| 6703 | } | 6712 | } |
| 6704 | IrInstSrc *then_expr_result = ir_gen_node_extra(ag, then_node, var_scope, lval, | 6713 | IrInstSrc *then_expr_result = astgen_node_extra(ag, then_node, var_scope, lval, |
| 6705 | &peer_parent->peers.at(0)->base); | 6714 | &peer_parent->peers.at(0)->base); |
| 6706 | if (then_expr_result == ag->codegen->invalid_inst_src) | 6715 | if (then_expr_result == ag->codegen->invalid_inst_src) |
| 6707 | return then_expr_result; | 6716 | return then_expr_result; |
| ... | @@ -6712,7 +6721,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod | ... | @@ -6712,7 +6721,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod |
| 6712 | ir_set_cursor_at_end_and_append_block(ag, else_block); | 6721 | ir_set_cursor_at_end_and_append_block(ag, else_block); |
| 6713 | IrInstSrc *else_expr_result; | 6722 | IrInstSrc *else_expr_result; |
| 6714 | if (else_node) { | 6723 | if (else_node) { |
| 6715 | else_expr_result = ir_gen_node_extra(ag, else_node, subexpr_scope, lval, &peer_parent->peers.at(1)->base); | 6724 | else_expr_result = astgen_node_extra(ag, else_node, subexpr_scope, lval, &peer_parent->peers.at(1)->base); |
| 6716 | if (else_expr_result == ag->codegen->invalid_inst_src) | 6725 | if (else_expr_result == ag->codegen->invalid_inst_src) |
| 6717 | return else_expr_result; | 6726 | return else_expr_result; |
| 6718 | } else { | 6727 | } else { |
| ... | @@ -6735,7 +6744,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod | ... | @@ -6735,7 +6744,7 @@ static IrInstSrc *ir_gen_if_optional_expr(Stage1AstGen *ag, Scope *scope, AstNod |
| 6735 | return ir_expr_wrap(ag, scope, phi, result_loc); | 6744 | return ir_expr_wrap(ag, scope, phi, result_loc); |
| 6736 | } | 6745 | } |
| 6737 | | 6746 | |
| 6738 | static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 6747 | static IrInstSrc *astgen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 6739 | ResultLoc *result_loc) | 6748 | ResultLoc *result_loc) |
| 6740 | { | 6749 | { |
| 6741 | assert(node->type == NodeTypeIfErrorExpr); | 6750 | assert(node->type == NodeTypeIfErrorExpr); |
| ... | @@ -6748,7 +6757,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -6748,7 +6757,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 6748 | Buf *var_symbol = node->data.if_err_expr.var_symbol; | 6757 | Buf *var_symbol = node->data.if_err_expr.var_symbol; |
| 6749 | Buf *err_symbol = node->data.if_err_expr.err_symbol; | 6758 | Buf *err_symbol = node->data.if_err_expr.err_symbol; |
| 6750 | | 6759 | |
| 6751 | IrInstSrc *err_val_ptr = ir_gen_node_extra(ag, target_node, scope, LValPtr, nullptr); | 6760 | IrInstSrc *err_val_ptr = astgen_node_extra(ag, target_node, scope, LValPtr, nullptr); |
| 6752 | if (err_val_ptr == ag->codegen->invalid_inst_src) | 6761 | if (err_val_ptr == ag->codegen->invalid_inst_src) |
| 6753 | return err_val_ptr; | 6762 | return err_val_ptr; |
| 6754 | | 6763 | |
| ... | @@ -6784,7 +6793,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -6784,7 +6793,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 6784 | } else { | 6793 | } else { |
| 6785 | var_scope = subexpr_scope; | 6794 | var_scope = subexpr_scope; |
| 6786 | } | 6795 | } |
| 6787 | IrInstSrc *then_expr_result = ir_gen_node_extra(ag, then_node, var_scope, lval, | 6796 | IrInstSrc *then_expr_result = astgen_node_extra(ag, then_node, var_scope, lval, |
| 6788 | &peer_parent->peers.at(0)->base); | 6797 | &peer_parent->peers.at(0)->base); |
| 6789 | if (then_expr_result == ag->codegen->invalid_inst_src) | 6798 | if (then_expr_result == ag->codegen->invalid_inst_src) |
| 6790 | return then_expr_result; | 6799 | return then_expr_result; |
| ... | @@ -6810,7 +6819,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -6810,7 +6819,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 6810 | } else { | 6819 | } else { |
| 6811 | err_var_scope = subexpr_scope; | 6820 | err_var_scope = subexpr_scope; |
| 6812 | } | 6821 | } |
| 6813 | else_expr_result = ir_gen_node_extra(ag, else_node, err_var_scope, lval, &peer_parent->peers.at(1)->base); | 6822 | else_expr_result = astgen_node_extra(ag, else_node, err_var_scope, lval, &peer_parent->peers.at(1)->base); |
| 6814 | if (else_expr_result == ag->codegen->invalid_inst_src) | 6823 | if (else_expr_result == ag->codegen->invalid_inst_src) |
| 6815 | return else_expr_result; | 6824 | return else_expr_result; |
| 6816 | } else { | 6825 | } else { |
| ... | @@ -6833,7 +6842,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -6833,7 +6842,7 @@ static IrInstSrc *ir_gen_if_err_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 6833 | return ir_expr_wrap(ag, scope, phi, result_loc); | 6842 | return ir_expr_wrap(ag, scope, phi, result_loc); |
| 6834 | } | 6843 | } |
| 6835 | | 6844 | |
| 6836 | static bool ir_gen_switch_prong_expr(Stage1AstGen *ag, Scope *scope, AstNode *switch_node, AstNode *prong_node, | 6845 | static bool astgen_switch_prong_expr(Stage1AstGen *ag, Scope *scope, AstNode *switch_node, AstNode *prong_node, |
| 6837 | Stage1ZirBasicBlock *end_block, IrInstSrc *is_comptime, IrInstSrc *var_is_comptime, | 6846 | Stage1ZirBasicBlock *end_block, IrInstSrc *is_comptime, IrInstSrc *var_is_comptime, |
| 6838 | IrInstSrc *target_value_ptr, IrInstSrc **prong_values, size_t prong_values_len, | 6847 | IrInstSrc *target_value_ptr, IrInstSrc **prong_values, size_t prong_values_len, |
| 6839 | ZigList<Stage1ZirBasicBlock *> *incoming_blocks, ZigList<IrInstSrc *> *incoming_values, | 6848 | ZigList<Stage1ZirBasicBlock *> *incoming_blocks, ZigList<IrInstSrc *> *incoming_values, |
| ... | @@ -6877,7 +6886,7 @@ static bool ir_gen_switch_prong_expr(Stage1AstGen *ag, Scope *scope, AstNode *sw | ... | @@ -6877,7 +6886,7 @@ static bool ir_gen_switch_prong_expr(Stage1AstGen *ag, Scope *scope, AstNode *sw |
| 6877 | child_scope = scope; | 6886 | child_scope = scope; |
| 6878 | } | 6887 | } |
| 6879 | | 6888 | |
| 6880 | IrInstSrc *expr_result = ir_gen_node_extra(ag, expr_node, child_scope, lval, result_loc); | 6889 | IrInstSrc *expr_result = astgen_node_extra(ag, expr_node, child_scope, lval, result_loc); |
| 6881 | if (expr_result == ag->codegen->invalid_inst_src) | 6890 | if (expr_result == ag->codegen->invalid_inst_src) |
| 6882 | return false; | 6891 | return false; |
| 6883 | if (!instr_is_unreachable(expr_result)) | 6892 | if (!instr_is_unreachable(expr_result)) |
| ... | @@ -6887,13 +6896,13 @@ static bool ir_gen_switch_prong_expr(Stage1AstGen *ag, Scope *scope, AstNode *sw | ... | @@ -6887,13 +6896,13 @@ static bool ir_gen_switch_prong_expr(Stage1AstGen *ag, Scope *scope, AstNode *sw |
| 6887 | return true; | 6896 | return true; |
| 6888 | } | 6897 | } |
| 6889 | | 6898 | |
| 6890 | static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 6899 | static IrInstSrc *astgen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 6891 | ResultLoc *result_loc) | 6900 | ResultLoc *result_loc) |
| 6892 | { | 6901 | { |
| 6893 | assert(node->type == NodeTypeSwitchExpr); | 6902 | assert(node->type == NodeTypeSwitchExpr); |
| 6894 | | 6903 | |
| 6895 | AstNode *target_node = node->data.switch_expr.expr; | 6904 | AstNode *target_node = node->data.switch_expr.expr; |
| 6896 | IrInstSrc *target_value_ptr = ir_gen_node_extra(ag, target_node, scope, LValPtr, nullptr); | 6905 | IrInstSrc *target_value_ptr = astgen_node_extra(ag, target_node, scope, LValPtr, nullptr); |
| 6897 | if (target_value_ptr == ag->codegen->invalid_inst_src) | 6906 | if (target_value_ptr == ag->codegen->invalid_inst_src) |
| 6898 | return target_value_ptr; | 6907 | return target_value_ptr; |
| 6899 | IrInstSrc *target_value = ir_build_switch_target(ag, scope, node, target_value_ptr); | 6908 | IrInstSrc *target_value = ir_build_switch_target(ag, scope, node, target_value_ptr); |
| ... | @@ -6949,11 +6958,11 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -6949,11 +6958,11 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 6949 | AstNode *start_node = item_node->data.switch_range.start; | 6958 | AstNode *start_node = item_node->data.switch_range.start; |
| 6950 | AstNode *end_node = item_node->data.switch_range.end; | 6959 | AstNode *end_node = item_node->data.switch_range.end; |
| 6951 | | 6960 | |
| 6952 | IrInstSrc *start_value = ir_gen_node(ag, start_node, comptime_scope); | 6961 | IrInstSrc *start_value = astgen_node(ag, start_node, comptime_scope); |
| 6953 | if (start_value == ag->codegen->invalid_inst_src) | 6962 | if (start_value == ag->codegen->invalid_inst_src) |
| 6954 | return ag->codegen->invalid_inst_src; | 6963 | return ag->codegen->invalid_inst_src; |
| 6955 | | 6964 | |
| 6956 | IrInstSrc *end_value = ir_gen_node(ag, end_node, comptime_scope); | 6965 | IrInstSrc *end_value = astgen_node(ag, end_node, comptime_scope); |
| 6957 | if (end_value == ag->codegen->invalid_inst_src) | 6966 | if (end_value == ag->codegen->invalid_inst_src) |
| 6958 | return ag->codegen->invalid_inst_src; | 6967 | return ag->codegen->invalid_inst_src; |
| 6959 | | 6968 | |
| ... | @@ -6973,7 +6982,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -6973,7 +6982,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 6973 | ok_bit = both_ok; | 6982 | ok_bit = both_ok; |
| 6974 | } | 6983 | } |
| 6975 | } else { | 6984 | } else { |
| 6976 | IrInstSrc *item_value = ir_gen_node(ag, item_node, comptime_scope); | 6985 | IrInstSrc *item_value = astgen_node(ag, item_node, comptime_scope); |
| 6977 | if (item_value == ag->codegen->invalid_inst_src) | 6986 | if (item_value == ag->codegen->invalid_inst_src) |
| 6978 | return ag->codegen->invalid_inst_src; | 6987 | return ag->codegen->invalid_inst_src; |
| 6979 | | 6988 | |
| ... | @@ -7007,7 +7016,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -7007,7 +7016,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 7007 | } | 7016 | } |
| 7008 | peer_parent->peers.append(this_peer_result_loc); | 7017 | peer_parent->peers.append(this_peer_result_loc); |
| 7009 | ir_set_cursor_at_end_and_append_block(ag, range_block_yes); | 7018 | ir_set_cursor_at_end_and_append_block(ag, range_block_yes); |
| 7010 | if (!ir_gen_switch_prong_expr(ag, subexpr_scope, node, prong_node, end_block, | 7019 | if (!astgen_switch_prong_expr(ag, subexpr_scope, node, prong_node, end_block, |
| 7011 | is_comptime, var_is_comptime, target_value_ptr, nullptr, 0, | 7020 | is_comptime, var_is_comptime, target_value_ptr, nullptr, 0, |
| 7012 | &incoming_blocks, &incoming_values, nullptr, LValNone, &this_peer_result_loc->base)) | 7021 | &incoming_blocks, &incoming_values, nullptr, LValNone, &this_peer_result_loc->base)) |
| 7013 | { | 7022 | { |
| ... | @@ -7058,7 +7067,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -7058,7 +7067,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 7058 | } | 7067 | } |
| 7059 | peer_parent->peers.append(this_peer_result_loc); | 7068 | peer_parent->peers.append(this_peer_result_loc); |
| 7060 | ir_set_cursor_at_end_and_append_block(ag, else_block); | 7069 | ir_set_cursor_at_end_and_append_block(ag, else_block); |
| 7061 | if (!ir_gen_switch_prong_expr(ag, subexpr_scope, node, prong_node, end_block, | 7070 | if (!astgen_switch_prong_expr(ag, subexpr_scope, node, prong_node, end_block, |
| 7062 | is_comptime, var_is_comptime, target_value_ptr, nullptr, 0, &incoming_blocks, &incoming_values, | 7071 | is_comptime, var_is_comptime, target_value_ptr, nullptr, 0, &incoming_blocks, &incoming_values, |
| 7063 | &switch_else_var, LValNone, &this_peer_result_loc->base)) | 7072 | &switch_else_var, LValNone, &this_peer_result_loc->base)) |
| 7064 | { | 7073 | { |
| ... | @@ -7088,7 +7097,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -7088,7 +7097,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 7088 | AstNode *item_node = prong_node->data.switch_prong.items.at(item_i); | 7097 | AstNode *item_node = prong_node->data.switch_prong.items.at(item_i); |
| 7089 | assert(item_node->type != NodeTypeSwitchRange); | 7098 | assert(item_node->type != NodeTypeSwitchRange); |
| 7090 | | 7099 | |
| 7091 | IrInstSrc *item_value = ir_gen_node(ag, item_node, comptime_scope); | 7100 | IrInstSrc *item_value = astgen_node(ag, item_node, comptime_scope); |
| 7092 | if (item_value == ag->codegen->invalid_inst_src) | 7101 | if (item_value == ag->codegen->invalid_inst_src) |
| 7093 | return ag->codegen->invalid_inst_src; | 7102 | return ag->codegen->invalid_inst_src; |
| 7094 | | 7103 | |
| ... | @@ -7109,7 +7118,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -7109,7 +7118,7 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 7109 | } | 7118 | } |
| 7110 | peer_parent->peers.append(this_peer_result_loc); | 7119 | peer_parent->peers.append(this_peer_result_loc); |
| 7111 | ir_set_cursor_at_end_and_append_block(ag, prong_block); | 7120 | ir_set_cursor_at_end_and_append_block(ag, prong_block); |
| 7112 | if (!ir_gen_switch_prong_expr(ag, subexpr_scope, node, prong_node, end_block, | 7121 | if (!astgen_switch_prong_expr(ag, subexpr_scope, node, prong_node, end_block, |
| 7113 | is_comptime, var_is_comptime, target_value_ptr, items, prong_item_count, | 7122 | is_comptime, var_is_comptime, target_value_ptr, items, prong_item_count, |
| 7114 | &incoming_blocks, &incoming_values, nullptr, LValNone, &this_peer_result_loc->base)) | 7123 | &incoming_blocks, &incoming_values, nullptr, LValNone, &this_peer_result_loc->base)) |
| 7115 | { | 7124 | { |
| ... | @@ -7165,23 +7174,23 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no | ... | @@ -7165,23 +7174,23 @@ static IrInstSrc *ir_gen_switch_expr(Stage1AstGen *ag, Scope *scope, AstNode *no |
| 7165 | return ir_lval_wrap(ag, scope, result_instruction, lval, result_loc); | 7174 | return ir_lval_wrap(ag, scope, result_instruction, lval, result_loc); |
| 7166 | } | 7175 | } |
| 7167 | | 7176 | |
| 7168 | static IrInstSrc *ir_gen_comptime(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval) { | 7177 | static IrInstSrc *astgen_comptime(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval) { |
| 7169 | assert(node->type == NodeTypeCompTime); | 7178 | assert(node->type == NodeTypeCompTime); |
| 7170 | | 7179 | |
| 7171 | Scope *child_scope = create_comptime_scope(ag->codegen, node, parent_scope); | 7180 | Scope *child_scope = create_comptime_scope(ag->codegen, node, parent_scope); |
| 7172 | // purposefully pass null for result_loc and let EndExpr handle it | 7181 | // purposefully pass null for result_loc and let EndExpr handle it |
| 7173 | return ir_gen_node_extra(ag, node->data.comptime_expr.expr, child_scope, lval, nullptr); | 7182 | return astgen_node_extra(ag, node->data.comptime_expr.expr, child_scope, lval, nullptr); |
| 7174 | } | 7183 | } |
| 7175 | | 7184 | |
| 7176 | static IrInstSrc *ir_gen_nosuspend(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval) { | 7185 | static IrInstSrc *astgen_nosuspend(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval) { |
| 7177 | assert(node->type == NodeTypeNoSuspend); | 7186 | assert(node->type == NodeTypeNoSuspend); |
| 7178 | | 7187 | |
| 7179 | Scope *child_scope = create_nosuspend_scope(ag->codegen, node, parent_scope); | 7188 | Scope *child_scope = create_nosuspend_scope(ag->codegen, node, parent_scope); |
| 7180 | // purposefully pass null for result_loc and let EndExpr handle it | 7189 | // purposefully pass null for result_loc and let EndExpr handle it |
| 7181 | return ir_gen_node_extra(ag, node->data.nosuspend_expr.expr, child_scope, lval, nullptr); | 7190 | return astgen_node_extra(ag, node->data.nosuspend_expr.expr, child_scope, lval, nullptr); |
| 7182 | } | 7191 | } |
| 7183 | | 7192 | |
| 7184 | static IrInstSrc *ir_gen_return_from_block(Stage1AstGen *ag, Scope *break_scope, AstNode *node, ScopeBlock *block_scope) { | 7193 | static IrInstSrc *astgen_return_from_block(Stage1AstGen *ag, Scope *break_scope, AstNode *node, ScopeBlock *block_scope) { |
| 7185 | IrInstSrc *is_comptime; | 7194 | IrInstSrc *is_comptime; |
| 7186 | if (ir_should_inline(ag->exec, break_scope)) { | 7195 | if (ir_should_inline(ag->exec, break_scope)) { |
| 7187 | is_comptime = ir_build_const_bool(ag, break_scope, node, true); | 7196 | is_comptime = ir_build_const_bool(ag, break_scope, node, true); |
| ... | @@ -7194,7 +7203,7 @@ static IrInstSrc *ir_gen_return_from_block(Stage1AstGen *ag, Scope *break_scope, | ... | @@ -7194,7 +7203,7 @@ static IrInstSrc *ir_gen_return_from_block(Stage1AstGen *ag, Scope *break_scope, |
| 7194 | ResultLocPeer *peer_result = create_peer_result(block_scope->peer_parent); | 7203 | ResultLocPeer *peer_result = create_peer_result(block_scope->peer_parent); |
| 7195 | block_scope->peer_parent->peers.append(peer_result); | 7204 | block_scope->peer_parent->peers.append(peer_result); |
| 7196 | | 7205 | |
| 7197 | result_value = ir_gen_node_extra(ag, node->data.break_expr.expr, break_scope, block_scope->lval, | 7206 | result_value = astgen_node_extra(ag, node->data.break_expr.expr, break_scope, block_scope->lval, |
| 7198 | &peer_result->base); | 7207 | &peer_result->base); |
| 7199 | if (result_value == ag->codegen->invalid_inst_src) | 7208 | if (result_value == ag->codegen->invalid_inst_src) |
| 7200 | return ag->codegen->invalid_inst_src; | 7209 | return ag->codegen->invalid_inst_src; |
| ... | @@ -7203,7 +7212,7 @@ static IrInstSrc *ir_gen_return_from_block(Stage1AstGen *ag, Scope *break_scope, | ... | @@ -7203,7 +7212,7 @@ static IrInstSrc *ir_gen_return_from_block(Stage1AstGen *ag, Scope *break_scope, |
| 7203 | } | 7212 | } |
| 7204 | | 7213 | |
| 7205 | Stage1ZirBasicBlock *dest_block = block_scope->end_block; | 7214 | Stage1ZirBasicBlock *dest_block = block_scope->end_block; |
| 7206 | if (!ir_gen_defers_for_block(ag, break_scope, dest_block->scope, nullptr, nullptr)) | 7215 | if (!astgen_defers_for_block(ag, break_scope, dest_block->scope, nullptr, nullptr)) |
| 7207 | return ag->codegen->invalid_inst_src; | 7216 | return ag->codegen->invalid_inst_src; |
| 7208 | | 7217 | |
| 7209 | block_scope->incoming_blocks->append(ag->current_basic_block); | 7218 | block_scope->incoming_blocks->append(ag->current_basic_block); |
| ... | @@ -7211,7 +7220,7 @@ static IrInstSrc *ir_gen_return_from_block(Stage1AstGen *ag, Scope *break_scope, | ... | @@ -7211,7 +7220,7 @@ static IrInstSrc *ir_gen_return_from_block(Stage1AstGen *ag, Scope *break_scope, |
| 7211 | return ir_build_br(ag, break_scope, node, dest_block, is_comptime); | 7220 | return ir_build_br(ag, break_scope, node, dest_block, is_comptime); |
| 7212 | } | 7221 | } |
| 7213 | | 7222 | |
| 7214 | static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *node) { | 7223 | static IrInstSrc *astgen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *node) { |
| 7215 | assert(node->type == NodeTypeBreak); | 7224 | assert(node->type == NodeTypeBreak); |
| 7216 | | 7225 | |
| 7217 | // Search up the scope. We'll find one of these things first: | 7226 | // Search up the scope. We'll find one of these things first: |
| ... | @@ -7250,7 +7259,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no | ... | @@ -7250,7 +7259,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no |
| 7250 | { | 7259 | { |
| 7251 | assert(this_block_scope->end_block != nullptr); | 7260 | assert(this_block_scope->end_block != nullptr); |
| 7252 | this_block_scope->name_used = true; | 7261 | this_block_scope->name_used = true; |
| 7253 | return ir_gen_return_from_block(ag, break_scope, node, this_block_scope); | 7262 | return astgen_return_from_block(ag, break_scope, node, this_block_scope); |
| 7254 | } | 7263 | } |
| 7255 | } else if (search_scope->id == ScopeIdSuspend) { | 7264 | } else if (search_scope->id == ScopeIdSuspend) { |
| 7256 | add_node_error(ag->codegen, node, buf_sprintf("cannot break out of suspend block")); | 7265 | add_node_error(ag->codegen, node, buf_sprintf("cannot break out of suspend block")); |
| ... | @@ -7271,7 +7280,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no | ... | @@ -7271,7 +7280,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no |
| 7271 | ResultLocPeer *peer_result = create_peer_result(loop_scope->peer_parent); | 7280 | ResultLocPeer *peer_result = create_peer_result(loop_scope->peer_parent); |
| 7272 | loop_scope->peer_parent->peers.append(peer_result); | 7281 | loop_scope->peer_parent->peers.append(peer_result); |
| 7273 | | 7282 | |
| 7274 | result_value = ir_gen_node_extra(ag, node->data.break_expr.expr, break_scope, | 7283 | result_value = astgen_node_extra(ag, node->data.break_expr.expr, break_scope, |
| 7275 | loop_scope->lval, &peer_result->base); | 7284 | loop_scope->lval, &peer_result->base); |
| 7276 | if (result_value == ag->codegen->invalid_inst_src) | 7285 | if (result_value == ag->codegen->invalid_inst_src) |
| 7277 | return ag->codegen->invalid_inst_src; | 7286 | return ag->codegen->invalid_inst_src; |
| ... | @@ -7280,7 +7289,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no | ... | @@ -7280,7 +7289,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no |
| 7280 | } | 7289 | } |
| 7281 | | 7290 | |
| 7282 | Stage1ZirBasicBlock *dest_block = loop_scope->break_block; | 7291 | Stage1ZirBasicBlock *dest_block = loop_scope->break_block; |
| 7283 | if (!ir_gen_defers_for_block(ag, break_scope, dest_block->scope, nullptr, nullptr)) | 7292 | if (!astgen_defers_for_block(ag, break_scope, dest_block->scope, nullptr, nullptr)) |
| 7284 | return ag->codegen->invalid_inst_src; | 7293 | return ag->codegen->invalid_inst_src; |
| 7285 | | 7294 | |
| 7286 | loop_scope->incoming_blocks->append(ag->current_basic_block); | 7295 | loop_scope->incoming_blocks->append(ag->current_basic_block); |
| ... | @@ -7288,7 +7297,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no | ... | @@ -7288,7 +7297,7 @@ static IrInstSrc *ir_gen_break(Stage1AstGen *ag, Scope *break_scope, AstNode *no |
| 7288 | return ir_build_br(ag, break_scope, node, dest_block, is_comptime); | 7297 | return ir_build_br(ag, break_scope, node, dest_block, is_comptime); |
| 7289 | } | 7298 | } |
| 7290 | | 7299 | |
| 7291 | static IrInstSrc *ir_gen_continue(Stage1AstGen *ag, Scope *continue_scope, AstNode *node) { | 7300 | static IrInstSrc *astgen_continue(Stage1AstGen *ag, Scope *continue_scope, AstNode *node) { |
| 7292 | assert(node->type == NodeTypeContinue); | 7301 | assert(node->type == NodeTypeContinue); |
| 7293 | | 7302 | |
| 7294 | // Search up the scope. We'll find one of these things first: | 7303 | // Search up the scope. We'll find one of these things first: |
| ... | @@ -7342,17 +7351,17 @@ static IrInstSrc *ir_gen_continue(Stage1AstGen *ag, Scope *continue_scope, AstNo | ... | @@ -7342,17 +7351,17 @@ static IrInstSrc *ir_gen_continue(Stage1AstGen *ag, Scope *continue_scope, AstNo |
| 7342 | runtime_scopes.deinit(); | 7351 | runtime_scopes.deinit(); |
| 7343 | | 7352 | |
| 7344 | Stage1ZirBasicBlock *dest_block = loop_scope->continue_block; | 7353 | Stage1ZirBasicBlock *dest_block = loop_scope->continue_block; |
| 7345 | if (!ir_gen_defers_for_block(ag, continue_scope, dest_block->scope, nullptr, nullptr)) | 7354 | if (!astgen_defers_for_block(ag, continue_scope, dest_block->scope, nullptr, nullptr)) |
| 7346 | return ag->codegen->invalid_inst_src; | 7355 | return ag->codegen->invalid_inst_src; |
| 7347 | return ir_mark_gen(ir_build_br(ag, continue_scope, node, dest_block, is_comptime)); | 7356 | return ir_mark_gen(ir_build_br(ag, continue_scope, node, dest_block, is_comptime)); |
| 7348 | } | 7357 | } |
| 7349 | | 7358 | |
| 7350 | static IrInstSrc *ir_gen_error_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 7359 | static IrInstSrc *astgen_error_type(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 7351 | assert(node->type == NodeTypeErrorType); | 7360 | assert(node->type == NodeTypeErrorType); |
| 7352 | return ir_build_const_type(ag, scope, node, ag->codegen->builtin_types.entry_global_error_set); | 7361 | return ir_build_const_type(ag, scope, node, ag->codegen->builtin_types.entry_global_error_set); |
| 7353 | } | 7362 | } |
| 7354 | | 7363 | |
| 7355 | static IrInstSrc *ir_gen_defer(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { | 7364 | static IrInstSrc *astgen_defer(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { |
| 7356 | assert(node->type == NodeTypeDefer); | 7365 | assert(node->type == NodeTypeDefer); |
| 7357 | | 7366 | |
| 7358 | ScopeDefer *defer_child_scope = create_defer_scope(ag->codegen, node, parent_scope); | 7367 | ScopeDefer *defer_child_scope = create_defer_scope(ag->codegen, node, parent_scope); |
| ... | @@ -7364,7 +7373,7 @@ static IrInstSrc *ir_gen_defer(Stage1AstGen *ag, Scope *parent_scope, AstNode *n | ... | @@ -7364,7 +7373,7 @@ static IrInstSrc *ir_gen_defer(Stage1AstGen *ag, Scope *parent_scope, AstNode *n |
| 7364 | return ir_build_const_void(ag, parent_scope, node); | 7373 | return ir_build_const_void(ag, parent_scope, node); |
| 7365 | } | 7374 | } |
| 7366 | | 7375 | |
| 7367 | static IrInstSrc *ir_gen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { | 7376 | static IrInstSrc *astgen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { |
| 7368 | assert(node->type == NodeTypeSliceExpr); | 7377 | assert(node->type == NodeTypeSliceExpr); |
| 7369 | | 7378 | |
| 7370 | AstNodeSliceExpr *slice_expr = &node->data.slice_expr; | 7379 | AstNodeSliceExpr *slice_expr = &node->data.slice_expr; |
| ... | @@ -7373,17 +7382,17 @@ static IrInstSrc *ir_gen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LV | ... | @@ -7373,17 +7382,17 @@ static IrInstSrc *ir_gen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LV |
| 7373 | AstNode *end_node = slice_expr->end; | 7382 | AstNode *end_node = slice_expr->end; |
| 7374 | AstNode *sentinel_node = slice_expr->sentinel; | 7383 | AstNode *sentinel_node = slice_expr->sentinel; |
| 7375 | | 7384 | |
| 7376 | IrInstSrc *ptr_value = ir_gen_node_extra(ag, array_node, scope, LValPtr, nullptr); | 7385 | IrInstSrc *ptr_value = astgen_node_extra(ag, array_node, scope, LValPtr, nullptr); |
| 7377 | if (ptr_value == ag->codegen->invalid_inst_src) | 7386 | if (ptr_value == ag->codegen->invalid_inst_src) |
| 7378 | return ag->codegen->invalid_inst_src; | 7387 | return ag->codegen->invalid_inst_src; |
| 7379 | | 7388 | |
| 7380 | IrInstSrc *start_value = ir_gen_node(ag, start_node, scope); | 7389 | IrInstSrc *start_value = astgen_node(ag, start_node, scope); |
| 7381 | if (start_value == ag->codegen->invalid_inst_src) | 7390 | if (start_value == ag->codegen->invalid_inst_src) |
| 7382 | return ag->codegen->invalid_inst_src; | 7391 | return ag->codegen->invalid_inst_src; |
| 7383 | | 7392 | |
| 7384 | IrInstSrc *end_value; | 7393 | IrInstSrc *end_value; |
| 7385 | if (end_node) { | 7394 | if (end_node) { |
| 7386 | end_value = ir_gen_node(ag, end_node, scope); | 7395 | end_value = astgen_node(ag, end_node, scope); |
| 7387 | if (end_value == ag->codegen->invalid_inst_src) | 7396 | if (end_value == ag->codegen->invalid_inst_src) |
| 7388 | return ag->codegen->invalid_inst_src; | 7397 | return ag->codegen->invalid_inst_src; |
| 7389 | } else { | 7398 | } else { |
| ... | @@ -7392,7 +7401,7 @@ static IrInstSrc *ir_gen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LV | ... | @@ -7392,7 +7401,7 @@ static IrInstSrc *ir_gen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LV |
| 7392 | | 7401 | |
| 7393 | IrInstSrc *sentinel_value; | 7402 | IrInstSrc *sentinel_value; |
| 7394 | if (sentinel_node) { | 7403 | if (sentinel_node) { |
| 7395 | sentinel_value = ir_gen_node(ag, sentinel_node, scope); | 7404 | sentinel_value = astgen_node(ag, sentinel_node, scope); |
| 7396 | if (sentinel_value == ag->codegen->invalid_inst_src) | 7405 | if (sentinel_value == ag->codegen->invalid_inst_src) |
| 7397 | return ag->codegen->invalid_inst_src; | 7406 | return ag->codegen->invalid_inst_src; |
| 7398 | } else { | 7407 | } else { |
| ... | @@ -7404,7 +7413,7 @@ static IrInstSrc *ir_gen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LV | ... | @@ -7404,7 +7413,7 @@ static IrInstSrc *ir_gen_slice(Stage1AstGen *ag, Scope *scope, AstNode *node, LV |
| 7404 | return ir_lval_wrap(ag, scope, slice, lval, result_loc); | 7413 | return ir_lval_wrap(ag, scope, slice, lval, result_loc); |
| 7405 | } | 7414 | } |
| 7406 | | 7415 | |
| 7407 | static IrInstSrc *ir_gen_catch(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval, | 7416 | static IrInstSrc *astgen_catch(Stage1AstGen *ag, Scope *parent_scope, AstNode *node, LVal lval, |
| 7408 | ResultLoc *result_loc) | 7417 | ResultLoc *result_loc) |
| 7409 | { | 7418 | { |
| 7410 | assert(node->type == NodeTypeCatchExpr); | 7419 | assert(node->type == NodeTypeCatchExpr); |
| ... | @@ -7420,14 +7429,14 @@ static IrInstSrc *ir_gen_catch(Stage1AstGen *ag, Scope *parent_scope, AstNode *n | ... | @@ -7420,14 +7429,14 @@ static IrInstSrc *ir_gen_catch(Stage1AstGen *ag, Scope *parent_scope, AstNode *n |
| 7420 | add_node_error(ag->codegen, var_node, buf_sprintf("unused variable: '%s'", buf_ptr(var_name))); | 7429 | add_node_error(ag->codegen, var_node, buf_sprintf("unused variable: '%s'", buf_ptr(var_name))); |
| 7421 | return ag->codegen->invalid_inst_src; | 7430 | return ag->codegen->invalid_inst_src; |
| 7422 | } | 7431 | } |
| 7423 | return ir_gen_catch_unreachable(ag, parent_scope, node, op1_node, lval, result_loc); | 7432 | return astgen_catch_unreachable(ag, parent_scope, node, op1_node, lval, result_loc); |
| 7424 | } | 7433 | } |
| 7425 | | 7434 | |
| 7426 | | 7435 | |
| 7427 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, op1_node, parent_scope); | 7436 | ScopeExpr *spill_scope = create_expr_scope(ag->codegen, op1_node, parent_scope); |
| 7428 | spill_scope->spill_harder = true; | 7437 | spill_scope->spill_harder = true; |
| 7429 | | 7438 | |
| 7430 | IrInstSrc *err_union_ptr = ir_gen_node_extra(ag, op1_node, &spill_scope->base, LValPtr, nullptr); | 7439 | IrInstSrc *err_union_ptr = astgen_node_extra(ag, op1_node, &spill_scope->base, LValPtr, nullptr); |
| 7431 | if (err_union_ptr == ag->codegen->invalid_inst_src) | 7440 | if (err_union_ptr == ag->codegen->invalid_inst_src) |
| 7432 | return ag->codegen->invalid_inst_src; | 7441 | return ag->codegen->invalid_inst_src; |
| 7433 | | 7442 | |
| ... | @@ -7465,7 +7474,7 @@ static IrInstSrc *ir_gen_catch(Stage1AstGen *ag, Scope *parent_scope, AstNode *n | ... | @@ -7465,7 +7474,7 @@ static IrInstSrc *ir_gen_catch(Stage1AstGen *ag, Scope *parent_scope, AstNode *n |
| 7465 | } else { | 7474 | } else { |
| 7466 | err_scope = subexpr_scope; | 7475 | err_scope = subexpr_scope; |
| 7467 | } | 7476 | } |
| 7468 | IrInstSrc *err_result = ir_gen_node_extra(ag, op2_node, err_scope, LValNone, &peer_parent->peers.at(0)->base); | 7477 | IrInstSrc *err_result = astgen_node_extra(ag, op2_node, err_scope, LValNone, &peer_parent->peers.at(0)->base); |
| 7469 | if (err_result == ag->codegen->invalid_inst_src) | 7478 | if (err_result == ag->codegen->invalid_inst_src) |
| 7470 | return ag->codegen->invalid_inst_src; | 7479 | return ag->codegen->invalid_inst_src; |
| 7471 | Stage1ZirBasicBlock *after_err_block = ag->current_basic_block; | 7480 | Stage1ZirBasicBlock *after_err_block = ag->current_basic_block; |
| ... | @@ -7535,7 +7544,7 @@ Buf *get_anon_type_name(CodeGen *codegen, Stage1Zir *exec, const char *kind_name | ... | @@ -7535,7 +7544,7 @@ Buf *get_anon_type_name(CodeGen *codegen, Stage1Zir *exec, const char *kind_name |
| 7535 | } | 7544 | } |
| 7536 | } | 7545 | } |
| 7537 | | 7546 | |
| 7538 | static IrInstSrc *ir_gen_container_decl(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { | 7547 | static IrInstSrc *astgen_container_decl(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { |
| 7539 | assert(node->type == NodeTypeContainerDecl); | 7548 | assert(node->type == NodeTypeContainerDecl); |
| 7540 | | 7549 | |
| 7541 | ContainerKind kind = node->data.container_decl.kind; | 7550 | ContainerKind kind = node->data.container_decl.kind; |
| ... | @@ -7564,7 +7573,7 @@ static IrInstSrc *ir_gen_container_decl(Stage1AstGen *ag, Scope *parent_scope, A | ... | @@ -7564,7 +7573,7 @@ static IrInstSrc *ir_gen_container_decl(Stage1AstGen *ag, Scope *parent_scope, A |
| 7564 | return ir_build_const_type(ag, parent_scope, node, container_type); | 7573 | return ir_build_const_type(ag, parent_scope, node, container_type); |
| 7565 | } | 7574 | } |
| 7566 | | 7575 | |
| 7567 | static IrInstSrc *ir_gen_err_set_decl(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { | 7576 | static IrInstSrc *astgen_err_set_decl(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { |
| 7568 | assert(node->type == NodeTypeErrorSetDecl); | 7577 | assert(node->type == NodeTypeErrorSetDecl); |
| 7569 | | 7578 | |
| 7570 | uint32_t err_count = node->data.err_set_decl.decls.length; | 7579 | uint32_t err_count = node->data.err_set_decl.decls.length; |
| ... | @@ -7615,7 +7624,7 @@ static IrInstSrc *ir_gen_err_set_decl(Stage1AstGen *ag, Scope *parent_scope, Ast | ... | @@ -7615,7 +7624,7 @@ static IrInstSrc *ir_gen_err_set_decl(Stage1AstGen *ag, Scope *parent_scope, Ast |
| 7615 | return ir_build_const_type(ag, parent_scope, node, err_set_type); | 7624 | return ir_build_const_type(ag, parent_scope, node, err_set_type); |
| 7616 | } | 7625 | } |
| 7617 | | 7626 | |
| 7618 | static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { | 7627 | static IrInstSrc *astgen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { |
| 7619 | assert(node->type == NodeTypeFnProto); | 7628 | assert(node->type == NodeTypeFnProto); |
| 7620 | | 7629 | |
| 7621 | size_t param_count = node->data.fn_proto.params.length; | 7630 | size_t param_count = node->data.fn_proto.params.length; |
| ... | @@ -7630,7 +7639,7 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -7630,7 +7639,7 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 7630 | } | 7639 | } |
| 7631 | if (param_node->data.param_decl.anytype_token == 0) { | 7640 | if (param_node->data.param_decl.anytype_token == 0) { |
| 7632 | AstNode *type_node = param_node->data.param_decl.type; | 7641 | AstNode *type_node = param_node->data.param_decl.type; |
| 7633 | IrInstSrc *type_value = ir_gen_node(ag, type_node, parent_scope); | 7642 | IrInstSrc *type_value = astgen_node(ag, type_node, parent_scope); |
| 7634 | if (type_value == ag->codegen->invalid_inst_src) | 7643 | if (type_value == ag->codegen->invalid_inst_src) |
| 7635 | return ag->codegen->invalid_inst_src; | 7644 | return ag->codegen->invalid_inst_src; |
| 7636 | param_types[i] = type_value; | 7645 | param_types[i] = type_value; |
| ... | @@ -7641,14 +7650,14 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -7641,14 +7650,14 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 7641 | | 7650 | |
| 7642 | IrInstSrc *align_value = nullptr; | 7651 | IrInstSrc *align_value = nullptr; |
| 7643 | if (node->data.fn_proto.align_expr != nullptr) { | 7652 | if (node->data.fn_proto.align_expr != nullptr) { |
| 7644 | align_value = ir_gen_node(ag, node->data.fn_proto.align_expr, parent_scope); | 7653 | align_value = astgen_node(ag, node->data.fn_proto.align_expr, parent_scope); |
| 7645 | if (align_value == ag->codegen->invalid_inst_src) | 7654 | if (align_value == ag->codegen->invalid_inst_src) |
| 7646 | return ag->codegen->invalid_inst_src; | 7655 | return ag->codegen->invalid_inst_src; |
| 7647 | } | 7656 | } |
| 7648 | | 7657 | |
| 7649 | IrInstSrc *callconv_value = nullptr; | 7658 | IrInstSrc *callconv_value = nullptr; |
| 7650 | if (node->data.fn_proto.callconv_expr != nullptr) { | 7659 | if (node->data.fn_proto.callconv_expr != nullptr) { |
| 7651 | callconv_value = ir_gen_node(ag, node->data.fn_proto.callconv_expr, parent_scope); | 7660 | callconv_value = astgen_node(ag, node->data.fn_proto.callconv_expr, parent_scope); |
| 7652 | if (callconv_value == ag->codegen->invalid_inst_src) | 7661 | if (callconv_value == ag->codegen->invalid_inst_src) |
| 7653 | return ag->codegen->invalid_inst_src; | 7662 | return ag->codegen->invalid_inst_src; |
| 7654 | } | 7663 | } |
| ... | @@ -7657,7 +7666,7 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -7657,7 +7666,7 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 7657 | if (node->data.fn_proto.return_type == nullptr) { | 7666 | if (node->data.fn_proto.return_type == nullptr) { |
| 7658 | return_type = ir_build_const_type(ag, parent_scope, node, ag->codegen->builtin_types.entry_void); | 7667 | return_type = ir_build_const_type(ag, parent_scope, node, ag->codegen->builtin_types.entry_void); |
| 7659 | } else { | 7668 | } else { |
| 7660 | return_type = ir_gen_node(ag, node->data.fn_proto.return_type, parent_scope); | 7669 | return_type = astgen_node(ag, node->data.fn_proto.return_type, parent_scope); |
| 7661 | if (return_type == ag->codegen->invalid_inst_src) | 7670 | if (return_type == ag->codegen->invalid_inst_src) |
| 7662 | return ag->codegen->invalid_inst_src; | 7671 | return ag->codegen->invalid_inst_src; |
| 7663 | } | 7672 | } |
| ... | @@ -7665,17 +7674,17 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -7665,17 +7674,17 @@ static IrInstSrc *ir_gen_fn_proto(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 7665 | return ir_build_fn_proto(ag, parent_scope, node, param_types, align_value, callconv_value, return_type, is_var_args); | 7674 | return ir_build_fn_proto(ag, parent_scope, node, param_types, align_value, callconv_value, return_type, is_var_args); |
| 7666 | } | 7675 | } |
| 7667 | | 7676 | |
| 7668 | static IrInstSrc *ir_gen_resume(Stage1AstGen *ag, Scope *scope, AstNode *node) { | 7677 | static IrInstSrc *astgen_resume(Stage1AstGen *ag, Scope *scope, AstNode *node) { |
| 7669 | assert(node->type == NodeTypeResume); | 7678 | assert(node->type == NodeTypeResume); |
| 7670 | | 7679 | |
| 7671 | IrInstSrc *target_inst = ir_gen_node_extra(ag, node->data.resume_expr.expr, scope, LValPtr, nullptr); | 7680 | IrInstSrc *target_inst = astgen_node_extra(ag, node->data.resume_expr.expr, scope, LValPtr, nullptr); |
| 7672 | if (target_inst == ag->codegen->invalid_inst_src) | 7681 | if (target_inst == ag->codegen->invalid_inst_src) |
| 7673 | return ag->codegen->invalid_inst_src; | 7682 | return ag->codegen->invalid_inst_src; |
| 7674 | | 7683 | |
| 7675 | return ir_build_resume_src(ag, scope, node, target_inst); | 7684 | return ir_build_resume_src(ag, scope, node, target_inst); |
| 7676 | } | 7685 | } |
| 7677 | | 7686 | |
| 7678 | static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, | 7687 | static IrInstSrc *astgen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *node, LVal lval, |
| 7679 | ResultLoc *result_loc) | 7688 | ResultLoc *result_loc) |
| 7680 | { | 7689 | { |
| 7681 | assert(node->type == NodeTypeAwaitExpr); | 7690 | assert(node->type == NodeTypeAwaitExpr); |
| ... | @@ -7690,7 +7699,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -7690,7 +7699,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 7690 | if (entry != nullptr) { | 7699 | if (entry != nullptr) { |
| 7691 | BuiltinFnEntry *builtin_fn = entry->value; | 7700 | BuiltinFnEntry *builtin_fn = entry->value; |
| 7692 | if (builtin_fn->id == BuiltinFnIdAsyncCall) { | 7701 | if (builtin_fn->id == BuiltinFnIdAsyncCall) { |
| 7693 | return ir_gen_async_call(ag, scope, node, expr_node, lval, result_loc); | 7702 | return astgen_async_call(ag, scope, node, expr_node, lval, result_loc); |
| 7694 | } | 7703 | } |
| 7695 | } | 7704 | } |
| 7696 | } | 7705 | } |
| ... | @@ -7709,7 +7718,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -7709,7 +7718,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 7709 | return ag->codegen->invalid_inst_src; | 7718 | return ag->codegen->invalid_inst_src; |
| 7710 | } | 7719 | } |
| 7711 | | 7720 | |
| 7712 | IrInstSrc *target_inst = ir_gen_node_extra(ag, expr_node, scope, LValPtr, nullptr); | 7721 | IrInstSrc *target_inst = astgen_node_extra(ag, expr_node, scope, LValPtr, nullptr); |
| 7713 | if (target_inst == ag->codegen->invalid_inst_src) | 7722 | if (target_inst == ag->codegen->invalid_inst_src) |
| 7714 | return ag->codegen->invalid_inst_src; | 7723 | return ag->codegen->invalid_inst_src; |
| 7715 | | 7724 | |
| ... | @@ -7717,7 +7726,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod | ... | @@ -7717,7 +7726,7 @@ static IrInstSrc *ir_gen_await_expr(Stage1AstGen *ag, Scope *scope, AstNode *nod |
| 7717 | return ir_lval_wrap(ag, scope, await_inst, lval, result_loc); | 7726 | return ir_lval_wrap(ag, scope, await_inst, lval, result_loc); |
| 7718 | } | 7727 | } |
| 7719 | | 7728 | |
| 7720 | static IrInstSrc *ir_gen_suspend(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { | 7729 | static IrInstSrc *astgen_suspend(Stage1AstGen *ag, Scope *parent_scope, AstNode *node) { |
| 7721 | assert(node->type == NodeTypeSuspend); | 7730 | assert(node->type == NodeTypeSuspend); |
| 7722 | | 7731 | |
| 7723 | if (!ag->fn) { | 7732 | if (!ag->fn) { |
| ... | @@ -7742,7 +7751,7 @@ static IrInstSrc *ir_gen_suspend(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -7742,7 +7751,7 @@ static IrInstSrc *ir_gen_suspend(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 7742 | IrInstSrcSuspendBegin *begin = ir_build_suspend_begin_src(ag, parent_scope, node); | 7751 | IrInstSrcSuspendBegin *begin = ir_build_suspend_begin_src(ag, parent_scope, node); |
| 7743 | ScopeSuspend *suspend_scope = create_suspend_scope(ag->codegen, node, parent_scope); | 7752 | ScopeSuspend *suspend_scope = create_suspend_scope(ag->codegen, node, parent_scope); |
| 7744 | Scope *child_scope = &suspend_scope->base; | 7753 | Scope *child_scope = &suspend_scope->base; |
| 7745 | IrInstSrc *susp_res = ir_gen_node(ag, node->data.suspend.block, child_scope); | 7754 | IrInstSrc *susp_res = astgen_node(ag, node->data.suspend.block, child_scope); |
| 7746 | if (susp_res == ag->codegen->invalid_inst_src) | 7755 | if (susp_res == ag->codegen->invalid_inst_src) |
| 7747 | return ag->codegen->invalid_inst_src; | 7756 | return ag->codegen->invalid_inst_src; |
| 7748 | ir_mark_gen(ir_build_check_statement_is_void(ag, child_scope, node->data.suspend.block, susp_res)); | 7757 | ir_mark_gen(ir_build_check_statement_is_void(ag, child_scope, node->data.suspend.block, susp_res)); |
| ... | @@ -7750,7 +7759,7 @@ static IrInstSrc *ir_gen_suspend(Stage1AstGen *ag, Scope *parent_scope, AstNode | ... | @@ -7750,7 +7759,7 @@ static IrInstSrc *ir_gen_suspend(Stage1AstGen *ag, Scope *parent_scope, AstNode |
| 7750 | return ir_mark_gen(ir_build_suspend_finish_src(ag, parent_scope, node, begin)); | 7759 | return ir_mark_gen(ir_build_suspend_finish_src(ag, parent_scope, node, begin)); |
| 7751 | } | 7760 | } |
| 7752 | | 7761 | |
| 7753 | static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, | 7762 | static IrInstSrc *astgen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, |
| 7754 | LVal lval, ResultLoc *result_loc) | 7763 | LVal lval, ResultLoc *result_loc) |
| 7755 | { | 7764 | { |
| 7756 | assert(scope); | 7765 | assert(scope); |
| ... | @@ -7766,40 +7775,40 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, | ... | @@ -7766,40 +7775,40 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, |
| 7766 | case NodeTypeTestDecl: | 7775 | case NodeTypeTestDecl: |
| 7767 | zig_unreachable(); | 7776 | zig_unreachable(); |
| 7768 | case NodeTypeBlock: | 7777 | case NodeTypeBlock: |
| 7769 | return ir_gen_block(ag, scope, node, lval, result_loc); | 7778 | return astgen_block(ag, scope, node, lval, result_loc); |
| 7770 | case NodeTypeGroupedExpr: | 7779 | case NodeTypeGroupedExpr: |
| 7771 | return ir_gen_node_raw(ag, node->data.grouped_expr, scope, lval, result_loc); | 7780 | return astgen_node_raw(ag, node->data.grouped_expr, scope, lval, result_loc); |
| 7772 | case NodeTypeBinOpExpr: | 7781 | case NodeTypeBinOpExpr: |
| 7773 | return ir_gen_bin_op(ag, scope, node, lval, result_loc); | 7782 | return astgen_bin_op(ag, scope, node, lval, result_loc); |
| 7774 | case NodeTypeIntLiteral: | 7783 | case NodeTypeIntLiteral: |
| 7775 | return ir_lval_wrap(ag, scope, ir_gen_int_lit(ag, scope, node), lval, result_loc); | 7784 | return ir_lval_wrap(ag, scope, astgen_int_lit(ag, scope, node), lval, result_loc); |
| 7776 | case NodeTypeFloatLiteral: | 7785 | case NodeTypeFloatLiteral: |
| 7777 | return ir_lval_wrap(ag, scope, ir_gen_float_lit(ag, scope, node), lval, result_loc); | 7786 | return ir_lval_wrap(ag, scope, astgen_float_lit(ag, scope, node), lval, result_loc); |
| 7778 | case NodeTypeCharLiteral: | 7787 | case NodeTypeCharLiteral: |
| 7779 | return ir_lval_wrap(ag, scope, ir_gen_char_lit(ag, scope, node), lval, result_loc); | 7788 | return ir_lval_wrap(ag, scope, astgen_char_lit(ag, scope, node), lval, result_loc); |
| 7780 | case NodeTypeIdentifier: | 7789 | case NodeTypeIdentifier: |
| 7781 | return ir_gen_symbol(ag, scope, node, lval, result_loc); | 7790 | return astgen_identifier(ag, scope, node, lval, result_loc); |
| 7782 | case NodeTypeFnCallExpr: | 7791 | case NodeTypeFnCallExpr: |
| 7783 | return ir_gen_fn_call(ag, scope, node, lval, result_loc); | 7792 | return astgen_fn_call(ag, scope, node, lval, result_loc); |
| 7784 | case NodeTypeIfBoolExpr: | 7793 | case NodeTypeIfBoolExpr: |
| 7785 | return ir_gen_if_bool_expr(ag, scope, node, lval, result_loc); | 7794 | return astgen_if_bool_expr(ag, scope, node, lval, result_loc); |
| 7786 | case NodeTypePrefixOpExpr: | 7795 | case NodeTypePrefixOpExpr: |
| 7787 | return ir_gen_prefix_op_expr(ag, scope, node, lval, result_loc); | 7796 | return astgen_prefix_op_expr(ag, scope, node, lval, result_loc); |
| 7788 | case NodeTypeContainerInitExpr: | 7797 | case NodeTypeContainerInitExpr: |
| 7789 | return ir_gen_container_init_expr(ag, scope, node, lval, result_loc); | 7798 | return astgen_container_init_expr(ag, scope, node, lval, result_loc); |
| 7790 | case NodeTypeVariableDeclaration: | 7799 | case NodeTypeVariableDeclaration: |
| 7791 | return ir_gen_var_decl(ag, scope, node); | 7800 | return astgen_var_decl(ag, scope, node); |
| 7792 | case NodeTypeWhileExpr: | 7801 | case NodeTypeWhileExpr: |
| 7793 | return ir_gen_while_expr(ag, scope, node, lval, result_loc); | 7802 | return astgen_while_expr(ag, scope, node, lval, result_loc); |
| 7794 | case NodeTypeForExpr: | 7803 | case NodeTypeForExpr: |
| 7795 | return ir_gen_for_expr(ag, scope, node, lval, result_loc); | 7804 | return astgen_for_expr(ag, scope, node, lval, result_loc); |
| 7796 | case NodeTypeArrayAccessExpr: | 7805 | case NodeTypeArrayAccessExpr: |
| 7797 | return ir_gen_array_access(ag, scope, node, lval, result_loc); | 7806 | return astgen_array_access(ag, scope, node, lval, result_loc); |
| 7798 | case NodeTypeReturnExpr: | 7807 | case NodeTypeReturnExpr: |
| 7799 | return ir_gen_return(ag, scope, node, lval, result_loc); | 7808 | return astgen_return(ag, scope, node, lval, result_loc); |
| 7800 | case NodeTypeFieldAccessExpr: | 7809 | case NodeTypeFieldAccessExpr: |
| 7801 | { | 7810 | { |
| 7802 | IrInstSrc *ptr_instruction = ir_gen_field_access(ag, scope, node); | 7811 | IrInstSrc *ptr_instruction = astgen_field_access(ag, scope, node); |
| 7803 | if (ptr_instruction == ag->codegen->invalid_inst_src) | 7812 | if (ptr_instruction == ag->codegen->invalid_inst_src) |
| 7804 | return ptr_instruction; | 7813 | return ptr_instruction; |
| 7805 | if (lval == LValPtr || lval == LValAssign) | 7814 | if (lval == LValPtr || lval == LValAssign) |
| ... | @@ -7815,7 +7824,7 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, | ... | @@ -7815,7 +7824,7 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, |
| 7815 | if (child_lval == LValAssign) | 7824 | if (child_lval == LValAssign) |
| 7816 | child_lval = LValPtr; | 7825 | child_lval = LValPtr; |
| 7817 | | 7826 | |
| 7818 | IrInstSrc *value = ir_gen_node_extra(ag, expr_node, scope, child_lval, nullptr); | 7827 | IrInstSrc *value = astgen_node_extra(ag, expr_node, scope, child_lval, nullptr); |
| 7819 | if (value == ag->codegen->invalid_inst_src) | 7828 | if (value == ag->codegen->invalid_inst_src) |
| 7820 | return value; | 7829 | return value; |
| 7821 | | 7830 | |
| ... | @@ -7828,7 +7837,7 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, | ... | @@ -7828,7 +7837,7 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, |
| 7828 | case NodeTypeUnwrapOptional: { | 7837 | case NodeTypeUnwrapOptional: { |
| 7829 | AstNode *expr_node = node->data.unwrap_optional.expr; | 7838 | AstNode *expr_node = node->data.unwrap_optional.expr; |
| 7830 | | 7839 | |
| 7831 | IrInstSrc *maybe_ptr = ir_gen_node_extra(ag, expr_node, scope, LValPtr, nullptr); | 7840 | IrInstSrc *maybe_ptr = astgen_node_extra(ag, expr_node, scope, LValPtr, nullptr); |
| 7832 | if (maybe_ptr == ag->codegen->invalid_inst_src) | 7841 | if (maybe_ptr == ag->codegen->invalid_inst_src) |
| 7833 | return ag->codegen->invalid_inst_src; | 7842 | return ag->codegen->invalid_inst_src; |
| 7834 | | 7843 | |
| ... | @@ -7840,59 +7849,59 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, | ... | @@ -7840,59 +7849,59 @@ static IrInstSrc *ir_gen_node_raw(Stage1AstGen *ag, AstNode *node, Scope *scope, |
| 7840 | return ir_expr_wrap(ag, scope, load_ptr, result_loc); | 7849 | return ir_expr_wrap(ag, scope, load_ptr, result_loc); |
| 7841 | } | 7850 | } |
| 7842 | case NodeTypeBoolLiteral: | 7851 | case NodeTypeBoolLiteral: |
| 7843 | return ir_lval_wrap(ag, scope, ir_gen_bool_literal(ag, scope, node), lval, result_loc); | 7852 | return ir_lval_wrap(ag, scope, astgen_bool_literal(ag, scope, node), lval, result_loc); |
| 7844 | case NodeTypeArrayType: | 7853 | case NodeTypeArrayType: |
| 7845 | return ir_lval_wrap(ag, scope, ir_gen_array_type(ag, scope, node), lval, result_loc); | 7854 | return ir_lval_wrap(ag, scope, astgen_array_type(ag, scope, node), lval, result_loc); |
| 7846 | case NodeTypePointerType: | 7855 | case NodeTypePointerType: |
| 7847 | return ir_lval_wrap(ag, scope, ir_gen_pointer_type(ag, scope, node), lval, result_loc); | 7856 | return ir_lval_wrap(ag, scope, astgen_pointer_type(ag, scope, node), lval, result_loc); |
| 7848 | case NodeTypeAnyFrameType: | 7857 | case NodeTypeAnyFrameType: |
| 7849 | return ir_lval_wrap(ag, scope, ir_gen_anyframe_type(ag, scope, node), lval, result_loc); | 7858 | return ir_lval_wrap(ag, scope, astgen_anyframe_type(ag, scope, node), lval, result_loc); |
| 7850 | case NodeTypeStringLiteral: | 7859 | case NodeTypeStringLiteral: |
| 7851 | return ir_lval_wrap(ag, scope, ir_gen_string_literal(ag, scope, node), lval, result_loc); | 7860 | return ir_lval_wrap(ag, scope, astgen_string_literal(ag, scope, node), lval, result_loc); |
| 7852 | case NodeTypeUndefinedLiteral: | 7861 | case NodeTypeUndefinedLiteral: |
| 7853 | return ir_lval_wrap(ag, scope, ir_gen_undefined_literal(ag, scope, node), lval, result_loc); | 7862 | return ir_lval_wrap(ag, scope, astgen_undefined_literal(ag, scope, node), lval, result_loc); |
| 7854 | case NodeTypeAsmExpr: | 7863 | case NodeTypeAsmExpr: |
| 7855 | return ir_lval_wrap(ag, scope, ir_gen_asm_expr(ag, scope, node), lval, result_loc); | 7864 | return ir_lval_wrap(ag, scope, astgen_asm_expr(ag, scope, node), lval, result_loc); |
| 7856 | case NodeTypeNullLiteral: | 7865 | case NodeTypeNullLiteral: |
| 7857 | return ir_lval_wrap(ag, scope, ir_gen_null_literal(ag, scope, node), lval, result_loc); | 7866 | return ir_lval_wrap(ag, scope, astgen_null_literal(ag, scope, node), lval, result_loc); |
| 7858 | case NodeTypeIfErrorExpr: | 7867 | case NodeTypeIfErrorExpr: |
| 7859 | return ir_gen_if_err_expr(ag, scope, node, lval, result_loc); | 7868 | return astgen_if_err_expr(ag, scope, node, lval, result_loc); |
| 7860 | case NodeTypeIfOptional: | 7869 | case NodeTypeIfOptional: |
| 7861 | return ir_gen_if_optional_expr(ag, scope, node, lval, result_loc); | 7870 | return astgen_if_optional_expr(ag, scope, node, lval, result_loc); |
| 7862 | case NodeTypeSwitchExpr: | 7871 | case NodeTypeSwitchExpr: |
| 7863 | return ir_gen_switch_expr(ag, scope, node, lval, result_loc); | 7872 | return astgen_switch_expr(ag, scope, node, lval, result_loc); |
| 7864 | case NodeTypeCompTime: | 7873 | case NodeTypeCompTime: |
| 7865 | return ir_expr_wrap(ag, scope, ir_gen_comptime(ag, scope, node, lval), result_loc); | 7874 | return ir_expr_wrap(ag, scope, astgen_comptime(ag, scope, node, lval), result_loc); |
| 7866 | case NodeTypeNoSuspend: | 7875 | case NodeTypeNoSuspend: |
| 7867 | return ir_expr_wrap(ag, scope, ir_gen_nosuspend(ag, scope, node, lval), result_loc); | 7876 | return ir_expr_wrap(ag, scope, astgen_nosuspend(ag, scope, node, lval), result_loc); |
| 7868 | case NodeTypeErrorType: | 7877 | case NodeTypeErrorType: |
| 7869 | return ir_lval_wrap(ag, scope, ir_gen_error_type(ag, scope, node), lval, result_loc); | 7878 | return ir_lval_wrap(ag, scope, astgen_error_type(ag, scope, node), lval, result_loc); |
| 7870 | case NodeTypeBreak: | 7879 | case NodeTypeBreak: |
| 7871 | return ir_lval_wrap(ag, scope, ir_gen_break(ag, scope, node), lval, result_loc); | 7880 | return ir_lval_wrap(ag, scope, astgen_break(ag, scope, node), lval, result_loc); |
| 7872 | case NodeTypeContinue: | 7881 | case NodeTypeContinue: |
| 7873 | return ir_lval_wrap(ag, scope, ir_gen_continue(ag, scope, node), lval, result_loc); | 7882 | return ir_lval_wrap(ag, scope, astgen_continue(ag, scope, node), lval, result_loc); |
| 7874 | case NodeTypeUnreachable: | 7883 | case NodeTypeUnreachable: |
| 7875 | return ir_build_unreachable(ag, scope, node); | 7884 | return ir_build_unreachable(ag, scope, node); |
| 7876 | case NodeTypeDefer: | 7885 | case NodeTypeDefer: |
| 7877 | return ir_lval_wrap(ag, scope, ir_gen_defer(ag, scope, node), lval, result_loc); | 7886 | return ir_lval_wrap(ag, scope, astgen_defer(ag, scope, node), lval, result_loc); |
| 7878 | case NodeTypeSliceExpr: | 7887 | case NodeTypeSliceExpr: |
| 7879 | return ir_gen_slice(ag, scope, node, lval, result_loc); | 7888 | return astgen_slice(ag, scope, node, lval, result_loc); |
| 7880 | case NodeTypeCatchExpr: | 7889 | case NodeTypeCatchExpr: |
| 7881 | return ir_gen_catch(ag, scope, node, lval, result_loc); | 7890 | return astgen_catch(ag, scope, node, lval, result_loc); |
| 7882 | case NodeTypeContainerDecl: | 7891 | case NodeTypeContainerDecl: |
| 7883 | return ir_lval_wrap(ag, scope, ir_gen_container_decl(ag, scope, node), lval, result_loc); | 7892 | return ir_lval_wrap(ag, scope, astgen_container_decl(ag, scope, node), lval, result_loc); |
| 7884 | case NodeTypeFnProto: | 7893 | case NodeTypeFnProto: |
| 7885 | return ir_lval_wrap(ag, scope, ir_gen_fn_proto(ag, scope, node), lval, result_loc); | 7894 | return ir_lval_wrap(ag, scope, astgen_fn_proto(ag, scope, node), lval, result_loc); |
| 7886 | case NodeTypeErrorSetDecl: | 7895 | case NodeTypeErrorSetDecl: |
| 7887 | return ir_lval_wrap(ag, scope, ir_gen_err_set_decl(ag, scope, node), lval, result_loc); | 7896 | return ir_lval_wrap(ag, scope, astgen_err_set_decl(ag, scope, node), lval, result_loc); |
| 7888 | case NodeTypeResume: | 7897 | case NodeTypeResume: |
| 7889 | return ir_lval_wrap(ag, scope, ir_gen_resume(ag, scope, node), lval, result_loc); | 7898 | return ir_lval_wrap(ag, scope, astgen_resume(ag, scope, node), lval, result_loc); |
| 7890 | case NodeTypeAwaitExpr: | 7899 | case NodeTypeAwaitExpr: |
| 7891 | return ir_gen_await_expr(ag, scope, node, lval, result_loc); | 7900 | return astgen_await_expr(ag, scope, node, lval, result_loc); |
| 7892 | case NodeTypeSuspend: | 7901 | case NodeTypeSuspend: |
| 7893 | return ir_lval_wrap(ag, scope, ir_gen_suspend(ag, scope, node), lval, result_loc); | 7902 | return ir_lval_wrap(ag, scope, astgen_suspend(ag, scope, node), lval, result_loc); |
| 7894 | case NodeTypeEnumLiteral: | 7903 | case NodeTypeEnumLiteral: |
| 7895 | return ir_lval_wrap(ag, scope, ir_gen_enum_literal(ag, scope, node), lval, result_loc); | 7904 | return ir_lval_wrap(ag, scope, astgen_enum_literal(ag, scope, node), lval, result_loc); |
| 7896 | case NodeTypeInferredArrayType: | 7905 | case NodeTypeInferredArrayType: |
| 7897 | add_node_error(ag->codegen, node, | 7906 | add_node_error(ag->codegen, node, |
| 7898 | buf_sprintf("inferred array size invalid here")); | 7907 | buf_sprintf("inferred array size invalid here")); |
| ... | @@ -7910,7 +7919,7 @@ ResultLoc *no_result_loc(void) { | ... | @@ -7910,7 +7919,7 @@ ResultLoc *no_result_loc(void) { |
| 7910 | return &result_loc_none->base; | 7919 | return &result_loc_none->base; |
| 7911 | } | 7920 | } |
| 7912 | | 7921 | |
| 7913 | static IrInstSrc *ir_gen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scope, LVal lval, | 7922 | static IrInstSrc *astgen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scope, LVal lval, |
| 7914 | ResultLoc *result_loc) | 7923 | ResultLoc *result_loc) |
| 7915 | { | 7924 | { |
| 7916 | if (lval == LValAssign) { | 7925 | if (lval == LValAssign) { |
| ... | @@ -8018,7 +8027,7 @@ static IrInstSrc *ir_gen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scop | ... | @@ -8018,7 +8027,7 @@ static IrInstSrc *ir_gen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scop |
| 8018 | } else { | 8027 | } else { |
| 8019 | child_scope = &create_expr_scope(ag->codegen, node, scope)->base; | 8028 | child_scope = &create_expr_scope(ag->codegen, node, scope)->base; |
| 8020 | } | 8029 | } |
| 8021 | IrInstSrc *result = ir_gen_node_raw(ag, node, child_scope, lval, result_loc); | 8030 | IrInstSrc *result = astgen_node_raw(ag, node, child_scope, lval, result_loc); |
| 8022 | if (result == ag->codegen->invalid_inst_src) { | 8031 | if (result == ag->codegen->invalid_inst_src) { |
| 8023 | if (ag->exec->first_err_trace_msg == nullptr) { | 8032 | if (ag->exec->first_err_trace_msg == nullptr) { |
| 8024 | ag->exec->first_err_trace_msg = ag->codegen->trace_err; | 8033 | ag->exec->first_err_trace_msg = ag->codegen->trace_err; |
| ... | @@ -8027,8 +8036,8 @@ static IrInstSrc *ir_gen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scop | ... | @@ -8027,8 +8036,8 @@ static IrInstSrc *ir_gen_node_extra(Stage1AstGen *ag, AstNode *node, Scope *scop |
| 8027 | return result; | 8036 | return result; |
| 8028 | } | 8037 | } |
| 8029 | | 8038 | |
| 8030 | static IrInstSrc *ir_gen_node(Stage1AstGen *ag, AstNode *node, Scope *scope) { | 8039 | static IrInstSrc *astgen_node(Stage1AstGen *ag, AstNode *node, Scope *scope) { |
| 8031 | return ir_gen_node_extra(ag, node, scope, LValNone, nullptr); | 8040 | return astgen_node_extra(ag, node, scope, LValNone, nullptr); |
| 8032 | } | 8041 | } |
| 8033 | | 8042 | |
| 8034 | bool stage1_astgen(CodeGen *codegen, AstNode *node, Scope *scope, Stage1Zir *stage1_zir, | 8043 | bool stage1_astgen(CodeGen *codegen, AstNode *node, Scope *scope, Stage1Zir *stage1_zir, |
| ... | @@ -8050,7 +8059,7 @@ bool stage1_astgen(CodeGen *codegen, AstNode *node, Scope *scope, Stage1Zir *sta | ... | @@ -8050,7 +8059,7 @@ bool stage1_astgen(CodeGen *codegen, AstNode *node, Scope *scope, Stage1Zir *sta |
| 8050 | // Entry block gets a reference because we enter it to begin. | 8059 | // Entry block gets a reference because we enter it to begin. |
| 8051 | ir_ref_bb(ag->current_basic_block); | 8060 | ir_ref_bb(ag->current_basic_block); |
| 8052 | | 8061 | |
| 8053 | IrInstSrc *result = ir_gen_node_extra(ag, node, scope, LValNone, nullptr); | 8062 | IrInstSrc *result = astgen_node_extra(ag, node, scope, LValNone, nullptr); |
| 8054 | | 8063 | |
| 8055 | if (result == ag->codegen->invalid_inst_src) | 8064 | if (result == ag->codegen->invalid_inst_src) |
| 8056 | return false; | 8065 | return false; |