authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-08-07 07:45:36-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-08-08 21:32:50-04:00
log49cc1bff086e9c521c110b35692a87f75e25c7ad
tree27b9b730b13634960acd413a88da53a23374be4a
parent6577f52614e21dc43ccc2eb9ab80eeaa4fde9cd4

llvm: finish converting intrinsics


6 files changed, 525 insertions(+), 249 deletions(-)

src/codegen/llvm.zig+190-191
......@@ -5466,7 +5466,7 @@ pub const FuncGen = struct {
54665466 const result_alignment = Builder.Alignment.fromByteUnits(va_list_ty.abiAlignment(mod));
54675467 const dest_list = try self.buildAlloca(llvm_va_list_ty, result_alignment);
54685468
5469 _ = try self.wip.callIntrinsic(.va_copy, &.{}, &.{ dest_list, src_list }, "");
5469 _ = try self.wip.callIntrinsic(.none, .va_copy, &.{}, &.{ dest_list, src_list }, "");
54705470 return if (isByRef(va_list_ty, mod))
54715471 dest_list
54725472 else
......@@ -5477,7 +5477,7 @@ pub const FuncGen = struct {
54775477 const un_op = self.air.instructions.items(.data)[inst].un_op;
54785478 const src_list = try self.resolveInst(un_op);
54795479
5480 _ = try self.wip.callIntrinsic(.va_end, &.{}, &.{src_list}, "");
5480 _ = try self.wip.callIntrinsic(.none, .va_end, &.{}, &.{src_list}, "");
54815481 return .none;
54825482 }
54835483
......@@ -5490,7 +5490,7 @@ pub const FuncGen = struct {
54905490 const result_alignment = Builder.Alignment.fromByteUnits(va_list_ty.abiAlignment(mod));
54915491 const dest_list = try self.buildAlloca(llvm_va_list_ty, result_alignment);
54925492
5493 _ = try self.wip.callIntrinsic(.va_start, &.{}, &.{dest_list}, "");
5493 _ = try self.wip.callIntrinsic(.none, .va_start, &.{}, &.{dest_list}, "");
54945494 return if (isByRef(va_list_ty, mod))
54955495 dest_list
54965496 else
......@@ -5600,8 +5600,8 @@ pub const FuncGen = struct {
56005600 const both_pl_block_end = self.wip.cursor.block;
56015601
56025602 self.wip.cursor = .{ .block = end_block };
5603 const llvm_i1_0 = try o.builder.intValue(.i1, 0);
5604 const llvm_i1_1 = try o.builder.intValue(.i1, 1);
5603 const llvm_i1_0 = Builder.Value.false;
5604 const llvm_i1_1 = Builder.Value.true;
56055605 const incoming_values: [3]Builder.Value = .{
56065606 switch (op) {
56075607 .eq => llvm_i1_1,
......@@ -5822,7 +5822,7 @@ pub const FuncGen = struct {
58225822 if (can_elide_load)
58235823 return payload_ptr;
58245824
5825 return fg.loadByRef(payload_ptr, payload_ty, payload_alignment, false);
5825 return fg.loadByRef(payload_ptr, payload_ty, payload_alignment, .normal);
58265826 }
58275827 const load_ty = err_union_llvm_ty.structFields(&o.builder)[offset];
58285828 return fg.wip.load(.normal, load_ty, payload_ptr, payload_alignment, "");
......@@ -6121,7 +6121,7 @@ pub const FuncGen = struct {
61216121 return ptr;
61226122
61236123 const elem_alignment = Builder.Alignment.fromByteUnits(elem_ty.abiAlignment(mod));
6124 return self.loadByRef(ptr, elem_ty, elem_alignment, false);
6124 return self.loadByRef(ptr, elem_ty, elem_alignment, .normal);
61256125 }
61266126
61276127 return self.load(ptr, slice_ty);
......@@ -6161,7 +6161,7 @@ pub const FuncGen = struct {
61616161 try self.wip.gep(.inbounds, array_llvm_ty, array_llvm_val, &indices, "");
61626162 if (canElideLoad(self, body_tail)) return elem_ptr;
61636163 const elem_alignment = Builder.Alignment.fromByteUnits(elem_ty.abiAlignment(mod));
6164 return self.loadByRef(elem_ptr, elem_ty, elem_alignment, false);
6164 return self.loadByRef(elem_ptr, elem_ty, elem_alignment, .normal);
61656165 } else {
61666166 const elem_llvm_ty = try o.lowerType(elem_ty);
61676167 if (Air.refToIndex(bin_op.lhs)) |lhs_index| {
......@@ -6221,7 +6221,7 @@ pub const FuncGen = struct {
62216221 if (isByRef(elem_ty, mod)) {
62226222 if (self.canElideLoad(body_tail)) return ptr;
62236223 const elem_alignment = Builder.Alignment.fromByteUnits(elem_ty.abiAlignment(mod));
6224 return self.loadByRef(ptr, elem_ty, elem_alignment, false);
6224 return self.loadByRef(ptr, elem_ty, elem_alignment, .normal);
62256225 }
62266226
62276227 return self.load(ptr, ptr_ty);
......@@ -6351,7 +6351,7 @@ pub const FuncGen = struct {
63516351
63526352 assert(llvm_field.alignment != 0);
63536353 const field_alignment = Builder.Alignment.fromByteUnits(llvm_field.alignment);
6354 return self.loadByRef(field_ptr, field_ty, field_alignment, false);
6354 return self.loadByRef(field_ptr, field_ty, field_alignment, .normal);
63556355 } else {
63566356 return self.load(field_ptr, field_ptr_ty);
63576357 }
......@@ -6366,7 +6366,7 @@ pub const FuncGen = struct {
63666366 const payload_alignment = Builder.Alignment.fromByteUnits(layout.payload_align);
63676367 if (isByRef(field_ty, mod)) {
63686368 if (canElideLoad(self, body_tail)) return field_ptr;
6369 return self.loadByRef(field_ptr, field_ty, payload_alignment, false);
6369 return self.loadByRef(field_ptr, field_ty, payload_alignment, .normal);
63706370 } else {
63716371 return self.wip.load(.normal, llvm_field_ty, field_ptr, payload_alignment, "");
63726372 }
......@@ -7150,7 +7150,7 @@ pub const FuncGen = struct {
71507150 const payload_ptr = try self.wip.gepStruct(err_union_llvm_ty, operand, offset, "");
71517151 if (isByRef(payload_ty, mod)) {
71527152 if (self.canElideLoad(body_tail)) return payload_ptr;
7153 return self.loadByRef(payload_ptr, payload_ty, payload_alignment, false);
7153 return self.loadByRef(payload_ptr, payload_ty, payload_alignment, .normal);
71547154 }
71557155 const payload_llvm_ty = err_union_llvm_ty.structFields(&o.builder)[offset];
71567156 return self.wip.load(.normal, payload_llvm_ty, payload_ptr, payload_alignment, "");
......@@ -7346,7 +7346,7 @@ pub const FuncGen = struct {
73467346 const o = self.dg.object;
73477347 const pl_op = self.air.instructions.items(.data)[inst].pl_op;
73487348 const index = pl_op.payload;
7349 return self.wip.callIntrinsic(.@"wasm.memory.size", &.{.i32}, &.{
7349 return self.wip.callIntrinsic(.none, .@"wasm.memory.size", &.{.i32}, &.{
73507350 try o.builder.intValue(.i32, index),
73517351 }, "");
73527352 }
......@@ -7355,7 +7355,7 @@ pub const FuncGen = struct {
73557355 const o = self.dg.object;
73567356 const pl_op = self.air.instructions.items(.data)[inst].pl_op;
73577357 const index = pl_op.payload;
7358 return self.wip.callIntrinsic(.@"wasm.memory.grow", &.{.i32}, &.{
7358 return self.wip.callIntrinsic(.none, .@"wasm.memory.grow", &.{.i32}, &.{
73597359 try o.builder.intValue(.i32, index), try self.resolveInst(pl_op.operand),
73607360 }, "");
73617361 }
......@@ -7371,13 +7371,11 @@ pub const FuncGen = struct {
73717371 const index = try self.resolveInst(extra.lhs);
73727372 const operand = try self.resolveInst(extra.rhs);
73737373
7374 const kind: Builder.MemoryAccessKind = switch (vector_ptr_ty.isVolatilePtr(mod)) {
7375 false => .normal,
7376 true => .@"volatile",
7377 };
7374 const access_kind: Builder.MemoryAccessKind =
7375 if (vector_ptr_ty.isVolatilePtr(mod)) .@"volatile" else .normal;
73787376 const elem_llvm_ty = try o.lowerType(vector_ptr_ty.childType(mod));
73797377 const alignment = Builder.Alignment.fromByteUnits(vector_ptr_ty.ptrAlignment(mod));
7380 const loaded = try self.wip.load(kind, elem_llvm_ty, vector_ptr, alignment, "");
7378 const loaded = try self.wip.load(access_kind, elem_llvm_ty, vector_ptr, alignment, "");
73817379
73827380 const new_vector = try self.wip.insertElement(loaded, operand, index, "");
73837381 _ = try self.store(vector_ptr, vector_ptr_ty, new_vector, .none);
......@@ -7395,6 +7393,7 @@ pub const FuncGen = struct {
73957393
73967394 if (scalar_ty.isAnyFloat()) return self.buildFloatOp(.fmin, inst_ty, 2, .{ lhs, rhs });
73977395 return self.wip.callIntrinsic(
7396 .none,
73987397 if (scalar_ty.isSignedInt(mod)) .smin else .umin,
73997398 &.{try o.lowerType(inst_ty)},
74007399 &.{ lhs, rhs },
......@@ -7413,6 +7412,7 @@ pub const FuncGen = struct {
74137412
74147413 if (scalar_ty.isAnyFloat()) return self.buildFloatOp(.fmax, inst_ty, 2, .{ lhs, rhs });
74157414 return self.wip.callIntrinsic(
7415 .none,
74167416 if (scalar_ty.isSignedInt(mod)) .smax else .umax,
74177417 &.{try o.lowerType(inst_ty)},
74187418 &.{ lhs, rhs },
......@@ -7462,12 +7462,19 @@ pub const FuncGen = struct {
74627462
74637463 const intrinsic = if (scalar_ty.isSignedInt(mod)) signed_intrinsic else unsigned_intrinsic;
74647464 const llvm_inst_ty = try o.lowerType(inst_ty);
7465 const results = try fg.wip.callIntrinsic(intrinsic, &.{llvm_inst_ty}, &.{ lhs, rhs }, "");
7465 const results =
7466 try fg.wip.callIntrinsic(.none, intrinsic, &.{llvm_inst_ty}, &.{ lhs, rhs }, "");
74667467
74677468 const overflow_bits = try fg.wip.extractValue(results, &.{1}, "");
74687469 const overflow_bits_ty = overflow_bits.typeOfWip(&fg.wip);
74697470 const overflow_bit = if (overflow_bits_ty.isVector(&o.builder))
7470 try fg.wip.callIntrinsic(.@"vector.reduce.or", &.{overflow_bits_ty}, &.{overflow_bits}, "")
7471 try fg.wip.callIntrinsic(
7472 .none,
7473 .@"vector.reduce.or",
7474 &.{overflow_bits_ty},
7475 &.{overflow_bits},
7476 "",
7477 )
74717478 else
74727479 overflow_bits;
74737480
......@@ -7501,6 +7508,7 @@ pub const FuncGen = struct {
75017508
75027509 if (scalar_ty.isAnyFloat()) return self.todo("saturating float add", .{});
75037510 return self.wip.callIntrinsic(
7511 .none,
75047512 if (scalar_ty.isSignedInt(mod)) .@"sadd.sat" else .@"uadd.sat",
75057513 &.{try o.lowerType(inst_ty)},
75067514 &.{ lhs, rhs },
......@@ -7542,6 +7550,7 @@ pub const FuncGen = struct {
75427550
75437551 if (scalar_ty.isAnyFloat()) return self.todo("saturating float sub", .{});
75447552 return self.wip.callIntrinsic(
7553 .none,
75457554 if (scalar_ty.isSignedInt(mod)) .@"ssub.sat" else .@"usub.sat",
75467555 &.{try o.lowerType(inst_ty)},
75477556 &.{ lhs, rhs },
......@@ -7583,6 +7592,7 @@ pub const FuncGen = struct {
75837592
75847593 if (scalar_ty.isAnyFloat()) return self.todo("saturating float mul", .{});
75857594 return self.wip.callIntrinsic(
7595 .none,
75867596 if (scalar_ty.isSignedInt(mod)) .@"smul.fix.sat" else .@"umul.fix.sat",
75877597 &.{try o.lowerType(inst_ty)},
75887598 &.{ lhs, rhs, try o.builder.intValue(.i32, 0) },
......@@ -7793,7 +7803,8 @@ pub const FuncGen = struct {
77937803 const intrinsic = if (scalar_ty.isSignedInt(mod)) signed_intrinsic else unsigned_intrinsic;
77947804 const llvm_inst_ty = try o.lowerType(inst_ty);
77957805 const llvm_lhs_ty = try o.lowerType(lhs_ty);
7796 const results = try self.wip.callIntrinsic(intrinsic, &.{llvm_lhs_ty}, &.{ lhs, rhs }, "");
7806 const results =
7807 try self.wip.callIntrinsic(.none, intrinsic, &.{llvm_lhs_ty}, &.{ lhs, rhs }, "");
77977808
77987809 const result_val = try self.wip.extractValue(results, &.{0}, "");
77997810 const overflow_bit = try self.wip.extractValue(results, &.{1}, "");
......@@ -7998,27 +8009,49 @@ pub const FuncGen = struct {
79988009 if (op != .tan and intrinsicsAllowed(scalar_ty, target)) switch (op) {
79998010 // Some operations are dedicated LLVM instructions, not available as intrinsics
80008011 .neg => return self.wip.un(.fneg, params[0], ""),
8001 .add => return self.wip.bin(.fadd, params[0], params[1], ""),
8002 .sub => return self.wip.bin(.fsub, params[0], params[1], ""),
8003 .mul => return self.wip.bin(.fmul, params[0], params[1], ""),
8004 .div => return self.wip.bin(.fdiv, params[0], params[1], ""),
8005 .fmod => return self.wip.bin(.frem, params[0], params[1], ""),
8006 .fmax => return self.wip.callIntrinsic(.maxnum, &.{llvm_ty}, &params, ""),
8007 .fmin => return self.wip.callIntrinsic(.minnum, &.{llvm_ty}, &params, ""),
8008 .ceil => return self.wip.callIntrinsic(.ceil, &.{llvm_ty}, &params, ""),
8009 .cos => return self.wip.callIntrinsic(.cos, &.{llvm_ty}, &params, ""),
8010 .exp => return self.wip.callIntrinsic(.exp, &.{llvm_ty}, &params, ""),
8011 .exp2 => return self.wip.callIntrinsic(.exp2, &.{llvm_ty}, &params, ""),
8012 .fabs => return self.wip.callIntrinsic(.fabs, &.{llvm_ty}, &params, ""),
8013 .floor => return self.wip.callIntrinsic(.floor, &.{llvm_ty}, &params, ""),
8014 .log => return self.wip.callIntrinsic(.log, &.{llvm_ty}, &params, ""),
8015 .log10 => return self.wip.callIntrinsic(.log10, &.{llvm_ty}, &params, ""),
8016 .log2 => return self.wip.callIntrinsic(.log2, &.{llvm_ty}, &params, ""),
8017 .round => return self.wip.callIntrinsic(.round, &.{llvm_ty}, &params, ""),
8018 .sin => return self.wip.callIntrinsic(.sin, &.{llvm_ty}, &params, ""),
8019 .sqrt => return self.wip.callIntrinsic(.sqrt, &.{llvm_ty}, &params, ""),
8020 .trunc => return self.wip.callIntrinsic(.trunc, &.{llvm_ty}, &params, ""),
8021 .fma => return self.wip.callIntrinsic(.fma, &.{llvm_ty}, &params, ""),
8012 .add, .sub, .mul, .div, .fmod => return self.wip.bin(switch (op) {
8013 .add => .fadd,
8014 .sub => .fsub,
8015 .mul => .fmul,
8016 .div => .fdiv,
8017 .fmod => .frem,
8018 else => unreachable,
8019 }, params[0], params[1], ""),
8020 .fmax,
8021 .fmin,
8022 .ceil,
8023 .cos,
8024 .exp,
8025 .exp2,
8026 .fabs,
8027 .floor,
8028 .log,
8029 .log10,
8030 .log2,
8031 .round,
8032 .sin,
8033 .sqrt,
8034 .trunc,
8035 .fma,
8036 => return self.wip.callIntrinsic(.none, switch (op) {
8037 .fmax => .maxnum,
8038 .fmin => .minnum,
8039 .ceil => .ceil,
8040 .cos => .cos,
8041 .exp => .exp,
8042 .exp2 => .exp2,
8043 .fabs => .fabs,
8044 .floor => .floor,
8045 .log => .log,
8046 .log10 => .log10,
8047 .log2 => .log2,
8048 .round => .round,
8049 .sin => .sin,
8050 .sqrt => .sqrt,
8051 .trunc => .trunc,
8052 .fma => .fma,
8053 else => unreachable,
8054 }, &.{llvm_ty}, &params, ""),
80228055 .tan => unreachable,
80238056 };
80248057
......@@ -8215,6 +8248,7 @@ pub const FuncGen = struct {
82158248 const llvm_lhs_ty = try o.lowerType(lhs_ty);
82168249 const llvm_lhs_scalar_ty = llvm_lhs_ty.scalarType(&o.builder);
82178250 const result = try self.wip.callIntrinsic(
8251 .none,
82188252 if (lhs_scalar_ty.isSignedInt(mod)) .@"sshl.sat" else .@"ushl.sat",
82198253 &.{llvm_lhs_ty},
82208254 &.{ lhs, casted_rhs },
......@@ -8588,21 +8622,14 @@ pub const FuncGen = struct {
85888622 // Even if safety is disabled, we still emit a memset to undefined since it conveys
85898623 // extra information to LLVM. However, safety makes the difference between using
85908624 // 0xaa or actual undefined for the fill byte.
8591 const fill_byte = if (safety)
8592 try o.builder.intConst(.i8, 0xaa)
8593 else
8594 try o.builder.undefConst(.i8);
8595 const operand_size = operand_ty.abiSize(mod);
8596 const usize_ty = try o.lowerType(Type.usize);
8597 const len = try o.builder.intValue(usize_ty, operand_size);
8598 const dest_ptr_align = Builder.Alignment.fromByteUnits(ptr_ty.ptrAlignment(mod));
8599 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemSet(
8600 dest_ptr.toLlvm(&self.wip),
8601 fill_byte.toLlvm(&o.builder),
8602 len.toLlvm(&self.wip),
8603 @intCast(dest_ptr_align.toByteUnits() orelse 0),
8604 ptr_ty.isVolatilePtr(mod),
8605 ), &self.wip);
8625 const len = try o.builder.intValue(try o.lowerType(Type.usize), operand_ty.abiSize(mod));
8626 _ = try self.wip.callMemSet(
8627 dest_ptr,
8628 Builder.Alignment.fromByteUnits(ptr_ty.ptrAlignment(mod)),
8629 if (safety) try o.builder.intValue(.i8, 0xaa) else try o.builder.undefValue(.i8),
8630 len,
8631 if (ptr_ty.isVolatilePtr(mod)) .@"volatile" else .normal,
8632 );
86068633 if (safety and mod.comp.bin_file.options.valgrind) {
86078634 try self.valgrindMarkUndef(dest_ptr, len);
86088635 }
......@@ -8655,14 +8682,14 @@ pub const FuncGen = struct {
86558682
86568683 fn airTrap(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
86578684 _ = inst;
8658 _ = try self.wip.callIntrinsic(.trap, &.{}, &.{}, "");
8685 _ = try self.wip.callIntrinsic(.none, .trap, &.{}, &.{}, "");
86598686 _ = try self.wip.@"unreachable"();
86608687 return .none;
86618688 }
86628689
86638690 fn airBreakpoint(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
86648691 _ = inst;
8665 _ = try self.wip.callIntrinsic(.debugtrap, &.{}, &.{}, "");
8692 _ = try self.wip.callIntrinsic(.none, .debugtrap, &.{}, &.{}, "");
86668693 return .none;
86678694 }
86688695
......@@ -8674,7 +8701,7 @@ pub const FuncGen = struct {
86748701 // https://github.com/ziglang/zig/issues/11946
86758702 return o.builder.intValue(llvm_usize, 0);
86768703 }
8677 const result = try self.wip.callIntrinsic(.returnaddress, &.{}, &.{
8704 const result = try self.wip.callIntrinsic(.none, .returnaddress, &.{}, &.{
86788705 try o.builder.intValue(.i32, 0),
86798706 }, "");
86808707 return self.wip.cast(.ptrtoint, result, llvm_usize, "");
......@@ -8683,7 +8710,7 @@ pub const FuncGen = struct {
86838710 fn airFrameAddress(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
86848711 _ = inst;
86858712 const o = self.dg.object;
8686 const result = try self.wip.callIntrinsic(.frameaddress, &.{.ptr}, &.{
8713 const result = try self.wip.callIntrinsic(.none, .frameaddress, &.{.ptr}, &.{
86878714 try o.builder.intValue(.i32, 0),
86888715 }, "");
86898716 return self.wip.cast(.ptrtoint, result, try o.lowerType(Type.usize), "");
......@@ -8835,16 +8862,14 @@ pub const FuncGen = struct {
88358862 const ptr_alignment = Builder.Alignment.fromByteUnits(
88368863 info.flags.alignment.toByteUnitsOptional() orelse info.child.toType().abiAlignment(mod),
88378864 );
8838 const ptr_kind: Builder.MemoryAccessKind = switch (info.flags.is_volatile) {
8839 false => .normal,
8840 true => .@"volatile",
8841 };
8865 const access_kind: Builder.MemoryAccessKind =
8866 if (info.flags.is_volatile) .@"volatile" else .normal;
88428867 const elem_llvm_ty = try o.lowerType(elem_ty);
88438868
88448869 if (llvm_abi_ty != .none) {
88458870 // operand needs widening and truncating
88468871 const loaded = try self.wip.loadAtomic(
8847 ptr_kind,
8872 access_kind,
88488873 llvm_abi_ty,
88498874 ptr,
88508875 self.sync_scope,
......@@ -8855,7 +8880,7 @@ pub const FuncGen = struct {
88558880 return self.wip.cast(.trunc, loaded, elem_llvm_ty, "");
88568881 }
88578882 return self.wip.loadAtomic(
8858 ptr_kind,
8883 access_kind,
88598884 elem_llvm_ty,
88608885 ptr,
88618886 self.sync_scope,
......@@ -8902,7 +8927,8 @@ pub const FuncGen = struct {
89028927 const elem_ty = self.typeOf(bin_op.rhs);
89038928 const dest_ptr_align = Builder.Alignment.fromByteUnits(ptr_ty.ptrAlignment(mod));
89048929 const dest_ptr = try self.sliceOrArrayPtr(dest_slice, ptr_ty);
8905 const is_volatile = ptr_ty.isVolatilePtr(mod);
8930 const access_kind: Builder.MemoryAccessKind =
8931 if (ptr_ty.isVolatilePtr(mod)) .@"volatile" else .normal;
89068932
89078933 // Any WebAssembly runtime will trap when the destination pointer is out-of-bounds, regardless
89088934 // of the length. This means we need to emit a check where we skip the memset when the length
......@@ -8923,17 +8949,10 @@ pub const FuncGen = struct {
89238949 try o.builder.undefValue(.i8);
89248950 const len = try self.sliceOrArrayLenInBytes(dest_slice, ptr_ty);
89258951 if (intrinsic_len0_traps) {
8926 try self.safeWasmMemset(dest_ptr, fill_byte, len, dest_ptr_align, is_volatile);
8952 try self.safeWasmMemset(dest_ptr, fill_byte, len, dest_ptr_align, access_kind);
89278953 } else {
8928 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemSet(
8929 dest_ptr.toLlvm(&self.wip),
8930 fill_byte.toLlvm(&self.wip),
8931 len.toLlvm(&self.wip),
8932 @intCast(dest_ptr_align.toByteUnits() orelse 0),
8933 is_volatile,
8934 ), &self.wip);
8954 _ = try self.wip.callMemSet(dest_ptr, dest_ptr_align, fill_byte, len, access_kind);
89358955 }
8936
89378956 if (safety and mod.comp.bin_file.options.valgrind) {
89388957 try self.valgrindMarkUndef(dest_ptr, len);
89398958 }
......@@ -8945,19 +8964,12 @@ pub const FuncGen = struct {
89458964 // repeating byte pattern of 0 bytes. In such case, the memset
89468965 // intrinsic can be used.
89478966 if (try elem_val.hasRepeatedByteRepr(elem_ty, mod)) |byte_val| {
8948 const fill_byte = try self.resolveValue(.{ .ty = Type.u8, .val = byte_val });
8967 const fill_byte = try o.builder.intValue(.i8, byte_val);
89498968 const len = try self.sliceOrArrayLenInBytes(dest_slice, ptr_ty);
8950
89518969 if (intrinsic_len0_traps) {
8952 try self.safeWasmMemset(dest_ptr, fill_byte.toValue(), len, dest_ptr_align, is_volatile);
8970 try self.safeWasmMemset(dest_ptr, fill_byte, len, dest_ptr_align, access_kind);
89538971 } else {
8954 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemSet(
8955 dest_ptr.toLlvm(&self.wip),
8956 fill_byte.toLlvm(&o.builder),
8957 len.toLlvm(&self.wip),
8958 @intCast(dest_ptr_align.toByteUnits() orelse 0),
8959 is_volatile,
8960 ), &self.wip);
8972 _ = try self.wip.callMemSet(dest_ptr, dest_ptr_align, fill_byte, len, access_kind);
89618973 }
89628974 return .none;
89638975 }
......@@ -8972,15 +8984,9 @@ pub const FuncGen = struct {
89728984 const len = try self.sliceOrArrayLenInBytes(dest_slice, ptr_ty);
89738985
89748986 if (intrinsic_len0_traps) {
8975 try self.safeWasmMemset(dest_ptr, fill_byte, len, dest_ptr_align, is_volatile);
8987 try self.safeWasmMemset(dest_ptr, fill_byte, len, dest_ptr_align, access_kind);
89768988 } else {
8977 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemSet(
8978 dest_ptr.toLlvm(&self.wip),
8979 fill_byte.toLlvm(&self.wip),
8980 len.toLlvm(&self.wip),
8981 @intCast(dest_ptr_align.toByteUnits() orelse 0),
8982 is_volatile,
8983 ), &self.wip);
8989 _ = try self.wip.callMemSet(dest_ptr, dest_ptr_align, fill_byte, len, access_kind);
89848990 }
89858991 return .none;
89868992 }
......@@ -9006,10 +9012,10 @@ pub const FuncGen = struct {
90069012 const body_block = try self.wip.block(1, "InlineMemsetBody");
90079013 const end_block = try self.wip.block(1, "InlineMemsetEnd");
90089014
9009 const usize_ty = try o.lowerType(Type.usize);
9015 const llvm_usize_ty = try o.lowerType(Type.usize);
90109016 const len = switch (ptr_ty.ptrSize(mod)) {
90119017 .Slice => try self.wip.extractValue(dest_slice, &.{1}, ""),
9012 .One => try o.builder.intValue(usize_ty, ptr_ty.childType(mod).arrayLen(mod)),
9018 .One => try o.builder.intValue(llvm_usize_ty, ptr_ty.childType(mod).arrayLen(mod)),
90139019 .Many, .C => unreachable,
90149020 };
90159021 const elem_llvm_ty = try o.lowerType(elem_ty);
......@@ -9022,25 +9028,22 @@ pub const FuncGen = struct {
90229028 _ = try self.wip.brCond(end, body_block, end_block);
90239029
90249030 self.wip.cursor = .{ .block = body_block };
9025 const elem_abi_alignment = elem_ty.abiAlignment(mod);
9026 const it_ptr_alignment = Builder.Alignment.fromByteUnits(
9027 @min(elem_abi_alignment, dest_ptr_align.toByteUnits() orelse std.math.maxInt(u64)),
9031 const elem_abi_align = elem_ty.abiAlignment(mod);
9032 const it_ptr_align = Builder.Alignment.fromByteUnits(
9033 @min(elem_abi_align, dest_ptr_align.toByteUnits() orelse std.math.maxInt(u64)),
90289034 );
90299035 if (isByRef(elem_ty, mod)) {
9030 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemCpy(
9031 it_ptr.toValue().toLlvm(&self.wip),
9032 @intCast(it_ptr_alignment.toByteUnits() orelse 0),
9033 value.toLlvm(&self.wip),
9034 elem_abi_alignment,
9035 (try o.builder.intConst(usize_ty, elem_abi_size)).toLlvm(&o.builder),
9036 is_volatile,
9037 ), &self.wip);
9038 } else _ = try self.wip.store(switch (is_volatile) {
9039 false => .normal,
9040 true => .@"volatile",
9041 }, value, it_ptr.toValue(), it_ptr_alignment);
9036 _ = try self.wip.callMemCpy(
9037 it_ptr.toValue(),
9038 it_ptr_align,
9039 value,
9040 Builder.Alignment.fromByteUnits(elem_abi_align),
9041 try o.builder.intValue(llvm_usize_ty, elem_abi_size),
9042 access_kind,
9043 );
9044 } else _ = try self.wip.store(access_kind, value, it_ptr.toValue(), it_ptr_align);
90429045 const next_ptr = try self.wip.gep(.inbounds, elem_llvm_ty, it_ptr.toValue(), &.{
9043 try o.builder.intValue(usize_ty, 1),
9046 try o.builder.intValue(llvm_usize_ty, 1),
90449047 }, "");
90459048 _ = try self.wip.br(loop_block);
90469049
......@@ -9055,7 +9058,7 @@ pub const FuncGen = struct {
90559058 fill_byte: Builder.Value,
90569059 len: Builder.Value,
90579060 dest_ptr_align: Builder.Alignment,
9058 is_volatile: bool,
9061 access_kind: Builder.MemoryAccessKind,
90599062 ) !void {
90609063 const o = self.dg.object;
90619064 const llvm_usize_ty = try o.lowerType(Type.usize);
......@@ -9064,13 +9067,7 @@ pub const FuncGen = struct {
90649067 const end_block = try self.wip.block(2, "MemsetTrapEnd");
90659068 _ = try self.wip.brCond(cond, memset_block, end_block);
90669069 self.wip.cursor = .{ .block = memset_block };
9067 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemSet(
9068 dest_ptr.toLlvm(&self.wip),
9069 fill_byte.toLlvm(&self.wip),
9070 len.toLlvm(&self.wip),
9071 @intCast(dest_ptr_align.toByteUnits() orelse 0),
9072 is_volatile,
9073 ), &self.wip);
9070 _ = try self.wip.callMemSet(dest_ptr, dest_ptr_align, fill_byte, len, access_kind);
90749071 _ = try self.wip.br(end_block);
90759072 self.wip.cursor = .{ .block = end_block };
90769073 }
......@@ -9086,7 +9083,8 @@ pub const FuncGen = struct {
90869083 const src_ptr = try self.sliceOrArrayPtr(src_slice, src_ptr_ty);
90879084 const len = try self.sliceOrArrayLenInBytes(dest_slice, dest_ptr_ty);
90889085 const dest_ptr = try self.sliceOrArrayPtr(dest_slice, dest_ptr_ty);
9089 const is_volatile = src_ptr_ty.isVolatilePtr(mod) or dest_ptr_ty.isVolatilePtr(mod);
9086 const access_kind: Builder.MemoryAccessKind = if (src_ptr_ty.isVolatilePtr(mod) or
9087 dest_ptr_ty.isVolatilePtr(mod)) .@"volatile" else .normal;
90909088
90919089 // When bulk-memory is enabled, this will be lowered to WebAssembly's memory.copy instruction.
90929090 // This instruction will trap on an invalid address, regardless of the length.
......@@ -9103,27 +9101,27 @@ pub const FuncGen = struct {
91039101 const end_block = try self.wip.block(2, "MemcpyTrapEnd");
91049102 _ = try self.wip.brCond(cond, memcpy_block, end_block);
91059103 self.wip.cursor = .{ .block = memcpy_block };
9106 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemCpy(
9107 dest_ptr.toLlvm(&self.wip),
9108 dest_ptr_ty.ptrAlignment(mod),
9109 src_ptr.toLlvm(&self.wip),
9110 src_ptr_ty.ptrAlignment(mod),
9111 len.toLlvm(&self.wip),
9112 is_volatile,
9113 ), &self.wip);
9104 _ = try self.wip.callMemCpy(
9105 dest_ptr,
9106 Builder.Alignment.fromByteUnits(dest_ptr_ty.ptrAlignment(mod)),
9107 src_ptr,
9108 Builder.Alignment.fromByteUnits(src_ptr_ty.ptrAlignment(mod)),
9109 len,
9110 access_kind,
9111 );
91149112 _ = try self.wip.br(end_block);
91159113 self.wip.cursor = .{ .block = end_block };
91169114 return .none;
91179115 }
91189116
9119 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemCpy(
9120 dest_ptr.toLlvm(&self.wip),
9121 dest_ptr_ty.ptrAlignment(mod),
9122 src_ptr.toLlvm(&self.wip),
9123 src_ptr_ty.ptrAlignment(mod),
9124 len.toLlvm(&self.wip),
9125 is_volatile,
9126 ), &self.wip);
9117 _ = try self.wip.callMemCpy(
9118 dest_ptr,
9119 Builder.Alignment.fromByteUnits(dest_ptr_ty.ptrAlignment(mod)),
9120 src_ptr,
9121 Builder.Alignment.fromByteUnits(src_ptr_ty.ptrAlignment(mod)),
9122 len,
9123 access_kind,
9124 );
91279125 return .none;
91289126 }
91299127
......@@ -9196,8 +9194,8 @@ pub const FuncGen = struct {
91969194 const operand_ty = self.typeOf(ty_op.operand);
91979195 const operand = try self.resolveInst(ty_op.operand);
91989196
9199 const result =
9200 try self.wip.callIntrinsic(
9197 const result = try self.wip.callIntrinsic(
9198 .none,
92019199 intrinsic,
92029200 &.{try o.lowerType(operand_ty)},
92039201 &.{ operand, .false },
......@@ -9214,6 +9212,7 @@ pub const FuncGen = struct {
92149212 const operand = try self.resolveInst(ty_op.operand);
92159213
92169214 const result = try self.wip.callIntrinsic(
9215 .none,
92179216 intrinsic,
92189217 &.{try o.lowerType(operand_ty)},
92199218 &.{operand},
......@@ -9251,7 +9250,7 @@ pub const FuncGen = struct {
92519250 bits = bits + 8;
92529251 }
92539252
9254 const result = try self.wip.callIntrinsic(.bswap, &.{llvm_operand_ty}, &.{operand}, "");
9253 const result = try self.wip.callIntrinsic(.none, .bswap, &.{llvm_operand_ty}, &.{operand}, "");
92559254 return self.wip.conv(.unsigned, result, try o.lowerType(inst_ty), "");
92569255 }
92579256
......@@ -9646,14 +9645,14 @@ pub const FuncGen = struct {
96469645 const llvm_scalar_ty = try o.lowerType(scalar_ty);
96479646
96489647 switch (reduce.operation) {
9649 .And, .Or, .Xor => return self.wip.callIntrinsic(switch (reduce.operation) {
9648 .And, .Or, .Xor => return self.wip.callIntrinsic(.none, switch (reduce.operation) {
96509649 .And => .@"vector.reduce.and",
96519650 .Or => .@"vector.reduce.or",
96529651 .Xor => .@"vector.reduce.xor",
96539652 else => unreachable,
96549653 }, &.{llvm_operand_ty}, &.{operand}, ""),
96559654 .Min, .Max => switch (scalar_ty.zigTypeTag(mod)) {
9656 .Int => return self.wip.callIntrinsic(switch (reduce.operation) {
9655 .Int => return self.wip.callIntrinsic(.none, switch (reduce.operation) {
96579656 .Min => if (scalar_ty.isSignedInt(mod))
96589657 .@"vector.reduce.smin"
96599658 else
......@@ -9665,7 +9664,7 @@ pub const FuncGen = struct {
96659664 else => unreachable,
96669665 }, &.{llvm_operand_ty}, &.{operand}, ""),
96679666 .Float => if (intrinsicsAllowed(scalar_ty, target))
9668 return self.wip.callIntrinsic(switch (reduce.operation) {
9667 return self.wip.callIntrinsic(.none, switch (reduce.operation) {
96699668 .Min => .@"vector.reduce.fmin",
96709669 .Max => .@"vector.reduce.fmax",
96719670 else => unreachable,
......@@ -9673,13 +9672,13 @@ pub const FuncGen = struct {
96739672 else => unreachable,
96749673 },
96759674 .Add, .Mul => switch (scalar_ty.zigTypeTag(mod)) {
9676 .Int => return self.wip.callIntrinsic(switch (reduce.operation) {
9675 .Int => return self.wip.callIntrinsic(.none, switch (reduce.operation) {
96779676 .Add => .@"vector.reduce.add",
96789677 .Mul => .@"vector.reduce.mul",
96799678 else => unreachable,
96809679 }, &.{llvm_operand_ty}, &.{operand}, ""),
96819680 .Float => if (intrinsicsAllowed(scalar_ty, target))
9682 return self.wip.callIntrinsic(switch (reduce.operation) {
9681 return self.wip.callIntrinsic(.none, switch (reduce.operation) {
96839682 .Add => .@"vector.reduce.fadd",
96849683 .Mul => .@"vector.reduce.fmul",
96859684 else => unreachable,
......@@ -10032,7 +10031,7 @@ pub const FuncGen = struct {
1003210031 .data => {},
1003310032 }
1003410033
10035 _ = try self.wip.callIntrinsic(.prefetch, &.{.ptr}, &.{
10034 _ = try self.wip.callIntrinsic(.none, .prefetch, &.{.ptr}, &.{
1003610035 try self.resolveInst(prefetch.ptr),
1003710036 try o.builder.intValue(.i32, prefetch.rw),
1003810037 try o.builder.intValue(.i32, prefetch.locality),
......@@ -10056,14 +10055,12 @@ pub const FuncGen = struct {
1005610055 default: u32,
1005710056 comptime basename: []const u8,
1005810057 ) !Builder.Value {
10059 const o = self.dg.object;
10060 const intrinsic = switch (dimension) {
10058 return self.wip.callIntrinsic(.none, switch (dimension) {
1006110059 0 => @field(Builder.Intrinsic, basename ++ ".x"),
1006210060 1 => @field(Builder.Intrinsic, basename ++ ".y"),
1006310061 2 => @field(Builder.Intrinsic, basename ++ ".z"),
10064 else => return o.builder.intValue(.i32, default),
10065 };
10066 return self.wip.callIntrinsic(intrinsic, &.{}, &.{}, "");
10062 else => return self.dg.object.builder.intValue(.i32, default),
10063 }, &.{}, &.{}, "");
1006710064 }
1006810065
1006910066 fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value {
......@@ -10087,7 +10084,7 @@ pub const FuncGen = struct {
1008710084
1008810085 // Fetch the dispatch pointer, which points to this structure:
1008910086 // https://github.com/RadeonOpenCompute/ROCR-Runtime/blob/adae6c61e10d371f7cbc3d0e94ae2c070cab18a4/src/inc/hsa.h#L2913
10090 const dispatch_ptr = try self.wip.callIntrinsic(.@"amdgcn.dispatch.ptr", &.{}, &.{}, "");
10087 const dispatch_ptr = try self.wip.callIntrinsic(.none, .@"amdgcn.dispatch.ptr", &.{}, &.{}, "");
1009110088
1009210089 // Load the work_group_* member from the struct as u16.
1009310090 // Just treat the dispatch pointer as an array of u16 to keep things simple.
......@@ -10188,7 +10185,7 @@ pub const FuncGen = struct {
1018810185 if (can_elide_load)
1018910186 return payload_ptr;
1019010187
10191 return fg.loadByRef(payload_ptr, payload_ty, payload_alignment, false);
10188 return fg.loadByRef(payload_ptr, payload_ty, payload_alignment, .normal);
1019210189 }
1019310190 const payload_llvm_ty = try o.lowerType(payload_ty);
1019410191 return fg.wip.load(.normal, payload_llvm_ty, payload_ptr, payload_alignment, "");
......@@ -10297,7 +10294,7 @@ pub const FuncGen = struct {
1029710294 ptr: Builder.Value,
1029810295 pointee_type: Type,
1029910296 ptr_alignment: Builder.Alignment,
10300 is_volatile: bool,
10297 access_kind: Builder.MemoryAccessKind,
1030110298 ) !Builder.Value {
1030210299 const o = fg.dg.object;
1030310300 const mod = o.module;
......@@ -10306,16 +10303,15 @@ pub const FuncGen = struct {
1030610303 @max(ptr_alignment.toByteUnits() orelse 0, pointee_type.abiAlignment(mod)),
1030710304 );
1030810305 const result_ptr = try fg.buildAlloca(pointee_llvm_ty, result_align);
10309 const usize_ty = try o.lowerType(Type.usize);
1031010306 const size_bytes = pointee_type.abiSize(mod);
10311 _ = (try fg.wip.unimplemented(.void, "")).finish(fg.builder.buildMemCpy(
10312 result_ptr.toLlvm(&fg.wip),
10313 @intCast(result_align.toByteUnits() orelse 0),
10314 ptr.toLlvm(&fg.wip),
10315 @intCast(ptr_alignment.toByteUnits() orelse 0),
10316 (try o.builder.intConst(usize_ty, size_bytes)).toLlvm(&o.builder),
10317 is_volatile,
10318 ), &fg.wip);
10307 _ = try fg.wip.callMemCpy(
10308 result_ptr,
10309 result_align,
10310 ptr,
10311 ptr_alignment,
10312 try o.builder.intValue(try o.lowerType(Type.usize), size_bytes),
10313 access_kind,
10314 );
1031910315 return result_ptr;
1032010316 }
1032110317
......@@ -10332,10 +10328,8 @@ pub const FuncGen = struct {
1033210328 const ptr_alignment = Builder.Alignment.fromByteUnits(
1033310329 info.flags.alignment.toByteUnitsOptional() orelse elem_ty.abiAlignment(mod),
1033410330 );
10335 const ptr_kind: Builder.MemoryAccessKind = switch (info.flags.is_volatile) {
10336 false => .normal,
10337 true => .@"volatile",
10338 };
10331 const access_kind: Builder.MemoryAccessKind =
10332 if (info.flags.is_volatile) .@"volatile" else .normal;
1033910333
1034010334 assert(info.flags.vector_index != .runtime);
1034110335 if (info.flags.vector_index != .none) {
......@@ -10343,19 +10337,20 @@ pub const FuncGen = struct {
1034310337 const vec_elem_ty = try o.lowerType(elem_ty);
1034410338 const vec_ty = try o.builder.vectorType(.normal, info.packed_offset.host_size, vec_elem_ty);
1034510339
10346 const loaded_vector = try self.wip.load(ptr_kind, vec_ty, ptr, ptr_alignment, "");
10340 const loaded_vector = try self.wip.load(access_kind, vec_ty, ptr, ptr_alignment, "");
1034710341 return self.wip.extractElement(loaded_vector, index_u32, "");
1034810342 }
1034910343
1035010344 if (info.packed_offset.host_size == 0) {
1035110345 if (isByRef(elem_ty, mod)) {
10352 return self.loadByRef(ptr, elem_ty, ptr_alignment, info.flags.is_volatile);
10346 return self.loadByRef(ptr, elem_ty, ptr_alignment, access_kind);
1035310347 }
10354 return self.wip.load(ptr_kind, try o.lowerType(elem_ty), ptr, ptr_alignment, "");
10348 return self.wip.load(access_kind, try o.lowerType(elem_ty), ptr, ptr_alignment, "");
1035510349 }
1035610350
1035710351 const containing_int_ty = try o.builder.intType(@intCast(info.packed_offset.host_size * 8));
10358 const containing_int = try self.wip.load(ptr_kind, containing_int_ty, ptr, ptr_alignment, "");
10352 const containing_int =
10353 try self.wip.load(access_kind, containing_int_ty, ptr, ptr_alignment, "");
1035910354
1036010355 const elem_bits = ptr_ty.childType(mod).bitSize(mod);
1036110356 const shift_amt = try o.builder.intValue(containing_int_ty, info.packed_offset.bit_offset);
......@@ -10402,10 +10397,8 @@ pub const FuncGen = struct {
1040210397 return;
1040310398 }
1040410399 const ptr_alignment = Builder.Alignment.fromByteUnits(ptr_ty.ptrAlignment(mod));
10405 const ptr_kind: Builder.MemoryAccessKind = switch (info.flags.is_volatile) {
10406 false => .normal,
10407 true => .@"volatile",
10408 };
10400 const access_kind: Builder.MemoryAccessKind =
10401 if (info.flags.is_volatile) .@"volatile" else .normal;
1040910402
1041010403 assert(info.flags.vector_index != .runtime);
1041110404 if (info.flags.vector_index != .none) {
......@@ -10413,12 +10406,12 @@ pub const FuncGen = struct {
1041310406 const vec_elem_ty = try o.lowerType(elem_ty);
1041410407 const vec_ty = try o.builder.vectorType(.normal, info.packed_offset.host_size, vec_elem_ty);
1041510408
10416 const loaded_vector = try self.wip.load(ptr_kind, vec_ty, ptr, ptr_alignment, "");
10409 const loaded_vector = try self.wip.load(access_kind, vec_ty, ptr, ptr_alignment, "");
1041710410
1041810411 const modified_vector = try self.wip.insertElement(loaded_vector, elem, index_u32, "");
1041910412
1042010413 assert(ordering == .none);
10421 _ = try self.wip.store(ptr_kind, modified_vector, ptr, ptr_alignment);
10414 _ = try self.wip.store(access_kind, modified_vector, ptr, ptr_alignment);
1042210415 return;
1042310416 }
1042410417
......@@ -10426,7 +10419,7 @@ pub const FuncGen = struct {
1042610419 const containing_int_ty = try o.builder.intType(@intCast(info.packed_offset.host_size * 8));
1042710420 assert(ordering == .none);
1042810421 const containing_int =
10429 try self.wip.load(ptr_kind, containing_int_ty, ptr, ptr_alignment, "");
10422 try self.wip.load(access_kind, containing_int_ty, ptr, ptr_alignment, "");
1043010423 const elem_bits = ptr_ty.childType(mod).bitSize(mod);
1043110424 const shift_amt = try o.builder.intConst(containing_int_ty, info.packed_offset.bit_offset);
1043210425 // Convert to equally-sized integer type in order to perform the bit
......@@ -10450,23 +10443,29 @@ pub const FuncGen = struct {
1045010443 const ored_value = try self.wip.bin(.@"or", shifted_value, anded_containing_int, "");
1045110444
1045210445 assert(ordering == .none);
10453 _ = try self.wip.store(ptr_kind, ored_value, ptr, ptr_alignment);
10446 _ = try self.wip.store(access_kind, ored_value, ptr, ptr_alignment);
1045410447 return;
1045510448 }
1045610449 if (!isByRef(elem_ty, mod)) {
10457 _ = try self.wip.storeAtomic(ptr_kind, elem, ptr, self.sync_scope, ordering, ptr_alignment);
10450 _ = try self.wip.storeAtomic(
10451 access_kind,
10452 elem,
10453 ptr,
10454 self.sync_scope,
10455 ordering,
10456 ptr_alignment,
10457 );
1045810458 return;
1045910459 }
1046010460 assert(ordering == .none);
10461 const size_bytes = elem_ty.abiSize(mod);
10462 _ = (try self.wip.unimplemented(.void, "")).finish(self.builder.buildMemCpy(
10463 ptr.toLlvm(&self.wip),
10464 @intCast(ptr_alignment.toByteUnits() orelse 0),
10465 elem.toLlvm(&self.wip),
10466 elem_ty.abiAlignment(mod),
10467 (try o.builder.intConst(try o.lowerType(Type.usize), size_bytes)).toLlvm(&o.builder),
10468 info.flags.is_volatile,
10469 ), &self.wip);
10461 _ = try self.wip.callMemCpy(
10462 ptr,
10463 ptr_alignment,
10464 elem,
10465 Builder.Alignment.fromByteUnits(elem_ty.abiAlignment(mod)),
10466 try o.builder.intValue(try o.lowerType(Type.usize), elem_ty.abiSize(mod)),
10467 access_kind,
10468 );
1047010469 }
1047110470
1047210471 fn valgrindMarkUndef(fg: *FuncGen, ptr: Builder.Value, len: Builder.Value) Allocator.Error!void {
src/codegen/llvm/Builder.zig+333-13
......@@ -2397,7 +2397,7 @@ pub const Intrinsic = enum {
23972397 @"udiv.fix.sat",
23982398
23992399 // Specialised Arithmetic
2400 canonicalisze,
2400 canonicalize,
24012401 fmuladd,
24022402
24032403 // Vector Reduction
......@@ -2416,14 +2416,15 @@ pub const Intrinsic = enum {
24162416 @"vector.reduce.fmin",
24172417 @"vector.reduce.fmaximum",
24182418 @"vector.reduce.fminimum",
2419 @"vector.reduce.insert",
2420 @"vector.reduce.extract",
24212419 @"vector.insert",
24222420 @"vector.extract",
24232421
2422 // Floating-Point Test
2423 @"is.fpclass",
2424
24242425 // General
2425 @"llvm.var.annotation",
2426 @"llvm.ptr.annotation",
2426 @"var.annotation",
2427 @"ptr.annotation",
24272428 annotation,
24282429 @"codeview.annotation",
24292430 trap,
......@@ -2442,7 +2443,7 @@ pub const Intrinsic = enum {
24422443 @"arithmetic.fence",
24432444 donothing,
24442445 @"load.relative",
2445 @"llvm.sideeffect",
2446 sideeffect,
24462447 @"is.constant",
24472448 ptrmask,
24482449 @"threadlocal.address",
......@@ -2483,10 +2484,7 @@ pub const Intrinsic = enum {
24832484 };
24842485 };
24852486
2486 const signatures = std.enums.EnumArray(Intrinsic, Signature).initDefault(.{
2487 .ret_len = 0,
2488 .params = &.{},
2489 }, .{
2487 const signatures = std.enums.EnumArray(Intrinsic, Signature).init(.{
24902488 .va_start = .{
24912489 .ret_len = 0,
24922490 .params = &.{
......@@ -2603,6 +2601,56 @@ pub const Intrinsic = enum {
26032601 },
26042602 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
26052603 },
2604 .memcpy = .{
2605 .ret_len = 0,
2606 .params = &.{
2607 .{ .kind = .overloaded, .attrs = &.{ .@"noalias", .nocapture, .writeonly } },
2608 .{ .kind = .overloaded, .attrs = &.{ .@"noalias", .nocapture, .readonly } },
2609 .{ .kind = .overloaded },
2610 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
2611 },
2612 .attrs = &.{ .nocallback, .nofree, .nounwind, .willreturn, .{ .memory = .{ .argmem = .readwrite } } },
2613 },
2614 .@"memcpy.inline" = .{
2615 .ret_len = 0,
2616 .params = &.{
2617 .{ .kind = .overloaded, .attrs = &.{ .@"noalias", .nocapture, .writeonly } },
2618 .{ .kind = .overloaded, .attrs = &.{ .@"noalias", .nocapture, .readonly } },
2619 .{ .kind = .overloaded, .attrs = &.{.immarg} },
2620 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
2621 },
2622 .attrs = &.{ .nocallback, .nofree, .nounwind, .willreturn, .{ .memory = .{ .argmem = .readwrite } } },
2623 },
2624 .memmove = .{
2625 .ret_len = 0,
2626 .params = &.{
2627 .{ .kind = .overloaded, .attrs = &.{ .nocapture, .writeonly } },
2628 .{ .kind = .overloaded, .attrs = &.{ .nocapture, .readonly } },
2629 .{ .kind = .overloaded },
2630 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
2631 },
2632 .attrs = &.{ .nocallback, .nofree, .nounwind, .willreturn, .{ .memory = .{ .argmem = .readwrite } } },
2633 },
2634 .memset = .{
2635 .ret_len = 0,
2636 .params = &.{
2637 .{ .kind = .overloaded, .attrs = &.{ .nocapture, .writeonly } },
2638 .{ .kind = .{ .type = .i8 } },
2639 .{ .kind = .overloaded },
2640 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
2641 },
2642 .attrs = &.{ .nocallback, .nofree, .nounwind, .willreturn, .{ .memory = .{ .argmem = .write } } },
2643 },
2644 .@"memset.inline" = .{
2645 .ret_len = 0,
2646 .params = &.{
2647 .{ .kind = .overloaded, .attrs = &.{ .nocapture, .writeonly } },
2648 .{ .kind = .{ .type = .i8 } },
2649 .{ .kind = .overloaded, .attrs = &.{.immarg} },
2650 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
2651 },
2652 .attrs = &.{ .nocallback, .nofree, .nounwind, .willreturn, .{ .memory = .{ .argmem = .write } } },
2653 },
26062654 .sqrt = .{
26072655 .ret_len = 1,
26082656 .params = &.{
......@@ -2884,7 +2932,7 @@ pub const Intrinsic = enum {
28842932 .params = &.{
28852933 .{ .kind = .overloaded },
28862934 .{ .kind = .{ .matches = 0 } },
2887 .{ .kind = .{ .type = .i1 } },
2935 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
28882936 },
28892937 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
28902938 },
......@@ -2893,7 +2941,7 @@ pub const Intrinsic = enum {
28932941 .params = &.{
28942942 .{ .kind = .overloaded },
28952943 .{ .kind = .{ .matches = 0 } },
2896 .{ .kind = .{ .type = .i1 } },
2944 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
28972945 },
28982946 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
28992947 },
......@@ -3115,6 +3163,25 @@ pub const Intrinsic = enum {
31153163 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
31163164 },
31173165
3166 .canonicalize = .{
3167 .ret_len = 1,
3168 .params = &.{
3169 .{ .kind = .overloaded },
3170 .{ .kind = .{ .matches = 0 } },
3171 },
3172 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3173 },
3174 .fmuladd = .{
3175 .ret_len = 1,
3176 .params = &.{
3177 .{ .kind = .overloaded },
3178 .{ .kind = .{ .matches = 0 } },
3179 .{ .kind = .{ .matches = 0 } },
3180 .{ .kind = .{ .matches = 0 } },
3181 },
3182 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3183 },
3184
31183185 .@"vector.reduce.add" = .{
31193186 .ret_len = 1,
31203187 .params = &.{
......@@ -3257,6 +3324,57 @@ pub const Intrinsic = enum {
32573324 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
32583325 },
32593326
3327 .@"is.fpclass" = .{
3328 .ret_len = 1,
3329 .params = &.{
3330 .{ .kind = .{ .matches_changed_scalar = .{ .index = 1, .scalar = .i1 } } },
3331 .{ .kind = .overloaded },
3332 .{ .kind = .{ .type = .i32 }, .attrs = &.{.immarg} },
3333 },
3334 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3335 },
3336
3337 .@"var.annotation" = .{
3338 .ret_len = 0,
3339 .params = &.{
3340 .{ .kind = .overloaded },
3341 .{ .kind = .overloaded },
3342 .{ .kind = .{ .matches = 1 } },
3343 .{ .kind = .{ .type = .i32 } },
3344 .{ .kind = .{ .matches = 1 } },
3345 },
3346 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = .{ .inaccessiblemem = .readwrite } } },
3347 },
3348 .@"ptr.annotation" = .{
3349 .ret_len = 1,
3350 .params = &.{
3351 .{ .kind = .overloaded },
3352 .{ .kind = .{ .matches = 0 } },
3353 .{ .kind = .overloaded },
3354 .{ .kind = .{ .matches = 2 } },
3355 .{ .kind = .{ .type = .i32 } },
3356 .{ .kind = .{ .matches = 2 } },
3357 },
3358 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = .{ .inaccessiblemem = .readwrite } } },
3359 },
3360 .annotation = .{
3361 .ret_len = 1,
3362 .params = &.{
3363 .{ .kind = .overloaded },
3364 .{ .kind = .{ .matches = 0 } },
3365 .{ .kind = .overloaded },
3366 .{ .kind = .{ .matches = 2 } },
3367 .{ .kind = .{ .type = .i32 } },
3368 },
3369 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = .{ .inaccessiblemem = .readwrite } } },
3370 },
3371 .@"codeview.annotation" = .{
3372 .ret_len = 0,
3373 .params = &.{
3374 .{ .kind = .{ .type = .metadata } },
3375 },
3376 .attrs = &.{ .nocallback, .noduplicate, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = .{ .inaccessiblemem = .readwrite } } },
3377 },
32603378 .trap = .{
32613379 .ret_len = 0,
32623380 .params = &.{},
......@@ -3274,6 +3392,156 @@ pub const Intrinsic = enum {
32743392 },
32753393 .attrs = &.{ .cold, .noreturn, .nounwind },
32763394 },
3395 .stackprotector = .{
3396 .ret_len = 0,
3397 .params = &.{
3398 .{ .kind = .{ .type = .ptr } },
3399 .{ .kind = .{ .type = .ptr } },
3400 },
3401 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn },
3402 },
3403 .stackguard = .{
3404 .ret_len = 1,
3405 .params = &.{
3406 .{ .kind = .{ .type = .ptr } },
3407 },
3408 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn },
3409 },
3410 .objectsize = .{
3411 .ret_len = 1,
3412 .params = &.{
3413 .{ .kind = .overloaded },
3414 .{ .kind = .overloaded },
3415 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
3416 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
3417 .{ .kind = .{ .type = .i1 }, .attrs = &.{.immarg} },
3418 },
3419 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3420 },
3421 .expect = .{
3422 .ret_len = 1,
3423 .params = &.{
3424 .{ .kind = .overloaded },
3425 .{ .kind = .{ .matches = 0 } },
3426 .{ .kind = .{ .matches = 0 } },
3427 },
3428 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3429 },
3430 .@"expect.with.probability" = .{
3431 .ret_len = 1,
3432 .params = &.{
3433 .{ .kind = .overloaded },
3434 .{ .kind = .{ .matches = 0 } },
3435 .{ .kind = .{ .matches = 0 } },
3436 .{ .kind = .{ .type = .double }, .attrs = &.{.immarg} },
3437 },
3438 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3439 },
3440 .assume = .{
3441 .ret_len = 0,
3442 .params = &.{
3443 .{ .kind = .{ .type = .i1 }, .attrs = &.{.noundef} },
3444 },
3445 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = .{ .inaccessiblemem = .write } } },
3446 },
3447 .@"ssa.copy" = .{
3448 .ret_len = 1,
3449 .params = &.{
3450 .{ .kind = .overloaded },
3451 .{ .kind = .{ .matches = 0 }, .attrs = &.{.returned} },
3452 },
3453 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3454 },
3455 .@"type.test" = .{
3456 .ret_len = 1,
3457 .params = &.{
3458 .{ .kind = .{ .type = .i1 } },
3459 .{ .kind = .{ .type = .ptr } },
3460 .{ .kind = .{ .type = .metadata } },
3461 },
3462 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3463 },
3464 .@"type.checked.load" = .{
3465 .ret_len = 2,
3466 .params = &.{
3467 .{ .kind = .{ .type = .ptr } },
3468 .{ .kind = .{ .type = .i1 } },
3469 .{ .kind = .{ .type = .ptr } },
3470 .{ .kind = .{ .type = .i32 } },
3471 .{ .kind = .{ .type = .metadata } },
3472 },
3473 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3474 },
3475 .@"type.checked.load.relative" = .{
3476 .ret_len = 2,
3477 .params = &.{
3478 .{ .kind = .{ .type = .ptr } },
3479 .{ .kind = .{ .type = .i1 } },
3480 .{ .kind = .{ .type = .ptr } },
3481 .{ .kind = .{ .type = .i32 } },
3482 .{ .kind = .{ .type = .metadata } },
3483 },
3484 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3485 },
3486 .@"arithmetic.fence" = .{
3487 .ret_len = 1,
3488 .params = &.{
3489 .{ .kind = .overloaded },
3490 .{ .kind = .{ .matches = 0 } },
3491 },
3492 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3493 },
3494 .donothing = .{
3495 .ret_len = 0,
3496 .params = &.{},
3497 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3498 },
3499 .@"load.relative" = .{
3500 .ret_len = 1,
3501 .params = &.{
3502 .{ .kind = .{ .type = .ptr } },
3503 .{ .kind = .{ .type = .ptr } },
3504 .{ .kind = .overloaded },
3505 },
3506 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = .{ .argmem = .read } } },
3507 },
3508 .sideeffect = .{
3509 .ret_len = 0,
3510 .params = &.{},
3511 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = .{ .inaccessiblemem = .readwrite } } },
3512 },
3513 .@"is.constant" = .{
3514 .ret_len = 1,
3515 .params = &.{
3516 .{ .kind = .{ .type = .i1 } },
3517 .{ .kind = .overloaded },
3518 },
3519 .attrs = &.{ .convergent, .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3520 },
3521 .ptrmask = .{
3522 .ret_len = 1,
3523 .params = &.{
3524 .{ .kind = .overloaded },
3525 .{ .kind = .{ .matches = 0 } },
3526 .{ .kind = .overloaded },
3527 },
3528 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3529 },
3530 .@"threadlocal.address" = .{
3531 .ret_len = 1,
3532 .params = &.{
3533 .{ .kind = .overloaded, .attrs = &.{.nonnull} },
3534 .{ .kind = .{ .matches = 0 }, .attrs = &.{.nonnull} },
3535 },
3536 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .speculatable, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3537 },
3538 .vscale = .{
3539 .ret_len = 1,
3540 .params = &.{
3541 .{ .kind = .overloaded },
3542 },
3543 .attrs = &.{ .nocallback, .nofree, .nosync, .nounwind, .willreturn, .{ .memory = Attribute.Memory.all(.none) } },
3544 },
32773545
32783546 .@"amdgcn.workitem.id.x" = .{
32793547 .ret_len = 1,
......@@ -5391,6 +5659,7 @@ pub const WipFunction = struct {
53915659
53925660 pub fn callIntrinsic(
53935661 self: *WipFunction,
5662 function_attributes: FunctionAttributes,
53945663 id: Intrinsic,
53955664 overload: []const Type,
53965665 args: []const Value,
......@@ -5400,7 +5669,7 @@ pub const WipFunction = struct {
54005669 return self.call(
54015670 .normal,
54025671 CallConv.default,
5403 .none,
5672 function_attributes,
54045673 intrinsic.typeOf(self.builder),
54055674 intrinsic.toValue(self.builder),
54065675 args,
......@@ -5408,6 +5677,57 @@ pub const WipFunction = struct {
54085677 );
54095678 }
54105679
5680 pub fn callMemCpy(
5681 self: *WipFunction,
5682 dst: Value,
5683 dst_align: Alignment,
5684 src: Value,
5685 src_align: Alignment,
5686 len: Value,
5687 kind: MemoryAccessKind,
5688 ) Allocator.Error!Instruction.Index {
5689 var dst_attrs = [_]Attribute.Index{try self.builder.attr(.{ .@"align" = dst_align })};
5690 var src_attrs = [_]Attribute.Index{try self.builder.attr(.{ .@"align" = src_align })};
5691 const value = try self.callIntrinsic(
5692 try self.builder.fnAttrs(&.{
5693 .none,
5694 .none,
5695 try self.builder.attrs(&dst_attrs),
5696 try self.builder.attrs(&src_attrs),
5697 }),
5698 .memcpy,
5699 &.{ dst.typeOfWip(self), src.typeOfWip(self), len.typeOfWip(self) },
5700 &.{ dst, src, len, switch (kind) {
5701 .normal => Value.false,
5702 .@"volatile" => Value.true,
5703 } },
5704 undefined,
5705 );
5706 return value.unwrap().instruction;
5707 }
5708
5709 pub fn callMemSet(
5710 self: *WipFunction,
5711 dst: Value,
5712 dst_align: Alignment,
5713 val: Value,
5714 len: Value,
5715 kind: MemoryAccessKind,
5716 ) Allocator.Error!Instruction.Index {
5717 var dst_attrs = [_]Attribute.Index{try self.builder.attr(.{ .@"align" = dst_align })};
5718 const value = try self.callIntrinsic(
5719 try self.builder.fnAttrs(&.{ .none, .none, try self.builder.attrs(&dst_attrs) }),
5720 .memset,
5721 &.{ dst.typeOfWip(self), len.typeOfWip(self) },
5722 &.{ dst, val, len, switch (kind) {
5723 .normal => Value.false,
5724 .@"volatile" => Value.true,
5725 } },
5726 undefined,
5727 );
5728 return value.unwrap().instruction;
5729 }
5730
54115731 pub fn vaArg(self: *WipFunction, list: Value, ty: Type, name: []const u8) Allocator.Error!Value {
54125732 try self.ensureUnusedExtraCapacity(1, Instruction.VaArg, 0);
54135733 const instruction = try self.addInst(name, .{
src/codegen/llvm/bindings.zig-21
......@@ -951,27 +951,6 @@ pub const Builder = opaque {
951951 Name: [*:0]const u8,
952952 ) *Value;
953953
954 pub const buildMemSet = ZigLLVMBuildMemSet;
955 extern fn ZigLLVMBuildMemSet(
956 B: *Builder,
957 Ptr: *Value,
958 Val: *Value,
959 Len: *Value,
960 Align: c_uint,
961 is_volatile: bool,
962 ) *Value;
963
964 pub const buildMemCpy = ZigLLVMBuildMemCpy;
965 extern fn ZigLLVMBuildMemCpy(
966 B: *Builder,
967 Dst: *Value,
968 DstAlign: c_uint,
969 Src: *Value,
970 SrcAlign: c_uint,
971 Size: *Value,
972 is_volatile: bool,
973 ) *Value;
974
975954 pub const buildExactUDiv = LLVMBuildExactUDiv;
976955 extern fn LLVMBuildExactUDiv(*Builder, LHS: *Value, RHS: *Value, Name: [*:0]const u8) *Value;
977956
src/value.zig+2-2
......@@ -3831,7 +3831,7 @@ pub const Value = struct {
38313831
38323832 /// If the value is represented in-memory as a series of bytes that all
38333833 /// have the same value, return that byte value, otherwise null.
3834 pub fn hasRepeatedByteRepr(val: Value, ty: Type, mod: *Module) !?Value {
3834 pub fn hasRepeatedByteRepr(val: Value, ty: Type, mod: *Module) !?u8 {
38353835 const abi_size = std.math.cast(usize, ty.abiSize(mod)) orelse return null;
38363836 assert(abi_size >= 1);
38373837 const byte_buffer = try mod.gpa.alloc(u8, abi_size);
......@@ -3852,7 +3852,7 @@ pub const Value = struct {
38523852 for (byte_buffer[1..]) |byte| {
38533853 if (byte != first_byte) return null;
38543854 }
3855 return try mod.intValue(Type.u8, first_byte);
3855 return first_byte;
38563856 }
38573857
38583858 pub fn isGenericPoison(val: Value) bool {
src/zig_llvm.cpp-16
......@@ -408,22 +408,6 @@ void ZigLLVMSetTailCallKind(LLVMValueRef Call, enum ZigLLVMTailCallKind TailCall
408408 unwrap<CallInst>(Call)->setTailCallKind(TCK);
409409}
410410
411LLVMValueRef ZigLLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign,
412 LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size, bool isVolatile)
413{
414 CallInst *call_inst = unwrap(B)->CreateMemCpy(unwrap(Dst),
415 MaybeAlign(DstAlign), unwrap(Src), MaybeAlign(SrcAlign), unwrap(Size), isVolatile);
416 return wrap(call_inst);
417}
418
419LLVMValueRef ZigLLVMBuildMemSet(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Val, LLVMValueRef Size,
420 unsigned Align, bool isVolatile)
421{
422 CallInst *call_inst = unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Size),
423 MaybeAlign(Align), isVolatile);
424 return wrap(call_inst);
425}
426
427411void ZigLLVMFnSetSubprogram(LLVMValueRef fn, ZigLLVMDISubprogram *subprogram) {
428412 assert( isa<Function>(unwrap(fn)) );
429413 Function *unwrapped_function = reinterpret_cast<Function*>(unwrap(fn));
src/zig_llvm.h-6
......@@ -122,12 +122,6 @@ enum ZigLLVM_CallingConv {
122122 ZigLLVM_MaxID = 1023,
123123};
124124
125ZIG_EXTERN_C LLVMValueRef ZigLLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign,
126 LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size, bool isVolatile);
127
128ZIG_EXTERN_C LLVMValueRef ZigLLVMBuildMemSet(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Val, LLVMValueRef Size,
129 unsigned Align, bool isVolatile);
130
131125ZIG_EXTERN_C LLVMValueRef ZigLLVMBuildNSWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMValueRef RHS,
132126 const char *name);
133127ZIG_EXTERN_C LLVMValueRef ZigLLVMBuildNUWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMValueRef RHS,