| author | |
| committer | |
| log | 78632894dabec3c20ee2ff4348e03cfa565477ef |
| tree | 6019fb67dc5b1a5d71df11522b37a6b2d99738df |
| parent | e83cf6a4542b34e7fd64028a3b1b89dacdc2e166 |
2 files changed, 28 insertions(+), 12 deletions(-)
src/AstGen.zig+5-5| ... | ... | @@ -4588,12 +4588,12 @@ fn finishThenElseBlock( |
| 4588 | 4588 | } else { |
| 4589 | 4589 | _ = try else_scope.addBreak(break_tag, main_block, .void_value); |
| 4590 | 4590 | } |
| 4591 | const block_ref = parent_gz.indexToRef(main_block); | |
| 4592 | 4591 | if (strat.elide_store_to_block_ptr_instructions) { |
| 4593 | try setCondBrPayloadElideBlockStorePtr(condbr, cond, then_scope, else_scope, block_ref); | |
| 4592 | try setCondBrPayloadElideBlockStorePtr(condbr, cond, then_scope, else_scope, block_scope.rl_ptr); | |
| 4594 | 4593 | } else { |
| 4595 | 4594 | try setCondBrPayload(condbr, cond, then_scope, else_scope); |
| 4596 | 4595 | } |
| 4596 | const block_ref = parent_gz.indexToRef(main_block); | |
| 4597 | 4597 | switch (rl) { |
| 4598 | 4598 | .ref => return block_ref, |
| 4599 | 4599 | else => return rvalue(parent_gz, parent_scope, rl, block_ref, node), |
| ... | ... | @@ -4909,7 +4909,7 @@ fn setCondBrPayloadElideBlockStorePtr( |
| 4909 | 4909 | cond: Zir.Inst.Ref, |
| 4910 | 4910 | then_scope: *GenZir, |
| 4911 | 4911 | else_scope: *GenZir, |
| 4912 | main_block: Zir.Inst.Ref, | |
| 4912 | block_ptr: Zir.Inst.Ref, | |
| 4913 | 4913 | ) !void { |
| 4914 | 4914 | const astgen = then_scope.astgen; |
| 4915 | 4915 | |
| ... | ... | @@ -4930,7 +4930,7 @@ fn setCondBrPayloadElideBlockStorePtr( |
| 4930 | 4930 | |
| 4931 | 4931 | for (then_scope.instructions.items) |src_inst| { |
| 4932 | 4932 | if (zir_tags[src_inst] == .store_to_block_ptr) { |
| 4933 | if (zir_datas[src_inst].bin.lhs == main_block) { | |
| 4933 | if (zir_datas[src_inst].bin.lhs == block_ptr) { | |
| 4934 | 4934 | astgen.extra.items[then_body_len_index] -= 1; |
| 4935 | 4935 | continue; |
| 4936 | 4936 | } |
| ... | ... | @@ -4939,7 +4939,7 @@ fn setCondBrPayloadElideBlockStorePtr( |
| 4939 | 4939 | } |
| 4940 | 4940 | for (else_scope.instructions.items) |src_inst| { |
| 4941 | 4941 | if (zir_tags[src_inst] == .store_to_block_ptr) { |
| 4942 | if (zir_datas[src_inst].bin.lhs == main_block) { | |
| 4942 | if (zir_datas[src_inst].bin.lhs == block_ptr) { | |
| 4943 | 4943 | astgen.extra.items[else_body_len_index] -= 1; |
| 4944 | 4944 | continue; |
| 4945 | 4945 | } |
src/codegen/llvm.zig+23-7| ... | ... | @@ -193,14 +193,9 @@ pub const Object = struct { |
| 193 | 193 | try stderr.print( |
| 194 | 194 | \\Zig is expecting LLVM to understand this target: '{s}' |
| 195 | 195 | \\However LLVM responded with: "{s}" |
| 196 | \\Zig is unable to continue. This is a bug in Zig: | |
| 197 | \\https://github.com/ziglang/zig/issues/438 | |
| 198 | 196 | \\ |
| 199 | 197 | , |
| 200 | .{ | |
| 201 | llvm_target_triple, | |
| 202 | error_message, | |
| 203 | }, | |
| 198 | .{ llvm_target_triple, error_message }, | |
| 204 | 199 | ); |
| 205 | 200 | return error.InvalidLLVMTriple; |
| 206 | 201 | } |
| ... | ... | @@ -431,6 +426,7 @@ pub const DeclGen = struct { |
| 431 | 426 | } |
| 432 | 427 | |
| 433 | 428 | fn getLLVMType(self: *DeclGen, t: Type) error{ OutOfMemory, CodegenFail }!*const llvm.Type { |
| 429 | log.debug("getLLVMType for {}", .{t}); | |
| 434 | 430 | switch (t.zigTypeTag()) { |
| 435 | 431 | .Void => return self.context().voidType(), |
| 436 | 432 | .NoReturn => return self.context().voidType(), |
| ... | ... | @@ -465,7 +461,27 @@ pub const DeclGen = struct { |
| 465 | 461 | return self.todo("implement optional pointers as actual pointers", .{}); |
| 466 | 462 | } |
| 467 | 463 | }, |
| 468 | else => return self.todo("implement getLLVMType for type '{}'", .{t}), | |
| 464 | .ComptimeInt => unreachable, | |
| 465 | .ComptimeFloat => unreachable, | |
| 466 | .Type => unreachable, | |
| 467 | .Undefined => unreachable, | |
| 468 | .Null => unreachable, | |
| 469 | .EnumLiteral => unreachable, | |
| 470 | ||
| 471 | .BoundFn => @panic("TODO remove BoundFn from the language"), | |
| 472 | ||
| 473 | .Float, | |
| 474 | .Struct, | |
| 475 | .ErrorUnion, | |
| 476 | .ErrorSet, | |
| 477 | .Enum, | |
| 478 | .Union, | |
| 479 | .Fn, | |
| 480 | .Opaque, | |
| 481 | .Frame, | |
| 482 | .AnyFrame, | |
| 483 | .Vector, | |
| 484 | => return self.todo("implement getLLVMType for type '{}'", .{t}), | |
| 469 | 485 | } |
| 470 | 486 | } |
| 471 | 487 |