diff options
| -rw-r--r-- | src/AstGen.zig | 10 | ||||
| -rw-r--r-- | src/codegen/llvm.zig | 30 |
2 files changed, 28 insertions, 12 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index c8225602ae..3b77462fde 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -4588,12 +4588,12 @@ fn finishThenElseBlock( } else { _ = try else_scope.addBreak(break_tag, main_block, .void_value); } - const block_ref = parent_gz.indexToRef(main_block); if (strat.elide_store_to_block_ptr_instructions) { - try setCondBrPayloadElideBlockStorePtr(condbr, cond, then_scope, else_scope, block_ref); + try setCondBrPayloadElideBlockStorePtr(condbr, cond, then_scope, else_scope, block_scope.rl_ptr); } else { try setCondBrPayload(condbr, cond, then_scope, else_scope); } + const block_ref = parent_gz.indexToRef(main_block); switch (rl) { .ref => return block_ref, else => return rvalue(parent_gz, parent_scope, rl, block_ref, node), @@ -4909,7 +4909,7 @@ fn setCondBrPayloadElideBlockStorePtr( cond: Zir.Inst.Ref, then_scope: *GenZir, else_scope: *GenZir, - main_block: Zir.Inst.Ref, + block_ptr: Zir.Inst.Ref, ) !void { const astgen = then_scope.astgen; @@ -4930,7 +4930,7 @@ fn setCondBrPayloadElideBlockStorePtr( for (then_scope.instructions.items) |src_inst| { if (zir_tags[src_inst] == .store_to_block_ptr) { - if (zir_datas[src_inst].bin.lhs == main_block) { + if (zir_datas[src_inst].bin.lhs == block_ptr) { astgen.extra.items[then_body_len_index] -= 1; continue; } @@ -4939,7 +4939,7 @@ fn setCondBrPayloadElideBlockStorePtr( } for (else_scope.instructions.items) |src_inst| { if (zir_tags[src_inst] == .store_to_block_ptr) { - if (zir_datas[src_inst].bin.lhs == main_block) { + if (zir_datas[src_inst].bin.lhs == block_ptr) { astgen.extra.items[else_body_len_index] -= 1; continue; } diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 0ba14f98ba..7a069bca57 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -193,14 +193,9 @@ pub const Object = struct { try stderr.print( \\Zig is expecting LLVM to understand this target: '{s}' \\However LLVM responded with: "{s}" - \\Zig is unable to continue. This is a bug in Zig: - \\https://github.com/ziglang/zig/issues/438 \\ , - .{ - llvm_target_triple, - error_message, - }, + .{ llvm_target_triple, error_message }, ); return error.InvalidLLVMTriple; } @@ -431,6 +426,7 @@ pub const DeclGen = struct { } fn getLLVMType(self: *DeclGen, t: Type) error{ OutOfMemory, CodegenFail }!*const llvm.Type { + log.debug("getLLVMType for {}", .{t}); switch (t.zigTypeTag()) { .Void => return self.context().voidType(), .NoReturn => return self.context().voidType(), @@ -465,7 +461,27 @@ pub const DeclGen = struct { return self.todo("implement optional pointers as actual pointers", .{}); } }, - else => return self.todo("implement getLLVMType for type '{}'", .{t}), + .ComptimeInt => unreachable, + .ComptimeFloat => unreachable, + .Type => unreachable, + .Undefined => unreachable, + .Null => unreachable, + .EnumLiteral => unreachable, + + .BoundFn => @panic("TODO remove BoundFn from the language"), + + .Float, + .Struct, + .ErrorUnion, + .ErrorSet, + .Enum, + .Union, + .Fn, + .Opaque, + .Frame, + .AnyFrame, + .Vector, + => return self.todo("implement getLLVMType for type '{}'", .{t}), } } |
