authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-05-01 20:57:56-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-05-01 20:57:56-04:00
log3dbe02e2d8cda1fe0072e71ae7630170c270419e
tree17c9c46c8774fc8e5972efca9a3e58089edec32c
parent3386bb896d071eef4ff571fac399e18b2270a382
parent09d6dc1ce6cf90712eee72ec6cdf9e9ec2ceb370
signature Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #5247 from mikdusan/housekeeping

stage1: cleanup

2 files changed, 5 insertions(+), 7 deletions(-)

src/all_types.hpp-1
...@@ -3453,7 +3453,6 @@ struct IrInstSrcOptionalUnwrapPtr {...@@ -3453,7 +3453,6 @@ struct IrInstSrcOptionalUnwrapPtr {
34533453
3454 IrInstSrc *base_ptr;3454 IrInstSrc *base_ptr;
3455 bool safety_check_on;3455 bool safety_check_on;
3456 bool initializing;
3457};3456};
34583457
3459struct IrInstGenOptionalUnwrapPtr {3458struct IrInstGenOptionalUnwrapPtr {
src/ir.cpp+5-6
...@@ -2967,12 +2967,11 @@ static IrInstGen *ir_build_test_non_null_gen(IrAnalyze *ira, IrInst *source_inst...@@ -2967,12 +2967,11 @@ static IrInstGen *ir_build_test_non_null_gen(IrAnalyze *ira, IrInst *source_inst
2967}2967}
29682968
2969static IrInstSrc *ir_build_optional_unwrap_ptr(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,2969static IrInstSrc *ir_build_optional_unwrap_ptr(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
2970 IrInstSrc *base_ptr, bool safety_check_on, bool initializing)2970 IrInstSrc *base_ptr, bool safety_check_on)
2971{2971{
2972 IrInstSrcOptionalUnwrapPtr *instruction = ir_build_instruction<IrInstSrcOptionalUnwrapPtr>(irb, scope, source_node);2972 IrInstSrcOptionalUnwrapPtr *instruction = ir_build_instruction<IrInstSrcOptionalUnwrapPtr>(irb, scope, source_node);
2973 instruction->base_ptr = base_ptr;2973 instruction->base_ptr = base_ptr;
2974 instruction->safety_check_on = safety_check_on;2974 instruction->safety_check_on = safety_check_on;
2975 instruction->initializing = initializing;
29762975
2977 ir_ref_instruction(base_ptr, irb->current_basic_block);2976 ir_ref_instruction(base_ptr, irb->current_basic_block);
29782977
...@@ -5721,7 +5720,7 @@ static IrInstSrc *ir_gen_orelse(IrBuilderSrc *irb, Scope *parent_scope, AstNode...@@ -5721,7 +5720,7 @@ static IrInstSrc *ir_gen_orelse(IrBuilderSrc *irb, Scope *parent_scope, AstNode
5721 ir_mark_gen(ir_build_br(irb, parent_scope, node, end_block, is_comptime));5720 ir_mark_gen(ir_build_br(irb, parent_scope, node, end_block, is_comptime));
57225721
5723 ir_set_cursor_at_end_and_append_block(irb, ok_block);5722 ir_set_cursor_at_end_and_append_block(irb, ok_block);
5724 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, parent_scope, node, maybe_ptr, false, false);5723 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, parent_scope, node, maybe_ptr, false);
5725 IrInstSrc *unwrapped_payload = ir_build_load_ptr(irb, parent_scope, node, unwrapped_ptr);5724 IrInstSrc *unwrapped_payload = ir_build_load_ptr(irb, parent_scope, node, unwrapped_ptr);
5726 ir_build_end_expr(irb, parent_scope, node, unwrapped_payload, &peer_parent->peers.at(1)->base);5725 ir_build_end_expr(irb, parent_scope, node, unwrapped_payload, &peer_parent->peers.at(1)->base);
5727 IrBasicBlockSrc *after_ok_block = irb->current_basic_block;5726 IrBasicBlockSrc *after_ok_block = irb->current_basic_block;
...@@ -8080,7 +8079,7 @@ static IrInstSrc *ir_gen_while_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no...@@ -8080,7 +8079,7 @@ static IrInstSrc *ir_gen_while_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no
8080 is_comptime);8079 is_comptime);
80818080
8082 ir_set_cursor_at_end_and_append_block(irb, body_block);8081 ir_set_cursor_at_end_and_append_block(irb, body_block);
8083 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, &spill_scope->base, symbol_node, maybe_val_ptr, false, false);8082 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, &spill_scope->base, symbol_node, maybe_val_ptr, false);
8084 IrInstSrc *var_value = node->data.while_expr.var_is_ptr ?8083 IrInstSrc *var_value = node->data.while_expr.var_is_ptr ?
8085 payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, symbol_node, payload_ptr);8084 payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, symbol_node, payload_ptr);
8086 build_decl_var_and_init(irb, child_scope, symbol_node, payload_var, var_value, buf_ptr(var_symbol), is_comptime);8085 build_decl_var_and_init(irb, child_scope, symbol_node, payload_var, var_value, buf_ptr(var_symbol), is_comptime);
...@@ -8743,7 +8742,7 @@ static IrInstSrc *ir_gen_if_optional_expr(IrBuilderSrc *irb, Scope *scope, AstNo...@@ -8743,7 +8742,7 @@ static IrInstSrc *ir_gen_if_optional_expr(IrBuilderSrc *irb, Scope *scope, AstNo
8743 ZigVar *var = ir_create_var(irb, node, subexpr_scope,8742 ZigVar *var = ir_create_var(irb, node, subexpr_scope,
8744 var_symbol, is_const, is_const, is_shadowable, is_comptime);8743 var_symbol, is_const, is_const, is_shadowable, is_comptime);
87458744
8746 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, subexpr_scope, node, maybe_val_ptr, false, false);8745 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, subexpr_scope, node, maybe_val_ptr, false);
8747 IrInstSrc *var_value = var_is_ptr ?8746 IrInstSrc *var_value = var_is_ptr ?
8748 payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, node, payload_ptr);8747 payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, node, payload_ptr);
8749 build_decl_var_and_init(irb, subexpr_scope, node, var, var_value, buf_ptr(var_symbol), is_comptime);8748 build_decl_var_and_init(irb, subexpr_scope, node, var, var_value, buf_ptr(var_symbol), is_comptime);
...@@ -9987,7 +9986,7 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope...@@ -9987,7 +9986,7 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope
9987 if (maybe_ptr == irb->codegen->invalid_inst_src)9986 if (maybe_ptr == irb->codegen->invalid_inst_src)
9988 return irb->codegen->invalid_inst_src;9987 return irb->codegen->invalid_inst_src;
99899988
9990 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, scope, node, maybe_ptr, true, false);9989 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, scope, node, maybe_ptr, true );
9991 if (lval == LValPtr || lval == LValAssign)9990 if (lval == LValPtr || lval == LValAssign)
9992 return unwrapped_ptr;9991 return unwrapped_ptr;
99939992