| ... | @@ -219,7 +219,7 @@ pub const LLVMIRModule = struct { | ... | @@ -219,7 +219,7 @@ pub const LLVMIRModule = struct { |
| 219 | | 219 | |
| 220 | var error_message: [*:0]const u8 = undefined; | 220 | var error_message: [*:0]const u8 = undefined; |
| 221 | var target: *const llvm.Target = undefined; | 221 | var target: *const llvm.Target = undefined; |
| 222 | if (llvm.Target.getFromTriple(llvm_target_triple.ptr, &target, &error_message)) { | 222 | if (llvm.Target.getFromTriple(llvm_target_triple.ptr, &target, &error_message).toBool()) { |
| 223 | defer llvm.disposeMessage(error_message); | 223 | defer llvm.disposeMessage(error_message); |
| 224 | | 224 | |
| 225 | const stderr = std.io.getStdErr().writer(); | 225 | const stderr = std.io.getStdErr().writer(); |
| ... | @@ -303,7 +303,7 @@ pub const LLVMIRModule = struct { | ... | @@ -303,7 +303,7 @@ pub const LLVMIRModule = struct { |
| 303 | // verifyModule always allocs the error_message even if there is no error | 303 | // verifyModule always allocs the error_message even if there is no error |
| 304 | defer llvm.disposeMessage(error_message); | 304 | defer llvm.disposeMessage(error_message); |
| 305 | | 305 | |
| 306 | if (self.llvm_module.verify(.ReturnStatus, &error_message)) { | 306 | if (self.llvm_module.verify(.ReturnStatus, &error_message).toBool()) { |
| 307 | const stderr = std.io.getStdErr().writer(); | 307 | const stderr = std.io.getStdErr().writer(); |
| 308 | try stderr.print("broken LLVM module found: {s}\nThis is a bug in the Zig compiler.", .{error_message}); | 308 | try stderr.print("broken LLVM module found: {s}\nThis is a bug in the Zig compiler.", .{error_message}); |
| 309 | return error.BrokenLLVMModule; | 309 | return error.BrokenLLVMModule; |
| ... | @@ -319,7 +319,7 @@ pub const LLVMIRModule = struct { | ... | @@ -319,7 +319,7 @@ pub const LLVMIRModule = struct { |
| 319 | object_pathZ.ptr, | 319 | object_pathZ.ptr, |
| 320 | .ObjectFile, | 320 | .ObjectFile, |
| 321 | &error_message, | 321 | &error_message, |
| 322 | )) { | 322 | ).toBool()) { |
| 323 | defer llvm.disposeMessage(error_message); | 323 | defer llvm.disposeMessage(error_message); |
| 324 | | 324 | |
| 325 | const stderr = std.io.getStdErr().writer(); | 325 | const stderr = std.io.getStdErr().writer(); |
| ... | @@ -614,7 +614,7 @@ pub const LLVMIRModule = struct { | ... | @@ -614,7 +614,7 @@ pub const LLVMIRModule = struct { |
| 614 | | 614 | |
| 615 | var indices: [2]*const llvm.Value = .{ | 615 | var indices: [2]*const llvm.Value = .{ |
| 616 | index_type.constNull(), | 616 | index_type.constNull(), |
| 617 | index_type.constInt(1, false), | 617 | index_type.constInt(1, .False), |
| 618 | }; | 618 | }; |
| 619 | | 619 | |
| 620 | return self.builder.buildLoad(self.builder.buildInBoundsGEP(operand, &indices, 2, ""), ""); | 620 | return self.builder.buildLoad(self.builder.buildInBoundsGEP(operand, &indices, 2, ""), ""); |
| ... | @@ -676,7 +676,7 @@ pub const LLVMIRModule = struct { | ... | @@ -676,7 +676,7 @@ pub const LLVMIRModule = struct { |
| 676 | const signed = inst.base.ty.isSignedInt(); | 676 | const signed = inst.base.ty.isSignedInt(); |
| 677 | // TODO: Should we use intcast here or just a simple bitcast? | 677 | // TODO: Should we use intcast here or just a simple bitcast? |
| 678 | // LLVM does truncation vs bitcast (+signed extension) in the intcast depending on the sizes | 678 | // LLVM does truncation vs bitcast (+signed extension) in the intcast depending on the sizes |
| 679 | return self.builder.buildIntCast2(val, try self.getLLVMType(inst.base.ty, inst.base.src), signed, ""); | 679 | return self.builder.buildIntCast2(val, try self.getLLVMType(inst.base.ty, inst.base.src), llvm.Bool.fromBool(signed), ""); |
| 680 | } | 680 | } |
| 681 | | 681 | |
| 682 | fn genBitCast(self: *LLVMIRModule, inst: *Inst.UnOp) !?*const llvm.Value { | 682 | fn genBitCast(self: *LLVMIRModule, inst: *Inst.UnOp) !?*const llvm.Value { |
| ... | @@ -782,7 +782,7 @@ pub const LLVMIRModule = struct { | ... | @@ -782,7 +782,7 @@ pub const LLVMIRModule = struct { |
| 782 | if (bigint.limbs.len != 1) { | 782 | if (bigint.limbs.len != 1) { |
| 783 | return self.fail(src, "TODO implement bigger bigint", .{}); | 783 | return self.fail(src, "TODO implement bigger bigint", .{}); |
| 784 | } | 784 | } |
| 785 | const llvm_int = llvm_type.constInt(bigint.limbs[0], false); | 785 | const llvm_int = llvm_type.constInt(bigint.limbs[0], .False); |
| 786 | if (!bigint.positive) { | 786 | if (!bigint.positive) { |
| 787 | return llvm.constNeg(llvm_int); | 787 | return llvm.constNeg(llvm_int); |
| 788 | } | 788 | } |
| ... | @@ -820,7 +820,7 @@ pub const LLVMIRModule = struct { | ... | @@ -820,7 +820,7 @@ pub const LLVMIRModule = struct { |
| 820 | return self.fail(src, "TODO handle other sentinel values", .{}); | 820 | return self.fail(src, "TODO handle other sentinel values", .{}); |
| 821 | } else false; | 821 | } else false; |
| 822 | | 822 | |
| 823 | return self.context.constString(payload.data.ptr, @intCast(c_uint, payload.data.len), !zero_sentinel); | 823 | return self.context.constString(payload.data.ptr, @intCast(c_uint, payload.data.len), llvm.Bool.fromBool(!zero_sentinel)); |
| 824 | } else { | 824 | } else { |
| 825 | return self.fail(src, "TODO handle more array values", .{}); | 825 | return self.fail(src, "TODO handle more array values", .{}); |
| 826 | } | 826 | } |
| ... | @@ -836,13 +836,13 @@ pub const LLVMIRModule = struct { | ... | @@ -836,13 +836,13 @@ pub const LLVMIRModule = struct { |
| 836 | llvm_child_type.constNull(), | 836 | llvm_child_type.constNull(), |
| 837 | self.context.intType(1).constNull(), | 837 | self.context.intType(1).constNull(), |
| 838 | }; | 838 | }; |
| 839 | return self.context.constStruct(&optional_values, 2, false); | 839 | return self.context.constStruct(&optional_values, 2, .False); |
| 840 | } else { | 840 | } else { |
| 841 | var optional_values: [2]*const llvm.Value = .{ | 841 | var optional_values: [2]*const llvm.Value = .{ |
| 842 | try self.genTypedValue(src, .{ .ty = child_type, .val = tv.val }), | 842 | try self.genTypedValue(src, .{ .ty = child_type, .val = tv.val }), |
| 843 | self.context.intType(1).constAllOnes(), | 843 | self.context.intType(1).constAllOnes(), |
| 844 | }; | 844 | }; |
| 845 | return self.context.constStruct(&optional_values, 2, false); | 845 | return self.context.constStruct(&optional_values, 2, .False); |
| 846 | } | 846 | } |
| 847 | } else { | 847 | } else { |
| 848 | return self.fail(src, "TODO implement const of optional pointer", .{}); | 848 | return self.fail(src, "TODO implement const of optional pointer", .{}); |
| ... | @@ -882,7 +882,7 @@ pub const LLVMIRModule = struct { | ... | @@ -882,7 +882,7 @@ pub const LLVMIRModule = struct { |
| 882 | try self.getLLVMType(child_type, src), | 882 | try self.getLLVMType(child_type, src), |
| 883 | self.context.intType(1), | 883 | self.context.intType(1), |
| 884 | }; | 884 | }; |
| 885 | return self.context.structType(&optional_types, 2, false); | 885 | return self.context.structType(&optional_types, 2, .False); |
| 886 | } else { | 886 | } else { |
| 887 | return self.fail(src, "TODO implement optional pointers as actual pointers", .{}); | 887 | return self.fail(src, "TODO implement optional pointers as actual pointers", .{}); |
| 888 | } | 888 | } |
| ... | @@ -934,7 +934,7 @@ pub const LLVMIRModule = struct { | ... | @@ -934,7 +934,7 @@ pub const LLVMIRModule = struct { |
| 934 | try self.getLLVMType(return_type, src), | 934 | try self.getLLVMType(return_type, src), |
| 935 | if (fn_param_len == 0) null else llvm_param.ptr, | 935 | if (fn_param_len == 0) null else llvm_param.ptr, |
| 936 | @intCast(c_uint, fn_param_len), | 936 | @intCast(c_uint, fn_param_len), |
| 937 | false, | 937 | .False, |
| 938 | ); | 938 | ); |
| 939 | const llvm_fn = self.llvm_module.addFunction(func.name, fn_type); | 939 | const llvm_fn = self.llvm_module.addFunction(func.name, fn_type); |
| 940 | | 940 | |