authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-31 17:38:42-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-31 17:38:42-07:00
log356a865b871db458149f70bc103a3971780d6962
treec4e06c84ce3735b48add6e89c69cf6cc3e84da1c
parent602af1b88f150f8b09d980520620ab289c425075

stage2: introduce support for noalias

Not implemented yet is enhancements to coerceInMemory to account for noalias parameters. Related to #11498.

6 files changed, 108 insertions(+), 23 deletions(-)

src/AstGen.zig+33-10
...@@ -1155,14 +1155,20 @@ fn fnProtoExpr(...@@ -1155,14 +1155,20 @@ fn fnProtoExpr(
11551155
1156 const block_inst = try gz.makeBlockInst(.block_inline, node);1156 const block_inst = try gz.makeBlockInst(.block_inline, node);
11571157
1158 var noalias_bits: u32 = 0;
1158 const is_var_args = is_var_args: {1159 const is_var_args = is_var_args: {
1159 var param_type_i: usize = 0;1160 var param_type_i: usize = 0;
1160 var it = fn_proto.iterate(tree);1161 var it = fn_proto.iterate(tree);
1161 while (it.next()) |param| : (param_type_i += 1) {1162 while (it.next()) |param| : (param_type_i += 1) {
1162 const is_comptime = if (param.comptime_noalias) |token|1163 const is_comptime = if (param.comptime_noalias) |token| switch (token_tags[token]) {
1163 token_tags[token] == .keyword_comptime1164 .keyword_noalias => is_comptime: {
1164 else1165 noalias_bits |= @as(u32, 1) << (std.math.cast(u5, param_type_i) orelse
1165 false;1166 return astgen.failTok(token, "this compiler implementation only supports 'noalias' on the first 32 parameters", .{}));
1167 break :is_comptime false;
1168 },
1169 .keyword_comptime => true,
1170 else => false,
1171 } else false;
11661172
1167 const is_anytype = if (param.anytype_ellipsis3) |token| blk: {1173 const is_anytype = if (param.anytype_ellipsis3) |token| blk: {
1168 switch (token_tags[token]) {1174 switch (token_tags[token]) {
...@@ -1255,6 +1261,7 @@ fn fnProtoExpr(...@@ -1255,6 +1261,7 @@ fn fnProtoExpr(
1255 .is_inferred_error = false,1261 .is_inferred_error = false,
1256 .is_test = false,1262 .is_test = false,
1257 .is_extern = false,1263 .is_extern = false,
1264 .noalias_bits = noalias_bits,
1258 });1265 });
12591266
1260 _ = try block_scope.addBreak(.break_inline, block_inst, result);1267 _ = try block_scope.addBreak(.break_inline, block_inst, result);
...@@ -3381,15 +3388,21 @@ fn fnDecl(...@@ -3381,15 +3388,21 @@ fn fnDecl(
3381 // align, linksection, and addrspace is passed in the func instruction in this case.3388 // align, linksection, and addrspace is passed in the func instruction in this case.
3382 wip_members.nextDecl(is_pub, is_export, false, false);3389 wip_members.nextDecl(is_pub, is_export, false, false);
33833390
3391 var noalias_bits: u32 = 0;
3384 var params_scope = &fn_gz.base;3392 var params_scope = &fn_gz.base;
3385 const is_var_args = is_var_args: {3393 const is_var_args = is_var_args: {
3386 var param_type_i: usize = 0;3394 var param_type_i: usize = 0;
3387 var it = fn_proto.iterate(tree);3395 var it = fn_proto.iterate(tree);
3388 while (it.next()) |param| : (param_type_i += 1) {3396 while (it.next()) |param| : (param_type_i += 1) {
3389 const is_comptime = if (param.comptime_noalias) |token|3397 const is_comptime = if (param.comptime_noalias) |token| switch (token_tags[token]) {
3390 token_tags[token] == .keyword_comptime3398 .keyword_noalias => is_comptime: {
3391 else3399 noalias_bits |= @as(u32, 1) << (std.math.cast(u5, param_type_i) orelse
3392 false;3400 return astgen.failTok(token, "this compiler implementation only supports 'noalias' on the first 32 parameters", .{}));
3401 break :is_comptime false;
3402 },
3403 .keyword_comptime => true,
3404 else => false,
3405 } else false;
33933406
3394 const is_anytype = if (param.anytype_ellipsis3) |token| blk: {3407 const is_anytype = if (param.anytype_ellipsis3) |token| blk: {
3395 switch (token_tags[token]) {3408 switch (token_tags[token]) {
...@@ -3576,6 +3589,7 @@ fn fnDecl(...@@ -3576,6 +3589,7 @@ fn fnDecl(
3576 .is_inferred_error = false,3589 .is_inferred_error = false,
3577 .is_test = false,3590 .is_test = false,
3578 .is_extern = true,3591 .is_extern = true,
3592 .noalias_bits = noalias_bits,
3579 });3593 });
3580 } else func: {3594 } else func: {
3581 if (is_var_args) {3595 if (is_var_args) {
...@@ -3623,6 +3637,7 @@ fn fnDecl(...@@ -3623,6 +3637,7 @@ fn fnDecl(
3623 .is_inferred_error = is_inferred_error,3637 .is_inferred_error = is_inferred_error,
3624 .is_test = false,3638 .is_test = false,
3625 .is_extern = false,3639 .is_extern = false,
3640 .noalias_bits = noalias_bits,
3626 });3641 });
3627 };3642 };
36283643
...@@ -4057,6 +4072,7 @@ fn testDecl(...@@ -4057,6 +4072,7 @@ fn testDecl(
4057 .is_inferred_error = true,4072 .is_inferred_error = true,
4058 .is_test = true,4073 .is_test = true,
4059 .is_extern = false,4074 .is_extern = false,
4075 .noalias_bits = 0,
4060 });4076 });
40614077
4062 _ = try decl_block.addBreak(.break_inline, block_inst, func_inst);4078 _ = try decl_block.addBreak(.break_inline, block_inst, func_inst);
...@@ -10024,6 +10040,7 @@ const GenZir = struct {...@@ -10024,6 +10040,7 @@ const GenZir = struct {
10024 ret_ref: Zir.Inst.Ref,10040 ret_ref: Zir.Inst.Ref,
1002510041
10026 lib_name: u32,10042 lib_name: u32,
10043 noalias_bits: u32,
10027 is_var_args: bool,10044 is_var_args: bool,
10028 is_inferred_error: bool,10045 is_inferred_error: bool,
10029 is_test: bool,10046 is_test: bool,
...@@ -10071,7 +10088,7 @@ const GenZir = struct {...@@ -10071,7 +10088,7 @@ const GenZir = struct {
10071 if (args.cc_ref != .none or args.lib_name != 0 or10088 if (args.cc_ref != .none or args.lib_name != 0 or
10072 args.is_var_args or args.is_test or args.is_extern or10089 args.is_var_args or args.is_test or args.is_extern or
10073 args.align_ref != .none or args.section_ref != .none or10090 args.align_ref != .none or args.section_ref != .none or
10074 args.addrspace_ref != .none)10091 args.addrspace_ref != .none or args.noalias_bits != 0)
10075 {10092 {
10076 var align_body: []Zir.Inst.Index = &.{};10093 var align_body: []Zir.Inst.Index = &.{};
10077 var addrspace_body: []Zir.Inst.Index = &.{};10094 var addrspace_body: []Zir.Inst.Index = &.{};
...@@ -10093,7 +10110,8 @@ const GenZir = struct {...@@ -10093,7 +10110,8 @@ const GenZir = struct {
10093 fancyFnExprExtraLen(cc_body, args.cc_ref) +10110 fancyFnExprExtraLen(cc_body, args.cc_ref) +
10094 fancyFnExprExtraLen(ret_body, ret_ref) +10111 fancyFnExprExtraLen(ret_body, ret_ref) +
10095 body.len + src_locs.len +10112 body.len + src_locs.len +
10096 @boolToInt(args.lib_name != 0),10113 @boolToInt(args.lib_name != 0) +
10114 @boolToInt(args.noalias_bits != 0),
10097 );10115 );
10098 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.FuncFancy{10116 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.FuncFancy{
10099 .param_block = args.param_block,10117 .param_block = args.param_block,
...@@ -10104,6 +10122,7 @@ const GenZir = struct {...@@ -10104,6 +10122,7 @@ const GenZir = struct {
10104 .is_test = args.is_test,10122 .is_test = args.is_test,
10105 .is_extern = args.is_extern,10123 .is_extern = args.is_extern,
10106 .has_lib_name = args.lib_name != 0,10124 .has_lib_name = args.lib_name != 0,
10125 .has_any_noalias = args.noalias_bits != 0,
1010710126
10108 .has_align_ref = args.align_ref != .none,10127 .has_align_ref = args.align_ref != .none,
10109 .has_addrspace_ref = args.addrspace_ref != .none,10128 .has_addrspace_ref = args.addrspace_ref != .none,
...@@ -10159,6 +10178,10 @@ const GenZir = struct {...@@ -10159,6 +10178,10 @@ const GenZir = struct {
10159 astgen.extra.appendAssumeCapacity(@enumToInt(ret_ref));10178 astgen.extra.appendAssumeCapacity(@enumToInt(ret_ref));
10160 }10179 }
1016110180
10181 if (args.noalias_bits != 0) {
10182 astgen.extra.appendAssumeCapacity(args.noalias_bits);
10183 }
10184
10162 astgen.extra.appendSliceAssumeCapacity(body);10185 astgen.extra.appendSliceAssumeCapacity(body);
10163 astgen.extra.appendSliceAssumeCapacity(src_locs);10186 astgen.extra.appendSliceAssumeCapacity(src_locs);
1016410187
src/Sema.zig+12-5
...@@ -6565,12 +6565,10 @@ fn zirFunc(...@@ -6565,12 +6565,10 @@ fn zirFunc(
6565 has_body,6565 has_body,
6566 src_locs,6566 src_locs,
6567 null,6567 null,
6568 0,
6568 );6569 );
6569}6570}
65706571
6571// TODO this function and its callsites along with funcCommon need to be reworked
6572// to handle when callconv, align, linksection, addrspace depend on comptime values
6573// (thus triggering error.GenericPoison)
6574fn resolveGenericBody(6572fn resolveGenericBody(
6575 sema: *Sema,6573 sema: *Sema,
6576 block: *Block,6574 block: *Block,
...@@ -6696,6 +6694,7 @@ fn funcCommon(...@@ -6696,6 +6694,7 @@ fn funcCommon(
6696 has_body: bool,6694 has_body: bool,
6697 src_locs: Zir.Inst.Func.SrcLocs,6695 src_locs: Zir.Inst.Func.SrcLocs,
6698 opt_lib_name: ?[]const u8,6696 opt_lib_name: ?[]const u8,
6697 noalias_bits: u32,
6699) CompileError!Air.Inst.Ref {6698) CompileError!Air.Inst.Ref {
6700 const ret_ty_src: LazySrcLoc = .{ .node_offset_fn_type_ret_ty = src_node_offset };6699 const ret_ty_src: LazySrcLoc = .{ .node_offset_fn_type_ret_ty = src_node_offset };
67016700
...@@ -6807,6 +6806,7 @@ fn funcCommon(...@@ -6807,6 +6806,7 @@ fn funcCommon(
6807 .addrspace_is_generic = address_space == null,6806 .addrspace_is_generic = address_space == null,
6808 .is_var_args = var_args,6807 .is_var_args = var_args,
6809 .is_generic = is_generic,6808 .is_generic = is_generic,
6809 .noalias_bits = noalias_bits,
6810 });6810 });
6811 };6811 };
68126812
...@@ -9626,7 +9626,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -9626,7 +9626,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
9626 const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };9626 const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node };
9627 const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };9627 const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node };
96289628
9629 // In `**` rhs has to be comptime-known, but lhs can be runtime-known9629 // In `**` rhs must be comptime-known, but lhs can be runtime-known
9630 const factor = try sema.resolveInt(block, rhs_src, extra.rhs, Type.usize);9630 const factor = try sema.resolveInt(block, rhs_src, extra.rhs, Type.usize);
96319631
9632 if (lhs_ty.isTuple()) {9632 if (lhs_ty.isTuple()) {
...@@ -11916,7 +11916,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai...@@ -11916,7 +11916,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1191611916
11917 try sema.queueFullTypeResolution(try error_field_ty.copy(sema.arena));11917 try sema.queueFullTypeResolution(try error_field_ty.copy(sema.arena));
1191811918
11919 // If the error set is inferred it has to be resolved at this point11919 // If the error set is inferred it must be resolved at this point
11920 try sema.resolveInferredErrorSetTy(block, src, ty);11920 try sema.resolveInferredErrorSetTy(block, src, ty);
1192111921
11922 // Build our list of Error values11922 // Build our list of Error values
...@@ -16970,6 +16970,12 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -16970,6 +16970,12 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
16970 break :blk ty;16970 break :blk ty;
16971 } else Type.void;16971 } else Type.void;
1697216972
16973 const noalias_bits: u32 = if (extra.data.bits.has_any_noalias) blk: {
16974 const x = sema.code.extra[extra_index];
16975 extra_index += 1;
16976 break :blk x;
16977 } else 0;
16978
16973 var src_locs: Zir.Inst.Func.SrcLocs = undefined;16979 var src_locs: Zir.Inst.Func.SrcLocs = undefined;
16974 const has_body = extra.data.body_len != 0;16980 const has_body = extra.data.body_len != 0;
16975 if (has_body) {16981 if (has_body) {
...@@ -16996,6 +17002,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A...@@ -16996,6 +17002,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
16996 has_body,17002 has_body,
16997 src_locs,17003 src_locs,
16998 lib_name,17004 lib_name,
17005 noalias_bits,
16999 );17006 );
17000}17007}
1700117008
src/Zir.zig+11-3
...@@ -2670,8 +2670,10 @@ pub const Inst = struct {...@@ -2670,8 +2670,10 @@ pub const Inst = struct {
2670 /// 14. ret_ty_body_len: u322670 /// 14. ret_ty_body_len: u32
2671 /// 15. ret_ty_body: u32 // for each ret_ty_body_len2671 /// 15. ret_ty_body: u32 // for each ret_ty_body_len
2672 /// }2672 /// }
2673 /// 16. body: Index // for each body_len2673 /// 16. noalias_bits: u32 // if has_any_noalias
2674 /// 17. src_locs: Func.SrcLocs // if body_len != 02674 /// - each bit starting with LSB corresponds to parameter indexes
2675 /// 17. body: Index // for each body_len
2676 /// 18. src_locs: Func.SrcLocs // if body_len != 0
2675 pub const FuncFancy = struct {2677 pub const FuncFancy = struct {
2676 /// Points to the block that contains the param instructions for this function.2678 /// Points to the block that contains the param instructions for this function.
2677 param_block: Index,2679 param_block: Index,
...@@ -2699,7 +2701,8 @@ pub const Inst = struct {...@@ -2699,7 +2701,8 @@ pub const Inst = struct {
2699 has_ret_ty_ref: bool,2701 has_ret_ty_ref: bool,
2700 has_ret_ty_body: bool,2702 has_ret_ty_body: bool,
2701 has_lib_name: bool,2703 has_lib_name: bool,
2702 _: u17 = undefined,2704 has_any_noalias: bool,
2705 _: u16 = undefined,
2703 };2706 };
2704 };2707 };
27052708
...@@ -3699,6 +3702,8 @@ fn findDeclsInner(...@@ -3699,6 +3702,8 @@ fn findDeclsInner(
3699 extra_index += 1;3702 extra_index += 1;
3700 }3703 }
37013704
3705 extra_index += @boolToInt(extra.data.bits.has_any_noalias);
3706
3702 const body = zir.extra[extra_index..][0..extra.data.body_len];3707 const body = zir.extra[extra_index..][0..extra.data.body_len];
3703 return zir.findDeclsBody(list, body);3708 return zir.findDeclsBody(list, body);
3704 },3709 },
...@@ -3906,6 +3911,9 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo {...@@ -3906,6 +3911,9 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo {
3906 ret_ty_ref = @intToEnum(Inst.Ref, zir.extra[extra_index]);3911 ret_ty_ref = @intToEnum(Inst.Ref, zir.extra[extra_index]);
3907 extra_index += 1;3912 extra_index += 1;
3908 }3913 }
3914
3915 extra_index += @boolToInt(extra.data.bits.has_any_noalias);
3916
3909 const body = zir.extra[extra_index..][0..extra.data.body_len];3917 const body = zir.extra[extra_index..][0..extra.data.body_len];
3910 extra_index += body.len;3918 extra_index += body.len;
3911 break :blk .{3919 break :blk .{
src/codegen/llvm.zig+5-1
...@@ -725,8 +725,12 @@ pub const Object = struct {...@@ -725,8 +725,12 @@ pub const Object = struct {
725 try args.append(param);725 try args.append(param);
726726
727 if (param_ty.isPtrAtRuntime()) {727 if (param_ty.isPtrAtRuntime()) {
728 // TODO noalias attribute
729 const ptr_info = param_ty.ptrInfo().data;728 const ptr_info = param_ty.ptrInfo().data;
729 if (math.cast(u5, it.zig_index - 1)) |i| {
730 if (@truncate(u1, fn_info.noalias_bits >> i) != 0) {
731 dg.addArgAttr(llvm_func, llvm_arg_i, "noalias");
732 }
733 }
730 if (!param_ty.isPtrLikeOptional() and !ptr_info.@"allowzero") {734 if (!param_ty.isPtrLikeOptional() and !ptr_info.@"allowzero") {
731 dg.addArgAttr(llvm_func, llvm_arg_i, "nonnull");735 dg.addArgAttr(llvm_func, llvm_arg_i, "nonnull");
732 }736 }
src/print_zir.zig+13
...@@ -1961,6 +1961,7 @@ const Writer = struct {...@@ -1961,6 +1961,7 @@ const Writer = struct {
1961 body,1961 body,
1962 src,1962 src,
1963 src_locs,1963 src_locs,
1964 0,
1964 );1965 );
1965 }1966 }
19661967
...@@ -2034,6 +2035,12 @@ const Writer = struct {...@@ -2034,6 +2035,12 @@ const Writer = struct {
2034 extra_index += 1;2035 extra_index += 1;
2035 }2036 }
20362037
2038 const noalias_bits: u32 = if (extra.data.bits.has_any_noalias) blk: {
2039 const x = self.code.extra[extra_index];
2040 extra_index += 1;
2041 break :blk x;
2042 } else 0;
2043
2037 const body = self.code.extra[extra_index..][0..extra.data.body_len];2044 const body = self.code.extra[extra_index..][0..extra.data.body_len];
2038 extra_index += body.len;2045 extra_index += body.len;
20392046
...@@ -2059,6 +2066,7 @@ const Writer = struct {...@@ -2059,6 +2066,7 @@ const Writer = struct {
2059 body,2066 body,
2060 src,2067 src,
2061 src_locs,2068 src_locs,
2069 noalias_bits,
2062 );2070 );
2063 }2071 }
20642072
...@@ -2216,6 +2224,7 @@ const Writer = struct {...@@ -2216,6 +2224,7 @@ const Writer = struct {
2216 body: []const Zir.Inst.Index,2224 body: []const Zir.Inst.Index,
2217 src: LazySrcLoc,2225 src: LazySrcLoc,
2218 src_locs: Zir.Inst.Func.SrcLocs,2226 src_locs: Zir.Inst.Func.SrcLocs,
2227 noalias_bits: u32,
2219 ) !void {2228 ) !void {
2220 try self.writeOptionalInstRefOrBody(stream, "align=", align_ref, align_body);2229 try self.writeOptionalInstRefOrBody(stream, "align=", align_ref, align_body);
2221 try self.writeOptionalInstRefOrBody(stream, "addrspace=", addrspace_ref, addrspace_body);2230 try self.writeOptionalInstRefOrBody(stream, "addrspace=", addrspace_ref, addrspace_body);
...@@ -2226,6 +2235,10 @@ const Writer = struct {...@@ -2226,6 +2235,10 @@ const Writer = struct {
2226 try self.writeFlag(stream, "extern, ", is_extern);2235 try self.writeFlag(stream, "extern, ", is_extern);
2227 try self.writeFlag(stream, "inferror, ", inferred_error_set);2236 try self.writeFlag(stream, "inferror, ", inferred_error_set);
22282237
2238 if (noalias_bits != 0) {
2239 try stream.print("noalias=0b{b}, ", .{noalias_bits});
2240 }
2241
2229 try stream.writeAll("body=");2242 try stream.writeAll("body=");
2230 try self.writeBracedBody(stream, body);2243 try self.writeBracedBody(stream, body);
2231 try stream.writeAll(") ");2244 try stream.writeAll(") ");
src/type.zig+34-4
...@@ -646,6 +646,9 @@ pub const Type = extern union {...@@ -646,6 +646,9 @@ pub const Type = extern union {
646 if (a_info.is_generic != b_info.is_generic)646 if (a_info.is_generic != b_info.is_generic)
647 return false;647 return false;
648648
649 if (a_info.noalias_bits != b_info.noalias_bits)
650 return false;
651
649 if (!a_info.cc_is_generic and a_info.cc != b_info.cc)652 if (!a_info.cc_is_generic and a_info.cc != b_info.cc)
650 return false;653 return false;
651654
...@@ -1047,6 +1050,7 @@ pub const Type = extern union {...@@ -1047,6 +1050,7 @@ pub const Type = extern union {
1047 }1050 }
1048 std.hash.autoHash(hasher, fn_info.is_var_args);1051 std.hash.autoHash(hasher, fn_info.is_var_args);
1049 std.hash.autoHash(hasher, fn_info.is_generic);1052 std.hash.autoHash(hasher, fn_info.is_generic);
1053 std.hash.autoHash(hasher, fn_info.noalias_bits);
10501054
1051 std.hash.autoHash(hasher, fn_info.param_types.len);1055 std.hash.autoHash(hasher, fn_info.param_types.len);
1052 for (fn_info.param_types) |param_ty, i| {1056 for (fn_info.param_types) |param_ty, i| {
...@@ -1424,6 +1428,11 @@ pub const Type = extern union {...@@ -1424,6 +1428,11 @@ pub const Type = extern union {
1424 .is_var_args = payload.is_var_args,1428 .is_var_args = payload.is_var_args,
1425 .is_generic = payload.is_generic,1429 .is_generic = payload.is_generic,
1426 .comptime_params = comptime_params.ptr,1430 .comptime_params = comptime_params.ptr,
1431 .align_is_generic = payload.align_is_generic,
1432 .cc_is_generic = payload.cc_is_generic,
1433 .section_is_generic = payload.section_is_generic,
1434 .addrspace_is_generic = payload.addrspace_is_generic,
1435 .noalias_bits = payload.noalias_bits,
1427 });1436 });
1428 },1437 },
1429 .pointer => {1438 .pointer => {
...@@ -4738,6 +4747,11 @@ pub const Type = extern union {...@@ -4738,6 +4747,11 @@ pub const Type = extern union {
4738 .alignment = 0,4747 .alignment = 0,
4739 .is_var_args = false,4748 .is_var_args = false,
4740 .is_generic = false,4749 .is_generic = false,
4750 .align_is_generic = false,
4751 .cc_is_generic = false,
4752 .section_is_generic = false,
4753 .addrspace_is_generic = false,
4754 .noalias_bits = 0,
4741 },4755 },
4742 .fn_void_no_args => .{4756 .fn_void_no_args => .{
4743 .param_types = &.{},4757 .param_types = &.{},
...@@ -4747,6 +4761,11 @@ pub const Type = extern union {...@@ -4747,6 +4761,11 @@ pub const Type = extern union {
4747 .alignment = 0,4761 .alignment = 0,
4748 .is_var_args = false,4762 .is_var_args = false,
4749 .is_generic = false,4763 .is_generic = false,
4764 .align_is_generic = false,
4765 .cc_is_generic = false,
4766 .section_is_generic = false,
4767 .addrspace_is_generic = false,
4768 .noalias_bits = 0,
4750 },4769 },
4751 .fn_naked_noreturn_no_args => .{4770 .fn_naked_noreturn_no_args => .{
4752 .param_types = &.{},4771 .param_types = &.{},
...@@ -4756,6 +4775,11 @@ pub const Type = extern union {...@@ -4756,6 +4775,11 @@ pub const Type = extern union {
4756 .alignment = 0,4775 .alignment = 0,
4757 .is_var_args = false,4776 .is_var_args = false,
4758 .is_generic = false,4777 .is_generic = false,
4778 .align_is_generic = false,
4779 .cc_is_generic = false,
4780 .section_is_generic = false,
4781 .addrspace_is_generic = false,
4782 .noalias_bits = 0,
4759 },4783 },
4760 .fn_ccc_void_no_args => .{4784 .fn_ccc_void_no_args => .{
4761 .param_types = &.{},4785 .param_types = &.{},
...@@ -4765,6 +4789,11 @@ pub const Type = extern union {...@@ -4765,6 +4789,11 @@ pub const Type = extern union {
4765 .alignment = 0,4789 .alignment = 0,
4766 .is_var_args = false,4790 .is_var_args = false,
4767 .is_generic = false,4791 .is_generic = false,
4792 .align_is_generic = false,
4793 .cc_is_generic = false,
4794 .section_is_generic = false,
4795 .addrspace_is_generic = false,
4796 .noalias_bits = 0,
4768 },4797 },
4769 .function => ty.castTag(.function).?.data,4798 .function => ty.castTag(.function).?.data,
47704799
...@@ -6123,13 +6152,14 @@ pub const Type = extern union {...@@ -6123,13 +6152,14 @@ pub const Type = extern union {
6123 return_type: Type,6152 return_type: Type,
6124 /// If zero use default target function code alignment.6153 /// If zero use default target function code alignment.
6125 alignment: u32,6154 alignment: u32,
6155 noalias_bits: u32,
6126 cc: std.builtin.CallingConvention,6156 cc: std.builtin.CallingConvention,
6127 is_var_args: bool,6157 is_var_args: bool,
6128 is_generic: bool,6158 is_generic: bool,
6129 align_is_generic: bool = false,6159 align_is_generic: bool,
6130 cc_is_generic: bool = false,6160 cc_is_generic: bool,
6131 section_is_generic: bool = false,6161 section_is_generic: bool,
6132 addrspace_is_generic: bool = false,6162 addrspace_is_generic: bool,
61336163
6134 pub fn paramIsComptime(self: @This(), i: usize) bool {6164 pub fn paramIsComptime(self: @This(), i: usize) bool {
6135 assert(i < self.param_types.len);6165 assert(i < self.param_types.len);