| author | |
| committer | |
| log | d3c6f7179c7a6086ab9cdbaed231da9a1f0b4dee |
| tree | a75bc8abc129a679fce0673165e04fa7283f2823 |
| parent | d9147b91a601ad2442aaa43f4dba2d01b25d803d |
| parent | 4c0f021c2e4270c7392df7250a5d8f2431dcc54f |
| signature |
Implement `@branchHint` and new `@export` usage266 files changed, 2443 insertions(+), 1808 deletions(-)
doc/langref.html.in+12-24| ... | ... | @@ -4340,6 +4340,13 @@ comptime { |
| 4340 | 4340 | {#see_also|@sizeOf|@typeInfo#} |
| 4341 | 4341 | {#header_close#} |
| 4342 | 4342 | |
| 4343 | {#header_open|@branchHint#} | |
| 4344 | <pre>{#syntax#}@branchHint(hint: BranchHint) void{#endsyntax#}</pre> | |
| 4345 | <p>Hints to the optimizer how likely a given branch of control flow is to be reached.</p> | |
| 4346 | <p>{#syntax#}BranchHint{#endsyntax#} can be found with {#syntax#}@import("std").builtin.BranchHint{#endsyntax#}.</p> | |
| 4347 | <p>This function is only valid as the first statement in a control flow branch, or the first statement in a function.</p> | |
| 4348 | {#header_close#} | |
| 4349 | ||
| 4343 | 4350 | {#header_open|@breakpoint#} |
| 4344 | 4351 | <pre>{#syntax#}@breakpoint() void{#endsyntax#}</pre> |
| 4345 | 4352 | <p> |
| ... | ... | @@ -4767,23 +4774,13 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 4767 | 4774 | {#header_close#} |
| 4768 | 4775 | |
| 4769 | 4776 | {#header_open|@export#} |
| 4770 | <pre>{#syntax#}@export(declaration, comptime options: std.builtin.ExportOptions) void{#endsyntax#}</pre> | |
| 4771 | <p> | |
| 4772 | Creates a symbol in the output object file. | |
| 4773 | </p> | |
| 4774 | <p> | |
| 4775 | <code>declaration</code> must be one of two things: | |
| 4776 | </p> | |
| 4777 | <ul> | |
| 4778 | <li>An identifier ({#syntax#}x{#endsyntax#}) identifying a {#link|function|Functions#} or a | |
| 4779 | {#link|variable|Container Level Variables#}.</li> | |
| 4780 | <li>Field access ({#syntax#}x.y{#endsyntax#}) looking up a {#link|function|Functions#} or a | |
| 4781 | {#link|variable|Container Level Variables#}.</li> | |
| 4782 | </ul> | |
| 4777 | <pre>{#syntax#}@export(comptime ptr: *const anyopaque, comptime options: std.builtin.ExportOptions) void{#endsyntax#}</pre> | |
| 4778 | <p>Creates a symbol in the output object file which refers to the target of <code>ptr</code>.</p> | |
| 4779 | <p><code>ptr</code> must point to a global variable or a comptime-known constant.</p> | |
| 4783 | 4780 | <p> |
| 4784 | 4781 | This builtin can be called from a {#link|comptime#} block to conditionally export symbols. |
| 4785 | When <code>declaration</code> is a function with the C calling convention and | |
| 4786 | {#syntax#}options.linkage{#endsyntax#} is {#syntax#}Strong{#endsyntax#}, this is equivalent to | |
| 4782 | When <code>ptr</code> points to a function with the C calling convention and | |
| 4783 | {#syntax#}options.linkage{#endsyntax#} is {#syntax#}.Strong{#endsyntax#}, this is equivalent to | |
| 4787 | 4784 | the {#syntax#}export{#endsyntax#} keyword used on a function: |
| 4788 | 4785 | </p> |
| 4789 | 4786 | {#code|export_builtin.zig#} |
| ... | ... | @@ -5252,15 +5249,6 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val |
| 5252 | 5249 | </p> |
| 5253 | 5250 | {#header_close#} |
| 5254 | 5251 | |
| 5255 | {#header_open|@setCold#} | |
| 5256 | <pre>{#syntax#}@setCold(comptime is_cold: bool) void{#endsyntax#}</pre> | |
| 5257 | <p> | |
| 5258 | Tells the optimizer that the current function is (or is not) rarely called. | |
| 5259 | ||
| 5260 | This function is only valid within function scope. | |
| 5261 | </p> | |
| 5262 | {#header_close#} | |
| 5263 | ||
| 5264 | 5252 | {#header_open|@setEvalBranchQuota#} |
| 5265 | 5253 | <pre>{#syntax#}@setEvalBranchQuota(comptime new_quota: u32) void{#endsyntax#}</pre> |
| 5266 | 5254 | <p> |
doc/langref/export_builtin.zig+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | comptime { |
| 2 | @export(internalName, .{ .name = "foo", .linkage = .strong }); | |
| 2 | @export(&internalName, .{ .name = "foo", .linkage = .strong }); | |
| 3 | 3 | } |
| 4 | 4 | |
| 5 | 5 | fn internalName() callconv(.C) void {} |
doc/langref/test_functions.zig+2-2| ... | ... | @@ -27,9 +27,9 @@ const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall |
| 27 | 27 | extern "kernel32" fn ExitProcess(exit_code: u32) callconv(WINAPI) noreturn; |
| 28 | 28 | extern "c" fn atan2(a: f64, b: f64) f64; |
| 29 | 29 | |
| 30 | // The @setCold builtin tells the optimizer that a function is rarely called. | |
| 30 | // The @branchHint builtin can be used to tell the optimizer that a function is rarely called ("cold"). | |
| 31 | 31 | fn abort() noreturn { |
| 32 | @setCold(true); | |
| 32 | @branchHint(.cold); | |
| 33 | 33 | while (true) {} |
| 34 | 34 | } |
| 35 | 35 |
lib/c.zig+11-11| ... | ... | @@ -26,27 +26,27 @@ const is_freestanding = switch (native_os) { |
| 26 | 26 | |
| 27 | 27 | comptime { |
| 28 | 28 | if (is_freestanding and is_wasm and builtin.link_libc) { |
| 29 | @export(wasm_start, .{ .name = "_start", .linkage = .strong }); | |
| 29 | @export(&wasm_start, .{ .name = "_start", .linkage = .strong }); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if (builtin.link_libc) { |
| 33 | @export(strcmp, .{ .name = "strcmp", .linkage = .strong }); | |
| 34 | @export(strncmp, .{ .name = "strncmp", .linkage = .strong }); | |
| 35 | @export(strerror, .{ .name = "strerror", .linkage = .strong }); | |
| 36 | @export(strlen, .{ .name = "strlen", .linkage = .strong }); | |
| 37 | @export(strcpy, .{ .name = "strcpy", .linkage = .strong }); | |
| 38 | @export(strncpy, .{ .name = "strncpy", .linkage = .strong }); | |
| 39 | @export(strcat, .{ .name = "strcat", .linkage = .strong }); | |
| 40 | @export(strncat, .{ .name = "strncat", .linkage = .strong }); | |
| 33 | @export(&strcmp, .{ .name = "strcmp", .linkage = .strong }); | |
| 34 | @export(&strncmp, .{ .name = "strncmp", .linkage = .strong }); | |
| 35 | @export(&strerror, .{ .name = "strerror", .linkage = .strong }); | |
| 36 | @export(&strlen, .{ .name = "strlen", .linkage = .strong }); | |
| 37 | @export(&strcpy, .{ .name = "strcpy", .linkage = .strong }); | |
| 38 | @export(&strncpy, .{ .name = "strncpy", .linkage = .strong }); | |
| 39 | @export(&strcat, .{ .name = "strcat", .linkage = .strong }); | |
| 40 | @export(&strncat, .{ .name = "strncat", .linkage = .strong }); | |
| 41 | 41 | } else if (is_msvc) { |
| 42 | @export(_fltused, .{ .name = "_fltused", .linkage = .strong }); | |
| 42 | @export(&_fltused, .{ .name = "_fltused", .linkage = .strong }); | |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Avoid dragging in the runtime safety mechanisms into this .o file, |
| 47 | 47 | // unless we're trying to test this file. |
| 48 | 48 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 49 | @setCold(true); | |
| 49 | @branchHint(.cold); | |
| 50 | 50 | _ = error_return_trace; |
| 51 | 51 | if (builtin.is_test) { |
| 52 | 52 | std.debug.panic("{s}", .{msg}); |
lib/compiler/aro/aro/Driver/Filesystem.zig+4-4| ... | ... | @@ -4,7 +4,7 @@ const builtin = @import("builtin"); |
| 4 | 4 | const is_windows = builtin.os.tag == .windows; |
| 5 | 5 | |
| 6 | 6 | fn readFileFake(entries: []const Filesystem.Entry, path: []const u8, buf: []u8) ?[]const u8 { |
| 7 | @setCold(true); | |
| 7 | @branchHint(.cold); | |
| 8 | 8 | for (entries) |entry| { |
| 9 | 9 | if (mem.eql(u8, entry.path, path)) { |
| 10 | 10 | const len = @min(entry.contents.len, buf.len); |
| ... | ... | @@ -16,7 +16,7 @@ fn readFileFake(entries: []const Filesystem.Entry, path: []const u8, buf: []u8) |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | fn findProgramByNameFake(entries: []const Filesystem.Entry, name: []const u8, path: ?[]const u8, buf: []u8) ?[]const u8 { |
| 19 | @setCold(true); | |
| 19 | @branchHint(.cold); | |
| 20 | 20 | if (mem.indexOfScalar(u8, name, '/') != null) { |
| 21 | 21 | @memcpy(buf[0..name.len], name); |
| 22 | 22 | return buf[0..name.len]; |
| ... | ... | @@ -35,7 +35,7 @@ fn findProgramByNameFake(entries: []const Filesystem.Entry, name: []const u8, pa |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | fn canExecuteFake(entries: []const Filesystem.Entry, path: []const u8) bool { |
| 38 | @setCold(true); | |
| 38 | @branchHint(.cold); | |
| 39 | 39 | for (entries) |entry| { |
| 40 | 40 | if (mem.eql(u8, entry.path, path)) { |
| 41 | 41 | return entry.executable; |
| ... | ... | @@ -45,7 +45,7 @@ fn canExecuteFake(entries: []const Filesystem.Entry, path: []const u8) bool { |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | fn existsFake(entries: []const Filesystem.Entry, path: []const u8) bool { |
| 48 | @setCold(true); | |
| 48 | @branchHint(.cold); | |
| 49 | 49 | var buf: [std.fs.max_path_bytes]u8 = undefined; |
| 50 | 50 | var fib = std.heap.FixedBufferAllocator.init(&buf); |
| 51 | 51 | const resolved = std.fs.path.resolvePosix(fib.allocator(), &.{path}) catch return false; |
lib/compiler/aro/aro/Parser.zig+5-5| ... | ... | @@ -385,12 +385,12 @@ fn errExpectedToken(p: *Parser, expected: Token.Id, actual: Token.Id) Error { |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | pub fn errStr(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, str: []const u8) Compilation.Error!void { |
| 388 | @setCold(true); | |
| 388 | @branchHint(.cold); | |
| 389 | 389 | return p.errExtra(tag, tok_i, .{ .str = str }); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | pub fn errExtra(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, extra: Diagnostics.Message.Extra) Compilation.Error!void { |
| 393 | @setCold(true); | |
| 393 | @branchHint(.cold); | |
| 394 | 394 | const tok = p.pp.tokens.get(tok_i); |
| 395 | 395 | var loc = tok.loc; |
| 396 | 396 | if (tok_i != 0 and tok.id == .eof) { |
| ... | ... | @@ -407,12 +407,12 @@ pub fn errExtra(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, extra: Diag |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | pub fn errTok(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex) Compilation.Error!void { |
| 410 | @setCold(true); | |
| 410 | @branchHint(.cold); | |
| 411 | 411 | return p.errExtra(tag, tok_i, .{ .none = {} }); |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | pub fn err(p: *Parser, tag: Diagnostics.Tag) Compilation.Error!void { |
| 415 | @setCold(true); | |
| 415 | @branchHint(.cold); | |
| 416 | 416 | return p.errExtra(tag, p.tok_i, .{ .none = {} }); |
| 417 | 417 | } |
| 418 | 418 | |
| ... | ... | @@ -638,7 +638,7 @@ fn pragma(p: *Parser) Compilation.Error!bool { |
| 638 | 638 | |
| 639 | 639 | /// Issue errors for top-level definitions whose type was never completed. |
| 640 | 640 | fn diagnoseIncompleteDefinitions(p: *Parser) !void { |
| 641 | @setCold(true); | |
| 641 | @branchHint(.cold); | |
| 642 | 642 | |
| 643 | 643 | const node_slices = p.nodes.slice(); |
| 644 | 644 | const tags = node_slices.items(.tag); |
lib/compiler/resinator/main.zig+4-4| ... | ... | @@ -421,7 +421,7 @@ fn cliDiagnosticsToErrorBundle( |
| 421 | 421 | gpa: std.mem.Allocator, |
| 422 | 422 | diagnostics: *cli.Diagnostics, |
| 423 | 423 | ) !ErrorBundle { |
| 424 | @setCold(true); | |
| 424 | @branchHint(.cold); | |
| 425 | 425 | |
| 426 | 426 | var bundle: ErrorBundle.Wip = undefined; |
| 427 | 427 | try bundle.init(gpa); |
| ... | ... | @@ -468,7 +468,7 @@ fn diagnosticsToErrorBundle( |
| 468 | 468 | diagnostics: *Diagnostics, |
| 469 | 469 | mappings: SourceMappings, |
| 470 | 470 | ) !ErrorBundle { |
| 471 | @setCold(true); | |
| 471 | @branchHint(.cold); | |
| 472 | 472 | |
| 473 | 473 | var bundle: ErrorBundle.Wip = undefined; |
| 474 | 474 | try bundle.init(gpa); |
| ... | ... | @@ -559,7 +559,7 @@ fn flushErrorMessageIntoBundle(wip: *ErrorBundle.Wip, msg: ErrorBundle.ErrorMess |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | fn errorStringToErrorBundle(allocator: std.mem.Allocator, comptime format: []const u8, args: anytype) !ErrorBundle { |
| 562 | @setCold(true); | |
| 562 | @branchHint(.cold); | |
| 563 | 563 | var bundle: ErrorBundle.Wip = undefined; |
| 564 | 564 | try bundle.init(allocator); |
| 565 | 565 | errdefer bundle.deinit(); |
| ... | ... | @@ -574,7 +574,7 @@ fn aroDiagnosticsToErrorBundle( |
| 574 | 574 | fail_msg: []const u8, |
| 575 | 575 | comp: *aro.Compilation, |
| 576 | 576 | ) !ErrorBundle { |
| 577 | @setCold(true); | |
| 577 | @branchHint(.cold); | |
| 578 | 578 | |
| 579 | 579 | var bundle: ErrorBundle.Wip = undefined; |
| 580 | 580 | try bundle.init(gpa); |
lib/compiler_rt/aarch64_outline_atomics.zig+100-100| ... | ... | @@ -2124,104 +2124,104 @@ fn __aarch64_cas16_acq_rel() align(16) callconv(.Naked) void { |
| 2124 | 2124 | } |
| 2125 | 2125 | |
| 2126 | 2126 | comptime { |
| 2127 | @export(__aarch64_cas1_relax, .{ .name = "__aarch64_cas1_relax", .linkage = linkage }); | |
| 2128 | @export(__aarch64_swp1_relax, .{ .name = "__aarch64_swp1_relax", .linkage = linkage }); | |
| 2129 | @export(__aarch64_ldadd1_relax, .{ .name = "__aarch64_ldadd1_relax", .linkage = linkage }); | |
| 2130 | @export(__aarch64_ldclr1_relax, .{ .name = "__aarch64_ldclr1_relax", .linkage = linkage }); | |
| 2131 | @export(__aarch64_ldeor1_relax, .{ .name = "__aarch64_ldeor1_relax", .linkage = linkage }); | |
| 2132 | @export(__aarch64_ldset1_relax, .{ .name = "__aarch64_ldset1_relax", .linkage = linkage }); | |
| 2133 | @export(__aarch64_cas1_acq, .{ .name = "__aarch64_cas1_acq", .linkage = linkage }); | |
| 2134 | @export(__aarch64_swp1_acq, .{ .name = "__aarch64_swp1_acq", .linkage = linkage }); | |
| 2135 | @export(__aarch64_ldadd1_acq, .{ .name = "__aarch64_ldadd1_acq", .linkage = linkage }); | |
| 2136 | @export(__aarch64_ldclr1_acq, .{ .name = "__aarch64_ldclr1_acq", .linkage = linkage }); | |
| 2137 | @export(__aarch64_ldeor1_acq, .{ .name = "__aarch64_ldeor1_acq", .linkage = linkage }); | |
| 2138 | @export(__aarch64_ldset1_acq, .{ .name = "__aarch64_ldset1_acq", .linkage = linkage }); | |
| 2139 | @export(__aarch64_cas1_rel, .{ .name = "__aarch64_cas1_rel", .linkage = linkage }); | |
| 2140 | @export(__aarch64_swp1_rel, .{ .name = "__aarch64_swp1_rel", .linkage = linkage }); | |
| 2141 | @export(__aarch64_ldadd1_rel, .{ .name = "__aarch64_ldadd1_rel", .linkage = linkage }); | |
| 2142 | @export(__aarch64_ldclr1_rel, .{ .name = "__aarch64_ldclr1_rel", .linkage = linkage }); | |
| 2143 | @export(__aarch64_ldeor1_rel, .{ .name = "__aarch64_ldeor1_rel", .linkage = linkage }); | |
| 2144 | @export(__aarch64_ldset1_rel, .{ .name = "__aarch64_ldset1_rel", .linkage = linkage }); | |
| 2145 | @export(__aarch64_cas1_acq_rel, .{ .name = "__aarch64_cas1_acq_rel", .linkage = linkage }); | |
| 2146 | @export(__aarch64_swp1_acq_rel, .{ .name = "__aarch64_swp1_acq_rel", .linkage = linkage }); | |
| 2147 | @export(__aarch64_ldadd1_acq_rel, .{ .name = "__aarch64_ldadd1_acq_rel", .linkage = linkage }); | |
| 2148 | @export(__aarch64_ldclr1_acq_rel, .{ .name = "__aarch64_ldclr1_acq_rel", .linkage = linkage }); | |
| 2149 | @export(__aarch64_ldeor1_acq_rel, .{ .name = "__aarch64_ldeor1_acq_rel", .linkage = linkage }); | |
| 2150 | @export(__aarch64_ldset1_acq_rel, .{ .name = "__aarch64_ldset1_acq_rel", .linkage = linkage }); | |
| 2151 | @export(__aarch64_cas2_relax, .{ .name = "__aarch64_cas2_relax", .linkage = linkage }); | |
| 2152 | @export(__aarch64_swp2_relax, .{ .name = "__aarch64_swp2_relax", .linkage = linkage }); | |
| 2153 | @export(__aarch64_ldadd2_relax, .{ .name = "__aarch64_ldadd2_relax", .linkage = linkage }); | |
| 2154 | @export(__aarch64_ldclr2_relax, .{ .name = "__aarch64_ldclr2_relax", .linkage = linkage }); | |
| 2155 | @export(__aarch64_ldeor2_relax, .{ .name = "__aarch64_ldeor2_relax", .linkage = linkage }); | |
| 2156 | @export(__aarch64_ldset2_relax, .{ .name = "__aarch64_ldset2_relax", .linkage = linkage }); | |
| 2157 | @export(__aarch64_cas2_acq, .{ .name = "__aarch64_cas2_acq", .linkage = linkage }); | |
| 2158 | @export(__aarch64_swp2_acq, .{ .name = "__aarch64_swp2_acq", .linkage = linkage }); | |
| 2159 | @export(__aarch64_ldadd2_acq, .{ .name = "__aarch64_ldadd2_acq", .linkage = linkage }); | |
| 2160 | @export(__aarch64_ldclr2_acq, .{ .name = "__aarch64_ldclr2_acq", .linkage = linkage }); | |
| 2161 | @export(__aarch64_ldeor2_acq, .{ .name = "__aarch64_ldeor2_acq", .linkage = linkage }); | |
| 2162 | @export(__aarch64_ldset2_acq, .{ .name = "__aarch64_ldset2_acq", .linkage = linkage }); | |
| 2163 | @export(__aarch64_cas2_rel, .{ .name = "__aarch64_cas2_rel", .linkage = linkage }); | |
| 2164 | @export(__aarch64_swp2_rel, .{ .name = "__aarch64_swp2_rel", .linkage = linkage }); | |
| 2165 | @export(__aarch64_ldadd2_rel, .{ .name = "__aarch64_ldadd2_rel", .linkage = linkage }); | |
| 2166 | @export(__aarch64_ldclr2_rel, .{ .name = "__aarch64_ldclr2_rel", .linkage = linkage }); | |
| 2167 | @export(__aarch64_ldeor2_rel, .{ .name = "__aarch64_ldeor2_rel", .linkage = linkage }); | |
| 2168 | @export(__aarch64_ldset2_rel, .{ .name = "__aarch64_ldset2_rel", .linkage = linkage }); | |
| 2169 | @export(__aarch64_cas2_acq_rel, .{ .name = "__aarch64_cas2_acq_rel", .linkage = linkage }); | |
| 2170 | @export(__aarch64_swp2_acq_rel, .{ .name = "__aarch64_swp2_acq_rel", .linkage = linkage }); | |
| 2171 | @export(__aarch64_ldadd2_acq_rel, .{ .name = "__aarch64_ldadd2_acq_rel", .linkage = linkage }); | |
| 2172 | @export(__aarch64_ldclr2_acq_rel, .{ .name = "__aarch64_ldclr2_acq_rel", .linkage = linkage }); | |
| 2173 | @export(__aarch64_ldeor2_acq_rel, .{ .name = "__aarch64_ldeor2_acq_rel", .linkage = linkage }); | |
| 2174 | @export(__aarch64_ldset2_acq_rel, .{ .name = "__aarch64_ldset2_acq_rel", .linkage = linkage }); | |
| 2175 | @export(__aarch64_cas4_relax, .{ .name = "__aarch64_cas4_relax", .linkage = linkage }); | |
| 2176 | @export(__aarch64_swp4_relax, .{ .name = "__aarch64_swp4_relax", .linkage = linkage }); | |
| 2177 | @export(__aarch64_ldadd4_relax, .{ .name = "__aarch64_ldadd4_relax", .linkage = linkage }); | |
| 2178 | @export(__aarch64_ldclr4_relax, .{ .name = "__aarch64_ldclr4_relax", .linkage = linkage }); | |
| 2179 | @export(__aarch64_ldeor4_relax, .{ .name = "__aarch64_ldeor4_relax", .linkage = linkage }); | |
| 2180 | @export(__aarch64_ldset4_relax, .{ .name = "__aarch64_ldset4_relax", .linkage = linkage }); | |
| 2181 | @export(__aarch64_cas4_acq, .{ .name = "__aarch64_cas4_acq", .linkage = linkage }); | |
| 2182 | @export(__aarch64_swp4_acq, .{ .name = "__aarch64_swp4_acq", .linkage = linkage }); | |
| 2183 | @export(__aarch64_ldadd4_acq, .{ .name = "__aarch64_ldadd4_acq", .linkage = linkage }); | |
| 2184 | @export(__aarch64_ldclr4_acq, .{ .name = "__aarch64_ldclr4_acq", .linkage = linkage }); | |
| 2185 | @export(__aarch64_ldeor4_acq, .{ .name = "__aarch64_ldeor4_acq", .linkage = linkage }); | |
| 2186 | @export(__aarch64_ldset4_acq, .{ .name = "__aarch64_ldset4_acq", .linkage = linkage }); | |
| 2187 | @export(__aarch64_cas4_rel, .{ .name = "__aarch64_cas4_rel", .linkage = linkage }); | |
| 2188 | @export(__aarch64_swp4_rel, .{ .name = "__aarch64_swp4_rel", .linkage = linkage }); | |
| 2189 | @export(__aarch64_ldadd4_rel, .{ .name = "__aarch64_ldadd4_rel", .linkage = linkage }); | |
| 2190 | @export(__aarch64_ldclr4_rel, .{ .name = "__aarch64_ldclr4_rel", .linkage = linkage }); | |
| 2191 | @export(__aarch64_ldeor4_rel, .{ .name = "__aarch64_ldeor4_rel", .linkage = linkage }); | |
| 2192 | @export(__aarch64_ldset4_rel, .{ .name = "__aarch64_ldset4_rel", .linkage = linkage }); | |
| 2193 | @export(__aarch64_cas4_acq_rel, .{ .name = "__aarch64_cas4_acq_rel", .linkage = linkage }); | |
| 2194 | @export(__aarch64_swp4_acq_rel, .{ .name = "__aarch64_swp4_acq_rel", .linkage = linkage }); | |
| 2195 | @export(__aarch64_ldadd4_acq_rel, .{ .name = "__aarch64_ldadd4_acq_rel", .linkage = linkage }); | |
| 2196 | @export(__aarch64_ldclr4_acq_rel, .{ .name = "__aarch64_ldclr4_acq_rel", .linkage = linkage }); | |
| 2197 | @export(__aarch64_ldeor4_acq_rel, .{ .name = "__aarch64_ldeor4_acq_rel", .linkage = linkage }); | |
| 2198 | @export(__aarch64_ldset4_acq_rel, .{ .name = "__aarch64_ldset4_acq_rel", .linkage = linkage }); | |
| 2199 | @export(__aarch64_cas8_relax, .{ .name = "__aarch64_cas8_relax", .linkage = linkage }); | |
| 2200 | @export(__aarch64_swp8_relax, .{ .name = "__aarch64_swp8_relax", .linkage = linkage }); | |
| 2201 | @export(__aarch64_ldadd8_relax, .{ .name = "__aarch64_ldadd8_relax", .linkage = linkage }); | |
| 2202 | @export(__aarch64_ldclr8_relax, .{ .name = "__aarch64_ldclr8_relax", .linkage = linkage }); | |
| 2203 | @export(__aarch64_ldeor8_relax, .{ .name = "__aarch64_ldeor8_relax", .linkage = linkage }); | |
| 2204 | @export(__aarch64_ldset8_relax, .{ .name = "__aarch64_ldset8_relax", .linkage = linkage }); | |
| 2205 | @export(__aarch64_cas8_acq, .{ .name = "__aarch64_cas8_acq", .linkage = linkage }); | |
| 2206 | @export(__aarch64_swp8_acq, .{ .name = "__aarch64_swp8_acq", .linkage = linkage }); | |
| 2207 | @export(__aarch64_ldadd8_acq, .{ .name = "__aarch64_ldadd8_acq", .linkage = linkage }); | |
| 2208 | @export(__aarch64_ldclr8_acq, .{ .name = "__aarch64_ldclr8_acq", .linkage = linkage }); | |
| 2209 | @export(__aarch64_ldeor8_acq, .{ .name = "__aarch64_ldeor8_acq", .linkage = linkage }); | |
| 2210 | @export(__aarch64_ldset8_acq, .{ .name = "__aarch64_ldset8_acq", .linkage = linkage }); | |
| 2211 | @export(__aarch64_cas8_rel, .{ .name = "__aarch64_cas8_rel", .linkage = linkage }); | |
| 2212 | @export(__aarch64_swp8_rel, .{ .name = "__aarch64_swp8_rel", .linkage = linkage }); | |
| 2213 | @export(__aarch64_ldadd8_rel, .{ .name = "__aarch64_ldadd8_rel", .linkage = linkage }); | |
| 2214 | @export(__aarch64_ldclr8_rel, .{ .name = "__aarch64_ldclr8_rel", .linkage = linkage }); | |
| 2215 | @export(__aarch64_ldeor8_rel, .{ .name = "__aarch64_ldeor8_rel", .linkage = linkage }); | |
| 2216 | @export(__aarch64_ldset8_rel, .{ .name = "__aarch64_ldset8_rel", .linkage = linkage }); | |
| 2217 | @export(__aarch64_cas8_acq_rel, .{ .name = "__aarch64_cas8_acq_rel", .linkage = linkage }); | |
| 2218 | @export(__aarch64_swp8_acq_rel, .{ .name = "__aarch64_swp8_acq_rel", .linkage = linkage }); | |
| 2219 | @export(__aarch64_ldadd8_acq_rel, .{ .name = "__aarch64_ldadd8_acq_rel", .linkage = linkage }); | |
| 2220 | @export(__aarch64_ldclr8_acq_rel, .{ .name = "__aarch64_ldclr8_acq_rel", .linkage = linkage }); | |
| 2221 | @export(__aarch64_ldeor8_acq_rel, .{ .name = "__aarch64_ldeor8_acq_rel", .linkage = linkage }); | |
| 2222 | @export(__aarch64_ldset8_acq_rel, .{ .name = "__aarch64_ldset8_acq_rel", .linkage = linkage }); | |
| 2223 | @export(__aarch64_cas16_relax, .{ .name = "__aarch64_cas16_relax", .linkage = linkage }); | |
| 2224 | @export(__aarch64_cas16_acq, .{ .name = "__aarch64_cas16_acq", .linkage = linkage }); | |
| 2225 | @export(__aarch64_cas16_rel, .{ .name = "__aarch64_cas16_rel", .linkage = linkage }); | |
| 2226 | @export(__aarch64_cas16_acq_rel, .{ .name = "__aarch64_cas16_acq_rel", .linkage = linkage }); | |
| 2127 | @export(&__aarch64_cas1_relax, .{ .name = "__aarch64_cas1_relax", .linkage = linkage }); | |
| 2128 | @export(&__aarch64_swp1_relax, .{ .name = "__aarch64_swp1_relax", .linkage = linkage }); | |
| 2129 | @export(&__aarch64_ldadd1_relax, .{ .name = "__aarch64_ldadd1_relax", .linkage = linkage }); | |
| 2130 | @export(&__aarch64_ldclr1_relax, .{ .name = "__aarch64_ldclr1_relax", .linkage = linkage }); | |
| 2131 | @export(&__aarch64_ldeor1_relax, .{ .name = "__aarch64_ldeor1_relax", .linkage = linkage }); | |
| 2132 | @export(&__aarch64_ldset1_relax, .{ .name = "__aarch64_ldset1_relax", .linkage = linkage }); | |
| 2133 | @export(&__aarch64_cas1_acq, .{ .name = "__aarch64_cas1_acq", .linkage = linkage }); | |
| 2134 | @export(&__aarch64_swp1_acq, .{ .name = "__aarch64_swp1_acq", .linkage = linkage }); | |
| 2135 | @export(&__aarch64_ldadd1_acq, .{ .name = "__aarch64_ldadd1_acq", .linkage = linkage }); | |
| 2136 | @export(&__aarch64_ldclr1_acq, .{ .name = "__aarch64_ldclr1_acq", .linkage = linkage }); | |
| 2137 | @export(&__aarch64_ldeor1_acq, .{ .name = "__aarch64_ldeor1_acq", .linkage = linkage }); | |
| 2138 | @export(&__aarch64_ldset1_acq, .{ .name = "__aarch64_ldset1_acq", .linkage = linkage }); | |
| 2139 | @export(&__aarch64_cas1_rel, .{ .name = "__aarch64_cas1_rel", .linkage = linkage }); | |
| 2140 | @export(&__aarch64_swp1_rel, .{ .name = "__aarch64_swp1_rel", .linkage = linkage }); | |
| 2141 | @export(&__aarch64_ldadd1_rel, .{ .name = "__aarch64_ldadd1_rel", .linkage = linkage }); | |
| 2142 | @export(&__aarch64_ldclr1_rel, .{ .name = "__aarch64_ldclr1_rel", .linkage = linkage }); | |
| 2143 | @export(&__aarch64_ldeor1_rel, .{ .name = "__aarch64_ldeor1_rel", .linkage = linkage }); | |
| 2144 | @export(&__aarch64_ldset1_rel, .{ .name = "__aarch64_ldset1_rel", .linkage = linkage }); | |
| 2145 | @export(&__aarch64_cas1_acq_rel, .{ .name = "__aarch64_cas1_acq_rel", .linkage = linkage }); | |
| 2146 | @export(&__aarch64_swp1_acq_rel, .{ .name = "__aarch64_swp1_acq_rel", .linkage = linkage }); | |
| 2147 | @export(&__aarch64_ldadd1_acq_rel, .{ .name = "__aarch64_ldadd1_acq_rel", .linkage = linkage }); | |
| 2148 | @export(&__aarch64_ldclr1_acq_rel, .{ .name = "__aarch64_ldclr1_acq_rel", .linkage = linkage }); | |
| 2149 | @export(&__aarch64_ldeor1_acq_rel, .{ .name = "__aarch64_ldeor1_acq_rel", .linkage = linkage }); | |
| 2150 | @export(&__aarch64_ldset1_acq_rel, .{ .name = "__aarch64_ldset1_acq_rel", .linkage = linkage }); | |
| 2151 | @export(&__aarch64_cas2_relax, .{ .name = "__aarch64_cas2_relax", .linkage = linkage }); | |
| 2152 | @export(&__aarch64_swp2_relax, .{ .name = "__aarch64_swp2_relax", .linkage = linkage }); | |
| 2153 | @export(&__aarch64_ldadd2_relax, .{ .name = "__aarch64_ldadd2_relax", .linkage = linkage }); | |
| 2154 | @export(&__aarch64_ldclr2_relax, .{ .name = "__aarch64_ldclr2_relax", .linkage = linkage }); | |
| 2155 | @export(&__aarch64_ldeor2_relax, .{ .name = "__aarch64_ldeor2_relax", .linkage = linkage }); | |
| 2156 | @export(&__aarch64_ldset2_relax, .{ .name = "__aarch64_ldset2_relax", .linkage = linkage }); | |
| 2157 | @export(&__aarch64_cas2_acq, .{ .name = "__aarch64_cas2_acq", .linkage = linkage }); | |
| 2158 | @export(&__aarch64_swp2_acq, .{ .name = "__aarch64_swp2_acq", .linkage = linkage }); | |
| 2159 | @export(&__aarch64_ldadd2_acq, .{ .name = "__aarch64_ldadd2_acq", .linkage = linkage }); | |
| 2160 | @export(&__aarch64_ldclr2_acq, .{ .name = "__aarch64_ldclr2_acq", .linkage = linkage }); | |
| 2161 | @export(&__aarch64_ldeor2_acq, .{ .name = "__aarch64_ldeor2_acq", .linkage = linkage }); | |
| 2162 | @export(&__aarch64_ldset2_acq, .{ .name = "__aarch64_ldset2_acq", .linkage = linkage }); | |
| 2163 | @export(&__aarch64_cas2_rel, .{ .name = "__aarch64_cas2_rel", .linkage = linkage }); | |
| 2164 | @export(&__aarch64_swp2_rel, .{ .name = "__aarch64_swp2_rel", .linkage = linkage }); | |
| 2165 | @export(&__aarch64_ldadd2_rel, .{ .name = "__aarch64_ldadd2_rel", .linkage = linkage }); | |
| 2166 | @export(&__aarch64_ldclr2_rel, .{ .name = "__aarch64_ldclr2_rel", .linkage = linkage }); | |
| 2167 | @export(&__aarch64_ldeor2_rel, .{ .name = "__aarch64_ldeor2_rel", .linkage = linkage }); | |
| 2168 | @export(&__aarch64_ldset2_rel, .{ .name = "__aarch64_ldset2_rel", .linkage = linkage }); | |
| 2169 | @export(&__aarch64_cas2_acq_rel, .{ .name = "__aarch64_cas2_acq_rel", .linkage = linkage }); | |
| 2170 | @export(&__aarch64_swp2_acq_rel, .{ .name = "__aarch64_swp2_acq_rel", .linkage = linkage }); | |
| 2171 | @export(&__aarch64_ldadd2_acq_rel, .{ .name = "__aarch64_ldadd2_acq_rel", .linkage = linkage }); | |
| 2172 | @export(&__aarch64_ldclr2_acq_rel, .{ .name = "__aarch64_ldclr2_acq_rel", .linkage = linkage }); | |
| 2173 | @export(&__aarch64_ldeor2_acq_rel, .{ .name = "__aarch64_ldeor2_acq_rel", .linkage = linkage }); | |
| 2174 | @export(&__aarch64_ldset2_acq_rel, .{ .name = "__aarch64_ldset2_acq_rel", .linkage = linkage }); | |
| 2175 | @export(&__aarch64_cas4_relax, .{ .name = "__aarch64_cas4_relax", .linkage = linkage }); | |
| 2176 | @export(&__aarch64_swp4_relax, .{ .name = "__aarch64_swp4_relax", .linkage = linkage }); | |
| 2177 | @export(&__aarch64_ldadd4_relax, .{ .name = "__aarch64_ldadd4_relax", .linkage = linkage }); | |
| 2178 | @export(&__aarch64_ldclr4_relax, .{ .name = "__aarch64_ldclr4_relax", .linkage = linkage }); | |
| 2179 | @export(&__aarch64_ldeor4_relax, .{ .name = "__aarch64_ldeor4_relax", .linkage = linkage }); | |
| 2180 | @export(&__aarch64_ldset4_relax, .{ .name = "__aarch64_ldset4_relax", .linkage = linkage }); | |
| 2181 | @export(&__aarch64_cas4_acq, .{ .name = "__aarch64_cas4_acq", .linkage = linkage }); | |
| 2182 | @export(&__aarch64_swp4_acq, .{ .name = "__aarch64_swp4_acq", .linkage = linkage }); | |
| 2183 | @export(&__aarch64_ldadd4_acq, .{ .name = "__aarch64_ldadd4_acq", .linkage = linkage }); | |
| 2184 | @export(&__aarch64_ldclr4_acq, .{ .name = "__aarch64_ldclr4_acq", .linkage = linkage }); | |
| 2185 | @export(&__aarch64_ldeor4_acq, .{ .name = "__aarch64_ldeor4_acq", .linkage = linkage }); | |
| 2186 | @export(&__aarch64_ldset4_acq, .{ .name = "__aarch64_ldset4_acq", .linkage = linkage }); | |
| 2187 | @export(&__aarch64_cas4_rel, .{ .name = "__aarch64_cas4_rel", .linkage = linkage }); | |
| 2188 | @export(&__aarch64_swp4_rel, .{ .name = "__aarch64_swp4_rel", .linkage = linkage }); | |
| 2189 | @export(&__aarch64_ldadd4_rel, .{ .name = "__aarch64_ldadd4_rel", .linkage = linkage }); | |
| 2190 | @export(&__aarch64_ldclr4_rel, .{ .name = "__aarch64_ldclr4_rel", .linkage = linkage }); | |
| 2191 | @export(&__aarch64_ldeor4_rel, .{ .name = "__aarch64_ldeor4_rel", .linkage = linkage }); | |
| 2192 | @export(&__aarch64_ldset4_rel, .{ .name = "__aarch64_ldset4_rel", .linkage = linkage }); | |
| 2193 | @export(&__aarch64_cas4_acq_rel, .{ .name = "__aarch64_cas4_acq_rel", .linkage = linkage }); | |
| 2194 | @export(&__aarch64_swp4_acq_rel, .{ .name = "__aarch64_swp4_acq_rel", .linkage = linkage }); | |
| 2195 | @export(&__aarch64_ldadd4_acq_rel, .{ .name = "__aarch64_ldadd4_acq_rel", .linkage = linkage }); | |
| 2196 | @export(&__aarch64_ldclr4_acq_rel, .{ .name = "__aarch64_ldclr4_acq_rel", .linkage = linkage }); | |
| 2197 | @export(&__aarch64_ldeor4_acq_rel, .{ .name = "__aarch64_ldeor4_acq_rel", .linkage = linkage }); | |
| 2198 | @export(&__aarch64_ldset4_acq_rel, .{ .name = "__aarch64_ldset4_acq_rel", .linkage = linkage }); | |
| 2199 | @export(&__aarch64_cas8_relax, .{ .name = "__aarch64_cas8_relax", .linkage = linkage }); | |
| 2200 | @export(&__aarch64_swp8_relax, .{ .name = "__aarch64_swp8_relax", .linkage = linkage }); | |
| 2201 | @export(&__aarch64_ldadd8_relax, .{ .name = "__aarch64_ldadd8_relax", .linkage = linkage }); | |
| 2202 | @export(&__aarch64_ldclr8_relax, .{ .name = "__aarch64_ldclr8_relax", .linkage = linkage }); | |
| 2203 | @export(&__aarch64_ldeor8_relax, .{ .name = "__aarch64_ldeor8_relax", .linkage = linkage }); | |
| 2204 | @export(&__aarch64_ldset8_relax, .{ .name = "__aarch64_ldset8_relax", .linkage = linkage }); | |
| 2205 | @export(&__aarch64_cas8_acq, .{ .name = "__aarch64_cas8_acq", .linkage = linkage }); | |
| 2206 | @export(&__aarch64_swp8_acq, .{ .name = "__aarch64_swp8_acq", .linkage = linkage }); | |
| 2207 | @export(&__aarch64_ldadd8_acq, .{ .name = "__aarch64_ldadd8_acq", .linkage = linkage }); | |
| 2208 | @export(&__aarch64_ldclr8_acq, .{ .name = "__aarch64_ldclr8_acq", .linkage = linkage }); | |
| 2209 | @export(&__aarch64_ldeor8_acq, .{ .name = "__aarch64_ldeor8_acq", .linkage = linkage }); | |
| 2210 | @export(&__aarch64_ldset8_acq, .{ .name = "__aarch64_ldset8_acq", .linkage = linkage }); | |
| 2211 | @export(&__aarch64_cas8_rel, .{ .name = "__aarch64_cas8_rel", .linkage = linkage }); | |
| 2212 | @export(&__aarch64_swp8_rel, .{ .name = "__aarch64_swp8_rel", .linkage = linkage }); | |
| 2213 | @export(&__aarch64_ldadd8_rel, .{ .name = "__aarch64_ldadd8_rel", .linkage = linkage }); | |
| 2214 | @export(&__aarch64_ldclr8_rel, .{ .name = "__aarch64_ldclr8_rel", .linkage = linkage }); | |
| 2215 | @export(&__aarch64_ldeor8_rel, .{ .name = "__aarch64_ldeor8_rel", .linkage = linkage }); | |
| 2216 | @export(&__aarch64_ldset8_rel, .{ .name = "__aarch64_ldset8_rel", .linkage = linkage }); | |
| 2217 | @export(&__aarch64_cas8_acq_rel, .{ .name = "__aarch64_cas8_acq_rel", .linkage = linkage }); | |
| 2218 | @export(&__aarch64_swp8_acq_rel, .{ .name = "__aarch64_swp8_acq_rel", .linkage = linkage }); | |
| 2219 | @export(&__aarch64_ldadd8_acq_rel, .{ .name = "__aarch64_ldadd8_acq_rel", .linkage = linkage }); | |
| 2220 | @export(&__aarch64_ldclr8_acq_rel, .{ .name = "__aarch64_ldclr8_acq_rel", .linkage = linkage }); | |
| 2221 | @export(&__aarch64_ldeor8_acq_rel, .{ .name = "__aarch64_ldeor8_acq_rel", .linkage = linkage }); | |
| 2222 | @export(&__aarch64_ldset8_acq_rel, .{ .name = "__aarch64_ldset8_acq_rel", .linkage = linkage }); | |
| 2223 | @export(&__aarch64_cas16_relax, .{ .name = "__aarch64_cas16_relax", .linkage = linkage }); | |
| 2224 | @export(&__aarch64_cas16_acq, .{ .name = "__aarch64_cas16_acq", .linkage = linkage }); | |
| 2225 | @export(&__aarch64_cas16_rel, .{ .name = "__aarch64_cas16_rel", .linkage = linkage }); | |
| 2226 | @export(&__aarch64_cas16_acq_rel, .{ .name = "__aarch64_cas16_acq_rel", .linkage = linkage }); | |
| 2227 | 2227 | } |
lib/compiler_rt/absvdi2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const absv = @import("./absv.zig").absv; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__absvdi2, .{ .name = "__absvdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__absvdi2, .{ .name = "__absvdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __absvdi2(a: i64) callconv(.C) i64 { |
lib/compiler_rt/absvsi2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const absv = @import("./absv.zig").absv; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__absvsi2, .{ .name = "__absvsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__absvsi2, .{ .name = "__absvsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __absvsi2(a: i32) callconv(.C) i32 { |
lib/compiler_rt/absvti2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const absv = @import("./absv.zig").absv; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__absvti2, .{ .name = "__absvti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__absvti2, .{ .name = "__absvti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __absvti2(a: i128) callconv(.C) i128 { |
lib/compiler_rt/adddf3.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_dadd, .{ .name = "__aeabi_dadd", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_dadd, .{ .name = "__aeabi_dadd", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__adddf3, .{ .name = "__adddf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__adddf3, .{ .name = "__adddf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/addhf3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const addf3 = @import("./addf3.zig").addf3; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__addhf3, .{ .name = "__addhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__addhf3, .{ .name = "__addhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __addhf3(a: f16, b: f16) callconv(.C) f16 { |
lib/compiler_rt/addo.zig+3-3| ... | ... | @@ -5,9 +5,9 @@ const common = @import("./common.zig"); |
| 5 | 5 | pub const panic = @import("common.zig").panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | @export(__addosi4, .{ .name = "__addosi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(__addodi4, .{ .name = "__addodi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__addoti4, .{ .name = "__addoti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__addosi4, .{ .name = "__addosi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__addodi4, .{ .name = "__addodi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__addoti4, .{ .name = "__addoti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // addo - add overflow |
lib/compiler_rt/addsf3.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_fadd, .{ .name = "__aeabi_fadd", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_fadd, .{ .name = "__aeabi_fadd", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__addsf3, .{ .name = "__addsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__addsf3, .{ .name = "__addsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/addtf3.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__addtf3, .{ .name = "__addkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__addtf3, .{ .name = "__addkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__addtf3, .{ .name = "__addtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__addtf3, .{ .name = "__addtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 { |
lib/compiler_rt/addxf3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const addf3 = @import("./addf3.zig").addf3; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__addxf3, .{ .name = "__addxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__addxf3, .{ .name = "__addxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __addxf3(a: f80, b: f80) callconv(.C) f80 { |
lib/compiler_rt/arm.zig+22-22| ... | ... | @@ -10,39 +10,39 @@ pub const panic = common.panic; |
| 10 | 10 | comptime { |
| 11 | 11 | if (!builtin.is_test) { |
| 12 | 12 | if (arch.isArmOrThumb()) { |
| 13 | @export(__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | 16 | |
| 17 | @export(__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | |
| 20 | @export(__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | |
| 23 | @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(__aeabi_memcpy4, .{ .name = "__aeabi_memcpy4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(__aeabi_memcpy8, .{ .name = "__aeabi_memcpy8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&__aeabi_memcpy4, .{ .name = "__aeabi_memcpy4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__aeabi_memcpy8, .{ .name = "__aeabi_memcpy8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | 26 | |
| 27 | @export(__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | @export(__aeabi_memmove4, .{ .name = "__aeabi_memmove4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(__aeabi_memmove8, .{ .name = "__aeabi_memmove8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(&__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | @export(&__aeabi_memmove4, .{ .name = "__aeabi_memmove4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(&__aeabi_memmove8, .{ .name = "__aeabi_memmove8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | 30 | |
| 31 | @export(__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(__aeabi_memset4, .{ .name = "__aeabi_memset4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(__aeabi_memset8, .{ .name = "__aeabi_memset8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | @export(&__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(&__aeabi_memset4, .{ .name = "__aeabi_memset4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(&__aeabi_memset8, .{ .name = "__aeabi_memset8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 34 | 34 | |
| 35 | @export(__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 36 | @export(__aeabi_memclr4, .{ .name = "__aeabi_memclr4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 37 | @export(__aeabi_memclr8, .{ .name = "__aeabi_memclr8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 35 | @export(&__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 36 | @export(&__aeabi_memclr4, .{ .name = "__aeabi_memclr4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 37 | @export(&__aeabi_memclr8, .{ .name = "__aeabi_memclr8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 38 | 38 | |
| 39 | 39 | if (builtin.os.tag == .linux) { |
| 40 | @export(__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 40 | @export(&__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // floating-point helper functions (single+double-precision reverse subtraction, y – x), see subdf3.zig |
| 44 | @export(__aeabi_frsub, .{ .name = "__aeabi_frsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 45 | @export(__aeabi_drsub, .{ .name = "__aeabi_drsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 44 | @export(&__aeabi_frsub, .{ .name = "__aeabi_frsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 45 | @export(&__aeabi_drsub, .{ .name = "__aeabi_drsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
lib/compiler_rt/atomics.zig+76-76| ... | ... | @@ -538,81 +538,81 @@ fn __atomic_fetch_umin_16(ptr: *u128, val: u128, model: i32) callconv(.C) u128 { |
| 538 | 538 | |
| 539 | 539 | comptime { |
| 540 | 540 | if (supports_atomic_ops and builtin.object_format != .c) { |
| 541 | @export(__atomic_load, .{ .name = "__atomic_load", .linkage = linkage, .visibility = visibility }); | |
| 542 | @export(__atomic_store, .{ .name = "__atomic_store", .linkage = linkage, .visibility = visibility }); | |
| 543 | @export(__atomic_exchange, .{ .name = "__atomic_exchange", .linkage = linkage, .visibility = visibility }); | |
| 544 | @export(__atomic_compare_exchange, .{ .name = "__atomic_compare_exchange", .linkage = linkage, .visibility = visibility }); | |
| 545 | ||
| 546 | @export(__atomic_fetch_add_1, .{ .name = "__atomic_fetch_add_1", .linkage = linkage, .visibility = visibility }); | |
| 547 | @export(__atomic_fetch_add_2, .{ .name = "__atomic_fetch_add_2", .linkage = linkage, .visibility = visibility }); | |
| 548 | @export(__atomic_fetch_add_4, .{ .name = "__atomic_fetch_add_4", .linkage = linkage, .visibility = visibility }); | |
| 549 | @export(__atomic_fetch_add_8, .{ .name = "__atomic_fetch_add_8", .linkage = linkage, .visibility = visibility }); | |
| 550 | @export(__atomic_fetch_add_16, .{ .name = "__atomic_fetch_add_16", .linkage = linkage, .visibility = visibility }); | |
| 551 | ||
| 552 | @export(__atomic_fetch_sub_1, .{ .name = "__atomic_fetch_sub_1", .linkage = linkage, .visibility = visibility }); | |
| 553 | @export(__atomic_fetch_sub_2, .{ .name = "__atomic_fetch_sub_2", .linkage = linkage, .visibility = visibility }); | |
| 554 | @export(__atomic_fetch_sub_4, .{ .name = "__atomic_fetch_sub_4", .linkage = linkage, .visibility = visibility }); | |
| 555 | @export(__atomic_fetch_sub_8, .{ .name = "__atomic_fetch_sub_8", .linkage = linkage, .visibility = visibility }); | |
| 556 | @export(__atomic_fetch_sub_16, .{ .name = "__atomic_fetch_sub_16", .linkage = linkage, .visibility = visibility }); | |
| 557 | ||
| 558 | @export(__atomic_fetch_and_1, .{ .name = "__atomic_fetch_and_1", .linkage = linkage, .visibility = visibility }); | |
| 559 | @export(__atomic_fetch_and_2, .{ .name = "__atomic_fetch_and_2", .linkage = linkage, .visibility = visibility }); | |
| 560 | @export(__atomic_fetch_and_4, .{ .name = "__atomic_fetch_and_4", .linkage = linkage, .visibility = visibility }); | |
| 561 | @export(__atomic_fetch_and_8, .{ .name = "__atomic_fetch_and_8", .linkage = linkage, .visibility = visibility }); | |
| 562 | @export(__atomic_fetch_and_16, .{ .name = "__atomic_fetch_and_16", .linkage = linkage, .visibility = visibility }); | |
| 563 | ||
| 564 | @export(__atomic_fetch_or_1, .{ .name = "__atomic_fetch_or_1", .linkage = linkage, .visibility = visibility }); | |
| 565 | @export(__atomic_fetch_or_2, .{ .name = "__atomic_fetch_or_2", .linkage = linkage, .visibility = visibility }); | |
| 566 | @export(__atomic_fetch_or_4, .{ .name = "__atomic_fetch_or_4", .linkage = linkage, .visibility = visibility }); | |
| 567 | @export(__atomic_fetch_or_8, .{ .name = "__atomic_fetch_or_8", .linkage = linkage, .visibility = visibility }); | |
| 568 | @export(__atomic_fetch_or_16, .{ .name = "__atomic_fetch_or_16", .linkage = linkage, .visibility = visibility }); | |
| 569 | ||
| 570 | @export(__atomic_fetch_xor_1, .{ .name = "__atomic_fetch_xor_1", .linkage = linkage, .visibility = visibility }); | |
| 571 | @export(__atomic_fetch_xor_2, .{ .name = "__atomic_fetch_xor_2", .linkage = linkage, .visibility = visibility }); | |
| 572 | @export(__atomic_fetch_xor_4, .{ .name = "__atomic_fetch_xor_4", .linkage = linkage, .visibility = visibility }); | |
| 573 | @export(__atomic_fetch_xor_8, .{ .name = "__atomic_fetch_xor_8", .linkage = linkage, .visibility = visibility }); | |
| 574 | @export(__atomic_fetch_xor_16, .{ .name = "__atomic_fetch_xor_16", .linkage = linkage, .visibility = visibility }); | |
| 575 | ||
| 576 | @export(__atomic_fetch_nand_1, .{ .name = "__atomic_fetch_nand_1", .linkage = linkage, .visibility = visibility }); | |
| 577 | @export(__atomic_fetch_nand_2, .{ .name = "__atomic_fetch_nand_2", .linkage = linkage, .visibility = visibility }); | |
| 578 | @export(__atomic_fetch_nand_4, .{ .name = "__atomic_fetch_nand_4", .linkage = linkage, .visibility = visibility }); | |
| 579 | @export(__atomic_fetch_nand_8, .{ .name = "__atomic_fetch_nand_8", .linkage = linkage, .visibility = visibility }); | |
| 580 | @export(__atomic_fetch_nand_16, .{ .name = "__atomic_fetch_nand_16", .linkage = linkage, .visibility = visibility }); | |
| 581 | ||
| 582 | @export(__atomic_fetch_umax_1, .{ .name = "__atomic_fetch_umax_1", .linkage = linkage, .visibility = visibility }); | |
| 583 | @export(__atomic_fetch_umax_2, .{ .name = "__atomic_fetch_umax_2", .linkage = linkage, .visibility = visibility }); | |
| 584 | @export(__atomic_fetch_umax_4, .{ .name = "__atomic_fetch_umax_4", .linkage = linkage, .visibility = visibility }); | |
| 585 | @export(__atomic_fetch_umax_8, .{ .name = "__atomic_fetch_umax_8", .linkage = linkage, .visibility = visibility }); | |
| 586 | @export(__atomic_fetch_umax_16, .{ .name = "__atomic_fetch_umax_16", .linkage = linkage, .visibility = visibility }); | |
| 587 | ||
| 588 | @export(__atomic_fetch_umin_1, .{ .name = "__atomic_fetch_umin_1", .linkage = linkage, .visibility = visibility }); | |
| 589 | @export(__atomic_fetch_umin_2, .{ .name = "__atomic_fetch_umin_2", .linkage = linkage, .visibility = visibility }); | |
| 590 | @export(__atomic_fetch_umin_4, .{ .name = "__atomic_fetch_umin_4", .linkage = linkage, .visibility = visibility }); | |
| 591 | @export(__atomic_fetch_umin_8, .{ .name = "__atomic_fetch_umin_8", .linkage = linkage, .visibility = visibility }); | |
| 592 | @export(__atomic_fetch_umin_16, .{ .name = "__atomic_fetch_umin_16", .linkage = linkage, .visibility = visibility }); | |
| 593 | ||
| 594 | @export(__atomic_load_1, .{ .name = "__atomic_load_1", .linkage = linkage, .visibility = visibility }); | |
| 595 | @export(__atomic_load_2, .{ .name = "__atomic_load_2", .linkage = linkage, .visibility = visibility }); | |
| 596 | @export(__atomic_load_4, .{ .name = "__atomic_load_4", .linkage = linkage, .visibility = visibility }); | |
| 597 | @export(__atomic_load_8, .{ .name = "__atomic_load_8", .linkage = linkage, .visibility = visibility }); | |
| 598 | @export(__atomic_load_16, .{ .name = "__atomic_load_16", .linkage = linkage, .visibility = visibility }); | |
| 599 | ||
| 600 | @export(__atomic_store_1, .{ .name = "__atomic_store_1", .linkage = linkage, .visibility = visibility }); | |
| 601 | @export(__atomic_store_2, .{ .name = "__atomic_store_2", .linkage = linkage, .visibility = visibility }); | |
| 602 | @export(__atomic_store_4, .{ .name = "__atomic_store_4", .linkage = linkage, .visibility = visibility }); | |
| 603 | @export(__atomic_store_8, .{ .name = "__atomic_store_8", .linkage = linkage, .visibility = visibility }); | |
| 604 | @export(__atomic_store_16, .{ .name = "__atomic_store_16", .linkage = linkage, .visibility = visibility }); | |
| 605 | ||
| 606 | @export(__atomic_exchange_1, .{ .name = "__atomic_exchange_1", .linkage = linkage, .visibility = visibility }); | |
| 607 | @export(__atomic_exchange_2, .{ .name = "__atomic_exchange_2", .linkage = linkage, .visibility = visibility }); | |
| 608 | @export(__atomic_exchange_4, .{ .name = "__atomic_exchange_4", .linkage = linkage, .visibility = visibility }); | |
| 609 | @export(__atomic_exchange_8, .{ .name = "__atomic_exchange_8", .linkage = linkage, .visibility = visibility }); | |
| 610 | @export(__atomic_exchange_16, .{ .name = "__atomic_exchange_16", .linkage = linkage, .visibility = visibility }); | |
| 611 | ||
| 612 | @export(__atomic_compare_exchange_1, .{ .name = "__atomic_compare_exchange_1", .linkage = linkage, .visibility = visibility }); | |
| 613 | @export(__atomic_compare_exchange_2, .{ .name = "__atomic_compare_exchange_2", .linkage = linkage, .visibility = visibility }); | |
| 614 | @export(__atomic_compare_exchange_4, .{ .name = "__atomic_compare_exchange_4", .linkage = linkage, .visibility = visibility }); | |
| 615 | @export(__atomic_compare_exchange_8, .{ .name = "__atomic_compare_exchange_8", .linkage = linkage, .visibility = visibility }); | |
| 616 | @export(__atomic_compare_exchange_16, .{ .name = "__atomic_compare_exchange_16", .linkage = linkage, .visibility = visibility }); | |
| 541 | @export(&__atomic_load, .{ .name = "__atomic_load", .linkage = linkage, .visibility = visibility }); | |
| 542 | @export(&__atomic_store, .{ .name = "__atomic_store", .linkage = linkage, .visibility = visibility }); | |
| 543 | @export(&__atomic_exchange, .{ .name = "__atomic_exchange", .linkage = linkage, .visibility = visibility }); | |
| 544 | @export(&__atomic_compare_exchange, .{ .name = "__atomic_compare_exchange", .linkage = linkage, .visibility = visibility }); | |
| 545 | ||
| 546 | @export(&__atomic_fetch_add_1, .{ .name = "__atomic_fetch_add_1", .linkage = linkage, .visibility = visibility }); | |
| 547 | @export(&__atomic_fetch_add_2, .{ .name = "__atomic_fetch_add_2", .linkage = linkage, .visibility = visibility }); | |
| 548 | @export(&__atomic_fetch_add_4, .{ .name = "__atomic_fetch_add_4", .linkage = linkage, .visibility = visibility }); | |
| 549 | @export(&__atomic_fetch_add_8, .{ .name = "__atomic_fetch_add_8", .linkage = linkage, .visibility = visibility }); | |
| 550 | @export(&__atomic_fetch_add_16, .{ .name = "__atomic_fetch_add_16", .linkage = linkage, .visibility = visibility }); | |
| 551 | ||
| 552 | @export(&__atomic_fetch_sub_1, .{ .name = "__atomic_fetch_sub_1", .linkage = linkage, .visibility = visibility }); | |
| 553 | @export(&__atomic_fetch_sub_2, .{ .name = "__atomic_fetch_sub_2", .linkage = linkage, .visibility = visibility }); | |
| 554 | @export(&__atomic_fetch_sub_4, .{ .name = "__atomic_fetch_sub_4", .linkage = linkage, .visibility = visibility }); | |
| 555 | @export(&__atomic_fetch_sub_8, .{ .name = "__atomic_fetch_sub_8", .linkage = linkage, .visibility = visibility }); | |
| 556 | @export(&__atomic_fetch_sub_16, .{ .name = "__atomic_fetch_sub_16", .linkage = linkage, .visibility = visibility }); | |
| 557 | ||
| 558 | @export(&__atomic_fetch_and_1, .{ .name = "__atomic_fetch_and_1", .linkage = linkage, .visibility = visibility }); | |
| 559 | @export(&__atomic_fetch_and_2, .{ .name = "__atomic_fetch_and_2", .linkage = linkage, .visibility = visibility }); | |
| 560 | @export(&__atomic_fetch_and_4, .{ .name = "__atomic_fetch_and_4", .linkage = linkage, .visibility = visibility }); | |
| 561 | @export(&__atomic_fetch_and_8, .{ .name = "__atomic_fetch_and_8", .linkage = linkage, .visibility = visibility }); | |
| 562 | @export(&__atomic_fetch_and_16, .{ .name = "__atomic_fetch_and_16", .linkage = linkage, .visibility = visibility }); | |
| 563 | ||
| 564 | @export(&__atomic_fetch_or_1, .{ .name = "__atomic_fetch_or_1", .linkage = linkage, .visibility = visibility }); | |
| 565 | @export(&__atomic_fetch_or_2, .{ .name = "__atomic_fetch_or_2", .linkage = linkage, .visibility = visibility }); | |
| 566 | @export(&__atomic_fetch_or_4, .{ .name = "__atomic_fetch_or_4", .linkage = linkage, .visibility = visibility }); | |
| 567 | @export(&__atomic_fetch_or_8, .{ .name = "__atomic_fetch_or_8", .linkage = linkage, .visibility = visibility }); | |
| 568 | @export(&__atomic_fetch_or_16, .{ .name = "__atomic_fetch_or_16", .linkage = linkage, .visibility = visibility }); | |
| 569 | ||
| 570 | @export(&__atomic_fetch_xor_1, .{ .name = "__atomic_fetch_xor_1", .linkage = linkage, .visibility = visibility }); | |
| 571 | @export(&__atomic_fetch_xor_2, .{ .name = "__atomic_fetch_xor_2", .linkage = linkage, .visibility = visibility }); | |
| 572 | @export(&__atomic_fetch_xor_4, .{ .name = "__atomic_fetch_xor_4", .linkage = linkage, .visibility = visibility }); | |
| 573 | @export(&__atomic_fetch_xor_8, .{ .name = "__atomic_fetch_xor_8", .linkage = linkage, .visibility = visibility }); | |
| 574 | @export(&__atomic_fetch_xor_16, .{ .name = "__atomic_fetch_xor_16", .linkage = linkage, .visibility = visibility }); | |
| 575 | ||
| 576 | @export(&__atomic_fetch_nand_1, .{ .name = "__atomic_fetch_nand_1", .linkage = linkage, .visibility = visibility }); | |
| 577 | @export(&__atomic_fetch_nand_2, .{ .name = "__atomic_fetch_nand_2", .linkage = linkage, .visibility = visibility }); | |
| 578 | @export(&__atomic_fetch_nand_4, .{ .name = "__atomic_fetch_nand_4", .linkage = linkage, .visibility = visibility }); | |
| 579 | @export(&__atomic_fetch_nand_8, .{ .name = "__atomic_fetch_nand_8", .linkage = linkage, .visibility = visibility }); | |
| 580 | @export(&__atomic_fetch_nand_16, .{ .name = "__atomic_fetch_nand_16", .linkage = linkage, .visibility = visibility }); | |
| 581 | ||
| 582 | @export(&__atomic_fetch_umax_1, .{ .name = "__atomic_fetch_umax_1", .linkage = linkage, .visibility = visibility }); | |
| 583 | @export(&__atomic_fetch_umax_2, .{ .name = "__atomic_fetch_umax_2", .linkage = linkage, .visibility = visibility }); | |
| 584 | @export(&__atomic_fetch_umax_4, .{ .name = "__atomic_fetch_umax_4", .linkage = linkage, .visibility = visibility }); | |
| 585 | @export(&__atomic_fetch_umax_8, .{ .name = "__atomic_fetch_umax_8", .linkage = linkage, .visibility = visibility }); | |
| 586 | @export(&__atomic_fetch_umax_16, .{ .name = "__atomic_fetch_umax_16", .linkage = linkage, .visibility = visibility }); | |
| 587 | ||
| 588 | @export(&__atomic_fetch_umin_1, .{ .name = "__atomic_fetch_umin_1", .linkage = linkage, .visibility = visibility }); | |
| 589 | @export(&__atomic_fetch_umin_2, .{ .name = "__atomic_fetch_umin_2", .linkage = linkage, .visibility = visibility }); | |
| 590 | @export(&__atomic_fetch_umin_4, .{ .name = "__atomic_fetch_umin_4", .linkage = linkage, .visibility = visibility }); | |
| 591 | @export(&__atomic_fetch_umin_8, .{ .name = "__atomic_fetch_umin_8", .linkage = linkage, .visibility = visibility }); | |
| 592 | @export(&__atomic_fetch_umin_16, .{ .name = "__atomic_fetch_umin_16", .linkage = linkage, .visibility = visibility }); | |
| 593 | ||
| 594 | @export(&__atomic_load_1, .{ .name = "__atomic_load_1", .linkage = linkage, .visibility = visibility }); | |
| 595 | @export(&__atomic_load_2, .{ .name = "__atomic_load_2", .linkage = linkage, .visibility = visibility }); | |
| 596 | @export(&__atomic_load_4, .{ .name = "__atomic_load_4", .linkage = linkage, .visibility = visibility }); | |
| 597 | @export(&__atomic_load_8, .{ .name = "__atomic_load_8", .linkage = linkage, .visibility = visibility }); | |
| 598 | @export(&__atomic_load_16, .{ .name = "__atomic_load_16", .linkage = linkage, .visibility = visibility }); | |
| 599 | ||
| 600 | @export(&__atomic_store_1, .{ .name = "__atomic_store_1", .linkage = linkage, .visibility = visibility }); | |
| 601 | @export(&__atomic_store_2, .{ .name = "__atomic_store_2", .linkage = linkage, .visibility = visibility }); | |
| 602 | @export(&__atomic_store_4, .{ .name = "__atomic_store_4", .linkage = linkage, .visibility = visibility }); | |
| 603 | @export(&__atomic_store_8, .{ .name = "__atomic_store_8", .linkage = linkage, .visibility = visibility }); | |
| 604 | @export(&__atomic_store_16, .{ .name = "__atomic_store_16", .linkage = linkage, .visibility = visibility }); | |
| 605 | ||
| 606 | @export(&__atomic_exchange_1, .{ .name = "__atomic_exchange_1", .linkage = linkage, .visibility = visibility }); | |
| 607 | @export(&__atomic_exchange_2, .{ .name = "__atomic_exchange_2", .linkage = linkage, .visibility = visibility }); | |
| 608 | @export(&__atomic_exchange_4, .{ .name = "__atomic_exchange_4", .linkage = linkage, .visibility = visibility }); | |
| 609 | @export(&__atomic_exchange_8, .{ .name = "__atomic_exchange_8", .linkage = linkage, .visibility = visibility }); | |
| 610 | @export(&__atomic_exchange_16, .{ .name = "__atomic_exchange_16", .linkage = linkage, .visibility = visibility }); | |
| 611 | ||
| 612 | @export(&__atomic_compare_exchange_1, .{ .name = "__atomic_compare_exchange_1", .linkage = linkage, .visibility = visibility }); | |
| 613 | @export(&__atomic_compare_exchange_2, .{ .name = "__atomic_compare_exchange_2", .linkage = linkage, .visibility = visibility }); | |
| 614 | @export(&__atomic_compare_exchange_4, .{ .name = "__atomic_compare_exchange_4", .linkage = linkage, .visibility = visibility }); | |
| 615 | @export(&__atomic_compare_exchange_8, .{ .name = "__atomic_compare_exchange_8", .linkage = linkage, .visibility = visibility }); | |
| 616 | @export(&__atomic_compare_exchange_16, .{ .name = "__atomic_compare_exchange_16", .linkage = linkage, .visibility = visibility }); | |
| 617 | 617 | } |
| 618 | 618 | } |
lib/compiler_rt/aulldiv.zig+2-2| ... | ... | @@ -9,8 +9,8 @@ pub const panic = common.panic; |
| 9 | 9 | comptime { |
| 10 | 10 | if (arch == .x86 and abi == .msvc and builtin.zig_backend != .stage2_c) { |
| 11 | 11 | // Don't let LLVM apply the stdcall name mangling on those MSVC builtins |
| 12 | @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 |
lib/compiler_rt/aullrem.zig+2-2| ... | ... | @@ -9,8 +9,8 @@ pub const panic = common.panic; |
| 9 | 9 | comptime { |
| 10 | 10 | if (arch == .x86 and abi == .msvc and builtin.zig_backend != .stage2_c) { |
| 11 | 11 | // Don't let LLVM apply the stdcall name mangling on those MSVC builtins |
| 12 | @export(_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 |
lib/compiler_rt/bcmp.zig+1-1| ... | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const common = @import("./common.zig"); |
| 3 | 3 | |
| 4 | 4 | comptime { |
| 5 | @export(bcmp, .{ .name = "bcmp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 5 | @export(&bcmp, .{ .name = "bcmp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | pub fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.C) c_int { |
lib/compiler_rt/bitreverse.zig+3-3| ... | ... | @@ -5,9 +5,9 @@ const common = @import("common.zig"); |
| 5 | 5 | pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | @export(__bitreversesi2, .{ .name = "__bitreversesi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(__bitreversedi2, .{ .name = "__bitreversedi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__bitreverseti2, .{ .name = "__bitreverseti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__bitreversesi2, .{ .name = "__bitreversesi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__bitreversedi2, .{ .name = "__bitreversedi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__bitreverseti2, .{ .name = "__bitreverseti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | inline fn bitreverseXi2(comptime T: type, a: T) T { |
lib/compiler_rt/bswap.zig+3-3| ... | ... | @@ -5,9 +5,9 @@ const common = @import("common.zig"); |
| 5 | 5 | pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | @export(__bswapsi2, .{ .name = "__bswapsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(__bswapdi2, .{ .name = "__bswapdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__bswapti2, .{ .name = "__bswapti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__bswapsi2, .{ .name = "__bswapsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__bswapdi2, .{ .name = "__bswapdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__bswapti2, .{ .name = "__bswapti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // bswap - byteswap |
lib/compiler_rt/ceil.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__ceilh, .{ .name = "__ceilh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(ceilf, .{ .name = "ceilf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(ceil, .{ .name = "ceil", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__ceilx, .{ .name = "__ceilx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__ceilh, .{ .name = "__ceilh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&ceilf, .{ .name = "ceilf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&ceil, .{ .name = "ceil", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__ceilx, .{ .name = "__ceilx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(ceilq, .{ .name = "ceilf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&ceilq, .{ .name = "ceilf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(ceilq, .{ .name = "ceilq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(ceill, .{ .name = "ceill", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&ceilq, .{ .name = "ceilq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&ceill, .{ .name = "ceill", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __ceilh(x: f16) callconv(.C) f16 { |
lib/compiler_rt/clear_cache.zig+1-1| ... | ... | @@ -175,7 +175,7 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void { |
| 175 | 175 | const linkage = if (builtin.is_test) std.builtin.GlobalLinkage.internal else std.builtin.GlobalLinkage.weak; |
| 176 | 176 | |
| 177 | 177 | fn exportIt() void { |
| 178 | @export(clear_cache, .{ .name = "__clear_cache", .linkage = linkage }); | |
| 178 | @export(&clear_cache, .{ .name = "__clear_cache", .linkage = linkage }); | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // Darwin-only |
lib/compiler_rt/cmp.zig+6-6| ... | ... | @@ -6,12 +6,12 @@ const common = @import("common.zig"); |
| 6 | 6 | pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | @export(__cmpsi2, .{ .name = "__cmpsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__cmpdi2, .{ .name = "__cmpdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__cmpti2, .{ .name = "__cmpti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(__ucmpti2, .{ .name = "__ucmpti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__cmpsi2, .{ .name = "__cmpsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__cmpdi2, .{ .name = "__cmpdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__cmpti2, .{ .name = "__cmpti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__ucmpti2, .{ .name = "__ucmpti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // cmp - signed compare |
lib/compiler_rt/cmpdf2.zig+8-8| ... | ... | @@ -7,15 +7,15 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_aeabi) { |
| 10 | @export(__aeabi_dcmpeq, .{ .name = "__aeabi_dcmpeq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__aeabi_dcmplt, .{ .name = "__aeabi_dcmplt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__aeabi_dcmple, .{ .name = "__aeabi_dcmple", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__aeabi_dcmpeq, .{ .name = "__aeabi_dcmpeq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__aeabi_dcmplt, .{ .name = "__aeabi_dcmplt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__aeabi_dcmple, .{ .name = "__aeabi_dcmple", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } else { |
| 14 | @export(__eqdf2, .{ .name = "__eqdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__nedf2, .{ .name = "__nedf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(__ledf2, .{ .name = "__ledf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__cmpdf2, .{ .name = "__cmpdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(__ltdf2, .{ .name = "__ltdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__eqdf2, .{ .name = "__eqdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__nedf2, .{ .name = "__nedf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__ledf2, .{ .name = "__ledf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__cmpdf2, .{ .name = "__cmpdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__ltdf2, .{ .name = "__ltdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 |
lib/compiler_rt/cmphf2.zig+5-5| ... | ... | @@ -6,11 +6,11 @@ const comparef = @import("./comparef.zig"); |
| 6 | 6 | pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | @export(__eqhf2, .{ .name = "__eqhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__nehf2, .{ .name = "__nehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__lehf2, .{ .name = "__lehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__cmphf2, .{ .name = "__cmphf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__lthf2, .{ .name = "__lthf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__eqhf2, .{ .name = "__eqhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__nehf2, .{ .name = "__nehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__lehf2, .{ .name = "__lehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__cmphf2, .{ .name = "__cmphf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__lthf2, .{ .name = "__lthf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; |
lib/compiler_rt/cmpsf2.zig+8-8| ... | ... | @@ -7,15 +7,15 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_aeabi) { |
| 10 | @export(__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } else { |
| 14 | @export(__eqsf2, .{ .name = "__eqsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__nesf2, .{ .name = "__nesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(__lesf2, .{ .name = "__lesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__cmpsf2, .{ .name = "__cmpsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(__ltsf2, .{ .name = "__ltsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__eqsf2, .{ .name = "__eqsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__nesf2, .{ .name = "__nesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__lesf2, .{ .name = "__lesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__cmpsf2, .{ .name = "__cmpsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__ltsf2, .{ .name = "__ltsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 |
lib/compiler_rt/cmptf2.zig+16-16| ... | ... | @@ -7,24 +7,24 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_ppc_abi) { |
| 10 | @export(__eqtf2, .{ .name = "__eqkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__netf2, .{ .name = "__nekf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__lttf2, .{ .name = "__ltkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__letf2, .{ .name = "__lekf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__eqtf2, .{ .name = "__eqkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__netf2, .{ .name = "__nekf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__lttf2, .{ .name = "__ltkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__letf2, .{ .name = "__lekf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } else if (common.want_sparc_abi) { |
| 15 | @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(_Qp_fne, .{ .name = "_Qp_fne", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(_Qp_flt, .{ .name = "_Qp_flt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&_Qp_feq, .{ .name = "_Qp_feq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&_Qp_fne, .{ .name = "_Qp_fne", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&_Qp_flt, .{ .name = "_Qp_flt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&_Qp_fle, .{ .name = "_Qp_fle", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&_Qp_fge, .{ .name = "_Qp_fge", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | } |
| 23 | @export(__eqtf2, .{ .name = "__eqtf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(__netf2, .{ .name = "__netf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(__letf2, .{ .name = "__letf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(__cmptf2, .{ .name = "__cmptf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(__lttf2, .{ .name = "__lttf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&__eqtf2, .{ .name = "__eqtf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&__netf2, .{ .name = "__netf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__letf2, .{ .name = "__letf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&__cmptf2, .{ .name = "__cmptf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(&__lttf2, .{ .name = "__lttf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; |
lib/compiler_rt/cmpxf2.zig+5-5| ... | ... | @@ -6,11 +6,11 @@ const comparef = @import("./comparef.zig"); |
| 6 | 6 | pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | @export(__eqxf2, .{ .name = "__eqxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__nexf2, .{ .name = "__nexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__lexf2, .{ .name = "__lexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__cmpxf2, .{ .name = "__cmpxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__ltxf2, .{ .name = "__ltxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__eqxf2, .{ .name = "__eqxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__nexf2, .{ .name = "__nexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__lexf2, .{ .name = "__lexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__cmpxf2, .{ .name = "__cmpxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__ltxf2, .{ .name = "__ltxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; |
lib/compiler_rt/common.zig+1-1| ... | ... | @@ -72,7 +72,7 @@ pub const want_sparc_abi = builtin.cpu.arch.isSPARC(); |
| 72 | 72 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 73 | 73 | _ = error_return_trace; |
| 74 | 74 | if (builtin.is_test) { |
| 75 | @setCold(true); | |
| 75 | @branchHint(.cold); | |
| 76 | 76 | std.debug.panic("{s}", .{msg}); |
| 77 | 77 | } else { |
| 78 | 78 | unreachable; |
lib/compiler_rt/cos.zig+7-7| ... | ... | @@ -11,15 +11,15 @@ const rem_pio2 = @import("rem_pio2.zig").rem_pio2; |
| 11 | 11 | const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f; |
| 12 | 12 | |
| 13 | 13 | comptime { |
| 14 | @export(__cosh, .{ .name = "__cosh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(cosf, .{ .name = "cosf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(cos, .{ .name = "cos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__cosx, .{ .name = "__cosx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__cosh, .{ .name = "__cosh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&cosf, .{ .name = "cosf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&cos, .{ .name = "cos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__cosx, .{ .name = "__cosx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | 18 | if (common.want_ppc_abi) { |
| 19 | @export(cosq, .{ .name = "cosf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&cosq, .{ .name = "cosf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | 20 | } |
| 21 | @export(cosq, .{ .name = "cosq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(cosl, .{ .name = "cosl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&cosq, .{ .name = "cosq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&cosl, .{ .name = "cosl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | pub fn __cosh(a: f16) callconv(.C) f16 { |
lib/compiler_rt/count0bits.zig+9-9| ... | ... | @@ -6,15 +6,15 @@ const common = @import("common.zig"); |
| 6 | 6 | pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | @export(__clzsi2, .{ .name = "__clzsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__clzdi2, .{ .name = "__clzdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__clzti2, .{ .name = "__clzti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__ctzsi2, .{ .name = "__ctzsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__ctzdi2, .{ .name = "__ctzdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(__ctzti2, .{ .name = "__ctzti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__ffssi2, .{ .name = "__ffssi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(__ffsdi2, .{ .name = "__ffsdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__ffsti2, .{ .name = "__ffsti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__clzsi2, .{ .name = "__clzsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__clzdi2, .{ .name = "__clzdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__clzti2, .{ .name = "__clzti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__ctzsi2, .{ .name = "__ctzsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__ctzdi2, .{ .name = "__ctzdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__ctzti2, .{ .name = "__ctzti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__ffssi2, .{ .name = "__ffssi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__ffsdi2, .{ .name = "__ffsdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__ffsti2, .{ .name = "__ffsti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // clz - count leading zeroes |
lib/compiler_rt/divdc3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const Complex = @import("./mulc3.zig").Complex; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 7 | @export(__divdc3, .{ .name = "__divdc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__divdc3, .{ .name = "__divdc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 |
lib/compiler_rt/divdf3.zig+2-2| ... | ... | @@ -15,9 +15,9 @@ pub const panic = common.panic; |
| 15 | 15 | |
| 16 | 16 | comptime { |
| 17 | 17 | if (common.want_aeabi) { |
| 18 | @export(__aeabi_ddiv, .{ .name = "__aeabi_ddiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__aeabi_ddiv, .{ .name = "__aeabi_ddiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } else { |
| 20 | @export(__divdf3, .{ .name = "__divdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__divdf3, .{ .name = "__divdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 |
lib/compiler_rt/divhc3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const Complex = @import("./mulc3.zig").Complex; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 7 | @export(__divhc3, .{ .name = "__divhc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__divhc3, .{ .name = "__divhc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 |
lib/compiler_rt/divhf3.zig+1-1| ... | ... | @@ -2,7 +2,7 @@ const common = @import("common.zig"); |
| 2 | 2 | const divsf3 = @import("./divsf3.zig"); |
| 3 | 3 | |
| 4 | 4 | comptime { |
| 5 | @export(__divhf3, .{ .name = "__divhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 5 | @export(&__divhf3, .{ .name = "__divhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | pub fn __divhf3(a: f16, b: f16) callconv(.C) f16 { |
lib/compiler_rt/divsc3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const Complex = @import("./mulc3.zig").Complex; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 7 | @export(__divsc3, .{ .name = "__divsc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__divsc3, .{ .name = "__divsc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 |
lib/compiler_rt/divsf3.zig+2-2| ... | ... | @@ -13,9 +13,9 @@ pub const panic = common.panic; |
| 13 | 13 | |
| 14 | 14 | comptime { |
| 15 | 15 | if (common.want_aeabi) { |
| 16 | @export(__aeabi_fdiv, .{ .name = "__aeabi_fdiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__aeabi_fdiv, .{ .name = "__aeabi_fdiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | 17 | } else { |
| 18 | @export(__divsf3, .{ .name = "__divsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__divsf3, .{ .name = "__divsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 |
lib/compiler_rt/divtc3.zig+2-2| ... | ... | @@ -5,8 +5,8 @@ const Complex = @import("./mulc3.zig").Complex; |
| 5 | 5 | comptime { |
| 6 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 7 | 7 | if (common.want_ppc_abi) |
| 8 | @export(__divtc3, .{ .name = "__divkc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(__divtc3, .{ .name = "__divtc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__divtc3, .{ .name = "__divkc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__divtc3, .{ .name = "__divtc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } |
| 11 | 11 | } |
| 12 | 12 |
lib/compiler_rt/divtf3.zig+3-3| ... | ... | @@ -9,11 +9,11 @@ pub const panic = common.panic; |
| 9 | 9 | |
| 10 | 10 | comptime { |
| 11 | 11 | if (common.want_ppc_abi) { |
| 12 | @export(__divtf3, .{ .name = "__divkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__divtf3, .{ .name = "__divkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } else if (common.want_sparc_abi) { |
| 14 | @export(_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | 15 | } |
| 16 | @export(__divtf3, .{ .name = "__divtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__divtf3, .{ .name = "__divtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | pub fn __divtf3(a: f128, b: f128) callconv(.C) f128 { |
lib/compiler_rt/divti3.zig+2-2| ... | ... | @@ -8,9 +8,9 @@ pub const panic = common.panic; |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | 10 | if (common.want_windows_v2u64_abi) { |
| 11 | @export(__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } else { |
| 13 | @export(__divti3, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__divti3, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 |
lib/compiler_rt/divxc3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const Complex = @import("./mulc3.zig").Complex; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 7 | @export(__divxc3, .{ .name = "__divxc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__divxc3, .{ .name = "__divxc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 |
lib/compiler_rt/divxf3.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ const wideMultiply = common.wideMultiply; |
| 9 | 9 | pub const panic = common.panic; |
| 10 | 10 | |
| 11 | 11 | comptime { |
| 12 | @export(__divxf3, .{ .name = "__divxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__divxf3, .{ .name = "__divxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __divxf3(a: f80, b: f80) callconv(.C) f80 { |
lib/compiler_rt/emutls.zig+1-1| ... | ... | @@ -19,7 +19,7 @@ pub const panic = common.panic; |
| 19 | 19 | |
| 20 | 20 | comptime { |
| 21 | 21 | if (builtin.link_libc and (builtin.abi == .android or builtin.os.tag == .openbsd)) { |
| 22 | @export(__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 |
lib/compiler_rt/exp.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__exph, .{ .name = "__exph", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(expf, .{ .name = "expf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(exp, .{ .name = "exp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__expx, .{ .name = "__expx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__exph, .{ .name = "__exph", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&expf, .{ .name = "expf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&exp, .{ .name = "exp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__expx, .{ .name = "__expx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(expq, .{ .name = "expf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&expq, .{ .name = "expf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(expq, .{ .name = "expq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(expl, .{ .name = "expl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&expq, .{ .name = "expq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&expl, .{ .name = "expl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __exph(a: f16) callconv(.C) f16 { |
lib/compiler_rt/exp2.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__exp2h, .{ .name = "__exp2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(exp2f, .{ .name = "exp2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(exp2, .{ .name = "exp2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__exp2x, .{ .name = "__exp2x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__exp2h, .{ .name = "__exp2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&exp2f, .{ .name = "exp2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&exp2, .{ .name = "exp2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__exp2x, .{ .name = "__exp2x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(exp2q, .{ .name = "exp2f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&exp2q, .{ .name = "exp2f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(exp2q, .{ .name = "exp2q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(exp2l, .{ .name = "exp2l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&exp2q, .{ .name = "exp2q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&exp2l, .{ .name = "exp2l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __exp2h(x: f16) callconv(.C) f16 { |
lib/compiler_rt/extenddftf2.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__extenddftf2, .{ .name = "__extenddfkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__extenddftf2, .{ .name = "__extenddfkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__extenddftf2, .{ .name = "__extenddftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __extenddftf2(a: f64) callconv(.C) f128 { |
lib/compiler_rt/extenddfxf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const extend_f80 = @import("./extendf.zig").extend_f80; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__extenddfxf2, .{ .name = "__extenddfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__extenddfxf2, .{ .name = "__extenddfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __extenddfxf2(a: f64) callconv(.C) f80 { |
lib/compiler_rt/extendhfdf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const extendf = @import("./extendf.zig").extendf; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__extendhfdf2, .{ .name = "__extendhfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__extendhfdf2, .{ .name = "__extendhfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __extendhfdf2(a: common.F16T(f64)) callconv(.C) f64 { |
lib/compiler_rt/extendhfsf2.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.gnu_f16_abi) { |
| 8 | @export(__gnu_h2f_ieee, .{ .name = "__gnu_h2f_ieee", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__gnu_h2f_ieee, .{ .name = "__gnu_h2f_ieee", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_aeabi) { |
| 10 | @export(__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __extendhfsf2(a: common.F16T(f32)) callconv(.C) f32 { |
lib/compiler_rt/extendhftf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const extendf = @import("./extendf.zig").extendf; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__extendhftf2, .{ .name = "__extendhftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__extendhftf2, .{ .name = "__extendhftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __extendhftf2(a: common.F16T(f128)) callconv(.C) f128 { |
lib/compiler_rt/extendhfxf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const extend_f80 = @import("./extendf.zig").extend_f80; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__extendhfxf2, .{ .name = "__extendhfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__extendhfxf2, .{ .name = "__extendhfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __extendhfxf2(a: common.F16T(f80)) callconv(.C) f80 { |
lib/compiler_rt/extendsfdf2.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/extendsftf2.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__extendsftf2, .{ .name = "__extendsfkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__extendsftf2, .{ .name = "__extendsfkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __extendsftf2(a: f32) callconv(.C) f128 { |
lib/compiler_rt/extendsfxf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const extend_f80 = @import("./extendf.zig").extend_f80; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__extendsfxf2, .{ .name = "__extendsfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__extendsfxf2, .{ .name = "__extendsfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __extendsfxf2(a: f32) callconv(.C) f80 { |
lib/compiler_rt/extendxftf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const common = @import("./common.zig"); |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__extendxftf2, .{ .name = "__extendxftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__extendxftf2, .{ .name = "__extendxftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __extendxftf2(a: f80) callconv(.C) f128 { |
lib/compiler_rt/fabs.zig+7-7| ... | ... | @@ -6,15 +6,15 @@ const common = @import("common.zig"); |
| 6 | 6 | pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | @export(__fabsh, .{ .name = "__fabsh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(fabsf, .{ .name = "fabsf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(fabs, .{ .name = "fabs", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__fabsx, .{ .name = "__fabsx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fabsh, .{ .name = "__fabsh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&fabsf, .{ .name = "fabsf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&fabs, .{ .name = "fabs", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fabsx, .{ .name = "__fabsx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | if (common.want_ppc_abi) { |
| 14 | @export(fabsq, .{ .name = "fabsf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&fabsq, .{ .name = "fabsf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | 15 | } |
| 16 | @export(fabsq, .{ .name = "fabsq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(fabsl, .{ .name = "fabsl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&fabsq, .{ .name = "fabsq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&fabsl, .{ .name = "fabsl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | pub fn __fabsh(a: f16) callconv(.C) f16 { |
lib/compiler_rt/fixdfdi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixdfdi, .{ .name = "__fixdfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixdfdi, .{ .name = "__fixdfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixdfsi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_d2iz, .{ .name = "__aeabi_d2iz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_d2iz, .{ .name = "__aeabi_d2iz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixdfsi, .{ .name = "__fixdfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixdfsi, .{ .name = "__fixdfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixdfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixdfti_windows_x86_64, .{ .name = "__fixdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixdfti_windows_x86_64, .{ .name = "__fixdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixdfti, .{ .name = "__fixdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixdfti, .{ .name = "__fixdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/fixhfdi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixhfdi, .{ .name = "__fixhfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixhfdi, .{ .name = "__fixhfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixhfdi(a: f16) callconv(.C) i64 { |
lib/compiler_rt/fixhfsi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixhfsi, .{ .name = "__fixhfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixhfsi, .{ .name = "__fixhfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixhfsi(a: f16) callconv(.C) i32 { |
lib/compiler_rt/fixhfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixhfti_windows_x86_64, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixhfti_windows_x86_64, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixhfti, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixhfti, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/fixsfdi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_f2lz, .{ .name = "__aeabi_f2lz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_f2lz, .{ .name = "__aeabi_f2lz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixsfdi, .{ .name = "__fixsfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixsfdi, .{ .name = "__fixsfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixsfsi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixsfsi, .{ .name = "__fixsfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixsfsi, .{ .name = "__fixsfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixsfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixsfti_windows_x86_64, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixsfti_windows_x86_64, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/fixtfdi.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__fixtfdi, .{ .name = "__fixkfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__fixtfdi, .{ .name = "__fixkfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fixtfdi, .{ .name = "__fixtfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __fixtfdi(a: f128) callconv(.C) i64 { |
lib/compiler_rt/fixtfsi.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__fixtfsi, .{ .name = "__fixkfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__fixtfsi, .{ .name = "__fixkfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fixtfsi, .{ .name = "__fixtfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __fixtfsi(a: f128) callconv(.C) i32 { |
lib/compiler_rt/fixtfti.zig+3-3| ... | ... | @@ -6,11 +6,11 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixtfti_windows_x86_64, .{ .name = "__fixtfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixtfti_windows_x86_64, .{ .name = "__fixtfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | 11 | if (common.want_ppc_abi) |
| 12 | @export(__fixtfti, .{ .name = "__fixkfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__fixtfti, .{ .name = "__fixtfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fixtfti, .{ .name = "__fixkfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__fixtfti, .{ .name = "__fixtfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 |
lib/compiler_rt/fixunsdfdi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixunsdfsi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixunsdfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixunsdfti_windows_x86_64, .{ .name = "__fixunsdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixunsdfti_windows_x86_64, .{ .name = "__fixunsdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/fixunshfdi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixunshfdi, .{ .name = "__fixunshfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixunshfdi, .{ .name = "__fixunshfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixunshfdi(a: f16) callconv(.C) u64 { |
lib/compiler_rt/fixunshfsi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixunshfsi, .{ .name = "__fixunshfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixunshfsi, .{ .name = "__fixunshfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixunshfsi(a: f16) callconv(.C) u32 { |
lib/compiler_rt/fixunshfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixunshfti_windows_x86_64, .{ .name = "__fixunshfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixunshfti_windows_x86_64, .{ .name = "__fixunshfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixunshfti, .{ .name = "__fixunshfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixunshfti, .{ .name = "__fixunshfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/fixunssfdi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixunssfsi.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/fixunssfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixunssfti_windows_x86_64, .{ .name = "__fixunssfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixunssfti_windows_x86_64, .{ .name = "__fixunssfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixunssfti, .{ .name = "__fixunssfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/fixunstfdi.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __fixunstfdi(a: f128) callconv(.C) u64 { |
lib/compiler_rt/fixunstfsi.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __fixunstfsi(a: f128) callconv(.C) u32 { |
lib/compiler_rt/fixunstfti.zig+3-3| ... | ... | @@ -6,11 +6,11 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixunstfti_windows_x86_64, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixunstfti_windows_x86_64, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | 11 | if (common.want_ppc_abi) |
| 12 | @export(__fixunstfti, .{ .name = "__fixunskfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fixunstfti, .{ .name = "__fixunskfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 |
lib/compiler_rt/fixunsxfdi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixunsxfdi, .{ .name = "__fixunsxfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixunsxfdi, .{ .name = "__fixunsxfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixunsxfdi(a: f80) callconv(.C) u64 { |
lib/compiler_rt/fixunsxfsi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixunsxfsi, .{ .name = "__fixunsxfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixunsxfsi, .{ .name = "__fixunsxfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixunsxfsi(a: f80) callconv(.C) u32 { |
lib/compiler_rt/fixunsxfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixunsxfti_windows_x86_64, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixunsxfti_windows_x86_64, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/fixxfdi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixxfdi, .{ .name = "__fixxfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixxfdi, .{ .name = "__fixxfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixxfdi(a: f80) callconv(.C) i64 { |
lib/compiler_rt/fixxfsi.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__fixxfsi, .{ .name = "__fixxfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__fixxfsi, .{ .name = "__fixxfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __fixxfsi(a: f80) callconv(.C) i32 { |
lib/compiler_rt/fixxfti.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__fixxfti_windows_x86_64, .{ .name = "__fixxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__fixxfti_windows_x86_64, .{ .name = "__fixxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__fixxfti, .{ .name = "__fixxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixxfti, .{ .name = "__fixxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floatdidf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatdidf, .{ .name = "__floatdidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatdidf, .{ .name = "__floatdidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatdihf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatdihf, .{ .name = "__floatdihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatdihf, .{ .name = "__floatdihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __floatdihf(a: i64) callconv(.C) f16 { |
lib/compiler_rt/floatdisf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_l2f, .{ .name = "__aeabi_l2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_l2f, .{ .name = "__aeabi_l2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatdisf, .{ .name = "__floatdisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatdisf, .{ .name = "__floatdisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatditf.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__floatditf, .{ .name = "__floatdikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__floatditf, .{ .name = "__floatdikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__floatditf, .{ .name = "__floatditf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__floatditf, .{ .name = "__floatditf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __floatditf(a: i64) callconv(.C) f128 { |
lib/compiler_rt/floatdixf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatdixf, .{ .name = "__floatdixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatdixf, .{ .name = "__floatdixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __floatdixf(a: i64) callconv(.C) f80 { |
lib/compiler_rt/floatsidf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatsidf, .{ .name = "__floatsidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatsidf, .{ .name = "__floatsidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatsihf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatsihf, .{ .name = "__floatsihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatsihf, .{ .name = "__floatsihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __floatsihf(a: i32) callconv(.C) f16 { |
lib/compiler_rt/floatsisf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatsisf, .{ .name = "__floatsisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatsisf, .{ .name = "__floatsisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatsitf.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__floatsitf, .{ .name = "__floatsikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__floatsitf, .{ .name = "__floatsikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __floatsitf(a: i32) callconv(.C) f128 { |
lib/compiler_rt/floatsixf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatsixf, .{ .name = "__floatsixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatsixf, .{ .name = "__floatsixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __floatsixf(a: i32) callconv(.C) f80 { |
lib/compiler_rt/floattidf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floattidf_windows_x86_64, .{ .name = "__floattidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floattidf_windows_x86_64, .{ .name = "__floattidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floattidf, .{ .name = "__floattidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floattidf, .{ .name = "__floattidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floattihf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floattihf_windows_x86_64, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floattihf_windows_x86_64, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floattihf, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floattihf, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floattisf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floattisf_windows_x86_64, .{ .name = "__floattisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floattisf_windows_x86_64, .{ .name = "__floattisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floattisf, .{ .name = "__floattisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floattisf, .{ .name = "__floattisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floattitf.zig+3-3| ... | ... | @@ -6,11 +6,11 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floattitf_windows_x86_64, .{ .name = "__floattitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floattitf_windows_x86_64, .{ .name = "__floattitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | 11 | if (common.want_ppc_abi) |
| 12 | @export(__floattitf, .{ .name = "__floattikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__floattitf, .{ .name = "__floattitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__floattitf, .{ .name = "__floattikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__floattitf, .{ .name = "__floattitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 |
lib/compiler_rt/floattixf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floattixf_windows_x86_64, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floattixf_windows_x86_64, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floattixf, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floattixf, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floatundidf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_ul2d, .{ .name = "__aeabi_ul2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_ul2d, .{ .name = "__aeabi_ul2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatundidf, .{ .name = "__floatundidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatundidf, .{ .name = "__floatundidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatundihf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatundihf, .{ .name = "__floatundihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatundihf, .{ .name = "__floatundihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __floatundihf(a: u64) callconv(.C) f16 { |
lib/compiler_rt/floatundisf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatundisf, .{ .name = "__floatundisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatundisf, .{ .name = "__floatundisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatunditf.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__floatunditf, .{ .name = "__floatundikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__floatunditf, .{ .name = "__floatundikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __floatunditf(a: u64) callconv(.C) f128 { |
lib/compiler_rt/floatundixf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatundixf, .{ .name = "__floatundixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatundixf, .{ .name = "__floatundixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __floatundixf(a: u64) callconv(.C) f80 { |
lib/compiler_rt/floatunsidf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatunsidf, .{ .name = "__floatunsidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatunsidf, .{ .name = "__floatunsidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatunsihf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatunsihf, .{ .name = "__floatunsihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatunsihf, .{ .name = "__floatunsihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __floatunsihf(a: u32) callconv(.C) f16 { |
lib/compiler_rt/floatunsisf.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_ui2f, .{ .name = "__aeabi_ui2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_ui2f, .{ .name = "__aeabi_ui2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__floatunsisf, .{ .name = "__floatunsisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__floatunsisf, .{ .name = "__floatunsisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/floatunsitf.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__floatunsitf, .{ .name = "__floatunsikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __floatunsitf(a: u32) callconv(.C) f128 { |
lib/compiler_rt/floatunsixf.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__floatunsixf, .{ .name = "__floatunsixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__floatunsixf, .{ .name = "__floatunsixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __floatunsixf(a: u32) callconv(.C) f80 { |
lib/compiler_rt/floatuntidf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floatuntidf_windows_x86_64, .{ .name = "__floatuntidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floatuntidf_windows_x86_64, .{ .name = "__floatuntidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floatuntidf, .{ .name = "__floatuntidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floatuntihf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floatuntihf_windows_x86_64, .{ .name = "__floatuntihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floatuntihf_windows_x86_64, .{ .name = "__floatuntihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floatuntihf, .{ .name = "__floatuntihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floatuntihf, .{ .name = "__floatuntihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floatuntisf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floatuntisf_windows_x86_64, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floatuntisf_windows_x86_64, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floatuntisf, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floatuntitf.zig+3-3| ... | ... | @@ -6,11 +6,11 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floatuntitf_windows_x86_64, .{ .name = "__floatuntitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floatuntitf_windows_x86_64, .{ .name = "__floatuntitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | 11 | if (common.want_ppc_abi) |
| 12 | @export(__floatuntitf, .{ .name = "__floatuntikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__floatuntitf, .{ .name = "__floatuntikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__floatuntitf, .{ .name = "__floatuntitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 |
lib/compiler_rt/floatuntixf.zig+2-2| ... | ... | @@ -6,9 +6,9 @@ pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | 8 | if (common.want_windows_v2u64_abi) { |
| 9 | @export(__floatuntixf_windows_x86_64, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__floatuntixf_windows_x86_64, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } else { |
| 11 | @export(__floatuntixf, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__floatuntixf, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 |
lib/compiler_rt/floor.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__floorh, .{ .name = "__floorh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(floorf, .{ .name = "floorf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(floor, .{ .name = "floor", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__floorx, .{ .name = "__floorx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__floorh, .{ .name = "__floorh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&floorf, .{ .name = "floorf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&floor, .{ .name = "floor", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__floorx, .{ .name = "__floorx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(floorq, .{ .name = "floorf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&floorq, .{ .name = "floorf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(floorq, .{ .name = "floorq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(floorl, .{ .name = "floorl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&floorq, .{ .name = "floorq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&floorl, .{ .name = "floorl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __floorh(x: f16) callconv(.C) f16 { |
lib/compiler_rt/fma.zig+7-7| ... | ... | @@ -13,15 +13,15 @@ const common = @import("common.zig"); |
| 13 | 13 | pub const panic = common.panic; |
| 14 | 14 | |
| 15 | 15 | comptime { |
| 16 | @export(__fmah, .{ .name = "__fmah", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(fmaf, .{ .name = "fmaf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(fma, .{ .name = "fma", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(__fmax, .{ .name = "__fmax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__fmah, .{ .name = "__fmah", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&fmaf, .{ .name = "fmaf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&fma, .{ .name = "fma", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__fmax, .{ .name = "__fmax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | 20 | if (common.want_ppc_abi) { |
| 21 | @export(fmaq, .{ .name = "fmaf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&fmaq, .{ .name = "fmaf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | } |
| 23 | @export(fmaq, .{ .name = "fmaq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(fmal, .{ .name = "fmal", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&fmaq, .{ .name = "fmaq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&fmal, .{ .name = "fmal", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | pub fn __fmah(x: f16, y: f16, z: f16) callconv(.C) f16 { |
lib/compiler_rt/fmax.zig+7-7| ... | ... | @@ -7,15 +7,15 @@ const common = @import("common.zig"); |
| 7 | 7 | pub const panic = common.panic; |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | @export(__fmaxh, .{ .name = "__fmaxh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(fmaxf, .{ .name = "fmaxf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(fmax, .{ .name = "fmax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__fmaxx, .{ .name = "__fmaxx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fmaxh, .{ .name = "__fmaxh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&fmaxf, .{ .name = "fmaxf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&fmax, .{ .name = "fmax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__fmaxx, .{ .name = "__fmaxx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | if (common.want_ppc_abi) { |
| 15 | @export(fmaxq, .{ .name = "fmaxf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&fmaxq, .{ .name = "fmaxf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | 16 | } |
| 17 | @export(fmaxq, .{ .name = "fmaxq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(fmaxl, .{ .name = "fmaxl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&fmaxq, .{ .name = "fmaxq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&fmaxl, .{ .name = "fmaxl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub fn __fmaxh(x: f16, y: f16) callconv(.C) f16 { |
lib/compiler_rt/fmin.zig+7-7| ... | ... | @@ -7,15 +7,15 @@ const common = @import("common.zig"); |
| 7 | 7 | pub const panic = common.panic; |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | @export(__fminh, .{ .name = "__fminh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(fminf, .{ .name = "fminf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(fmin, .{ .name = "fmin", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__fminx, .{ .name = "__fminx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fminh, .{ .name = "__fminh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&fminf, .{ .name = "fminf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&fmin, .{ .name = "fmin", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__fminx, .{ .name = "__fminx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | if (common.want_ppc_abi) { |
| 15 | @export(fminq, .{ .name = "fminf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&fminq, .{ .name = "fminf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | 16 | } |
| 17 | @export(fminq, .{ .name = "fminq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(fminl, .{ .name = "fminl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&fminq, .{ .name = "fminq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&fminl, .{ .name = "fminl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub fn __fminh(x: f16, y: f16) callconv(.C) f16 { |
lib/compiler_rt/fmod.zig+7-7| ... | ... | @@ -9,15 +9,15 @@ const normalize = common.normalize; |
| 9 | 9 | pub const panic = common.panic; |
| 10 | 10 | |
| 11 | 11 | comptime { |
| 12 | @export(__fmodh, .{ .name = "__fmodh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(fmodf, .{ .name = "fmodf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(fmod, .{ .name = "fmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__fmodx, .{ .name = "__fmodx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__fmodh, .{ .name = "__fmodh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&fmodf, .{ .name = "fmodf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&fmod, .{ .name = "fmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__fmodx, .{ .name = "__fmodx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | 16 | if (common.want_ppc_abi) { |
| 17 | @export(fmodq, .{ .name = "fmodf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&fmodq, .{ .name = "fmodf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | 18 | } |
| 19 | @export(fmodq, .{ .name = "fmodq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(fmodl, .{ .name = "fmodl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&fmodq, .{ .name = "fmodq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&fmodl, .{ .name = "fmodl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | pub fn __fmodh(x: f16, y: f16) callconv(.C) f16 { |
lib/compiler_rt/gedf2.zig+4-4| ... | ... | @@ -7,11 +7,11 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_aeabi) { |
| 10 | @export(__aeabi_dcmpge, .{ .name = "__aeabi_dcmpge", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__aeabi_dcmpgt, .{ .name = "__aeabi_dcmpgt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__aeabi_dcmpge, .{ .name = "__aeabi_dcmpge", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__aeabi_dcmpgt, .{ .name = "__aeabi_dcmpgt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } else { |
| 13 | @export(__gedf2, .{ .name = "__gedf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(__gtdf2, .{ .name = "__gtdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__gedf2, .{ .name = "__gedf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__gtdf2, .{ .name = "__gtdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 |
lib/compiler_rt/gehf2.zig+2-2| ... | ... | @@ -6,8 +6,8 @@ const comparef = @import("./comparef.zig"); |
| 6 | 6 | pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | @export(__gehf2, .{ .name = "__gehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__gthf2, .{ .name = "__gthf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__gehf2, .{ .name = "__gehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__gthf2, .{ .name = "__gthf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /// "These functions return a value greater than or equal to zero if neither |
lib/compiler_rt/gesf2.zig+4-4| ... | ... | @@ -7,11 +7,11 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_aeabi) { |
| 10 | @export(__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } else { |
| 13 | @export(__gesf2, .{ .name = "__gesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(__gtsf2, .{ .name = "__gtsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__gesf2, .{ .name = "__gesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__gtsf2, .{ .name = "__gtsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 |
lib/compiler_rt/getf2.zig+4-4| ... | ... | @@ -7,14 +7,14 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_ppc_abi) { |
| 10 | @export(__getf2, .{ .name = "__gekf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__gttf2, .{ .name = "__gtkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__getf2, .{ .name = "__gekf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__gttf2, .{ .name = "__gtkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } else if (common.want_sparc_abi) { |
| 13 | 13 | // These exports are handled in cmptf2.zig because gt and ge on sparc |
| 14 | 14 | // are based on calling _Qp_cmp. |
| 15 | 15 | } |
| 16 | @export(__getf2, .{ .name = "__getf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__gttf2, .{ .name = "__gttf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__getf2, .{ .name = "__getf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__gttf2, .{ .name = "__gttf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /// "These functions return a value greater than or equal to zero if neither |
lib/compiler_rt/gexf2.zig+2-2| ... | ... | @@ -4,8 +4,8 @@ const comparef = @import("./comparef.zig"); |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__gexf2, .{ .name = "__gexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(__gtxf2, .{ .name = "__gtxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__gexf2, .{ .name = "__gexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__gtxf2, .{ .name = "__gtxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | fn __gexf2(a: f80, b: f80) callconv(.C) i32 { |
lib/compiler_rt/int.zig+15-15| ... | ... | @@ -15,24 +15,24 @@ const arm = @import("arm.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__divmodti4, .{ .name = "__divmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(__divmoddi4, .{ .name = "__divmoddi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__divmodti4, .{ .name = "__divmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__divmoddi4, .{ .name = "__divmoddi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | 21 | if (common.want_aeabi) { |
| 22 | @export(__aeabi_idiv, .{ .name = "__aeabi_idiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(__aeabi_uidiv, .{ .name = "__aeabi_uidiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&__aeabi_idiv, .{ .name = "__aeabi_idiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&__aeabi_uidiv, .{ .name = "__aeabi_uidiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } else { |
| 25 | @export(__divsi3, .{ .name = "__divsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(__udivsi3, .{ .name = "__udivsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__divsi3, .{ .name = "__divsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&__udivsi3, .{ .name = "__udivsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | @export(__divdi3, .{ .name = "__divdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(__udivdi3, .{ .name = "__udivdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | @export(__modsi3, .{ .name = "__modsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | @export(__moddi3, .{ .name = "__moddi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(__umodsi3, .{ .name = "__umodsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(__umoddi3, .{ .name = "__umoddi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 34 | @export(__divmodsi4, .{ .name = "__divmodsi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 35 | @export(__udivmodsi4, .{ .name = "__udivmodsi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | @export(&__divdi3, .{ .name = "__divdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(&__udivdi3, .{ .name = "__udivdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | @export(&__modsi3, .{ .name = "__modsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | @export(&__moddi3, .{ .name = "__moddi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(&__umodsi3, .{ .name = "__umodsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(&__umoddi3, .{ .name = "__umoddi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 34 | @export(&__divmodsi4, .{ .name = "__divmodsi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 35 | @export(&__udivmodsi4, .{ .name = "__udivmodsi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | pub fn __divmodti4(a: i128, b: i128, rem: *i128) callconv(.C) i128 { |
lib/compiler_rt/log.zig+7-7| ... | ... | @@ -14,15 +14,15 @@ const common = @import("common.zig"); |
| 14 | 14 | pub const panic = common.panic; |
| 15 | 15 | |
| 16 | 16 | comptime { |
| 17 | @export(__logh, .{ .name = "__logh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(logf, .{ .name = "logf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(log, .{ .name = "log", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(__logx, .{ .name = "__logx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__logh, .{ .name = "__logh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&logf, .{ .name = "logf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&log, .{ .name = "log", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__logx, .{ .name = "__logx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | 21 | if (common.want_ppc_abi) { |
| 22 | @export(logq, .{ .name = "logf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&logq, .{ .name = "logf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | 23 | } |
| 24 | @export(logq, .{ .name = "logq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(logl, .{ .name = "logl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&logq, .{ .name = "logq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&logl, .{ .name = "logl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | pub fn __logh(a: f16) callconv(.C) f16 { |
lib/compiler_rt/log10.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__log10h, .{ .name = "__log10h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(log10f, .{ .name = "log10f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(log10, .{ .name = "log10", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__log10x, .{ .name = "__log10x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__log10h, .{ .name = "__log10h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&log10f, .{ .name = "log10f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&log10, .{ .name = "log10", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__log10x, .{ .name = "__log10x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(log10q, .{ .name = "log10f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&log10q, .{ .name = "log10f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(log10q, .{ .name = "log10q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(log10l, .{ .name = "log10l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&log10q, .{ .name = "log10q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&log10l, .{ .name = "log10l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __log10h(a: f16) callconv(.C) f16 { |
lib/compiler_rt/log2.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__log2h, .{ .name = "__log2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(log2f, .{ .name = "log2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(log2, .{ .name = "log2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__log2x, .{ .name = "__log2x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__log2h, .{ .name = "__log2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&log2f, .{ .name = "log2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&log2, .{ .name = "log2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__log2x, .{ .name = "__log2x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(log2q, .{ .name = "log2f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&log2q, .{ .name = "log2f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(log2q, .{ .name = "log2q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(log2l, .{ .name = "log2l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&log2q, .{ .name = "log2q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&log2l, .{ .name = "log2l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __log2h(a: f16) callconv(.C) f16 { |
lib/compiler_rt/memcmp.zig+1-1| ... | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const common = @import("./common.zig"); |
| 3 | 3 | |
| 4 | 4 | comptime { |
| 5 | @export(memcmp, .{ .name = "memcmp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 5 | @export(&memcmp, .{ .name = "memcmp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | pub fn memcmp(vl: [*]const u8, vr: [*]const u8, n: usize) callconv(.C) c_int { |
lib/compiler_rt/memcpy.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const builtin = @import("builtin"); |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (builtin.object_format != .c) { |
| 7 | @export(memcpy, .{ .name = "memcpy", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&memcpy, .{ .name = "memcpy", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 |
lib/compiler_rt/memmove.zig+1-1| ... | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const common = @import("./common.zig"); |
| 3 | 3 | |
| 4 | 4 | comptime { |
| 5 | @export(memmove, .{ .name = "memmove", .linkage = common.linkage, .visibility = common.visibility }); | |
| 5 | @export(&memmove, .{ .name = "memmove", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | pub fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8 { |
lib/compiler_rt/memset.zig+2-2| ... | ... | @@ -4,8 +4,8 @@ const builtin = @import("builtin"); |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (builtin.object_format != .c) { |
| 7 | @export(memset, .{ .name = "memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(__memset, .{ .name = "__memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&memset, .{ .name = "memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__memset, .{ .name = "__memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 |
lib/compiler_rt/modti3.zig+2-2| ... | ... | @@ -11,9 +11,9 @@ pub const panic = common.panic; |
| 11 | 11 | |
| 12 | 12 | comptime { |
| 13 | 13 | if (common.want_windows_v2u64_abi) { |
| 14 | @export(__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | 15 | } else { |
| 16 | @export(__modti3, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__modti3, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 |
lib/compiler_rt/mulXi3.zig+5-5| ... | ... | @@ -7,16 +7,16 @@ const native_endian = builtin.cpu.arch.endian(); |
| 7 | 7 | pub const panic = common.panic; |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | @export(__mulsi3, .{ .name = "__mulsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__mulsi3, .{ .name = "__mulsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | if (common.want_aeabi) { |
| 12 | @export(__aeabi_lmul, .{ .name = "__aeabi_lmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__aeabi_lmul, .{ .name = "__aeabi_lmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } else { |
| 14 | @export(__muldi3, .{ .name = "__muldi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__muldi3, .{ .name = "__muldi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | 15 | } |
| 16 | 16 | if (common.want_windows_v2u64_abi) { |
| 17 | @export(__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | 18 | } else { |
| 19 | @export(__multi3, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__multi3, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 |
lib/compiler_rt/muldc3.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (@import("builtin").zig_backend != .stage2_c) { |
| 8 | @export(__muldc3, .{ .name = "__muldc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__muldc3, .{ .name = "__muldc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 |
lib/compiler_rt/muldf3.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_dmul, .{ .name = "__aeabi_dmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_dmul, .{ .name = "__aeabi_dmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__muldf3, .{ .name = "__muldf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__muldf3, .{ .name = "__muldf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/mulhc3.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (@import("builtin").zig_backend != .stage2_c) { |
| 8 | @export(__mulhc3, .{ .name = "__mulhc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__mulhc3, .{ .name = "__mulhc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 |
lib/compiler_rt/mulhf3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const mulf3 = @import("./mulf3.zig").mulf3; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__mulhf3, .{ .name = "__mulhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__mulhf3, .{ .name = "__mulhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __mulhf3(a: f16, b: f16) callconv(.C) f16 { |
lib/compiler_rt/mulo.zig+3-3| ... | ... | @@ -6,9 +6,9 @@ const common = @import("common.zig"); |
| 6 | 6 | pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | @export(__mulosi4, .{ .name = "__mulosi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__mulodi4, .{ .name = "__mulodi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__muloti4, .{ .name = "__muloti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__mulosi4, .{ .name = "__mulosi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__mulodi4, .{ .name = "__mulodi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__muloti4, .{ .name = "__muloti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // mulo - multiplication overflow |
lib/compiler_rt/mulsc3.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (@import("builtin").zig_backend != .stage2_c) { |
| 8 | @export(__mulsc3, .{ .name = "__mulsc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__mulsc3, .{ .name = "__mulsc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 |
lib/compiler_rt/mulsf3.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__mulsf3, .{ .name = "__mulsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__mulsf3, .{ .name = "__mulsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/multc3.zig+2-2| ... | ... | @@ -6,8 +6,8 @@ pub const panic = common.panic; |
| 6 | 6 | comptime { |
| 7 | 7 | if (@import("builtin").zig_backend != .stage2_c) { |
| 8 | 8 | if (common.want_ppc_abi) |
| 9 | @export(__multc3, .{ .name = "__mulkc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(__multc3, .{ .name = "__multc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__multc3, .{ .name = "__mulkc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__multc3, .{ .name = "__multc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/multf3.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__multf3, .{ .name = "__mulkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__multf3, .{ .name = "__mulkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__multf3, .{ .name = "__multf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__multf3, .{ .name = "__multf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __multf3(a: f128, b: f128) callconv(.C) f128 { |
lib/compiler_rt/mulxc3.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (@import("builtin").zig_backend != .stage2_c) { |
| 8 | @export(__mulxc3, .{ .name = "__mulxc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__mulxc3, .{ .name = "__mulxc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 |
lib/compiler_rt/mulxf3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const mulf3 = @import("./mulf3.zig").mulf3; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__mulxf3, .{ .name = "__mulxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__mulxf3, .{ .name = "__mulxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __mulxf3(a: f80, b: f80) callconv(.C) f80 { |
lib/compiler_rt/negXi2.zig+3-3| ... | ... | @@ -13,9 +13,9 @@ const common = @import("common.zig"); |
| 13 | 13 | pub const panic = common.panic; |
| 14 | 14 | |
| 15 | 15 | comptime { |
| 16 | @export(__negsi2, .{ .name = "__negsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__negdi2, .{ .name = "__negdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(__negti2, .{ .name = "__negti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__negsi2, .{ .name = "__negsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__negdi2, .{ .name = "__negdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__negti2, .{ .name = "__negti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub fn __negsi2(a: i32) callconv(.C) i32 { |
lib/compiler_rt/negdf2.zig+2-2| ... | ... | @@ -4,9 +4,9 @@ pub const panic = common.panic; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (common.want_aeabi) { |
| 7 | @export(__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } else { |
| 9 | @export(__negdf2, .{ .name = "__negdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__negdf2, .{ .name = "__negdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } |
| 11 | 11 | } |
| 12 | 12 |
lib/compiler_rt/neghf2.zig+1-1| ... | ... | @@ -3,7 +3,7 @@ const common = @import("./common.zig"); |
| 3 | 3 | pub const panic = common.panic; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | @export(__neghf2, .{ .name = "__neghf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | @export(&__neghf2, .{ .name = "__neghf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | fn __neghf2(a: f16) callconv(.C) f16 { |
lib/compiler_rt/negsf2.zig+2-2| ... | ... | @@ -4,9 +4,9 @@ pub const panic = common.panic; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (common.want_aeabi) { |
| 7 | @export(__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } else { |
| 9 | @export(__negsf2, .{ .name = "__negsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__negsf2, .{ .name = "__negsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | 10 | } |
| 11 | 11 | } |
| 12 | 12 |
lib/compiler_rt/negtf2.zig+2-2| ... | ... | @@ -4,8 +4,8 @@ pub const panic = common.panic; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (common.want_ppc_abi) |
| 7 | @export(__negtf2, .{ .name = "__negkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(__negtf2, .{ .name = "__negtf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__negtf2, .{ .name = "__negkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__negtf2, .{ .name = "__negtf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | fn __negtf2(a: f128) callconv(.C) f128 { |
lib/compiler_rt/negv.zig+3-3| ... | ... | @@ -8,9 +8,9 @@ const common = @import("common.zig"); |
| 8 | 8 | pub const panic = common.panic; |
| 9 | 9 | |
| 10 | 10 | comptime { |
| 11 | @export(__negvsi2, .{ .name = "__negvsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__negvdi2, .{ .name = "__negvdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__negvti2, .{ .name = "__negvti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__negvsi2, .{ .name = "__negvsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__negvdi2, .{ .name = "__negvdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__negvti2, .{ .name = "__negvti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | pub fn __negvsi2(a: i32) callconv(.C) i32 { |
lib/compiler_rt/negxf2.zig+1-1| ... | ... | @@ -3,7 +3,7 @@ const common = @import("./common.zig"); |
| 3 | 3 | pub const panic = common.panic; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | @export(__negxf2, .{ .name = "__negxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | @export(&__negxf2, .{ .name = "__negxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | fn __negxf2(a: f80) callconv(.C) f80 { |
lib/compiler_rt/os_version_check.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ const have_availability_version_check = builtin.os.tag.isDarwin() and |
| 9 | 9 | |
| 10 | 10 | comptime { |
| 11 | 11 | if (have_availability_version_check) { |
| 12 | @export(__isPlatformVersionAtLeast, .{ .name = "__isPlatformVersionAtLeast", .linkage = linkage }); | |
| 12 | @export(&__isPlatformVersionAtLeast, .{ .name = "__isPlatformVersionAtLeast", .linkage = linkage }); | |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 |
lib/compiler_rt/parity.zig+3-3| ... | ... | @@ -8,9 +8,9 @@ const common = @import("common.zig"); |
| 8 | 8 | pub const panic = common.panic; |
| 9 | 9 | |
| 10 | 10 | comptime { |
| 11 | @export(__paritysi2, .{ .name = "__paritysi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__paritydi2, .{ .name = "__paritydi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__parityti2, .{ .name = "__parityti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__paritysi2, .{ .name = "__paritysi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__paritydi2, .{ .name = "__paritydi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__parityti2, .{ .name = "__parityti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | pub fn __paritysi2(a: i32) callconv(.C) i32 { |
lib/compiler_rt/popcount.zig+3-3| ... | ... | @@ -13,9 +13,9 @@ const common = @import("common.zig"); |
| 13 | 13 | pub const panic = common.panic; |
| 14 | 14 | |
| 15 | 15 | comptime { |
| 16 | @export(__popcountsi2, .{ .name = "__popcountsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__popcountdi2, .{ .name = "__popcountdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(__popcountti2, .{ .name = "__popcountti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__popcountsi2, .{ .name = "__popcountsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__popcountdi2, .{ .name = "__popcountdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__popcountti2, .{ .name = "__popcountti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub fn __popcountsi2(a: i32) callconv(.C) i32 { |
lib/compiler_rt/powiXf2.zig+6-6| ... | ... | @@ -10,13 +10,13 @@ const std = @import("std"); |
| 10 | 10 | pub const panic = common.panic; |
| 11 | 11 | |
| 12 | 12 | comptime { |
| 13 | @export(__powihf2, .{ .name = "__powihf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(__powisf2, .{ .name = "__powisf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__powidf2, .{ .name = "__powidf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__powihf2, .{ .name = "__powihf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__powisf2, .{ .name = "__powisf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__powidf2, .{ .name = "__powidf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | 16 | if (common.want_ppc_abi) |
| 17 | @export(__powitf2, .{ .name = "__powikf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(__powitf2, .{ .name = "__powitf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(__powixf2, .{ .name = "__powixf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__powitf2, .{ .name = "__powikf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__powitf2, .{ .name = "__powitf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__powixf2, .{ .name = "__powixf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | inline fn powiXf2(comptime FT: type, a: FT, b: i32) FT { |
lib/compiler_rt/round.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__roundh, .{ .name = "__roundh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(roundf, .{ .name = "roundf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(round, .{ .name = "round", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__roundx, .{ .name = "__roundx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__roundh, .{ .name = "__roundh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&roundf, .{ .name = "roundf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&round, .{ .name = "round", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__roundx, .{ .name = "__roundx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(roundq, .{ .name = "roundf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&roundq, .{ .name = "roundf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(roundq, .{ .name = "roundq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(roundl, .{ .name = "roundl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&roundq, .{ .name = "roundq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&roundl, .{ .name = "roundl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __roundh(x: f16) callconv(.C) f16 { |
lib/compiler_rt/shift.zig+12-12| ... | ... | @@ -7,22 +7,22 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | // symbol compatibility with libgcc |
| 10 | @export(__ashlsi3, .{ .name = "__ashlsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__ashrsi3, .{ .name = "__ashrsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(__lshrsi3, .{ .name = "__lshrsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__ashlsi3, .{ .name = "__ashlsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__ashrsi3, .{ .name = "__ashrsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__lshrsi3, .{ .name = "__lshrsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | |
| 14 | @export(__ashlti3, .{ .name = "__ashlti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__ashrti3, .{ .name = "__ashrti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(__lshrti3, .{ .name = "__lshrti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__ashlti3, .{ .name = "__ashlti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__ashrti3, .{ .name = "__ashrti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__lshrti3, .{ .name = "__lshrti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | 17 | |
| 18 | 18 | if (common.want_aeabi) { |
| 19 | @export(__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | } else { |
| 23 | @export(__ashldi3, .{ .name = "__ashldi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(__ashrdi3, .{ .name = "__ashrdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(__lshrdi3, .{ .name = "__lshrdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&__ashldi3, .{ .name = "__ashldi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&__ashrdi3, .{ .name = "__ashrdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__lshrdi3, .{ .name = "__lshrdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 |
lib/compiler_rt/sin.zig+7-7| ... | ... | @@ -19,15 +19,15 @@ const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f; |
| 19 | 19 | pub const panic = common.panic; |
| 20 | 20 | |
| 21 | 21 | comptime { |
| 22 | @export(__sinh, .{ .name = "__sinh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(sinf, .{ .name = "sinf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(sin, .{ .name = "sin", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(__sinx, .{ .name = "__sinx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&__sinh, .{ .name = "__sinh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&sinf, .{ .name = "sinf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&sin, .{ .name = "sin", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__sinx, .{ .name = "__sinx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | 26 | if (common.want_ppc_abi) { |
| 27 | @export(sinq, .{ .name = "sinf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(&sinq, .{ .name = "sinf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | 28 | } |
| 29 | @export(sinq, .{ .name = "sinq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | @export(sinl, .{ .name = "sinl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(&sinq, .{ .name = "sinq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | @export(&sinl, .{ .name = "sinl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | pub fn __sinh(x: f16) callconv(.C) f16 { |
lib/compiler_rt/sincos.zig+7-7| ... | ... | @@ -11,15 +11,15 @@ const common = @import("common.zig"); |
| 11 | 11 | pub const panic = common.panic; |
| 12 | 12 | |
| 13 | 13 | comptime { |
| 14 | @export(__sincosh, .{ .name = "__sincosh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(sincosf, .{ .name = "sincosf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(sincos, .{ .name = "sincos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(__sincosx, .{ .name = "__sincosx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__sincosh, .{ .name = "__sincosh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&sincosf, .{ .name = "sincosf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&sincos, .{ .name = "sincos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__sincosx, .{ .name = "__sincosx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | 18 | if (common.want_ppc_abi) { |
| 19 | @export(sincosq, .{ .name = "sincosf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&sincosq, .{ .name = "sincosf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | 20 | } |
| 21 | @export(sincosq, .{ .name = "sincosq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(sincosl, .{ .name = "sincosl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&sincosq, .{ .name = "sincosq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&sincosl, .{ .name = "sincosl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | pub fn __sincosh(x: f16, r_sin: *f16, r_cos: *f16) callconv(.C) void { |
lib/compiler_rt/sqrt.zig+7-7| ... | ... | @@ -7,15 +7,15 @@ const common = @import("common.zig"); |
| 7 | 7 | pub const panic = common.panic; |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | @export(__sqrth, .{ .name = "__sqrth", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(sqrtf, .{ .name = "sqrtf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(sqrt, .{ .name = "sqrt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(__sqrtx, .{ .name = "__sqrtx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__sqrth, .{ .name = "__sqrth", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&sqrtf, .{ .name = "sqrtf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&sqrt, .{ .name = "sqrt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__sqrtx, .{ .name = "__sqrtx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | if (common.want_ppc_abi) { |
| 15 | @export(sqrtq, .{ .name = "sqrtf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&sqrtq, .{ .name = "sqrtf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | 16 | } |
| 17 | @export(sqrtq, .{ .name = "sqrtq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(sqrtl, .{ .name = "sqrtl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&sqrtq, .{ .name = "sqrtq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&sqrtl, .{ .name = "sqrtl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub fn __sqrth(x: f16) callconv(.C) f16 { |
lib/compiler_rt/ssp.zig+10-10| ... | ... | @@ -21,16 +21,16 @@ extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) call |
| 21 | 21 | extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8; |
| 22 | 22 | |
| 23 | 23 | comptime { |
| 24 | @export(__stack_chk_fail, .{ .name = "__stack_chk_fail", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(__chk_fail, .{ .name = "__chk_fail", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(__strcpy_chk, .{ .name = "__strcpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | @export(__strncpy_chk, .{ .name = "__strncpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(__strcat_chk, .{ .name = "__strcat_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | @export(__strncat_chk, .{ .name = "__strncat_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | @export(__memcpy_chk, .{ .name = "__memcpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(__memmove_chk, .{ .name = "__memmove_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(__memset_chk, .{ .name = "__memset_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&__stack_chk_fail, .{ .name = "__stack_chk_fail", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__chk_fail, .{ .name = "__chk_fail", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(&__strcpy_chk, .{ .name = "__strcpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | @export(&__strncpy_chk, .{ .name = "__strncpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(&__strcat_chk, .{ .name = "__strcat_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | @export(&__strncat_chk, .{ .name = "__strncat_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | @export(&__memcpy_chk, .{ .name = "__memcpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(&__memmove_chk, .{ .name = "__memmove_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(&__memset_chk, .{ .name = "__memset_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | fn __stack_chk_fail() callconv(.C) noreturn { |
lib/compiler_rt/stack_probe.zig+6-6| ... | ... | @@ -16,16 +16,16 @@ comptime { |
| 16 | 16 | if (builtin.os.tag == .windows) { |
| 17 | 17 | // Default stack-probe functions emitted by LLVM |
| 18 | 18 | if (is_mingw) { |
| 19 | @export(_chkstk, .{ .name = "_alloca", .linkage = linkage }); | |
| 20 | @export(___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = linkage }); | |
| 19 | @export(&_chkstk, .{ .name = "_alloca", .linkage = linkage }); | |
| 20 | @export(&___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = linkage }); | |
| 21 | 21 | |
| 22 | 22 | if (arch.isAARCH64()) { |
| 23 | @export(__chkstk, .{ .name = "__chkstk", .linkage = linkage }); | |
| 23 | @export(&__chkstk, .{ .name = "__chkstk", .linkage = linkage }); | |
| 24 | 24 | } |
| 25 | 25 | } else if (!builtin.link_libc) { |
| 26 | 26 | // This symbols are otherwise exported by MSVCRT.lib |
| 27 | @export(_chkstk, .{ .name = "_chkstk", .linkage = linkage }); | |
| 28 | @export(__chkstk, .{ .name = "__chkstk", .linkage = linkage }); | |
| 27 | @export(&_chkstk, .{ .name = "_chkstk", .linkage = linkage }); | |
| 28 | @export(&__chkstk, .{ .name = "__chkstk", .linkage = linkage }); | |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| ... | ... | @@ -33,7 +33,7 @@ comptime { |
| 33 | 33 | .x86, |
| 34 | 34 | .x86_64, |
| 35 | 35 | => { |
| 36 | @export(zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage }); | |
| 36 | @export(&zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage }); | |
| 37 | 37 | }, |
| 38 | 38 | else => {}, |
| 39 | 39 | } |
lib/compiler_rt/subdf3.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_dsub, .{ .name = "__aeabi_dsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_dsub, .{ .name = "__aeabi_dsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__subdf3, .{ .name = "__subdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__subdf3, .{ .name = "__subdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/subhf3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const addf3 = @import("./addf3.zig").addf3; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__subhf3, .{ .name = "__subhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__subhf3, .{ .name = "__subhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __subhf3(a: f16, b: f16) callconv(.C) f16 { |
lib/compiler_rt/subo.zig+3-3| ... | ... | @@ -10,9 +10,9 @@ const common = @import("common.zig"); |
| 10 | 10 | pub const panic = common.panic; |
| 11 | 11 | |
| 12 | 12 | comptime { |
| 13 | @export(__subosi4, .{ .name = "__subosi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(__subodi4, .{ .name = "__subodi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(__suboti4, .{ .name = "__suboti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__subosi4, .{ .name = "__subosi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__subodi4, .{ .name = "__subodi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__suboti4, .{ .name = "__suboti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | pub fn __subosi4(a: i32, b: i32, overflow: *c_int) callconv(.C) i32 { |
lib/compiler_rt/subsf3.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__subsf3, .{ .name = "__subsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__subsf3, .{ .name = "__subsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/subtf3.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__subtf3, .{ .name = "__subkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__subtf3, .{ .name = "__subkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__subtf3, .{ .name = "__subtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__subtf3, .{ .name = "__subtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 { |
lib/compiler_rt/subxf3.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const common = @import("./common.zig"); |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__subxf3, .{ .name = "__subxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__subxf3, .{ .name = "__subxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __subxf3(a: f80, b: f80) callconv(.C) f80 { |
lib/compiler_rt/tan.zig+7-7| ... | ... | @@ -21,15 +21,15 @@ const common = @import("common.zig"); |
| 21 | 21 | pub const panic = common.panic; |
| 22 | 22 | |
| 23 | 23 | comptime { |
| 24 | @export(__tanh, .{ .name = "__tanh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(tanf, .{ .name = "tanf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(tan, .{ .name = "tan", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(__tanx, .{ .name = "__tanx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&__tanh, .{ .name = "__tanh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&tanf, .{ .name = "tanf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&tan, .{ .name = "tan", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(&__tanx, .{ .name = "__tanx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | 28 | if (common.want_ppc_abi) { |
| 29 | @export(tanq, .{ .name = "tanf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(&tanq, .{ .name = "tanf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | 30 | } |
| 31 | @export(tanq, .{ .name = "tanq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(tanl, .{ .name = "tanl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | @export(&tanq, .{ .name = "tanq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(&tanl, .{ .name = "tanl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | pub fn __tanh(x: f16) callconv(.C) f16 { |
lib/compiler_rt/trunc.zig+7-7| ... | ... | @@ -15,15 +15,15 @@ const common = @import("common.zig"); |
| 15 | 15 | pub const panic = common.panic; |
| 16 | 16 | |
| 17 | 17 | comptime { |
| 18 | @export(__trunch, .{ .name = "__trunch", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(truncf, .{ .name = "truncf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(trunc, .{ .name = "trunc", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(__truncx, .{ .name = "__truncx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__trunch, .{ .name = "__trunch", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&truncf, .{ .name = "truncf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&trunc, .{ .name = "trunc", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__truncx, .{ .name = "__truncx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | 22 | if (common.want_ppc_abi) { |
| 23 | @export(truncq, .{ .name = "truncf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&truncq, .{ .name = "truncf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | 24 | } |
| 25 | @export(truncq, .{ .name = "truncq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(truncl, .{ .name = "truncl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&truncq, .{ .name = "truncq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&truncl, .{ .name = "truncl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | pub fn __trunch(x: f16) callconv(.C) f16 { |
lib/compiler_rt/truncdfhf2.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_d2h, .{ .name = "__aeabi_d2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_d2h, .{ .name = "__aeabi_d2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__truncdfhf2, .{ .name = "__truncdfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__truncdfhf2, .{ .name = "__truncdfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/truncdfsf2.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/truncsfhf2.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.gnu_f16_abi) { |
| 8 | @export(__gnu_f2h_ieee, .{ .name = "__gnu_f2h_ieee", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__gnu_f2h_ieee, .{ .name = "__gnu_f2h_ieee", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_aeabi) { |
| 10 | @export(__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __truncsfhf2(a: f32) callconv(.C) common.F16T(f32) { |
lib/compiler_rt/trunctfdf2.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __trunctfdf2(a: f128) callconv(.C) f64 { |
lib/compiler_rt/trunctfhf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const truncf = @import("./truncf.zig").truncf; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__trunctfhf2, .{ .name = "__trunctfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__trunctfhf2, .{ .name = "__trunctfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __trunctfhf2(a: f128) callconv(.C) common.F16T(f128) { |
lib/compiler_rt/trunctfsf2.zig+3-3| ... | ... | @@ -5,11 +5,11 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | @export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | pub fn __trunctfsf2(a: f128) callconv(.C) f32 { |
lib/compiler_rt/trunctfxf2.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ const trunc_f80 = @import("./truncf.zig").trunc_f80; |
| 5 | 5 | pub const panic = common.panic; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | @export(__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | pub fn __trunctfxf2(a: f128) callconv(.C) f80 { |
lib/compiler_rt/truncxfdf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const trunc_f80 = @import("./truncf.zig").trunc_f80; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__truncxfdf2, .{ .name = "__truncxfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__truncxfdf2, .{ .name = "__truncxfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __truncxfdf2(a: f80) callconv(.C) f64 { |
lib/compiler_rt/truncxfhf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const trunc_f80 = @import("./truncf.zig").trunc_f80; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__truncxfhf2, .{ .name = "__truncxfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__truncxfhf2, .{ .name = "__truncxfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __truncxfhf2(a: f80) callconv(.C) common.F16T(f80) { |
lib/compiler_rt/truncxfsf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const trunc_f80 = @import("./truncf.zig").trunc_f80; |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__truncxfsf2, .{ .name = "__truncxfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__truncxfsf2, .{ .name = "__truncxfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | fn __truncxfsf2(a: f80) callconv(.C) f32 { |
lib/compiler_rt/udivmodei4.zig+2-2| ... | ... | @@ -7,8 +7,8 @@ const shl = std.math.shl; |
| 7 | 7 | const max_limbs = std.math.divCeil(usize, 65535, 32) catch unreachable; // max supported type is u65535 |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | @export(__udivei4, .{ .name = "__udivei4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(__umodei4, .{ .name = "__umodei4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__udivei4, .{ .name = "__udivei4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__umodei4, .{ .name = "__umodei4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | const endian = builtin.cpu.arch.endian(); |
lib/compiler_rt/udivmodti4.zig+2-2| ... | ... | @@ -7,9 +7,9 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_windows_v2u64_abi) { |
| 10 | @export(__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } else { |
| 12 | @export(__udivmodti4, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__udivmodti4, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 |
lib/compiler_rt/udivti3.zig+2-2| ... | ... | @@ -7,9 +7,9 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_windows_v2u64_abi) { |
| 10 | @export(__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } else { |
| 12 | @export(__udivti3, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__udivti3, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 |
lib/compiler_rt/umodti3.zig+2-2| ... | ... | @@ -7,9 +7,9 @@ pub const panic = common.panic; |
| 7 | 7 | |
| 8 | 8 | comptime { |
| 9 | 9 | if (common.want_windows_v2u64_abi) { |
| 10 | @export(__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } else { |
| 12 | @export(__umodti3, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__umodti3, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 |
lib/compiler_rt/unorddf2.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_dcmpun, .{ .name = "__aeabi_dcmpun", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_dcmpun, .{ .name = "__aeabi_dcmpun", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__unorddf2, .{ .name = "__unorddf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__unorddf2, .{ .name = "__unorddf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/unordhf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const comparef = @import("./comparef.zig"); |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__unordhf2, .{ .name = "__unordhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__unordhf2, .{ .name = "__unordhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __unordhf2(a: f16, b: f16) callconv(.C) i32 { |
lib/compiler_rt/unordsf2.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_aeabi) { |
| 8 | @export(__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else { |
| 10 | @export(__unordsf2, .{ .name = "__unordsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__unordsf2, .{ .name = "__unordsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 |
lib/compiler_rt/unordtf2.zig+2-2| ... | ... | @@ -5,12 +5,12 @@ pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (common.want_ppc_abi) { |
| 8 | @export(__unordtf2, .{ .name = "__unordkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__unordtf2, .{ .name = "__unordkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | 9 | } else if (common.want_sparc_abi) { |
| 10 | 10 | // These exports are handled in cmptf2.zig because unordered comparisons |
| 11 | 11 | // are based on calling _Qp_cmp. |
| 12 | 12 | } |
| 13 | @export(__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | fn __unordtf2(a: f128, b: f128) callconv(.C) i32 { |
lib/compiler_rt/unordxf2.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const comparef = @import("./comparef.zig"); |
| 4 | 4 | pub const panic = common.panic; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | @export(__unordxf2, .{ .name = "__unordxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__unordxf2, .{ .name = "__unordxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | pub fn __unordxf2(a: f80, b: f80) callconv(.C) i32 { |
lib/std/Thread/Futex.zig+4-4| ... | ... | @@ -27,7 +27,7 @@ const atomic = std.atomic; |
| 27 | 27 | /// The checking of `ptr` and `expect`, along with blocking the caller, is done atomically |
| 28 | 28 | /// and totally ordered (sequentially consistent) with respect to other wait()/wake() calls on the same `ptr`. |
| 29 | 29 | pub fn wait(ptr: *const atomic.Value(u32), expect: u32) void { |
| 30 | @setCold(true); | |
| 30 | @branchHint(.cold); | |
| 31 | 31 | |
| 32 | 32 | Impl.wait(ptr, expect, null) catch |err| switch (err) { |
| 33 | 33 | error.Timeout => unreachable, // null timeout meant to wait forever |
| ... | ... | @@ -43,7 +43,7 @@ pub fn wait(ptr: *const atomic.Value(u32), expect: u32) void { |
| 43 | 43 | /// The checking of `ptr` and `expect`, along with blocking the caller, is done atomically |
| 44 | 44 | /// and totally ordered (sequentially consistent) with respect to other wait()/wake() calls on the same `ptr`. |
| 45 | 45 | pub fn timedWait(ptr: *const atomic.Value(u32), expect: u32, timeout_ns: u64) error{Timeout}!void { |
| 46 | @setCold(true); | |
| 46 | @branchHint(.cold); | |
| 47 | 47 | |
| 48 | 48 | // Avoid calling into the OS for no-op timeouts. |
| 49 | 49 | if (timeout_ns == 0) { |
| ... | ... | @@ -56,7 +56,7 @@ pub fn timedWait(ptr: *const atomic.Value(u32), expect: u32, timeout_ns: u64) er |
| 56 | 56 | |
| 57 | 57 | /// Unblocks at most `max_waiters` callers blocked in a `wait()` call on `ptr`. |
| 58 | 58 | pub fn wake(ptr: *const atomic.Value(u32), max_waiters: u32) void { |
| 59 | @setCold(true); | |
| 59 | @branchHint(.cold); | |
| 60 | 60 | |
| 61 | 61 | // Avoid calling into the OS if there's nothing to wake up. |
| 62 | 62 | if (max_waiters == 0) { |
| ... | ... | @@ -1048,7 +1048,7 @@ pub const Deadline = struct { |
| 1048 | 1048 | /// - A spurious wake occurs. |
| 1049 | 1049 | /// - The deadline expires; In which case `error.Timeout` is returned. |
| 1050 | 1050 | pub fn wait(self: *Deadline, ptr: *const atomic.Value(u32), expect: u32) error{Timeout}!void { |
| 1051 | @setCold(true); | |
| 1051 | @branchHint(.cold); | |
| 1052 | 1052 | |
| 1053 | 1053 | // Check if we actually have a timeout to wait until. |
| 1054 | 1054 | // If not just wait "forever". |
lib/std/Thread/Mutex.zig+1-1| ... | ... | @@ -169,7 +169,7 @@ const FutexImpl = struct { |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | fn lockSlow(self: *@This()) void { |
| 172 | @setCold(true); | |
| 172 | @branchHint(.cold); | |
| 173 | 173 | |
| 174 | 174 | // Avoid doing an atomic swap below if we already know the state is contended. |
| 175 | 175 | // An atomic swap unconditionally stores which marks the cache-line as modified unnecessarily. |
lib/std/Thread/ResetEvent.zig+1-1| ... | ... | @@ -107,7 +107,7 @@ const FutexImpl = struct { |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | fn waitUntilSet(self: *Impl, timeout: ?u64) error{Timeout}!void { |
| 110 | @setCold(true); | |
| 110 | @branchHint(.cold); | |
| 111 | 111 | |
| 112 | 112 | // Try to set the state from `unset` to `waiting` to indicate |
| 113 | 113 | // to the set() thread that others are blocked on the ResetEvent. |
lib/std/builtin.zig+26-7| ... | ... | @@ -675,6 +675,25 @@ pub const ExternOptions = struct { |
| 675 | 675 | is_thread_local: bool = false, |
| 676 | 676 | }; |
| 677 | 677 | |
| 678 | /// This data structure is used by the Zig language code generation and | |
| 679 | /// therefore must be kept in sync with the compiler implementation. | |
| 680 | pub const BranchHint = enum(u3) { | |
| 681 | /// Equivalent to no hint given. | |
| 682 | none, | |
| 683 | /// This branch of control flow is more likely to be reached than its peers. | |
| 684 | /// The optimizer should optimize for reaching it. | |
| 685 | likely, | |
| 686 | /// This branch of control flow is less likely to be reached than its peers. | |
| 687 | /// The optimizer should optimize for not reaching it. | |
| 688 | unlikely, | |
| 689 | /// This branch of control flow is unlikely to *ever* be reached. | |
| 690 | /// The optimizer may place it in a different page of memory to optimize other branches. | |
| 691 | cold, | |
| 692 | /// It is difficult to predict whether this branch of control flow will be reached. | |
| 693 | /// The optimizer should avoid branching behavior with expensive mispredictions. | |
| 694 | unpredictable, | |
| 695 | }; | |
| 696 | ||
| 678 | 697 | /// This enum is set by the compiler and communicates which compiler backend is |
| 679 | 698 | /// used to produce machine code. |
| 680 | 699 | /// Think carefully before deciding to observe this value. Nearly all code should |
| ... | ... | @@ -760,7 +779,7 @@ else |
| 760 | 779 | /// This function is used by the Zig language code generation and |
| 761 | 780 | /// therefore must be kept in sync with the compiler implementation. |
| 762 | 781 | pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn { |
| 763 | @setCold(true); | |
| 782 | @branchHint(.cold); | |
| 764 | 783 | |
| 765 | 784 | // For backends that cannot handle the language features depended on by the |
| 766 | 785 | // default panic handler, we have a simpler panic handler: |
| ... | ... | @@ -877,27 +896,27 @@ pub fn checkNonScalarSentinel(expected: anytype, actual: @TypeOf(expected)) void |
| 877 | 896 | } |
| 878 | 897 | |
| 879 | 898 | pub fn panicSentinelMismatch(expected: anytype, actual: @TypeOf(expected)) noreturn { |
| 880 | @setCold(true); | |
| 899 | @branchHint(.cold); | |
| 881 | 900 | std.debug.panicExtra(null, @returnAddress(), "sentinel mismatch: expected {any}, found {any}", .{ expected, actual }); |
| 882 | 901 | } |
| 883 | 902 | |
| 884 | 903 | pub fn panicUnwrapError(st: ?*StackTrace, err: anyerror) noreturn { |
| 885 | @setCold(true); | |
| 904 | @branchHint(.cold); | |
| 886 | 905 | std.debug.panicExtra(st, @returnAddress(), "attempt to unwrap error: {s}", .{@errorName(err)}); |
| 887 | 906 | } |
| 888 | 907 | |
| 889 | 908 | pub fn panicOutOfBounds(index: usize, len: usize) noreturn { |
| 890 | @setCold(true); | |
| 909 | @branchHint(.cold); | |
| 891 | 910 | std.debug.panicExtra(null, @returnAddress(), "index out of bounds: index {d}, len {d}", .{ index, len }); |
| 892 | 911 | } |
| 893 | 912 | |
| 894 | 913 | pub fn panicStartGreaterThanEnd(start: usize, end: usize) noreturn { |
| 895 | @setCold(true); | |
| 914 | @branchHint(.cold); | |
| 896 | 915 | std.debug.panicExtra(null, @returnAddress(), "start index {d} is larger than end index {d}", .{ start, end }); |
| 897 | 916 | } |
| 898 | 917 | |
| 899 | 918 | pub fn panicInactiveUnionField(active: anytype, wanted: @TypeOf(active)) noreturn { |
| 900 | @setCold(true); | |
| 919 | @branchHint(.cold); | |
| 901 | 920 | std.debug.panicExtra(null, @returnAddress(), "access of union field '{s}' while field '{s}' is active", .{ @tagName(wanted), @tagName(active) }); |
| 902 | 921 | } |
| 903 | 922 | |
| ... | ... | @@ -930,7 +949,7 @@ pub const panic_messages = struct { |
| 930 | 949 | }; |
| 931 | 950 | |
| 932 | 951 | pub noinline fn returnError(st: *StackTrace) void { |
| 933 | @setCold(true); | |
| 952 | @branchHint(.cold); | |
| 934 | 953 | @setRuntimeSafety(false); |
| 935 | 954 | addErrRetTraceAddr(st, @returnAddress()); |
| 936 | 955 | } |
lib/std/c.zig+1-1| ... | ... | @@ -40,7 +40,7 @@ pub extern var _mh_execute_header: mach_hdr; |
| 40 | 40 | var dummy_execute_header: mach_hdr = undefined; |
| 41 | 41 | comptime { |
| 42 | 42 | if (native_os.isDarwin()) { |
| 43 | @export(dummy_execute_header, .{ .name = "_mh_execute_header", .linkage = .weak }); | |
| 43 | @export(&dummy_execute_header, .{ .name = "_mh_execute_header", .linkage = .weak }); | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 |
lib/std/debug.zig+3-3| ... | ... | @@ -409,7 +409,7 @@ pub fn assertReadable(slice: []const volatile u8) void { |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | pub fn panic(comptime format: []const u8, args: anytype) noreturn { |
| 412 | @setCold(true); | |
| 412 | @branchHint(.cold); | |
| 413 | 413 | |
| 414 | 414 | panicExtra(@errorReturnTrace(), @returnAddress(), format, args); |
| 415 | 415 | } |
| ... | ... | @@ -422,7 +422,7 @@ pub fn panicExtra( |
| 422 | 422 | comptime format: []const u8, |
| 423 | 423 | args: anytype, |
| 424 | 424 | ) noreturn { |
| 425 | @setCold(true); | |
| 425 | @branchHint(.cold); | |
| 426 | 426 | |
| 427 | 427 | const size = 0x1000; |
| 428 | 428 | const trunc_msg = "(msg truncated)"; |
| ... | ... | @@ -450,7 +450,7 @@ threadlocal var panic_stage: usize = 0; |
| 450 | 450 | // `panicImpl` could be useful in implementing a custom panic handler which |
| 451 | 451 | // calls the default handler (on supported platforms) |
| 452 | 452 | pub fn panicImpl(trace: ?*const std.builtin.StackTrace, first_trace_addr: ?usize, msg: []const u8) noreturn { |
| 453 | @setCold(true); | |
| 453 | @branchHint(.cold); | |
| 454 | 454 | |
| 455 | 455 | if (enable_segfault_handler) { |
| 456 | 456 | // If a segfault happens while panicking, we want it to actually segfault, not trigger |
lib/std/fmt/parse_float/convert_slow.zig+1-1| ... | ... | @@ -36,7 +36,7 @@ pub fn getShift(n: usize) usize { |
| 36 | 36 | /// Note that this function needs a lot of stack space and is marked |
| 37 | 37 | /// cold to hint against inlining into the caller. |
| 38 | 38 | pub fn convertSlow(comptime T: type, s: []const u8) BiasedFp(T) { |
| 39 | @setCold(true); | |
| 39 | @branchHint(.cold); | |
| 40 | 40 | |
| 41 | 41 | const MantissaT = mantissaType(T); |
| 42 | 42 | const min_exponent = -(1 << (math.floatExponentBits(T) - 1)) + 1; |
lib/std/hash/xxhash.zig+6-6| ... | ... | @@ -593,7 +593,7 @@ pub const XxHash3 = struct { |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | fn hash3(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 { |
| 596 | @setCold(true); | |
| 596 | @branchHint(.cold); | |
| 597 | 597 | std.debug.assert(input.len > 0 and input.len < 4); |
| 598 | 598 | |
| 599 | 599 | const flip: [2]u32 = @bitCast(secret[0..8].*); |
| ... | ... | @@ -609,7 +609,7 @@ pub const XxHash3 = struct { |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | fn hash8(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 { |
| 612 | @setCold(true); | |
| 612 | @branchHint(.cold); | |
| 613 | 613 | std.debug.assert(input.len >= 4 and input.len <= 8); |
| 614 | 614 | |
| 615 | 615 | const flip: [2]u64 = @bitCast(secret[8..24].*); |
| ... | ... | @@ -625,7 +625,7 @@ pub const XxHash3 = struct { |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | fn hash16(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 { |
| 628 | @setCold(true); | |
| 628 | @branchHint(.cold); | |
| 629 | 629 | std.debug.assert(input.len > 8 and input.len <= 16); |
| 630 | 630 | |
| 631 | 631 | const flip: [4]u64 = @bitCast(secret[24..56].*); |
| ... | ... | @@ -641,7 +641,7 @@ pub const XxHash3 = struct { |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | fn hash128(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 { |
| 644 | @setCold(true); | |
| 644 | @branchHint(.cold); | |
| 645 | 645 | std.debug.assert(input.len > 16 and input.len <= 128); |
| 646 | 646 | |
| 647 | 647 | var acc = XxHash64.prime_1 *% @as(u64, input.len); |
| ... | ... | @@ -657,7 +657,7 @@ pub const XxHash3 = struct { |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | fn hash240(seed: u64, input: anytype, noalias secret: *const [192]u8) u64 { |
| 660 | @setCold(true); | |
| 660 | @branchHint(.cold); | |
| 661 | 661 | std.debug.assert(input.len > 128 and input.len <= 240); |
| 662 | 662 | |
| 663 | 663 | var acc = XxHash64.prime_1 *% @as(u64, input.len); |
| ... | ... | @@ -676,7 +676,7 @@ pub const XxHash3 = struct { |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | noinline fn hashLong(seed: u64, input: []const u8) u64 { |
| 679 | @setCold(true); | |
| 679 | @branchHint(.cold); | |
| 680 | 680 | std.debug.assert(input.len >= 240); |
| 681 | 681 | |
| 682 | 682 | const block_count = ((input.len - 1) / @sizeOf(Block)) * @sizeOf(Block); |
lib/std/hash_map.zig+1-1| ... | ... | @@ -1657,7 +1657,7 @@ pub fn HashMapUnmanaged( |
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | 1659 | fn grow(self: *Self, allocator: Allocator, new_capacity: Size, ctx: Context) Allocator.Error!void { |
| 1660 | @setCold(true); | |
| 1660 | @branchHint(.cold); | |
| 1661 | 1661 | const new_cap = @max(new_capacity, minimal_capacity); |
| 1662 | 1662 | assert(new_cap > self.capacity()); |
| 1663 | 1663 | assert(std.math.isPowerOfTwo(new_cap)); |
lib/std/heap/WasmPageAllocator.zig+1-1| ... | ... | @@ -61,7 +61,7 @@ const FreeBlock = struct { |
| 61 | 61 | const not_found = maxInt(usize); |
| 62 | 62 | |
| 63 | 63 | fn useRecycled(self: FreeBlock, num_pages: usize, log2_align: u8) usize { |
| 64 | @setCold(true); | |
| 64 | @branchHint(.cold); | |
| 65 | 65 | for (self.data, 0..) |segment, i| { |
| 66 | 66 | const spills_into_next = @as(i128, @bitCast(segment)) < 0; |
| 67 | 67 | const has_enough_bits = @popCount(segment) >= num_pages; |
lib/std/log.zig+1-1| ... | ... | @@ -171,7 +171,7 @@ pub fn scoped(comptime scope: @Type(.EnumLiteral)) type { |
| 171 | 171 | comptime format: []const u8, |
| 172 | 172 | args: anytype, |
| 173 | 173 | ) void { |
| 174 | @setCold(true); | |
| 174 | @branchHint(.cold); | |
| 175 | 175 | log(.err, scope, format, args); |
| 176 | 176 | } |
| 177 | 177 |
lib/std/once.zig+1-1| ... | ... | @@ -25,7 +25,7 @@ pub fn Once(comptime f: fn () void) type { |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | fn callSlow(self: *@This()) void { |
| 28 | @setCold(true); | |
| 28 | @branchHint(.cold); | |
| 29 | 29 | |
| 30 | 30 | self.mutex.lock(); |
| 31 | 31 | defer self.mutex.unlock(); |
lib/std/os/emscripten.zig+2-2| ... | ... | @@ -21,8 +21,8 @@ comptime { |
| 21 | 21 | if (builtin.os.tag == .emscripten) { |
| 22 | 22 | if (builtin.mode == .Debug or builtin.mode == .ReleaseSafe) { |
| 23 | 23 | // Emscripten does not provide these symbols, so we must export our own |
| 24 | @export(__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = .strong }); | |
| 25 | @export(__stack_chk_fail, .{ .name = "__stack_chk_fail", .linkage = .strong }); | |
| 24 | @export(&__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = .strong }); | |
| 25 | @export(&__stack_chk_fail, .{ .name = "__stack_chk_fail", .linkage = .strong }); | |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
lib/std/os/linux.zig+1-1| ... | ... | @@ -434,7 +434,7 @@ comptime { |
| 434 | 434 | // Export this only when building executable, otherwise it is overriding |
| 435 | 435 | // the libc implementation |
| 436 | 436 | if (extern_getauxval and (builtin.output_mode == .Exe or @hasDecl(root, "main"))) { |
| 437 | @export(getauxvalImpl, .{ .name = "getauxval", .linkage = .weak }); | |
| 437 | @export(&getauxvalImpl, .{ .name = "getauxval", .linkage = .weak }); | |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 |
lib/std/posix.zig+1-1| ... | ... | @@ -654,7 +654,7 @@ fn getRandomBytesDevURandom(buf: []u8) !void { |
| 654 | 654 | /// it raises SIGABRT followed by SIGKILL and finally lo |
| 655 | 655 | /// Invokes the current signal handler for SIGABRT, if any. |
| 656 | 656 | pub fn abort() noreturn { |
| 657 | @setCold(true); | |
| 657 | @branchHint(.cold); | |
| 658 | 658 | // MSVCRT abort() sometimes opens a popup window which is undesirable, so |
| 659 | 659 | // even when linking libc on Windows we use our own abort implementation. |
| 660 | 660 | // See https://github.com/ziglang/zig/issues/2071 for more details. |
lib/std/sort/pdq.zig+2-2| ... | ... | @@ -203,7 +203,7 @@ fn partitionEqual(a: usize, b: usize, pivot: usize, context: anytype) usize { |
| 203 | 203 | /// |
| 204 | 204 | /// returns `true` if the slice is sorted at the end. This function is `O(n)` worst-case. |
| 205 | 205 | fn partialInsertionSort(a: usize, b: usize, context: anytype) bool { |
| 206 | @setCold(true); | |
| 206 | @branchHint(.cold); | |
| 207 | 207 | |
| 208 | 208 | // maximum number of adjacent out-of-order pairs that will get shifted |
| 209 | 209 | const max_steps = 5; |
| ... | ... | @@ -247,7 +247,7 @@ fn partialInsertionSort(a: usize, b: usize, context: anytype) bool { |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | fn breakPatterns(a: usize, b: usize, context: anytype) void { |
| 250 | @setCold(true); | |
| 250 | @branchHint(.cold); | |
| 251 | 251 | |
| 252 | 252 | const len = b - a; |
| 253 | 253 | if (len < 8) return; |
lib/std/start.zig+13-13| ... | ... | @@ -31,38 +31,38 @@ comptime { |
| 31 | 31 | if (builtin.output_mode == .Exe) { |
| 32 | 32 | if ((builtin.link_libc or builtin.object_format == .c) and @hasDecl(root, "main")) { |
| 33 | 33 | if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) { |
| 34 | @export(main2, .{ .name = "main" }); | |
| 34 | @export(&main2, .{ .name = "main" }); | |
| 35 | 35 | } |
| 36 | 36 | } else if (builtin.os.tag == .windows) { |
| 37 | 37 | if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) { |
| 38 | @export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" }); | |
| 38 | @export(&wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" }); | |
| 39 | 39 | } |
| 40 | 40 | } else if (builtin.os.tag == .opencl) { |
| 41 | 41 | if (@hasDecl(root, "main")) |
| 42 | @export(spirvMain2, .{ .name = "main" }); | |
| 42 | @export(&spirvMain2, .{ .name = "main" }); | |
| 43 | 43 | } else { |
| 44 | 44 | if (!@hasDecl(root, "_start")) { |
| 45 | @export(_start2, .{ .name = "_start" }); | |
| 45 | @export(&_start2, .{ .name = "_start" }); | |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | } else { |
| 50 | 50 | if (builtin.output_mode == .Lib and builtin.link_mode == .dynamic) { |
| 51 | 51 | if (native_os == .windows and !@hasDecl(root, "_DllMainCRTStartup")) { |
| 52 | @export(_DllMainCRTStartup, .{ .name = "_DllMainCRTStartup" }); | |
| 52 | @export(&_DllMainCRTStartup, .{ .name = "_DllMainCRTStartup" }); | |
| 53 | 53 | } |
| 54 | 54 | } else if (builtin.output_mode == .Exe or @hasDecl(root, "main")) { |
| 55 | 55 | if (builtin.link_libc and @hasDecl(root, "main")) { |
| 56 | 56 | if (native_arch.isWasm()) { |
| 57 | @export(mainWithoutEnv, .{ .name = "main" }); | |
| 57 | @export(&mainWithoutEnv, .{ .name = "main" }); | |
| 58 | 58 | } else if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) { |
| 59 | @export(main, .{ .name = "main" }); | |
| 59 | @export(&main, .{ .name = "main" }); | |
| 60 | 60 | } |
| 61 | 61 | } else if (native_os == .windows) { |
| 62 | 62 | if (!@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup") and |
| 63 | 63 | !@hasDecl(root, "wWinMain") and !@hasDecl(root, "wWinMainCRTStartup")) |
| 64 | 64 | { |
| 65 | @export(WinStartup, .{ .name = "wWinMainCRTStartup" }); | |
| 65 | @export(&WinStartup, .{ .name = "wWinMainCRTStartup" }); | |
| 66 | 66 | } else if (@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup") and |
| 67 | 67 | !@hasDecl(root, "wWinMain") and !@hasDecl(root, "wWinMainCRTStartup")) |
| 68 | 68 | { |
| ... | ... | @@ -70,10 +70,10 @@ comptime { |
| 70 | 70 | } else if (@hasDecl(root, "wWinMain") and !@hasDecl(root, "wWinMainCRTStartup") and |
| 71 | 71 | !@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup")) |
| 72 | 72 | { |
| 73 | @export(wWinMainCRTStartup, .{ .name = "wWinMainCRTStartup" }); | |
| 73 | @export(&wWinMainCRTStartup, .{ .name = "wWinMainCRTStartup" }); | |
| 74 | 74 | } |
| 75 | 75 | } else if (native_os == .uefi) { |
| 76 | if (!@hasDecl(root, "EfiMain")) @export(EfiMain, .{ .name = "EfiMain" }); | |
| 76 | if (!@hasDecl(root, "EfiMain")) @export(&EfiMain, .{ .name = "EfiMain" }); | |
| 77 | 77 | } else if (native_os == .wasi) { |
| 78 | 78 | const wasm_start_sym = switch (builtin.wasi_exec_model) { |
| 79 | 79 | .reactor => "_initialize", |
| ... | ... | @@ -82,14 +82,14 @@ comptime { |
| 82 | 82 | if (!@hasDecl(root, wasm_start_sym) and @hasDecl(root, "main")) { |
| 83 | 83 | // Only call main when defined. For WebAssembly it's allowed to pass `-fno-entry` in which |
| 84 | 84 | // case it's not required to provide an entrypoint such as main. |
| 85 | @export(wasi_start, .{ .name = wasm_start_sym }); | |
| 85 | @export(&wasi_start, .{ .name = wasm_start_sym }); | |
| 86 | 86 | } |
| 87 | 87 | } else if (native_arch.isWasm() and native_os == .freestanding) { |
| 88 | 88 | // Only call main when defined. For WebAssembly it's allowed to pass `-fno-entry` in which |
| 89 | 89 | // case it's not required to provide an entrypoint such as main. |
| 90 | if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(wasm_freestanding_start, .{ .name = start_sym_name }); | |
| 90 | if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name }); | |
| 91 | 91 | } else if (native_os != .other and native_os != .freestanding) { |
| 92 | if (!@hasDecl(root, start_sym_name)) @export(_start, .{ .name = start_sym_name }); | |
| 92 | if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }); | |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
lib/std/zig/AstGen.zig+97-136| ... | ... | @@ -811,18 +811,18 @@ fn expr(gz: *GenZir, scope: *Scope, ri: ResultInfo, node: Ast.Node.Index) InnerE |
| 811 | 811 | .builtin_call_two, .builtin_call_two_comma => { |
| 812 | 812 | if (node_datas[node].lhs == 0) { |
| 813 | 813 | const params = [_]Ast.Node.Index{}; |
| 814 | return builtinCall(gz, scope, ri, node, &params); | |
| 814 | return builtinCall(gz, scope, ri, node, &params, false); | |
| 815 | 815 | } else if (node_datas[node].rhs == 0) { |
| 816 | 816 | const params = [_]Ast.Node.Index{node_datas[node].lhs}; |
| 817 | return builtinCall(gz, scope, ri, node, &params); | |
| 817 | return builtinCall(gz, scope, ri, node, &params, false); | |
| 818 | 818 | } else { |
| 819 | 819 | const params = [_]Ast.Node.Index{ node_datas[node].lhs, node_datas[node].rhs }; |
| 820 | return builtinCall(gz, scope, ri, node, &params); | |
| 820 | return builtinCall(gz, scope, ri, node, &params, false); | |
| 821 | 821 | } |
| 822 | 822 | }, |
| 823 | 823 | .builtin_call, .builtin_call_comma => { |
| 824 | 824 | const params = tree.extra_data[node_datas[node].lhs..node_datas[node].rhs]; |
| 825 | return builtinCall(gz, scope, ri, node, params); | |
| 825 | return builtinCall(gz, scope, ri, node, params, false); | |
| 826 | 826 | }, |
| 827 | 827 | |
| 828 | 828 | .call_one, |
| ... | ... | @@ -1017,16 +1017,16 @@ fn expr(gz: *GenZir, scope: *Scope, ri: ResultInfo, node: Ast.Node.Index) InnerE |
| 1017 | 1017 | .block_two, .block_two_semicolon => { |
| 1018 | 1018 | const statements = [2]Ast.Node.Index{ node_datas[node].lhs, node_datas[node].rhs }; |
| 1019 | 1019 | if (node_datas[node].lhs == 0) { |
| 1020 | return blockExpr(gz, scope, ri, node, statements[0..0]); | |
| 1020 | return blockExpr(gz, scope, ri, node, statements[0..0], .normal); | |
| 1021 | 1021 | } else if (node_datas[node].rhs == 0) { |
| 1022 | return blockExpr(gz, scope, ri, node, statements[0..1]); | |
| 1022 | return blockExpr(gz, scope, ri, node, statements[0..1], .normal); | |
| 1023 | 1023 | } else { |
| 1024 | return blockExpr(gz, scope, ri, node, statements[0..2]); | |
| 1024 | return blockExpr(gz, scope, ri, node, statements[0..2], .normal); | |
| 1025 | 1025 | } |
| 1026 | 1026 | }, |
| 1027 | 1027 | .block, .block_semicolon => { |
| 1028 | 1028 | const statements = tree.extra_data[node_datas[node].lhs..node_datas[node].rhs]; |
| 1029 | return blockExpr(gz, scope, ri, node, statements); | |
| 1029 | return blockExpr(gz, scope, ri, node, statements, .normal); | |
| 1030 | 1030 | }, |
| 1031 | 1031 | .enum_literal => return simpleStrTok(gz, ri, main_tokens[node], node, .enum_literal), |
| 1032 | 1032 | .error_value => return simpleStrTok(gz, ri, node_datas[node].rhs, node, .error_value), |
| ... | ... | @@ -1241,7 +1241,7 @@ fn suspendExpr( |
| 1241 | 1241 | suspend_scope.suspend_node = node; |
| 1242 | 1242 | defer suspend_scope.unstack(); |
| 1243 | 1243 | |
| 1244 | const body_result = try fullBodyExpr(&suspend_scope, &suspend_scope.base, .{ .rl = .none }, body_node); | |
| 1244 | const body_result = try fullBodyExpr(&suspend_scope, &suspend_scope.base, .{ .rl = .none }, body_node, .normal); | |
| 1245 | 1245 | if (!gz.refIsNoReturn(body_result)) { |
| 1246 | 1246 | _ = try suspend_scope.addBreak(.break_inline, suspend_inst, .void_value); |
| 1247 | 1247 | } |
| ... | ... | @@ -1362,7 +1362,7 @@ fn fnProtoExpr( |
| 1362 | 1362 | assert(param_type_node != 0); |
| 1363 | 1363 | var param_gz = block_scope.makeSubBlock(scope); |
| 1364 | 1364 | defer param_gz.unstack(); |
| 1365 | const param_type = try fullBodyExpr(&param_gz, scope, coerced_type_ri, param_type_node); | |
| 1365 | const param_type = try fullBodyExpr(&param_gz, scope, coerced_type_ri, param_type_node, .normal); | |
| 1366 | 1366 | const param_inst_expected: Zir.Inst.Index = @enumFromInt(astgen.instructions.len + 1); |
| 1367 | 1367 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 1368 | 1368 | const main_tokens = tree.nodes.items(.main_token); |
| ... | ... | @@ -2040,13 +2040,13 @@ fn comptimeExpr( |
| 2040 | 2040 | else |
| 2041 | 2041 | stmts[0..2]; |
| 2042 | 2042 | |
| 2043 | const block_ref = try labeledBlockExpr(gz, scope, ty_only_ri, node, stmt_slice, true); | |
| 2043 | const block_ref = try labeledBlockExpr(gz, scope, ty_only_ri, node, stmt_slice, true, .normal); | |
| 2044 | 2044 | return rvalue(gz, ri, block_ref, node); |
| 2045 | 2045 | }, |
| 2046 | 2046 | .block, .block_semicolon => { |
| 2047 | 2047 | const stmts = tree.extra_data[node_datas[node].lhs..node_datas[node].rhs]; |
| 2048 | 2048 | // Replace result location and copy back later - see above. |
| 2049 | const block_ref = try labeledBlockExpr(gz, scope, ty_only_ri, node, stmts, true); | |
| 2049 | const block_ref = try labeledBlockExpr(gz, scope, ty_only_ri, node, stmts, true, .normal); | |
| 2050 | 2050 | return rvalue(gz, ri, block_ref, node); |
| 2051 | 2051 | }, |
| 2052 | 2052 | else => unreachable, |
| ... | ... | @@ -2071,7 +2071,7 @@ fn comptimeExpr( |
| 2071 | 2071 | else |
| 2072 | 2072 | .none, |
| 2073 | 2073 | }; |
| 2074 | const block_result = try fullBodyExpr(&block_scope, scope, ty_only_ri, node); | |
| 2074 | const block_result = try fullBodyExpr(&block_scope, scope, ty_only_ri, node, .normal); | |
| 2075 | 2075 | if (!gz.refIsNoReturn(block_result)) { |
| 2076 | 2076 | _ = try block_scope.addBreak(.@"break", block_inst, block_result); |
| 2077 | 2077 | } |
| ... | ... | @@ -2311,6 +2311,7 @@ fn fullBodyExpr( |
| 2311 | 2311 | scope: *Scope, |
| 2312 | 2312 | ri: ResultInfo, |
| 2313 | 2313 | node: Ast.Node.Index, |
| 2314 | block_kind: BlockKind, | |
| 2314 | 2315 | ) InnerError!Zir.Inst.Ref { |
| 2315 | 2316 | const tree = gz.astgen.tree; |
| 2316 | 2317 | const node_tags = tree.nodes.items(.tag); |
| ... | ... | @@ -2340,21 +2341,24 @@ fn fullBodyExpr( |
| 2340 | 2341 | // Labeled blocks are tricky - forwarding result location information properly is non-trivial, |
| 2341 | 2342 | // plus if this block is exited with a `break_inline` we aren't allowed multiple breaks. This |
| 2342 | 2343 | // case is rare, so just treat it as a normal expression and create a nested block. |
| 2343 | return expr(gz, scope, ri, node); | |
| 2344 | return blockExpr(gz, scope, ri, node, statements, block_kind); | |
| 2344 | 2345 | } |
| 2345 | 2346 | |
| 2346 | 2347 | var sub_gz = gz.makeSubBlock(scope); |
| 2347 | try blockExprStmts(&sub_gz, &sub_gz.base, statements); | |
| 2348 | try blockExprStmts(&sub_gz, &sub_gz.base, statements, block_kind); | |
| 2348 | 2349 | |
| 2349 | 2350 | return rvalue(gz, ri, .void_value, node); |
| 2350 | 2351 | } |
| 2351 | 2352 | |
| 2353 | const BlockKind = enum { normal, allow_branch_hint }; | |
| 2354 | ||
| 2352 | 2355 | fn blockExpr( |
| 2353 | 2356 | gz: *GenZir, |
| 2354 | 2357 | scope: *Scope, |
| 2355 | 2358 | ri: ResultInfo, |
| 2356 | 2359 | block_node: Ast.Node.Index, |
| 2357 | 2360 | statements: []const Ast.Node.Index, |
| 2361 | kind: BlockKind, | |
| 2358 | 2362 | ) InnerError!Zir.Inst.Ref { |
| 2359 | 2363 | const astgen = gz.astgen; |
| 2360 | 2364 | const tree = astgen.tree; |
| ... | ... | @@ -2365,7 +2369,7 @@ fn blockExpr( |
| 2365 | 2369 | if (token_tags[lbrace - 1] == .colon and |
| 2366 | 2370 | token_tags[lbrace - 2] == .identifier) |
| 2367 | 2371 | { |
| 2368 | return labeledBlockExpr(gz, scope, ri, block_node, statements, false); | |
| 2372 | return labeledBlockExpr(gz, scope, ri, block_node, statements, false, kind); | |
| 2369 | 2373 | } |
| 2370 | 2374 | |
| 2371 | 2375 | if (!gz.is_comptime) { |
| ... | ... | @@ -2380,7 +2384,7 @@ fn blockExpr( |
| 2380 | 2384 | var block_scope = gz.makeSubBlock(scope); |
| 2381 | 2385 | defer block_scope.unstack(); |
| 2382 | 2386 | |
| 2383 | try blockExprStmts(&block_scope, &block_scope.base, statements); | |
| 2387 | try blockExprStmts(&block_scope, &block_scope.base, statements, kind); | |
| 2384 | 2388 | |
| 2385 | 2389 | if (!block_scope.endsWithNoReturn()) { |
| 2386 | 2390 | // As our last action before the break, "pop" the error trace if needed |
| ... | ... | @@ -2391,7 +2395,7 @@ fn blockExpr( |
| 2391 | 2395 | try block_scope.setBlockBody(block_inst); |
| 2392 | 2396 | } else { |
| 2393 | 2397 | var sub_gz = gz.makeSubBlock(scope); |
| 2394 | try blockExprStmts(&sub_gz, &sub_gz.base, statements); | |
| 2398 | try blockExprStmts(&sub_gz, &sub_gz.base, statements, kind); | |
| 2395 | 2399 | } |
| 2396 | 2400 | |
| 2397 | 2401 | return rvalue(gz, ri, .void_value, block_node); |
| ... | ... | @@ -2436,6 +2440,7 @@ fn labeledBlockExpr( |
| 2436 | 2440 | block_node: Ast.Node.Index, |
| 2437 | 2441 | statements: []const Ast.Node.Index, |
| 2438 | 2442 | force_comptime: bool, |
| 2443 | block_kind: BlockKind, | |
| 2439 | 2444 | ) InnerError!Zir.Inst.Ref { |
| 2440 | 2445 | const astgen = gz.astgen; |
| 2441 | 2446 | const tree = astgen.tree; |
| ... | ... | @@ -2476,7 +2481,7 @@ fn labeledBlockExpr( |
| 2476 | 2481 | if (force_comptime) block_scope.is_comptime = true; |
| 2477 | 2482 | defer block_scope.unstack(); |
| 2478 | 2483 | |
| 2479 | try blockExprStmts(&block_scope, &block_scope.base, statements); | |
| 2484 | try blockExprStmts(&block_scope, &block_scope.base, statements, block_kind); | |
| 2480 | 2485 | if (!block_scope.endsWithNoReturn()) { |
| 2481 | 2486 | // As our last action before the return, "pop" the error trace if needed |
| 2482 | 2487 | _ = try gz.addRestoreErrRetIndex(.{ .block = block_inst }, .always, block_node); |
| ... | ... | @@ -2495,7 +2500,7 @@ fn labeledBlockExpr( |
| 2495 | 2500 | } |
| 2496 | 2501 | } |
| 2497 | 2502 | |
| 2498 | fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Node.Index) !void { | |
| 2503 | fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Node.Index, block_kind: BlockKind) !void { | |
| 2499 | 2504 | const astgen = gz.astgen; |
| 2500 | 2505 | const tree = astgen.tree; |
| 2501 | 2506 | const node_tags = tree.nodes.items(.tag); |
| ... | ... | @@ -2509,7 +2514,7 @@ fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Nod |
| 2509 | 2514 | |
| 2510 | 2515 | var noreturn_src_node: Ast.Node.Index = 0; |
| 2511 | 2516 | var scope = parent_scope; |
| 2512 | for (statements) |statement| { | |
| 2517 | for (statements, 0..) |statement, stmt_idx| { | |
| 2513 | 2518 | if (noreturn_src_node != 0) { |
| 2514 | 2519 | try astgen.appendErrorNodeNotes( |
| 2515 | 2520 | statement, |
| ... | ... | @@ -2524,6 +2529,10 @@ fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Nod |
| 2524 | 2529 | }, |
| 2525 | 2530 | ); |
| 2526 | 2531 | } |
| 2532 | const allow_branch_hint = switch (block_kind) { | |
| 2533 | .normal => false, | |
| 2534 | .allow_branch_hint => stmt_idx == 0, | |
| 2535 | }; | |
| 2527 | 2536 | var inner_node = statement; |
| 2528 | 2537 | while (true) { |
| 2529 | 2538 | switch (node_tags[inner_node]) { |
| ... | ... | @@ -2567,6 +2576,30 @@ fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Nod |
| 2567 | 2576 | .for_simple, |
| 2568 | 2577 | .@"for", => _ = try forExpr(gz, scope, .{ .rl = .none }, inner_node, tree.fullFor(inner_node).?, true), |
| 2569 | 2578 | |
| 2579 | // These cases are here to allow branch hints. | |
| 2580 | .builtin_call_two, .builtin_call_two_comma => { | |
| 2581 | try emitDbgNode(gz, inner_node); | |
| 2582 | const ri: ResultInfo = .{ .rl = .none }; | |
| 2583 | const result = if (node_data[inner_node].lhs == 0) r: { | |
| 2584 | break :r try builtinCall(gz, scope, ri, inner_node, &.{}, allow_branch_hint); | |
| 2585 | } else if (node_data[inner_node].rhs == 0) r: { | |
| 2586 | break :r try builtinCall(gz, scope, ri, inner_node, &.{node_data[inner_node].lhs}, allow_branch_hint); | |
| 2587 | } else r: { | |
| 2588 | break :r try builtinCall(gz, scope, ri, inner_node, &.{ | |
| 2589 | node_data[inner_node].lhs, | |
| 2590 | node_data[inner_node].rhs, | |
| 2591 | }, allow_branch_hint); | |
| 2592 | }; | |
| 2593 | noreturn_src_node = try addEnsureResult(gz, result, inner_node); | |
| 2594 | }, | |
| 2595 | .builtin_call, .builtin_call_comma => { | |
| 2596 | try emitDbgNode(gz, inner_node); | |
| 2597 | const ri: ResultInfo = .{ .rl = .none }; | |
| 2598 | const params = tree.extra_data[node_data[inner_node].lhs..node_data[inner_node].rhs]; | |
| 2599 | const result = try builtinCall(gz, scope, ri, inner_node, params, allow_branch_hint); | |
| 2600 | noreturn_src_node = try addEnsureResult(gz, result, inner_node); | |
| 2601 | }, | |
| 2602 | ||
| 2570 | 2603 | else => noreturn_src_node = try unusedResultExpr(gz, scope, inner_node), |
| 2571 | 2604 | // zig fmt: on |
| 2572 | 2605 | } |
| ... | ... | @@ -2827,7 +2860,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2827 | 2860 | .fence, |
| 2828 | 2861 | .set_float_mode, |
| 2829 | 2862 | .set_align_stack, |
| 2830 | .set_cold, | |
| 2863 | .branch_hint, | |
| 2831 | 2864 | => break :b true, |
| 2832 | 2865 | else => break :b false, |
| 2833 | 2866 | }, |
| ... | ... | @@ -2861,7 +2894,6 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2861 | 2894 | .ensure_result_non_error, |
| 2862 | 2895 | .ensure_err_union_payload_void, |
| 2863 | 2896 | .@"export", |
| 2864 | .export_value, | |
| 2865 | 2897 | .set_eval_branch_quota, |
| 2866 | 2898 | .atomic_store, |
| 2867 | 2899 | .store_node, |
| ... | ... | @@ -4155,7 +4187,7 @@ fn fnDecl( |
| 4155 | 4187 | assert(param_type_node != 0); |
| 4156 | 4188 | var param_gz = decl_gz.makeSubBlock(scope); |
| 4157 | 4189 | defer param_gz.unstack(); |
| 4158 | const param_type = try fullBodyExpr(&param_gz, params_scope, coerced_type_ri, param_type_node); | |
| 4190 | const param_type = try fullBodyExpr(&param_gz, params_scope, coerced_type_ri, param_type_node, .normal); | |
| 4159 | 4191 | const param_inst_expected: Zir.Inst.Index = @enumFromInt(astgen.instructions.len + 1); |
| 4160 | 4192 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 4161 | 4193 | |
| ... | ... | @@ -4277,7 +4309,7 @@ fn fnDecl( |
| 4277 | 4309 | var ret_gz = decl_gz.makeSubBlock(params_scope); |
| 4278 | 4310 | defer ret_gz.unstack(); |
| 4279 | 4311 | const ret_ref: Zir.Inst.Ref = inst: { |
| 4280 | const inst = try fullBodyExpr(&ret_gz, params_scope, coerced_type_ri, fn_proto.ast.return_type); | |
| 4312 | const inst = try fullBodyExpr(&ret_gz, params_scope, coerced_type_ri, fn_proto.ast.return_type, .normal); | |
| 4281 | 4313 | if (ret_gz.instructionsSlice().len == 0) { |
| 4282 | 4314 | // In this case we will send a len=0 body which can be encoded more efficiently. |
| 4283 | 4315 | break :inst inst; |
| ... | ... | @@ -4352,7 +4384,7 @@ fn fnDecl( |
| 4352 | 4384 | const lbrace_line = astgen.source_line - decl_gz.decl_line; |
| 4353 | 4385 | const lbrace_column = astgen.source_column; |
| 4354 | 4386 | |
| 4355 | _ = try fullBodyExpr(&fn_gz, params_scope, .{ .rl = .none }, body_node); | |
| 4387 | _ = try fullBodyExpr(&fn_gz, params_scope, .{ .rl = .none }, body_node, .allow_branch_hint); | |
| 4356 | 4388 | try checkUsed(gz, &fn_gz.base, params_scope); |
| 4357 | 4389 | |
| 4358 | 4390 | if (!fn_gz.endsWithNoReturn()) { |
| ... | ... | @@ -4553,20 +4585,20 @@ fn globalVarDecl( |
| 4553 | 4585 | |
| 4554 | 4586 | var align_gz = block_scope.makeSubBlock(scope); |
| 4555 | 4587 | if (var_decl.ast.align_node != 0) { |
| 4556 | const align_inst = try fullBodyExpr(&align_gz, &align_gz.base, coerced_align_ri, var_decl.ast.align_node); | |
| 4588 | const align_inst = try fullBodyExpr(&align_gz, &align_gz.base, coerced_align_ri, var_decl.ast.align_node, .normal); | |
| 4557 | 4589 | _ = try align_gz.addBreakWithSrcNode(.break_inline, decl_inst, align_inst, node); |
| 4558 | 4590 | } |
| 4559 | 4591 | |
| 4560 | 4592 | var linksection_gz = align_gz.makeSubBlock(scope); |
| 4561 | 4593 | if (var_decl.ast.section_node != 0) { |
| 4562 | const linksection_inst = try fullBodyExpr(&linksection_gz, &linksection_gz.base, coerced_linksection_ri, var_decl.ast.section_node); | |
| 4594 | const linksection_inst = try fullBodyExpr(&linksection_gz, &linksection_gz.base, coerced_linksection_ri, var_decl.ast.section_node, .normal); | |
| 4563 | 4595 | _ = try linksection_gz.addBreakWithSrcNode(.break_inline, decl_inst, linksection_inst, node); |
| 4564 | 4596 | } |
| 4565 | 4597 | |
| 4566 | 4598 | var addrspace_gz = linksection_gz.makeSubBlock(scope); |
| 4567 | 4599 | if (var_decl.ast.addrspace_node != 0) { |
| 4568 | 4600 | const addrspace_ty = try addrspace_gz.addBuiltinValue(var_decl.ast.addrspace_node, .address_space); |
| 4569 | const addrspace_inst = try fullBodyExpr(&addrspace_gz, &addrspace_gz.base, .{ .rl = .{ .coerced_ty = addrspace_ty } }, var_decl.ast.addrspace_node); | |
| 4601 | const addrspace_inst = try fullBodyExpr(&addrspace_gz, &addrspace_gz.base, .{ .rl = .{ .coerced_ty = addrspace_ty } }, var_decl.ast.addrspace_node, .normal); | |
| 4570 | 4602 | _ = try addrspace_gz.addBreakWithSrcNode(.break_inline, decl_inst, addrspace_inst, node); |
| 4571 | 4603 | } |
| 4572 | 4604 | |
| ... | ... | @@ -4623,7 +4655,7 @@ fn comptimeDecl( |
| 4623 | 4655 | }; |
| 4624 | 4656 | defer decl_block.unstack(); |
| 4625 | 4657 | |
| 4626 | const block_result = try fullBodyExpr(&decl_block, &decl_block.base, .{ .rl = .none }, body_node); | |
| 4658 | const block_result = try fullBodyExpr(&decl_block, &decl_block.base, .{ .rl = .none }, body_node, .normal); | |
| 4627 | 4659 | if (decl_block.isEmpty() or !decl_block.refIsNoReturn(block_result)) { |
| 4628 | 4660 | _ = try decl_block.addBreak(.break_inline, decl_inst, .void_value); |
| 4629 | 4661 | } |
| ... | ... | @@ -4844,7 +4876,7 @@ fn testDecl( |
| 4844 | 4876 | const lbrace_line = astgen.source_line - decl_block.decl_line; |
| 4845 | 4877 | const lbrace_column = astgen.source_column; |
| 4846 | 4878 | |
| 4847 | const block_result = try fullBodyExpr(&fn_block, &fn_block.base, .{ .rl = .none }, body_node); | |
| 4879 | const block_result = try fullBodyExpr(&fn_block, &fn_block.base, .{ .rl = .none }, body_node, .normal); | |
| 4848 | 4880 | if (fn_block.isEmpty() or !fn_block.refIsNoReturn(block_result)) { |
| 4849 | 4881 | |
| 4850 | 4882 | // As our last action before the return, "pop" the error trace if needed |
| ... | ... | @@ -6113,7 +6145,7 @@ fn orelseCatchExpr( |
| 6113 | 6145 | break :blk &err_val_scope.base; |
| 6114 | 6146 | }; |
| 6115 | 6147 | |
| 6116 | const else_result = try fullBodyExpr(&else_scope, else_sub_scope, block_scope.break_result_info, rhs); | |
| 6148 | const else_result = try fullBodyExpr(&else_scope, else_sub_scope, block_scope.break_result_info, rhs, .allow_branch_hint); | |
| 6117 | 6149 | if (!else_scope.endsWithNoReturn()) { |
| 6118 | 6150 | // As our last action before the break, "pop" the error trace if needed |
| 6119 | 6151 | if (do_err_trace) |
| ... | ... | @@ -6281,7 +6313,7 @@ fn boolBinOp( |
| 6281 | 6313 | |
| 6282 | 6314 | var rhs_scope = gz.makeSubBlock(scope); |
| 6283 | 6315 | defer rhs_scope.unstack(); |
| 6284 | const rhs = try fullBodyExpr(&rhs_scope, &rhs_scope.base, coerced_bool_ri, node_datas[node].rhs); | |
| 6316 | const rhs = try fullBodyExpr(&rhs_scope, &rhs_scope.base, coerced_bool_ri, node_datas[node].rhs, .allow_branch_hint); | |
| 6285 | 6317 | if (!gz.refIsNoReturn(rhs)) { |
| 6286 | 6318 | _ = try rhs_scope.addBreakWithSrcNode(.break_inline, bool_br, rhs, node_datas[node].rhs); |
| 6287 | 6319 | } |
| ... | ... | @@ -6425,7 +6457,7 @@ fn ifExpr( |
| 6425 | 6457 | } |
| 6426 | 6458 | }; |
| 6427 | 6459 | |
| 6428 | const then_result = try fullBodyExpr(&then_scope, then_sub_scope, block_scope.break_result_info, then_node); | |
| 6460 | const then_result = try fullBodyExpr(&then_scope, then_sub_scope, block_scope.break_result_info, then_node, .allow_branch_hint); | |
| 6429 | 6461 | try checkUsed(parent_gz, &then_scope.base, then_sub_scope); |
| 6430 | 6462 | if (!then_scope.endsWithNoReturn()) { |
| 6431 | 6463 | _ = try then_scope.addBreakWithSrcNode(.@"break", block, then_result, then_node); |
| ... | ... | @@ -6467,7 +6499,7 @@ fn ifExpr( |
| 6467 | 6499 | break :s &else_scope.base; |
| 6468 | 6500 | } |
| 6469 | 6501 | }; |
| 6470 | const else_result = try fullBodyExpr(&else_scope, sub_scope, block_scope.break_result_info, else_node); | |
| 6502 | const else_result = try fullBodyExpr(&else_scope, sub_scope, block_scope.break_result_info, else_node, .allow_branch_hint); | |
| 6471 | 6503 | if (!else_scope.endsWithNoReturn()) { |
| 6472 | 6504 | // As our last action before the break, "pop" the error trace if needed |
| 6473 | 6505 | if (do_err_trace) |
| ... | ... | @@ -6576,7 +6608,7 @@ fn whileExpr( |
| 6576 | 6608 | } = c: { |
| 6577 | 6609 | if (while_full.error_token) |_| { |
| 6578 | 6610 | const cond_ri: ResultInfo = .{ .rl = if (payload_is_ref) .ref else .none }; |
| 6579 | const err_union = try fullBodyExpr(&cond_scope, &cond_scope.base, cond_ri, while_full.ast.cond_expr); | |
| 6611 | const err_union = try fullBodyExpr(&cond_scope, &cond_scope.base, cond_ri, while_full.ast.cond_expr, .normal); | |
| 6580 | 6612 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_err_ptr else .is_non_err; |
| 6581 | 6613 | break :c .{ |
| 6582 | 6614 | .inst = err_union, |
| ... | ... | @@ -6584,14 +6616,14 @@ fn whileExpr( |
| 6584 | 6616 | }; |
| 6585 | 6617 | } else if (while_full.payload_token) |_| { |
| 6586 | 6618 | const cond_ri: ResultInfo = .{ .rl = if (payload_is_ref) .ref else .none }; |
| 6587 | const optional = try fullBodyExpr(&cond_scope, &cond_scope.base, cond_ri, while_full.ast.cond_expr); | |
| 6619 | const optional = try fullBodyExpr(&cond_scope, &cond_scope.base, cond_ri, while_full.ast.cond_expr, .normal); | |
| 6588 | 6620 | const tag: Zir.Inst.Tag = if (payload_is_ref) .is_non_null_ptr else .is_non_null; |
| 6589 | 6621 | break :c .{ |
| 6590 | 6622 | .inst = optional, |
| 6591 | 6623 | .bool_bit = try cond_scope.addUnNode(tag, optional, while_full.ast.cond_expr), |
| 6592 | 6624 | }; |
| 6593 | 6625 | } else { |
| 6594 | const cond = try fullBodyExpr(&cond_scope, &cond_scope.base, coerced_bool_ri, while_full.ast.cond_expr); | |
| 6626 | const cond = try fullBodyExpr(&cond_scope, &cond_scope.base, coerced_bool_ri, while_full.ast.cond_expr, .normal); | |
| 6595 | 6627 | break :c .{ |
| 6596 | 6628 | .inst = cond, |
| 6597 | 6629 | .bool_bit = cond, |
| ... | ... | @@ -6716,7 +6748,7 @@ fn whileExpr( |
| 6716 | 6748 | continue_scope.instructions_top = continue_scope.instructions.items.len; |
| 6717 | 6749 | { |
| 6718 | 6750 | try emitDbgNode(&continue_scope, then_node); |
| 6719 | const unused_result = try fullBodyExpr(&continue_scope, &continue_scope.base, .{ .rl = .none }, then_node); | |
| 6751 | const unused_result = try fullBodyExpr(&continue_scope, &continue_scope.base, .{ .rl = .none }, then_node, .allow_branch_hint); | |
| 6720 | 6752 | _ = try addEnsureResult(&continue_scope, unused_result, then_node); |
| 6721 | 6753 | } |
| 6722 | 6754 | try checkUsed(parent_gz, &then_scope.base, then_sub_scope); |
| ... | ... | @@ -6762,7 +6794,7 @@ fn whileExpr( |
| 6762 | 6794 | // control flow apply to outer loops; not this one. |
| 6763 | 6795 | loop_scope.continue_block = .none; |
| 6764 | 6796 | loop_scope.break_block = .none; |
| 6765 | const else_result = try fullBodyExpr(&else_scope, sub_scope, loop_scope.break_result_info, else_node); | |
| 6797 | const else_result = try fullBodyExpr(&else_scope, sub_scope, loop_scope.break_result_info, else_node, .allow_branch_hint); | |
| 6766 | 6798 | if (is_statement) { |
| 6767 | 6799 | _ = try addEnsureResult(&else_scope, else_result, else_node); |
| 6768 | 6800 | } |
| ... | ... | @@ -7030,7 +7062,7 @@ fn forExpr( |
| 7030 | 7062 | break :blk capture_sub_scope; |
| 7031 | 7063 | }; |
| 7032 | 7064 | |
| 7033 | const then_result = try fullBodyExpr(&then_scope, then_sub_scope, .{ .rl = .none }, then_node); | |
| 7065 | const then_result = try fullBodyExpr(&then_scope, then_sub_scope, .{ .rl = .none }, then_node, .allow_branch_hint); | |
| 7034 | 7066 | _ = try addEnsureResult(&then_scope, then_result, then_node); |
| 7035 | 7067 | |
| 7036 | 7068 | try checkUsed(parent_gz, &then_scope.base, then_sub_scope); |
| ... | ... | @@ -7049,7 +7081,7 @@ fn forExpr( |
| 7049 | 7081 | // control flow apply to outer loops; not this one. |
| 7050 | 7082 | loop_scope.continue_block = .none; |
| 7051 | 7083 | loop_scope.break_block = .none; |
| 7052 | const else_result = try fullBodyExpr(&else_scope, sub_scope, loop_scope.break_result_info, else_node); | |
| 7084 | const else_result = try fullBodyExpr(&else_scope, sub_scope, loop_scope.break_result_info, else_node, .allow_branch_hint); | |
| 7053 | 7085 | if (is_statement) { |
| 7054 | 7086 | _ = try addEnsureResult(&else_scope, else_result, else_node); |
| 7055 | 7087 | } |
| ... | ... | @@ -7526,7 +7558,7 @@ fn switchExprErrUnion( |
| 7526 | 7558 | } |
| 7527 | 7559 | |
| 7528 | 7560 | const target_expr_node = case.ast.target_expr; |
| 7529 | const case_result = try fullBodyExpr(&case_scope, sub_scope, block_scope.break_result_info, target_expr_node); | |
| 7561 | const case_result = try fullBodyExpr(&case_scope, sub_scope, block_scope.break_result_info, target_expr_node, .allow_branch_hint); | |
| 7530 | 7562 | // check capture_scope, not err_scope to avoid false positive unused error capture |
| 7531 | 7563 | try checkUsed(parent_gz, &case_scope.base, err_scope.parent); |
| 7532 | 7564 | const uses_err = err_scope.used != 0 or err_scope.discarded != 0; |
| ... | ... | @@ -7987,7 +8019,7 @@ fn switchExpr( |
| 7987 | 8019 | try case_scope.addDbgVar(.dbg_var_val, dbg_var_tag_name, dbg_var_tag_inst); |
| 7988 | 8020 | } |
| 7989 | 8021 | const target_expr_node = case.ast.target_expr; |
| 7990 | const case_result = try fullBodyExpr(&case_scope, sub_scope, block_scope.break_result_info, target_expr_node); | |
| 8022 | const case_result = try fullBodyExpr(&case_scope, sub_scope, block_scope.break_result_info, target_expr_node, .allow_branch_hint); | |
| 7991 | 8023 | try checkUsed(parent_gz, &case_scope.base, sub_scope); |
| 7992 | 8024 | if (!parent_gz.refIsNoReturn(case_result)) { |
| 7993 | 8025 | _ = try case_scope.addBreakWithSrcNode(.@"break", switch_block, case_result, target_expr_node); |
| ... | ... | @@ -9155,6 +9187,7 @@ fn builtinCall( |
| 9155 | 9187 | ri: ResultInfo, |
| 9156 | 9188 | node: Ast.Node.Index, |
| 9157 | 9189 | params: []const Ast.Node.Index, |
| 9190 | allow_branch_hint: bool, | |
| 9158 | 9191 | ) InnerError!Zir.Inst.Ref { |
| 9159 | 9192 | const astgen = gz.astgen; |
| 9160 | 9193 | const tree = astgen.tree; |
| ... | ... | @@ -9188,6 +9221,18 @@ fn builtinCall( |
| 9188 | 9221 | return astgen.failNode(node, "'{s}' outside function scope", .{builtin_name}); |
| 9189 | 9222 | |
| 9190 | 9223 | switch (info.tag) { |
| 9224 | .branch_hint => { | |
| 9225 | if (!allow_branch_hint) { | |
| 9226 | return astgen.failNode(node, "'@branchHint' must appear as the first statement in a function or conditional branch", .{}); | |
| 9227 | } | |
| 9228 | const hint_ty = try gz.addBuiltinValue(node, .branch_hint); | |
| 9229 | const hint_val = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = hint_ty } }, params[0]); | |
| 9230 | _ = try gz.addExtendedPayload(.branch_hint, Zir.Inst.UnNode{ | |
| 9231 | .node = gz.nodeIndexToRelative(node), | |
| 9232 | .operand = hint_val, | |
| 9233 | }); | |
| 9234 | return rvalue(gz, ri, .void_value, node); | |
| 9235 | }, | |
| 9191 | 9236 | .import => { |
| 9192 | 9237 | const node_tags = tree.nodes.items(.tag); |
| 9193 | 9238 | const operand_node = params[0]; |
| ... | ... | @@ -9249,87 +9294,11 @@ fn builtinCall( |
| 9249 | 9294 | // zig fmt: on |
| 9250 | 9295 | |
| 9251 | 9296 | .@"export" => { |
| 9297 | const exported = try expr(gz, scope, .{ .rl = .none }, params[0]); | |
| 9252 | 9298 | const export_options_ty = try gz.addBuiltinValue(node, .export_options); |
| 9253 | const node_tags = tree.nodes.items(.tag); | |
| 9254 | const node_datas = tree.nodes.items(.data); | |
| 9255 | // This function causes a Decl to be exported. The first parameter is not an expression, | |
| 9256 | // but an identifier of the Decl to be exported. | |
| 9257 | var namespace: Zir.Inst.Ref = .none; | |
| 9258 | var decl_name: Zir.NullTerminatedString = .empty; | |
| 9259 | switch (node_tags[params[0]]) { | |
| 9260 | .identifier => { | |
| 9261 | const ident_token = main_tokens[params[0]]; | |
| 9262 | if (isPrimitive(tree.tokenSlice(ident_token))) { | |
| 9263 | return astgen.failTok(ident_token, "unable to export primitive value", .{}); | |
| 9264 | } | |
| 9265 | decl_name = try astgen.identAsString(ident_token); | |
| 9266 | ||
| 9267 | var s = scope; | |
| 9268 | var found_already: ?Ast.Node.Index = null; // we have found a decl with the same name already | |
| 9269 | while (true) switch (s.tag) { | |
| 9270 | .local_val => { | |
| 9271 | const local_val = s.cast(Scope.LocalVal).?; | |
| 9272 | if (local_val.name == decl_name) { | |
| 9273 | local_val.used = ident_token; | |
| 9274 | _ = try gz.addPlNode(.export_value, node, Zir.Inst.ExportValue{ | |
| 9275 | .operand = local_val.inst, | |
| 9276 | .options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = export_options_ty } }, params[1]), | |
| 9277 | }); | |
| 9278 | return rvalue(gz, ri, .void_value, node); | |
| 9279 | } | |
| 9280 | s = local_val.parent; | |
| 9281 | }, | |
| 9282 | .local_ptr => { | |
| 9283 | const local_ptr = s.cast(Scope.LocalPtr).?; | |
| 9284 | if (local_ptr.name == decl_name) { | |
| 9285 | if (!local_ptr.maybe_comptime) | |
| 9286 | return astgen.failNode(params[0], "unable to export runtime-known value", .{}); | |
| 9287 | local_ptr.used = ident_token; | |
| 9288 | const loaded = try gz.addUnNode(.load, local_ptr.ptr, node); | |
| 9289 | _ = try gz.addPlNode(.export_value, node, Zir.Inst.ExportValue{ | |
| 9290 | .operand = loaded, | |
| 9291 | .options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = export_options_ty } }, params[1]), | |
| 9292 | }); | |
| 9293 | return rvalue(gz, ri, .void_value, node); | |
| 9294 | } | |
| 9295 | s = local_ptr.parent; | |
| 9296 | }, | |
| 9297 | .gen_zir => s = s.cast(GenZir).?.parent, | |
| 9298 | .defer_normal, .defer_error => s = s.cast(Scope.Defer).?.parent, | |
| 9299 | .namespace => { | |
| 9300 | const ns = s.cast(Scope.Namespace).?; | |
| 9301 | if (ns.decls.get(decl_name)) |i| { | |
| 9302 | if (found_already) |f| { | |
| 9303 | return astgen.failNodeNotes(node, "ambiguous reference", .{}, &.{ | |
| 9304 | try astgen.errNoteNode(f, "declared here", .{}), | |
| 9305 | try astgen.errNoteNode(i, "also declared here", .{}), | |
| 9306 | }); | |
| 9307 | } | |
| 9308 | // We found a match but must continue looking for ambiguous references to decls. | |
| 9309 | found_already = i; | |
| 9310 | } | |
| 9311 | s = ns.parent; | |
| 9312 | }, | |
| 9313 | .top => break, | |
| 9314 | }; | |
| 9315 | if (found_already == null) { | |
| 9316 | const ident_name = try astgen.identifierTokenString(ident_token); | |
| 9317 | return astgen.failNode(params[0], "use of undeclared identifier '{s}'", .{ident_name}); | |
| 9318 | } | |
| 9319 | }, | |
| 9320 | .field_access => { | |
| 9321 | const namespace_node = node_datas[params[0]].lhs; | |
| 9322 | namespace = try typeExpr(gz, scope, namespace_node); | |
| 9323 | const dot_token = main_tokens[params[0]]; | |
| 9324 | const field_ident = dot_token + 1; | |
| 9325 | decl_name = try astgen.identAsString(field_ident); | |
| 9326 | }, | |
| 9327 | else => return astgen.failNode(params[0], "symbol to export must identify a declaration", .{}), | |
| 9328 | } | |
| 9329 | 9299 | const options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = export_options_ty } }, params[1]); |
| 9330 | 9300 | _ = try gz.addPlNode(.@"export", node, Zir.Inst.Export{ |
| 9331 | .namespace = namespace, | |
| 9332 | .decl_name = decl_name, | |
| 9301 | .exported = exported, | |
| 9333 | 9302 | .options = options, |
| 9334 | 9303 | }); |
| 9335 | 9304 | return rvalue(gz, ri, .void_value, node); |
| ... | ... | @@ -9371,14 +9340,6 @@ fn builtinCall( |
| 9371 | 9340 | }); |
| 9372 | 9341 | return rvalue(gz, ri, .void_value, node); |
| 9373 | 9342 | }, |
| 9374 | .set_cold => { | |
| 9375 | const order = try expr(gz, scope, ri, params[0]); | |
| 9376 | _ = try gz.addExtendedPayload(.set_cold, Zir.Inst.UnNode{ | |
| 9377 | .node = gz.nodeIndexToRelative(node), | |
| 9378 | .operand = order, | |
| 9379 | }); | |
| 9380 | return rvalue(gz, ri, .void_value, node); | |
| 9381 | }, | |
| 9382 | 9343 | |
| 9383 | 9344 | .src => { |
| 9384 | 9345 | // Incorporate the source location into the source hash, so that |
| ... | ... | @@ -10040,7 +10001,7 @@ fn cImport( |
| 10040 | 10001 | defer block_scope.unstack(); |
| 10041 | 10002 | |
| 10042 | 10003 | const block_inst = try gz.makeBlockInst(.c_import, node); |
| 10043 | const block_result = try fullBodyExpr(&block_scope, &block_scope.base, .{ .rl = .none }, body_node); | |
| 10004 | const block_result = try fullBodyExpr(&block_scope, &block_scope.base, .{ .rl = .none }, body_node, .normal); | |
| 10044 | 10005 | _ = try gz.addUnNode(.ensure_result_used, block_result, node); |
| 10045 | 10006 | if (!gz.refIsNoReturn(block_result)) { |
| 10046 | 10007 | _ = try block_scope.addBreak(.break_inline, block_inst, .void_value); |
| ... | ... | @@ -10123,7 +10084,7 @@ fn callExpr( |
| 10123 | 10084 | defer arg_block.unstack(); |
| 10124 | 10085 | |
| 10125 | 10086 | // `call_inst` is reused to provide the param type. |
| 10126 | const arg_ref = try fullBodyExpr(&arg_block, &arg_block.base, .{ .rl = .{ .coerced_ty = call_inst }, .ctx = .fn_arg }, param_node); | |
| 10087 | const arg_ref = try fullBodyExpr(&arg_block, &arg_block.base, .{ .rl = .{ .coerced_ty = call_inst }, .ctx = .fn_arg }, param_node, .normal); | |
| 10127 | 10088 | _ = try arg_block.addBreakWithSrcNode(.break_inline, call_index, arg_ref, param_node); |
| 10128 | 10089 | |
| 10129 | 10090 | const body = arg_block.instructionsSlice(); |
| ... | ... | @@ -11474,7 +11435,7 @@ fn appendErrorNodeNotes( |
| 11474 | 11435 | args: anytype, |
| 11475 | 11436 | notes: []const u32, |
| 11476 | 11437 | ) Allocator.Error!void { |
| 11477 | @setCold(true); | |
| 11438 | @branchHint(.cold); | |
| 11478 | 11439 | const string_bytes = &astgen.string_bytes; |
| 11479 | 11440 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); |
| 11480 | 11441 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); |
| ... | ... | @@ -11565,7 +11526,7 @@ fn appendErrorTokNotesOff( |
| 11565 | 11526 | args: anytype, |
| 11566 | 11527 | notes: []const u32, |
| 11567 | 11528 | ) !void { |
| 11568 | @setCold(true); | |
| 11529 | @branchHint(.cold); | |
| 11569 | 11530 | const gpa = astgen.gpa; |
| 11570 | 11531 | const string_bytes = &astgen.string_bytes; |
| 11571 | 11532 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); |
| ... | ... | @@ -11602,7 +11563,7 @@ fn errNoteTokOff( |
| 11602 | 11563 | comptime format: []const u8, |
| 11603 | 11564 | args: anytype, |
| 11604 | 11565 | ) Allocator.Error!u32 { |
| 11605 | @setCold(true); | |
| 11566 | @branchHint(.cold); | |
| 11606 | 11567 | const string_bytes = &astgen.string_bytes; |
| 11607 | 11568 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); |
| 11608 | 11569 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); |
| ... | ... | @@ -11621,7 +11582,7 @@ fn errNoteNode( |
| 11621 | 11582 | comptime format: []const u8, |
| 11622 | 11583 | args: anytype, |
| 11623 | 11584 | ) Allocator.Error!u32 { |
| 11624 | @setCold(true); | |
| 11585 | @branchHint(.cold); | |
| 11625 | 11586 | const string_bytes = &astgen.string_bytes; |
| 11626 | 11587 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); |
| 11627 | 11588 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); |
lib/std/zig/AstRlAnnotate.zig+4-1| ... | ... | @@ -829,6 +829,10 @@ fn builtinCall(astrl: *AstRlAnnotate, block: ?*Block, ri: ResultInfo, node: Ast. |
| 829 | 829 | } |
| 830 | 830 | switch (info.tag) { |
| 831 | 831 | .import => return false, |
| 832 | .branch_hint => { | |
| 833 | _ = try astrl.expr(args[0], block, ResultInfo.type_only); | |
| 834 | return false; | |
| 835 | }, | |
| 832 | 836 | .compile_log, .TypeOf => { |
| 833 | 837 | for (args) |arg_node| { |
| 834 | 838 | _ = try astrl.expr(arg_node, block, ResultInfo.none); |
| ... | ... | @@ -907,7 +911,6 @@ fn builtinCall(astrl: *AstRlAnnotate, block: ?*Block, ri: ResultInfo, node: Ast. |
| 907 | 911 | .fence, |
| 908 | 912 | .set_float_mode, |
| 909 | 913 | .set_align_stack, |
| 910 | .set_cold, | |
| 911 | 914 | .type_info, |
| 912 | 915 | .work_item_id, |
| 913 | 916 | .work_group_size, |
lib/std/zig/BuiltinFn.zig+9-9| ... | ... | @@ -14,6 +14,7 @@ pub const Tag = enum { |
| 14 | 14 | bit_offset_of, |
| 15 | 15 | int_from_bool, |
| 16 | 16 | bit_size_of, |
| 17 | branch_hint, | |
| 17 | 18 | breakpoint, |
| 18 | 19 | disable_instrumentation, |
| 19 | 20 | mul_add, |
| ... | ... | @@ -82,7 +83,6 @@ pub const Tag = enum { |
| 82 | 83 | return_address, |
| 83 | 84 | select, |
| 84 | 85 | set_align_stack, |
| 85 | set_cold, | |
| 86 | 86 | set_eval_branch_quota, |
| 87 | 87 | set_float_mode, |
| 88 | 88 | set_runtime_safety, |
| ... | ... | @@ -256,6 +256,14 @@ pub const list = list: { |
| 256 | 256 | .param_count = 1, |
| 257 | 257 | }, |
| 258 | 258 | }, |
| 259 | .{ | |
| 260 | "@branchHint", | |
| 261 | .{ | |
| 262 | .tag = .branch_hint, | |
| 263 | .param_count = 1, | |
| 264 | .illegal_outside_function = true, | |
| 265 | }, | |
| 266 | }, | |
| 259 | 267 | .{ |
| 260 | 268 | "@breakpoint", |
| 261 | 269 | .{ |
| ... | ... | @@ -744,14 +752,6 @@ pub const list = list: { |
| 744 | 752 | .illegal_outside_function = true, |
| 745 | 753 | }, |
| 746 | 754 | }, |
| 747 | .{ | |
| 748 | "@setCold", | |
| 749 | .{ | |
| 750 | .tag = .set_cold, | |
| 751 | .param_count = 1, | |
| 752 | .illegal_outside_function = true, | |
| 753 | }, | |
| 754 | }, | |
| 755 | 755 | .{ |
| 756 | 756 | "@setEvalBranchQuota", |
| 757 | 757 | .{ |
lib/std/zig/Parse.zig+6-6| ... | ... | @@ -81,7 +81,7 @@ fn addExtra(p: *Parse, extra: anytype) Allocator.Error!Node.Index { |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | fn warnExpected(p: *Parse, expected_token: Token.Tag) error{OutOfMemory}!void { |
| 84 | @setCold(true); | |
| 84 | @branchHint(.cold); | |
| 85 | 85 | try p.warnMsg(.{ |
| 86 | 86 | .tag = .expected_token, |
| 87 | 87 | .token = p.tok_i, |
| ... | ... | @@ -90,12 +90,12 @@ fn warnExpected(p: *Parse, expected_token: Token.Tag) error{OutOfMemory}!void { |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | fn warn(p: *Parse, error_tag: AstError.Tag) error{OutOfMemory}!void { |
| 93 | @setCold(true); | |
| 93 | @branchHint(.cold); | |
| 94 | 94 | try p.warnMsg(.{ .tag = error_tag, .token = p.tok_i }); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | fn warnMsg(p: *Parse, msg: Ast.Error) error{OutOfMemory}!void { |
| 98 | @setCold(true); | |
| 98 | @branchHint(.cold); | |
| 99 | 99 | switch (msg.tag) { |
| 100 | 100 | .expected_semi_after_decl, |
| 101 | 101 | .expected_semi_after_stmt, |
| ... | ... | @@ -141,12 +141,12 @@ fn warnMsg(p: *Parse, msg: Ast.Error) error{OutOfMemory}!void { |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | fn fail(p: *Parse, tag: Ast.Error.Tag) error{ ParseError, OutOfMemory } { |
| 144 | @setCold(true); | |
| 144 | @branchHint(.cold); | |
| 145 | 145 | return p.failMsg(.{ .tag = tag, .token = p.tok_i }); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | fn failExpected(p: *Parse, expected_token: Token.Tag) error{ ParseError, OutOfMemory } { |
| 149 | @setCold(true); | |
| 149 | @branchHint(.cold); | |
| 150 | 150 | return p.failMsg(.{ |
| 151 | 151 | .tag = .expected_token, |
| 152 | 152 | .token = p.tok_i, |
| ... | ... | @@ -155,7 +155,7 @@ fn failExpected(p: *Parse, expected_token: Token.Tag) error{ ParseError, OutOfMe |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | fn failMsg(p: *Parse, msg: Ast.Error) error{ ParseError, OutOfMemory } { |
| 158 | @setCold(true); | |
| 158 | @branchHint(.cold); | |
| 159 | 159 | try p.warnMsg(msg); |
| 160 | 160 | return error.ParseError; |
| 161 | 161 | } |
lib/std/zig/Zir.zig+9-26| ... | ... | @@ -431,14 +431,9 @@ pub const Inst = struct { |
| 431 | 431 | error_union_type, |
| 432 | 432 | /// `error.Foo` syntax. Uses the `str_tok` field of the Data union. |
| 433 | 433 | error_value, |
| 434 | /// Implements the `@export` builtin function, based on either an identifier to a Decl, | |
| 435 | /// or field access of a Decl. The thing being exported is the Decl. | |
| 434 | /// Implements the `@export` builtin function. | |
| 436 | 435 | /// Uses the `pl_node` union field. Payload is `Export`. |
| 437 | 436 | @"export", |
| 438 | /// Implements the `@export` builtin function, based on a comptime-known value. | |
| 439 | /// The thing being exported is the comptime-known value which is the operand. | |
| 440 | /// Uses the `pl_node` union field. Payload is `ExportValue`. | |
| 441 | export_value, | |
| 442 | 437 | /// Given a pointer to a struct or object that contains virtual fields, returns a pointer |
| 443 | 438 | /// to the named field. The field name is stored in string_bytes. Used by a.b syntax. |
| 444 | 439 | /// Uses `pl_node` field. The AST node is the a.b syntax. Payload is Field. |
| ... | ... | @@ -1093,7 +1088,6 @@ pub const Inst = struct { |
| 1093 | 1088 | .ensure_result_non_error, |
| 1094 | 1089 | .ensure_err_union_payload_void, |
| 1095 | 1090 | .@"export", |
| 1096 | .export_value, | |
| 1097 | 1091 | .field_ptr, |
| 1098 | 1092 | .field_val, |
| 1099 | 1093 | .field_ptr_named, |
| ... | ... | @@ -1314,7 +1308,6 @@ pub const Inst = struct { |
| 1314 | 1308 | .validate_deref, |
| 1315 | 1309 | .validate_destructure, |
| 1316 | 1310 | .@"export", |
| 1317 | .export_value, | |
| 1318 | 1311 | .set_runtime_safety, |
| 1319 | 1312 | .memcpy, |
| 1320 | 1313 | .memset, |
| ... | ... | @@ -1553,7 +1546,7 @@ pub const Inst = struct { |
| 1553 | 1546 | => false, |
| 1554 | 1547 | |
| 1555 | 1548 | .extended => switch (data.extended.opcode) { |
| 1556 | .fence, .set_cold, .breakpoint, .disable_instrumentation => true, | |
| 1549 | .fence, .branch_hint, .breakpoint, .disable_instrumentation => true, | |
| 1557 | 1550 | else => false, |
| 1558 | 1551 | }, |
| 1559 | 1552 | }; |
| ... | ... | @@ -1637,7 +1630,6 @@ pub const Inst = struct { |
| 1637 | 1630 | .error_union_type = .pl_node, |
| 1638 | 1631 | .error_value = .str_tok, |
| 1639 | 1632 | .@"export" = .pl_node, |
| 1640 | .export_value = .pl_node, | |
| 1641 | 1633 | .field_ptr = .pl_node, |
| 1642 | 1634 | .field_val = .pl_node, |
| 1643 | 1635 | .field_ptr_named = .pl_node, |
| ... | ... | @@ -1962,9 +1954,6 @@ pub const Inst = struct { |
| 1962 | 1954 | /// Implement builtin `@setAlignStack`. |
| 1963 | 1955 | /// `operand` is payload index to `UnNode`. |
| 1964 | 1956 | set_align_stack, |
| 1965 | /// Implements `@setCold`. | |
| 1966 | /// `operand` is payload index to `UnNode`. | |
| 1967 | set_cold, | |
| 1968 | 1957 | /// Implements the `@errorCast` builtin. |
| 1969 | 1958 | /// `operand` is payload index to `BinNode`. `lhs` is dest type, `rhs` is operand. |
| 1970 | 1959 | error_cast, |
| ... | ... | @@ -2059,6 +2048,10 @@ pub const Inst = struct { |
| 2059 | 2048 | /// `operand` is `src_node: i32`. |
| 2060 | 2049 | /// `small` is an `Inst.BuiltinValue`. |
| 2061 | 2050 | builtin_value, |
| 2051 | /// Provide a `@branchHint` for the current block. | |
| 2052 | /// `operand` is payload index to `UnNode`. | |
| 2053 | /// `small` is unused. | |
| 2054 | branch_hint, | |
| 2062 | 2055 | |
| 2063 | 2056 | pub const InstData = struct { |
| 2064 | 2057 | opcode: Extended, |
| ... | ... | @@ -3150,6 +3143,7 @@ pub const Inst = struct { |
| 3150 | 3143 | export_options, |
| 3151 | 3144 | extern_options, |
| 3152 | 3145 | type_info, |
| 3146 | branch_hint, | |
| 3153 | 3147 | // Values |
| 3154 | 3148 | calling_convention_c, |
| 3155 | 3149 | calling_convention_inline, |
| ... | ... | @@ -3425,17 +3419,7 @@ pub const Inst = struct { |
| 3425 | 3419 | }; |
| 3426 | 3420 | |
| 3427 | 3421 | pub const Export = struct { |
| 3428 | /// If present, this is referring to a Decl via field access, e.g. `a.b`. | |
| 3429 | /// If omitted, this is referring to a Decl via identifier, e.g. `a`. | |
| 3430 | namespace: Ref, | |
| 3431 | /// Null-terminated string index. | |
| 3432 | decl_name: NullTerminatedString, | |
| 3433 | options: Ref, | |
| 3434 | }; | |
| 3435 | ||
| 3436 | pub const ExportValue = struct { | |
| 3437 | /// The comptime value to export. | |
| 3438 | operand: Ref, | |
| 3422 | exported: Ref, | |
| 3439 | 3423 | options: Ref, |
| 3440 | 3424 | }; |
| 3441 | 3425 | |
| ... | ... | @@ -3793,7 +3777,6 @@ fn findDeclsInner( |
| 3793 | 3777 | .error_union_type, |
| 3794 | 3778 | .error_value, |
| 3795 | 3779 | .@"export", |
| 3796 | .export_value, | |
| 3797 | 3780 | .field_ptr, |
| 3798 | 3781 | .field_val, |
| 3799 | 3782 | .field_ptr_named, |
| ... | ... | @@ -3981,7 +3964,6 @@ fn findDeclsInner( |
| 3981 | 3964 | .fence, |
| 3982 | 3965 | .set_float_mode, |
| 3983 | 3966 | .set_align_stack, |
| 3984 | .set_cold, | |
| 3985 | 3967 | .error_cast, |
| 3986 | 3968 | .await_nosuspend, |
| 3987 | 3969 | .breakpoint, |
| ... | ... | @@ -4005,6 +3987,7 @@ fn findDeclsInner( |
| 4005 | 3987 | .closure_get, |
| 4006 | 3988 | .field_parent_ptr, |
| 4007 | 3989 | .builtin_value, |
| 3990 | .branch_hint, | |
| 4008 | 3991 | => return, |
| 4009 | 3992 | |
| 4010 | 3993 | // `@TypeOf` has a body. |
src/Air.zig+109-6| ... | ... | @@ -433,13 +433,18 @@ pub const Inst = struct { |
| 433 | 433 | /// In the case of non-error, control flow proceeds to the next instruction |
| 434 | 434 | /// after the `try`, with the result of this instruction being the unwrapped |
| 435 | 435 | /// payload value, as if `unwrap_errunion_payload` was executed on the operand. |
| 436 | /// The error branch is considered to have a branch hint of `.unlikely`. | |
| 436 | 437 | /// Uses the `pl_op` field. Payload is `Try`. |
| 437 | 438 | @"try", |
| 439 | /// Same as `try` except the error branch hint is `.cold`. | |
| 440 | try_cold, | |
| 438 | 441 | /// Same as `try` except the operand is a pointer to an error union, and the |
| 439 | 442 | /// result is a pointer to the payload. Result is as if `unwrap_errunion_payload_ptr` |
| 440 | 443 | /// was executed on the operand. |
| 441 | 444 | /// Uses the `ty_pl` field. Payload is `TryPtr`. |
| 442 | 445 | try_ptr, |
| 446 | /// Same as `try_ptr` except the error branch hint is `.cold`. | |
| 447 | try_ptr_cold, | |
| 443 | 448 | /// Notes the beginning of a source code statement and marks the line and column. |
| 444 | 449 | /// Result type is always void. |
| 445 | 450 | /// Uses the `dbg_stmt` field. |
| ... | ... | @@ -1116,11 +1121,20 @@ pub const Call = struct { |
| 1116 | 1121 | pub const CondBr = struct { |
| 1117 | 1122 | then_body_len: u32, |
| 1118 | 1123 | else_body_len: u32, |
| 1124 | branch_hints: BranchHints, | |
| 1125 | pub const BranchHints = packed struct(u32) { | |
| 1126 | true: std.builtin.BranchHint, | |
| 1127 | false: std.builtin.BranchHint, | |
| 1128 | _: u26 = 0, | |
| 1129 | }; | |
| 1119 | 1130 | }; |
| 1120 | 1131 | |
| 1121 | 1132 | /// Trailing: |
| 1122 | /// * 0. `Case` for each `cases_len` | |
| 1123 | /// * 1. the else body, according to `else_body_len`. | |
| 1133 | /// * 0. `BranchHint` for each `cases_len + 1`. bit-packed into `u32` | |
| 1134 | /// elems such that each `u32` contains up to 10x `BranchHint`. | |
| 1135 | /// LSBs are first case. Final hint is `else`. | |
| 1136 | /// * 1. `Case` for each `cases_len` | |
| 1137 | /// * 2. the else body, according to `else_body_len`. | |
| 1124 | 1138 | pub const SwitchBr = struct { |
| 1125 | 1139 | cases_len: u32, |
| 1126 | 1140 | else_body_len: u32, |
| ... | ... | @@ -1380,6 +1394,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1380 | 1394 | .ptr_add, |
| 1381 | 1395 | .ptr_sub, |
| 1382 | 1396 | .try_ptr, |
| 1397 | .try_ptr_cold, | |
| 1383 | 1398 | => return datas[@intFromEnum(inst)].ty_pl.ty.toType(), |
| 1384 | 1399 | |
| 1385 | 1400 | .not, |
| ... | ... | @@ -1500,7 +1515,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1500 | 1515 | return air.typeOf(extra.lhs, ip); |
| 1501 | 1516 | }, |
| 1502 | 1517 | |
| 1503 | .@"try" => { | |
| 1518 | .@"try", .try_cold => { | |
| 1504 | 1519 | const err_union_ty = air.typeOf(datas[@intFromEnum(inst)].pl_op.operand, ip); |
| 1505 | 1520 | return Type.fromInterned(ip.indexToKey(err_union_ty.ip_index).error_union_type.payload_type); |
| 1506 | 1521 | }, |
| ... | ... | @@ -1524,9 +1539,8 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end |
| 1524 | 1539 | inline for (fields) |field| { |
| 1525 | 1540 | @field(result, field.name) = switch (field.type) { |
| 1526 | 1541 | u32 => air.extra[i], |
| 1527 | Inst.Ref => @as(Inst.Ref, @enumFromInt(air.extra[i])), | |
| 1528 | i32 => @as(i32, @bitCast(air.extra[i])), | |
| 1529 | InternPool.Index => @as(InternPool.Index, @enumFromInt(air.extra[i])), | |
| 1542 | InternPool.Index, Inst.Ref => @enumFromInt(air.extra[i]), | |
| 1543 | i32, CondBr.BranchHints => @bitCast(air.extra[i]), | |
| 1530 | 1544 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 1531 | 1545 | }; |
| 1532 | 1546 | i += 1; |
| ... | ... | @@ -1593,7 +1607,9 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool { |
| 1593 | 1607 | .cond_br, |
| 1594 | 1608 | .switch_br, |
| 1595 | 1609 | .@"try", |
| 1610 | .try_cold, | |
| 1596 | 1611 | .try_ptr, |
| 1612 | .try_ptr_cold, | |
| 1597 | 1613 | .dbg_stmt, |
| 1598 | 1614 | .dbg_inline_block, |
| 1599 | 1615 | .dbg_var_ptr, |
| ... | ... | @@ -1796,4 +1812,91 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool { |
| 1796 | 1812 | }; |
| 1797 | 1813 | } |
| 1798 | 1814 | |
| 1815 | pub const UnwrappedSwitch = struct { | |
| 1816 | air: *const Air, | |
| 1817 | operand: Inst.Ref, | |
| 1818 | cases_len: u32, | |
| 1819 | else_body_len: u32, | |
| 1820 | branch_hints_start: u32, | |
| 1821 | cases_start: u32, | |
| 1822 | ||
| 1823 | /// Asserts that `case_idx < us.cases_len`. | |
| 1824 | pub fn getHint(us: UnwrappedSwitch, case_idx: u32) std.builtin.BranchHint { | |
| 1825 | assert(case_idx < us.cases_len); | |
| 1826 | return us.getHintInner(case_idx); | |
| 1827 | } | |
| 1828 | pub fn getElseHint(us: UnwrappedSwitch) std.builtin.BranchHint { | |
| 1829 | return us.getHintInner(us.cases_len); | |
| 1830 | } | |
| 1831 | fn getHintInner(us: UnwrappedSwitch, idx: u32) std.builtin.BranchHint { | |
| 1832 | const bag = us.air.extra[us.branch_hints_start..][idx / 10]; | |
| 1833 | const bits: u3 = @truncate(bag >> @intCast(3 * (idx % 10))); | |
| 1834 | return @enumFromInt(bits); | |
| 1835 | } | |
| 1836 | ||
| 1837 | pub fn iterateCases(us: UnwrappedSwitch) CaseIterator { | |
| 1838 | return .{ | |
| 1839 | .air = us.air, | |
| 1840 | .cases_len = us.cases_len, | |
| 1841 | .else_body_len = us.else_body_len, | |
| 1842 | .next_case = 0, | |
| 1843 | .extra_index = us.cases_start, | |
| 1844 | }; | |
| 1845 | } | |
| 1846 | pub const CaseIterator = struct { | |
| 1847 | air: *const Air, | |
| 1848 | cases_len: u32, | |
| 1849 | else_body_len: u32, | |
| 1850 | next_case: u32, | |
| 1851 | extra_index: u32, | |
| 1852 | ||
| 1853 | pub fn next(it: *CaseIterator) ?Case { | |
| 1854 | if (it.next_case == it.cases_len) return null; | |
| 1855 | const idx = it.next_case; | |
| 1856 | it.next_case += 1; | |
| 1857 | ||
| 1858 | const extra = it.air.extraData(SwitchBr.Case, it.extra_index); | |
| 1859 | var extra_index = extra.end; | |
| 1860 | const items: []const Inst.Ref = @ptrCast(it.air.extra[extra_index..][0..extra.data.items_len]); | |
| 1861 | extra_index += items.len; | |
| 1862 | const body: []const Inst.Index = @ptrCast(it.air.extra[extra_index..][0..extra.data.body_len]); | |
| 1863 | extra_index += body.len; | |
| 1864 | it.extra_index = @intCast(extra_index); | |
| 1865 | ||
| 1866 | return .{ | |
| 1867 | .idx = idx, | |
| 1868 | .items = items, | |
| 1869 | .body = body, | |
| 1870 | }; | |
| 1871 | } | |
| 1872 | /// Only valid to call once all cases have been iterated, i.e. `next` returns `null`. | |
| 1873 | /// Returns the body of the "default" (`else`) case. | |
| 1874 | pub fn elseBody(it: *CaseIterator) []const Inst.Index { | |
| 1875 | assert(it.next_case == it.cases_len); | |
| 1876 | return @ptrCast(it.air.extra[it.extra_index..][0..it.else_body_len]); | |
| 1877 | } | |
| 1878 | pub const Case = struct { | |
| 1879 | idx: u32, | |
| 1880 | items: []const Inst.Ref, | |
| 1881 | body: []const Inst.Index, | |
| 1882 | }; | |
| 1883 | }; | |
| 1884 | }; | |
| 1885 | ||
| 1886 | pub fn unwrapSwitch(air: *const Air, switch_inst: Inst.Index) UnwrappedSwitch { | |
| 1887 | const inst = air.instructions.get(@intFromEnum(switch_inst)); | |
| 1888 | assert(inst.tag == .switch_br); | |
| 1889 | const pl_op = inst.data.pl_op; | |
| 1890 | const extra = air.extraData(SwitchBr, pl_op.payload); | |
| 1891 | const hint_bag_count = std.math.divCeil(usize, extra.data.cases_len + 1, 10) catch unreachable; | |
| 1892 | return .{ | |
| 1893 | .air = air, | |
| 1894 | .operand = pl_op.operand, | |
| 1895 | .cases_len = extra.data.cases_len, | |
| 1896 | .else_body_len = extra.data.else_body_len, | |
| 1897 | .branch_hints_start = @intCast(extra.end), | |
| 1898 | .cases_start = @intCast(extra.end + hint_bag_count), | |
| 1899 | }; | |
| 1900 | } | |
| 1901 | ||
| 1799 | 1902 | pub const typesFullyResolved = @import("Air/types_resolved.zig").typesFullyResolved; |
src/Air/types_resolved.zig+9-22| ... | ... | @@ -344,7 +344,7 @@ fn checkBody(air: Air, body: []const Air.Inst.Index, zcu: *Zcu) bool { |
| 344 | 344 | if (!checkRef(data.pl_op.operand, zcu)) return false; |
| 345 | 345 | }, |
| 346 | 346 | |
| 347 | .@"try" => { | |
| 347 | .@"try", .try_cold => { | |
| 348 | 348 | const extra = air.extraData(Air.Try, data.pl_op.payload); |
| 349 | 349 | if (!checkRef(data.pl_op.operand, zcu)) return false; |
| 350 | 350 | if (!checkBody( |
| ... | ... | @@ -354,7 +354,7 @@ fn checkBody(air: Air, body: []const Air.Inst.Index, zcu: *Zcu) bool { |
| 354 | 354 | )) return false; |
| 355 | 355 | }, |
| 356 | 356 | |
| 357 | .try_ptr => { | |
| 357 | .try_ptr, .try_ptr_cold => { | |
| 358 | 358 | const extra = air.extraData(Air.TryPtr, data.ty_pl.payload); |
| 359 | 359 | if (!checkType(data.ty_pl.ty.toType(), zcu)) return false; |
| 360 | 360 | if (!checkRef(extra.data.ptr, zcu)) return false; |
| ... | ... | @@ -381,27 +381,14 @@ fn checkBody(air: Air, body: []const Air.Inst.Index, zcu: *Zcu) bool { |
| 381 | 381 | }, |
| 382 | 382 | |
| 383 | 383 | .switch_br => { |
| 384 | const extra = air.extraData(Air.SwitchBr, data.pl_op.payload); | |
| 385 | if (!checkRef(data.pl_op.operand, zcu)) return false; | |
| 386 | var extra_index = extra.end; | |
| 387 | for (0..extra.data.cases_len) |_| { | |
| 388 | const case = air.extraData(Air.SwitchBr.Case, extra_index); | |
| 389 | extra_index = case.end; | |
| 390 | const items: []const Air.Inst.Ref = @ptrCast(air.extra[extra_index..][0..case.data.items_len]); | |
| 391 | extra_index += case.data.items_len; | |
| 392 | for (items) |item| if (!checkRef(item, zcu)) return false; | |
| 393 | if (!checkBody( | |
| 394 | air, | |
| 395 | @ptrCast(air.extra[extra_index..][0..case.data.body_len]), | |
| 396 | zcu, | |
| 397 | )) return false; | |
| 398 | extra_index += case.data.body_len; | |
| 384 | const switch_br = air.unwrapSwitch(inst); | |
| 385 | if (!checkRef(switch_br.operand, zcu)) return false; | |
| 386 | var it = switch_br.iterateCases(); | |
| 387 | while (it.next()) |case| { | |
| 388 | for (case.items) |item| if (!checkRef(item, zcu)) return false; | |
| 389 | if (!checkBody(air, case.body, zcu)) return false; | |
| 399 | 390 | } |
| 400 | if (!checkBody( | |
| 401 | air, | |
| 402 | @ptrCast(air.extra[extra_index..][0..extra.data.else_body_len]), | |
| 403 | zcu, | |
| 404 | )) return false; | |
| 391 | if (!checkBody(air, it.elseBody(), zcu)) return false; | |
| 405 | 392 | }, |
| 406 | 393 | |
| 407 | 394 | .assembly => { |
src/Compilation.zig+4-4| ... | ... | @@ -5785,7 +5785,7 @@ fn failCObj( |
| 5785 | 5785 | comptime format: []const u8, |
| 5786 | 5786 | args: anytype, |
| 5787 | 5787 | ) SemaError { |
| 5788 | @setCold(true); | |
| 5788 | @branchHint(.cold); | |
| 5789 | 5789 | const diag_bundle = blk: { |
| 5790 | 5790 | const diag_bundle = try comp.gpa.create(CObject.Diag.Bundle); |
| 5791 | 5791 | diag_bundle.* = .{}; |
| ... | ... | @@ -5809,7 +5809,7 @@ fn failCObjWithOwnedDiagBundle( |
| 5809 | 5809 | c_object: *CObject, |
| 5810 | 5810 | diag_bundle: *CObject.Diag.Bundle, |
| 5811 | 5811 | ) SemaError { |
| 5812 | @setCold(true); | |
| 5812 | @branchHint(.cold); | |
| 5813 | 5813 | assert(diag_bundle.diags.len > 0); |
| 5814 | 5814 | { |
| 5815 | 5815 | comp.mutex.lock(); |
| ... | ... | @@ -5825,7 +5825,7 @@ fn failCObjWithOwnedDiagBundle( |
| 5825 | 5825 | } |
| 5826 | 5826 | |
| 5827 | 5827 | fn failWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, comptime format: []const u8, args: anytype) SemaError { |
| 5828 | @setCold(true); | |
| 5828 | @branchHint(.cold); | |
| 5829 | 5829 | var bundle: ErrorBundle.Wip = undefined; |
| 5830 | 5830 | try bundle.init(comp.gpa); |
| 5831 | 5831 | errdefer bundle.deinit(); |
| ... | ... | @@ -5852,7 +5852,7 @@ fn failWin32ResourceWithOwnedBundle( |
| 5852 | 5852 | win32_resource: *Win32Resource, |
| 5853 | 5853 | err_bundle: ErrorBundle, |
| 5854 | 5854 | ) SemaError { |
| 5855 | @setCold(true); | |
| 5855 | @branchHint(.cold); | |
| 5856 | 5856 | { |
| 5857 | 5857 | comp.mutex.lock(); |
| 5858 | 5858 | defer comp.mutex.unlock(); |
src/InternPool.zig+17-18| ... | ... | @@ -2121,6 +2121,17 @@ pub const Key = union(enum) { |
| 2121 | 2121 | @atomicStore(FuncAnalysis, analysis_ptr, analysis, .release); |
| 2122 | 2122 | } |
| 2123 | 2123 | |
| 2124 | pub fn setBranchHint(func: Func, ip: *InternPool, hint: std.builtin.BranchHint) void { | |
| 2125 | const extra_mutex = &ip.getLocal(func.tid).mutate.extra.mutex; | |
| 2126 | extra_mutex.lock(); | |
| 2127 | defer extra_mutex.unlock(); | |
| 2128 | ||
| 2129 | const analysis_ptr = func.analysisPtr(ip); | |
| 2130 | var analysis = analysis_ptr.*; | |
| 2131 | analysis.branch_hint = hint; | |
| 2132 | @atomicStore(FuncAnalysis, analysis_ptr, analysis, .release); | |
| 2133 | } | |
| 2134 | ||
| 2124 | 2135 | /// Returns a pointer that becomes invalid after any additions to the `InternPool`. |
| 2125 | 2136 | fn zirBodyInstPtr(func: Func, ip: *InternPool) *TrackedInst.Index { |
| 2126 | 2137 | const extra = ip.getLocalShared(func.tid).extra.acquire(); |
| ... | ... | @@ -5575,7 +5586,7 @@ pub const Tag = enum(u8) { |
| 5575 | 5586 | /// to be part of the type of the function. |
| 5576 | 5587 | pub const FuncAnalysis = packed struct(u32) { |
| 5577 | 5588 | state: State, |
| 5578 | is_cold: bool, | |
| 5589 | branch_hint: std.builtin.BranchHint, | |
| 5579 | 5590 | is_noinline: bool, |
| 5580 | 5591 | calls_or_awaits_errorable_fn: bool, |
| 5581 | 5592 | stack_alignment: Alignment, |
| ... | ... | @@ -5583,7 +5594,7 @@ pub const FuncAnalysis = packed struct(u32) { |
| 5583 | 5594 | inferred_error_set: bool, |
| 5584 | 5595 | disable_instrumentation: bool, |
| 5585 | 5596 | |
| 5586 | _: u19 = 0, | |
| 5597 | _: u17 = 0, | |
| 5587 | 5598 | |
| 5588 | 5599 | pub const State = enum(u2) { |
| 5589 | 5600 | /// The runtime function has never been referenced. |
| ... | ... | @@ -8636,7 +8647,7 @@ pub fn getFuncDecl( |
| 8636 | 8647 | const func_decl_extra_index = addExtraAssumeCapacity(extra, Tag.FuncDecl{ |
| 8637 | 8648 | .analysis = .{ |
| 8638 | 8649 | .state = .unreferenced, |
| 8639 | .is_cold = false, | |
| 8650 | .branch_hint = .none, | |
| 8640 | 8651 | .is_noinline = key.is_noinline, |
| 8641 | 8652 | .calls_or_awaits_errorable_fn = false, |
| 8642 | 8653 | .stack_alignment = .none, |
| ... | ... | @@ -8740,7 +8751,7 @@ pub fn getFuncDeclIes( |
| 8740 | 8751 | const func_decl_extra_index = addExtraAssumeCapacity(extra, Tag.FuncDecl{ |
| 8741 | 8752 | .analysis = .{ |
| 8742 | 8753 | .state = .unreferenced, |
| 8743 | .is_cold = false, | |
| 8754 | .branch_hint = .none, | |
| 8744 | 8755 | .is_noinline = key.is_noinline, |
| 8745 | 8756 | .calls_or_awaits_errorable_fn = false, |
| 8746 | 8757 | .stack_alignment = .none, |
| ... | ... | @@ -8932,7 +8943,7 @@ pub fn getFuncInstance( |
| 8932 | 8943 | const func_extra_index = addExtraAssumeCapacity(extra, Tag.FuncInstance{ |
| 8933 | 8944 | .analysis = .{ |
| 8934 | 8945 | .state = .unreferenced, |
| 8935 | .is_cold = false, | |
| 8946 | .branch_hint = .none, | |
| 8936 | 8947 | .is_noinline = arg.is_noinline, |
| 8937 | 8948 | .calls_or_awaits_errorable_fn = false, |
| 8938 | 8949 | .stack_alignment = .none, |
| ... | ... | @@ -9032,7 +9043,7 @@ pub fn getFuncInstanceIes( |
| 9032 | 9043 | const func_extra_index = addExtraAssumeCapacity(extra, Tag.FuncInstance{ |
| 9033 | 9044 | .analysis = .{ |
| 9034 | 9045 | .state = .unreferenced, |
| 9035 | .is_cold = false, | |
| 9046 | .branch_hint = .none, | |
| 9036 | 9047 | .is_noinline = arg.is_noinline, |
| 9037 | 9048 | .calls_or_awaits_errorable_fn = false, |
| 9038 | 9049 | .stack_alignment = .none, |
| ... | ... | @@ -11853,18 +11864,6 @@ pub fn funcSetDisableInstrumentation(ip: *InternPool, func: Index) void { |
| 11853 | 11864 | @atomicStore(FuncAnalysis, analysis_ptr, analysis, .release); |
| 11854 | 11865 | } |
| 11855 | 11866 | |
| 11856 | pub fn funcSetCold(ip: *InternPool, func: Index, is_cold: bool) void { | |
| 11857 | const unwrapped_func = func.unwrap(ip); | |
| 11858 | const extra_mutex = &ip.getLocal(unwrapped_func.tid).mutate.extra.mutex; | |
| 11859 | extra_mutex.lock(); | |
| 11860 | defer extra_mutex.unlock(); | |
| 11861 | ||
| 11862 | const analysis_ptr = ip.funcAnalysisPtr(func); | |
| 11863 | var analysis = analysis_ptr.*; | |
| 11864 | analysis.is_cold = is_cold; | |
| 11865 | @atomicStore(FuncAnalysis, analysis_ptr, analysis, .release); | |
| 11866 | } | |
| 11867 | ||
| 11868 | 11867 | pub fn funcZirBodyInst(ip: *const InternPool, func: Index) TrackedInst.Index { |
| 11869 | 11868 | const unwrapped_func = func.unwrap(ip); |
| 11870 | 11869 | const item = unwrapped_func.getItem(ip); |
src/Liveness.zig+15-21| ... | ... | @@ -658,10 +658,10 @@ pub fn categorizeOperand( |
| 658 | 658 | |
| 659 | 659 | return .complex; |
| 660 | 660 | }, |
| 661 | .@"try" => { | |
| 661 | .@"try", .try_cold => { | |
| 662 | 662 | return .complex; |
| 663 | 663 | }, |
| 664 | .try_ptr => { | |
| 664 | .try_ptr, .try_ptr_cold => { | |
| 665 | 665 | return .complex; |
| 666 | 666 | }, |
| 667 | 667 | .loop => { |
| ... | ... | @@ -1254,8 +1254,8 @@ fn analyzeInst( |
| 1254 | 1254 | }, |
| 1255 | 1255 | .loop => return analyzeInstLoop(a, pass, data, inst), |
| 1256 | 1256 | |
| 1257 | .@"try" => return analyzeInstCondBr(a, pass, data, inst, .@"try"), | |
| 1258 | .try_ptr => return analyzeInstCondBr(a, pass, data, inst, .try_ptr), | |
| 1257 | .@"try", .try_cold => return analyzeInstCondBr(a, pass, data, inst, .@"try"), | |
| 1258 | .try_ptr, .try_ptr_cold => return analyzeInstCondBr(a, pass, data, inst, .try_ptr), | |
| 1259 | 1259 | .cond_br => return analyzeInstCondBr(a, pass, data, inst, .cond_br), |
| 1260 | 1260 | .switch_br => return analyzeInstSwitchBr(a, pass, data, inst), |
| 1261 | 1261 | |
| ... | ... | @@ -1674,21 +1674,18 @@ fn analyzeInstSwitchBr( |
| 1674 | 1674 | const inst_datas = a.air.instructions.items(.data); |
| 1675 | 1675 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; |
| 1676 | 1676 | const condition = pl_op.operand; |
| 1677 | const switch_br = a.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 1677 | const switch_br = a.air.unwrapSwitch(inst); | |
| 1678 | 1678 | const gpa = a.gpa; |
| 1679 | const ncases = switch_br.data.cases_len; | |
| 1679 | const ncases = switch_br.cases_len; | |
| 1680 | 1680 | |
| 1681 | 1681 | switch (pass) { |
| 1682 | 1682 | .loop_analysis => { |
| 1683 | var air_extra_index: usize = switch_br.end; | |
| 1684 | for (0..ncases) |_| { | |
| 1685 | const case = a.air.extraData(Air.SwitchBr.Case, air_extra_index); | |
| 1686 | const case_body: []const Air.Inst.Index = @ptrCast(a.air.extra[case.end + case.data.items_len ..][0..case.data.body_len]); | |
| 1687 | air_extra_index = case.end + case.data.items_len + case_body.len; | |
| 1688 | try analyzeBody(a, pass, data, case_body); | |
| 1683 | var it = switch_br.iterateCases(); | |
| 1684 | while (it.next()) |case| { | |
| 1685 | try analyzeBody(a, pass, data, case.body); | |
| 1689 | 1686 | } |
| 1690 | 1687 | { // else |
| 1691 | const else_body: []const Air.Inst.Index = @ptrCast(a.air.extra[air_extra_index..][0..switch_br.data.else_body_len]); | |
| 1688 | const else_body = it.elseBody(); | |
| 1692 | 1689 | try analyzeBody(a, pass, data, else_body); |
| 1693 | 1690 | } |
| 1694 | 1691 | }, |
| ... | ... | @@ -1706,16 +1703,13 @@ fn analyzeInstSwitchBr( |
| 1706 | 1703 | @memset(case_live_sets, .{}); |
| 1707 | 1704 | defer for (case_live_sets) |*live_set| live_set.deinit(gpa); |
| 1708 | 1705 | |
| 1709 | var air_extra_index: usize = switch_br.end; | |
| 1710 | for (case_live_sets[0..ncases]) |*live_set| { | |
| 1711 | const case = a.air.extraData(Air.SwitchBr.Case, air_extra_index); | |
| 1712 | const case_body: []const Air.Inst.Index = @ptrCast(a.air.extra[case.end + case.data.items_len ..][0..case.data.body_len]); | |
| 1713 | air_extra_index = case.end + case.data.items_len + case_body.len; | |
| 1714 | try analyzeBody(a, pass, data, case_body); | |
| 1715 | live_set.* = data.live_set.move(); | |
| 1706 | var case_it = switch_br.iterateCases(); | |
| 1707 | while (case_it.next()) |case| { | |
| 1708 | try analyzeBody(a, pass, data, case.body); | |
| 1709 | case_live_sets[case.idx] = data.live_set.move(); | |
| 1716 | 1710 | } |
| 1717 | 1711 | { // else |
| 1718 | const else_body: []const Air.Inst.Index = @ptrCast(a.air.extra[air_extra_index..][0..switch_br.data.else_body_len]); | |
| 1712 | const else_body = case_it.elseBody(); | |
| 1719 | 1713 | try analyzeBody(a, pass, data, else_body); |
| 1720 | 1714 | case_live_sets[ncases] = data.live_set.move(); |
| 1721 | 1715 | } |
src/Liveness/Verify.zig+11-22| ... | ... | @@ -374,7 +374,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 374 | 374 | }, |
| 375 | 375 | |
| 376 | 376 | // control flow |
| 377 | .@"try" => { | |
| 377 | .@"try", .try_cold => { | |
| 378 | 378 | const pl_op = data[@intFromEnum(inst)].pl_op; |
| 379 | 379 | const extra = self.air.extraData(Air.Try, pl_op.payload); |
| 380 | 380 | const try_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra.end..][0..extra.data.body_len]); |
| ... | ... | @@ -396,7 +396,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 396 | 396 | |
| 397 | 397 | try self.verifyInst(inst); |
| 398 | 398 | }, |
| 399 | .try_ptr => { | |
| 399 | .try_ptr, .try_ptr_cold => { | |
| 400 | 400 | const ty_pl = data[@intFromEnum(inst)].ty_pl; |
| 401 | 401 | const extra = self.air.extraData(Air.TryPtr, ty_pl.payload); |
| 402 | 402 | const try_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra.end..][0..extra.data.body_len]); |
| ... | ... | @@ -509,44 +509,33 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 509 | 509 | try self.verifyInst(inst); |
| 510 | 510 | }, |
| 511 | 511 | .switch_br => { |
| 512 | const pl_op = data[@intFromEnum(inst)].pl_op; | |
| 513 | const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 514 | var extra_index = switch_br.end; | |
| 515 | var case_i: u32 = 0; | |
| 512 | const switch_br = self.air.unwrapSwitch(inst); | |
| 516 | 513 | const switch_br_liveness = try self.liveness.getSwitchBr( |
| 517 | 514 | self.gpa, |
| 518 | 515 | inst, |
| 519 | switch_br.data.cases_len + 1, | |
| 516 | switch_br.cases_len + 1, | |
| 520 | 517 | ); |
| 521 | 518 | defer self.gpa.free(switch_br_liveness.deaths); |
| 522 | 519 | |
| 523 | try self.verifyOperand(inst, pl_op.operand, self.liveness.operandDies(inst, 0)); | |
| 520 | try self.verifyOperand(inst, switch_br.operand, self.liveness.operandDies(inst, 0)); | |
| 524 | 521 | |
| 525 | 522 | var live = self.live.move(); |
| 526 | 523 | defer live.deinit(self.gpa); |
| 527 | 524 | |
| 528 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 529 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 530 | const items = @as( | |
| 531 | []const Air.Inst.Ref, | |
| 532 | @ptrCast(self.air.extra[case.end..][0..case.data.items_len]), | |
| 533 | ); | |
| 534 | const case_body: []const Air.Inst.Index = @ptrCast(self.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 535 | extra_index = case.end + items.len + case_body.len; | |
| 536 | ||
| 525 | var it = switch_br.iterateCases(); | |
| 526 | while (it.next()) |case| { | |
| 537 | 527 | self.live.deinit(self.gpa); |
| 538 | 528 | self.live = try live.clone(self.gpa); |
| 539 | 529 | |
| 540 | for (switch_br_liveness.deaths[case_i]) |death| try self.verifyDeath(inst, death); | |
| 541 | try self.verifyBody(case_body); | |
| 530 | for (switch_br_liveness.deaths[case.idx]) |death| try self.verifyDeath(inst, death); | |
| 531 | try self.verifyBody(case.body); | |
| 542 | 532 | } |
| 543 | 533 | |
| 544 | const else_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 534 | const else_body = it.elseBody(); | |
| 545 | 535 | if (else_body.len > 0) { |
| 546 | 536 | self.live.deinit(self.gpa); |
| 547 | 537 | self.live = try live.clone(self.gpa); |
| 548 | ||
| 549 | for (switch_br_liveness.deaths[case_i]) |death| try self.verifyDeath(inst, death); | |
| 538 | for (switch_br_liveness.deaths[switch_br.cases_len]) |death| try self.verifyDeath(inst, death); | |
| 550 | 539 | try self.verifyBody(else_body); |
| 551 | 540 | } |
| 552 | 541 |
src/Sema.zig+319-174| ... | ... | @@ -118,6 +118,10 @@ dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .{}, |
| 118 | 118 | /// by `analyzeCall`. |
| 119 | 119 | allow_memoize: bool = true, |
| 120 | 120 | |
| 121 | /// The `BranchHint` for the current branch of runtime control flow. | |
| 122 | /// This state is on `Sema` so that `cold` hints can be propagated up through blocks with less special handling. | |
| 123 | branch_hint: ?std.builtin.BranchHint = null, | |
| 124 | ||
| 121 | 125 | const MaybeComptimeAlloc = struct { |
| 122 | 126 | /// The runtime index of the `alloc` instruction. |
| 123 | 127 | runtime_index: Value.RuntimeIndex, |
| ... | ... | @@ -892,7 +896,12 @@ pub fn deinit(sema: *Sema) void { |
| 892 | 896 | /// Performs semantic analysis of a ZIR body which is behind a runtime condition. If comptime |
| 893 | 897 | /// control flow happens here, Sema will convert it to runtime control flow by introducing post-hoc |
| 894 | 898 | /// blocks where necessary. |
| 895 | fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.Index) !void { | |
| 899 | /// Returns the branch hint for this branch. | |
| 900 | fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.Index) !std.builtin.BranchHint { | |
| 901 | const parent_hint = sema.branch_hint; | |
| 902 | defer sema.branch_hint = parent_hint; | |
| 903 | sema.branch_hint = null; | |
| 904 | ||
| 896 | 905 | sema.analyzeBodyInner(block, body) catch |err| switch (err) { |
| 897 | 906 | error.ComptimeBreak => { |
| 898 | 907 | const zir_datas = sema.code.instructions.items(.data); |
| ... | ... | @@ -902,6 +911,8 @@ fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.In |
| 902 | 911 | }, |
| 903 | 912 | else => |e| return e, |
| 904 | 913 | }; |
| 914 | ||
| 915 | return sema.branch_hint orelse .none; | |
| 905 | 916 | } |
| 906 | 917 | |
| 907 | 918 | /// Semantically analyze a ZIR function body. It is guranteed by AstGen that such a body cannot |
| ... | ... | @@ -1304,11 +1315,6 @@ fn analyzeBodyInner( |
| 1304 | 1315 | i += 1; |
| 1305 | 1316 | continue; |
| 1306 | 1317 | }, |
| 1307 | .set_cold => { | |
| 1308 | try sema.zirSetCold(block, extended); | |
| 1309 | i += 1; | |
| 1310 | continue; | |
| 1311 | }, | |
| 1312 | 1318 | .breakpoint => { |
| 1313 | 1319 | if (!block.is_comptime) { |
| 1314 | 1320 | _ = try block.addNoOp(.breakpoint); |
| ... | ... | @@ -1326,6 +1332,11 @@ fn analyzeBodyInner( |
| 1326 | 1332 | i += 1; |
| 1327 | 1333 | continue; |
| 1328 | 1334 | }, |
| 1335 | .branch_hint => { | |
| 1336 | try sema.zirBranchHint(block, extended); | |
| 1337 | i += 1; | |
| 1338 | continue; | |
| 1339 | }, | |
| 1329 | 1340 | .value_placeholder => unreachable, // never appears in a body |
| 1330 | 1341 | .field_parent_ptr => try sema.zirFieldParentPtr(block, extended), |
| 1331 | 1342 | .builtin_value => try sema.zirBuiltinValue(extended), |
| ... | ... | @@ -1442,11 +1453,6 @@ fn analyzeBodyInner( |
| 1442 | 1453 | i += 1; |
| 1443 | 1454 | continue; |
| 1444 | 1455 | }, |
| 1445 | .export_value => { | |
| 1446 | try sema.zirExportValue(block, inst); | |
| 1447 | i += 1; | |
| 1448 | continue; | |
| 1449 | }, | |
| 1450 | 1456 | .set_runtime_safety => { |
| 1451 | 1457 | try sema.zirSetRuntimeSafety(block, inst); |
| 1452 | 1458 | i += 1; |
| ... | ... | @@ -2465,7 +2471,7 @@ fn addFieldErrNote( |
| 2465 | 2471 | comptime format: []const u8, |
| 2466 | 2472 | args: anytype, |
| 2467 | 2473 | ) !void { |
| 2468 | @setCold(true); | |
| 2474 | @branchHint(.cold); | |
| 2469 | 2475 | const type_src = container_ty.srcLocOrNull(sema.pt.zcu) orelse return; |
| 2470 | 2476 | const field_src: LazySrcLoc = .{ |
| 2471 | 2477 | .base_node_inst = type_src.base_node_inst, |
| ... | ... | @@ -2501,7 +2507,7 @@ pub fn fail( |
| 2501 | 2507 | } |
| 2502 | 2508 | |
| 2503 | 2509 | pub fn failWithOwnedErrorMsg(sema: *Sema, block: ?*Block, err_msg: *Zcu.ErrorMsg) error{ AnalysisFail, OutOfMemory } { |
| 2504 | @setCold(true); | |
| 2510 | @branchHint(.cold); | |
| 2505 | 2511 | const gpa = sema.gpa; |
| 2506 | 2512 | const zcu = sema.pt.zcu; |
| 2507 | 2513 | |
| ... | ... | @@ -5732,6 +5738,13 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5732 | 5738 | if (block.is_comptime) { |
| 5733 | 5739 | return sema.fail(block, src, "encountered @panic at comptime", .{}); |
| 5734 | 5740 | } |
| 5741 | ||
| 5742 | // We only apply the first hint in a branch. | |
| 5743 | // This allows user-provided hints to override implicit cold hints. | |
| 5744 | if (sema.branch_hint == null) { | |
| 5745 | sema.branch_hint = .cold; | |
| 5746 | } | |
| 5747 | ||
| 5735 | 5748 | try sema.panicWithMsg(block, src, coerced_msg, .@"@panic"); |
| 5736 | 5749 | } |
| 5737 | 5750 | |
| ... | ... | @@ -6279,73 +6292,72 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 6279 | 6292 | const ip = &zcu.intern_pool; |
| 6280 | 6293 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; |
| 6281 | 6294 | const extra = sema.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; |
| 6282 | const src = block.nodeOffset(inst_data.src_node); | |
| 6283 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | |
| 6284 | const options_src = block.builtinCallArgSrc(inst_data.src_node, 1); | |
| 6285 | const decl_name = try ip.getOrPutString( | |
| 6286 | zcu.gpa, | |
| 6287 | pt.tid, | |
| 6288 | sema.code.nullTerminatedString(extra.decl_name), | |
| 6289 | .no_embedded_nulls, | |
| 6290 | ); | |
| 6291 | const nav_index = if (extra.namespace != .none) index_blk: { | |
| 6292 | const container_ty = try sema.resolveType(block, operand_src, extra.namespace); | |
| 6293 | const container_namespace = container_ty.getNamespaceIndex(zcu); | |
| 6294 | ||
| 6295 | const lookup = try sema.lookupInNamespace(block, operand_src, container_namespace, decl_name, false) orelse | |
| 6296 | return sema.failWithBadMemberAccess(block, container_ty, operand_src, decl_name); | |
| 6297 | 6295 | |
| 6298 | break :index_blk lookup.nav; | |
| 6299 | } else try sema.lookupIdentifier(block, operand_src, decl_name); | |
| 6300 | const options = try sema.resolveExportOptions(block, options_src, extra.options); | |
| 6301 | ||
| 6302 | try sema.ensureNavResolved(src, nav_index); | |
| 6303 | ||
| 6304 | // Make sure to export the owner Nav if applicable. | |
| 6305 | const exported_nav = switch (ip.indexToKey(ip.getNav(nav_index).status.resolved.val)) { | |
| 6306 | .variable => |v| v.owner_nav, | |
| 6307 | .@"extern" => |e| e.owner_nav, | |
| 6308 | .func => |f| f.owner_nav, | |
| 6309 | else => nav_index, | |
| 6310 | }; | |
| 6311 | try sema.analyzeExport(block, src, options, exported_nav); | |
| 6312 | } | |
| 6313 | ||
| 6314 | fn zirExportValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | |
| 6315 | const tracy = trace(@src()); | |
| 6316 | defer tracy.end(); | |
| 6317 | ||
| 6318 | const pt = sema.pt; | |
| 6319 | const zcu = pt.zcu; | |
| 6320 | const ip = &zcu.intern_pool; | |
| 6321 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 6322 | const extra = sema.code.extraData(Zir.Inst.ExportValue, inst_data.payload_index).data; | |
| 6323 | 6296 | const src = block.nodeOffset(inst_data.src_node); |
| 6324 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | |
| 6297 | const ptr_src = block.builtinCallArgSrc(inst_data.src_node, 0); | |
| 6325 | 6298 | const options_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 6326 | const operand = try sema.resolveInstConst(block, operand_src, extra.operand, .{ | |
| 6299 | ||
| 6300 | const ptr = try sema.resolveInst(extra.exported); | |
| 6301 | const ptr_val = try sema.resolveConstDefinedValue(block, ptr_src, ptr, .{ | |
| 6327 | 6302 | .needed_comptime_reason = "export target must be comptime-known", |
| 6328 | 6303 | }); |
| 6304 | const ptr_ty = ptr_val.typeOf(zcu); | |
| 6305 | ||
| 6329 | 6306 | const options = try sema.resolveExportOptions(block, options_src, extra.options); |
| 6330 | if (options.linkage == .internal) | |
| 6331 | return; | |
| 6332 | 6307 | |
| 6333 | // If the value has an owner Nav, export that instead. | |
| 6334 | const maybe_owner_nav = switch (ip.indexToKey(operand.toIntern())) { | |
| 6335 | .variable => |v| v.owner_nav, | |
| 6336 | .@"extern" => |e| e.owner_nav, | |
| 6337 | .func => |f| f.owner_nav, | |
| 6338 | else => null, | |
| 6339 | }; | |
| 6340 | if (maybe_owner_nav) |owner_nav| { | |
| 6341 | return sema.analyzeExport(block, src, options, owner_nav); | |
| 6342 | } else { | |
| 6343 | try sema.exports.append(zcu.gpa, .{ | |
| 6344 | .opts = options, | |
| 6345 | .src = src, | |
| 6346 | .exported = .{ .uav = operand.toIntern() }, | |
| 6347 | .status = .in_progress, | |
| 6348 | }); | |
| 6308 | { | |
| 6309 | if (ptr_ty.zigTypeTag(zcu) != .Pointer) { | |
| 6310 | return sema.fail(block, ptr_src, "expected pointer type, found '{}'", .{ptr_ty.fmt(pt)}); | |
| 6311 | } | |
| 6312 | const ptr_ty_info = ptr_ty.ptrInfo(zcu); | |
| 6313 | if (ptr_ty_info.flags.size == .Slice) { | |
| 6314 | return sema.fail(block, ptr_src, "export target cannot be slice", .{}); | |
| 6315 | } | |
| 6316 | if (ptr_ty_info.packed_offset.host_size != 0) { | |
| 6317 | return sema.fail(block, ptr_src, "export target cannot be bit-pointer", .{}); | |
| 6318 | } | |
| 6319 | } | |
| 6320 | ||
| 6321 | const ptr_info = ip.indexToKey(ptr_val.toIntern()).ptr; | |
| 6322 | switch (ptr_info.base_addr) { | |
| 6323 | .comptime_alloc, .int, .comptime_field => return sema.fail(block, ptr_src, "export target must be a global variable or a comptime-known constant", .{}), | |
| 6324 | .eu_payload, .opt_payload, .field, .arr_elem => return sema.fail(block, ptr_src, "TODO: export pointer in middle of value", .{}), | |
| 6325 | .uav => |uav| { | |
| 6326 | if (ptr_info.byte_offset != 0) { | |
| 6327 | return sema.fail(block, ptr_src, "TODO: export pointer in middle of value", .{}); | |
| 6328 | } | |
| 6329 | if (options.linkage == .internal) return; | |
| 6330 | const export_ty = Value.fromInterned(uav.val).typeOf(zcu); | |
| 6331 | if (!try sema.validateExternType(export_ty, .other)) { | |
| 6332 | return sema.failWithOwnedErrorMsg(block, msg: { | |
| 6333 | const msg = try sema.errMsg(src, "unable to export type '{}'", .{export_ty.fmt(pt)}); | |
| 6334 | errdefer msg.destroy(sema.gpa); | |
| 6335 | try sema.explainWhyTypeIsNotExtern(msg, src, export_ty, .other); | |
| 6336 | try sema.addDeclaredHereNote(msg, export_ty); | |
| 6337 | break :msg msg; | |
| 6338 | }); | |
| 6339 | } | |
| 6340 | try sema.exports.append(zcu.gpa, .{ | |
| 6341 | .opts = options, | |
| 6342 | .src = src, | |
| 6343 | .exported = .{ .uav = uav.val }, | |
| 6344 | .status = .in_progress, | |
| 6345 | }); | |
| 6346 | }, | |
| 6347 | .nav => |nav| { | |
| 6348 | if (ptr_info.byte_offset != 0) { | |
| 6349 | return sema.fail(block, ptr_src, "TODO: export pointer in middle of value", .{}); | |
| 6350 | } | |
| 6351 | try sema.ensureNavResolved(src, nav); | |
| 6352 | // Make sure to export the owner Nav if applicable. | |
| 6353 | const exported_nav = switch (ip.indexToKey(ip.getNav(nav).status.resolved.val)) { | |
| 6354 | .variable => |v| v.owner_nav, | |
| 6355 | .@"extern" => |e| e.owner_nav, | |
| 6356 | .func => |f| f.owner_nav, | |
| 6357 | else => nav, | |
| 6358 | }; | |
| 6359 | try sema.analyzeExport(block, src, options, exported_nav); | |
| 6360 | }, | |
| 6349 | 6361 | } |
| 6350 | 6362 | } |
| 6351 | 6363 | |
| ... | ... | @@ -6424,25 +6436,6 @@ fn zirSetAlignStack(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst |
| 6424 | 6436 | sema.allow_memoize = false; |
| 6425 | 6437 | } |
| 6426 | 6438 | |
| 6427 | fn zirSetCold(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { | |
| 6428 | const pt = sema.pt; | |
| 6429 | const zcu = pt.zcu; | |
| 6430 | const ip = &zcu.intern_pool; | |
| 6431 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | |
| 6432 | const operand_src = block.builtinCallArgSrc(extra.node, 0); | |
| 6433 | const is_cold = try sema.resolveConstBool(block, operand_src, extra.operand, .{ | |
| 6434 | .needed_comptime_reason = "operand to @setCold must be comptime-known", | |
| 6435 | }); | |
| 6436 | // TODO: should `@setCold` apply to the parent in an inline call? | |
| 6437 | // See also #20642 and friends. | |
| 6438 | const func = switch (sema.owner.unwrap()) { | |
| 6439 | .func => |func| func, | |
| 6440 | .cau => return, // does nothing outside a function | |
| 6441 | }; | |
| 6442 | ip.funcSetCold(func, is_cold); | |
| 6443 | sema.allow_memoize = false; | |
| 6444 | } | |
| 6445 | ||
| 6446 | 6439 | fn zirDisableInstrumentation(sema: *Sema) CompileError!void { |
| 6447 | 6440 | const pt = sema.pt; |
| 6448 | 6441 | const zcu = pt.zcu; |
| ... | ... | @@ -6897,13 +6890,20 @@ fn popErrorReturnTrace( |
| 6897 | 6890 | @typeInfo(Air.Block).Struct.fields.len + 1); // +1 for the sole .cond_br instruction in the .block |
| 6898 | 6891 | |
| 6899 | 6892 | const cond_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); |
| 6900 | try sema.air_instructions.append(gpa, .{ .tag = .cond_br, .data = .{ .pl_op = .{ | |
| 6901 | .operand = is_non_error_inst, | |
| 6902 | .payload = sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 6903 | .then_body_len = @intCast(then_block.instructions.items.len), | |
| 6904 | .else_body_len = @intCast(else_block.instructions.items.len), | |
| 6905 | }), | |
| 6906 | } } }); | |
| 6893 | try sema.air_instructions.append(gpa, .{ | |
| 6894 | .tag = .cond_br, | |
| 6895 | .data = .{ | |
| 6896 | .pl_op = .{ | |
| 6897 | .operand = is_non_error_inst, | |
| 6898 | .payload = sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 6899 | .then_body_len = @intCast(then_block.instructions.items.len), | |
| 6900 | .else_body_len = @intCast(else_block.instructions.items.len), | |
| 6901 | // weight against error branch | |
| 6902 | .branch_hints = .{ .true = .likely, .false = .unlikely }, | |
| 6903 | }), | |
| 6904 | }, | |
| 6905 | }, | |
| 6906 | }); | |
| 6907 | 6907 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(then_block.instructions.items)); |
| 6908 | 6908 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(else_block.instructions.items)); |
| 6909 | 6909 | |
| ... | ... | @@ -10960,6 +10960,11 @@ const SwitchProngAnalysis = struct { |
| 10960 | 10960 | sema.code.instructions.items(.data)[@intFromEnum(spa.switch_block_inst)].pl_node.src_node, |
| 10961 | 10961 | ); |
| 10962 | 10962 | |
| 10963 | // We can propagate `.cold` hints from this branch since it's comptime-known | |
| 10964 | // to be taken from the parent branch. | |
| 10965 | const parent_hint = sema.branch_hint; | |
| 10966 | defer sema.branch_hint = parent_hint orelse if (sema.branch_hint == .cold) .cold else null; | |
| 10967 | ||
| 10963 | 10968 | if (has_tag_capture) { |
| 10964 | 10969 | const tag_ref = try spa.analyzeTagCapture(child_block, capture_src, inline_case_capture); |
| 10965 | 10970 | sema.inst_map.putAssumeCapacity(spa.tag_capture_inst, tag_ref); |
| ... | ... | @@ -10996,6 +11001,7 @@ const SwitchProngAnalysis = struct { |
| 10996 | 11001 | |
| 10997 | 11002 | /// Analyze a switch prong which may have peers at runtime. |
| 10998 | 11003 | /// Uses `analyzeBodyRuntimeBreak`. Sets up captures as needed. |
| 11004 | /// Returns the `BranchHint` for the prong. | |
| 10999 | 11005 | fn analyzeProngRuntime( |
| 11000 | 11006 | spa: SwitchProngAnalysis, |
| 11001 | 11007 | case_block: *Block, |
| ... | ... | @@ -11013,7 +11019,7 @@ const SwitchProngAnalysis = struct { |
| 11013 | 11019 | /// Whether this prong has an inline tag capture. If `true`, then |
| 11014 | 11020 | /// `inline_case_capture` cannot be `.none`. |
| 11015 | 11021 | has_tag_capture: bool, |
| 11016 | ) CompileError!void { | |
| 11022 | ) CompileError!std.builtin.BranchHint { | |
| 11017 | 11023 | const sema = spa.sema; |
| 11018 | 11024 | |
| 11019 | 11025 | if (has_tag_capture) { |
| ... | ... | @@ -11039,7 +11045,7 @@ const SwitchProngAnalysis = struct { |
| 11039 | 11045 | |
| 11040 | 11046 | if (sema.typeOf(capture_ref).isNoReturn(sema.pt.zcu)) { |
| 11041 | 11047 | // No need to analyze any further, the prong is unreachable |
| 11042 | return; | |
| 11048 | return .none; | |
| 11043 | 11049 | } |
| 11044 | 11050 | |
| 11045 | 11051 | sema.inst_map.putAssumeCapacity(spa.switch_block_inst, capture_ref); |
| ... | ... | @@ -11308,10 +11314,17 @@ const SwitchProngAnalysis = struct { |
| 11308 | 11314 | |
| 11309 | 11315 | const prong_count = field_indices.len - in_mem_coercible.count(); |
| 11310 | 11316 | |
| 11311 | const estimated_extra = prong_count * 6; // 2 for Case, 1 item, probably 3 insts | |
| 11317 | const estimated_extra = prong_count * 6 + (prong_count / 10); // 2 for Case, 1 item, probably 3 insts; plus hints | |
| 11312 | 11318 | var cases_extra = try std.ArrayList(u32).initCapacity(sema.gpa, estimated_extra); |
| 11313 | 11319 | defer cases_extra.deinit(); |
| 11314 | 11320 | |
| 11321 | { | |
| 11322 | // All branch hints are `.none`, so just add zero elems. | |
| 11323 | comptime assert(@intFromEnum(std.builtin.BranchHint.none) == 0); | |
| 11324 | const need_elems = std.math.divCeil(usize, prong_count + 1, 10) catch unreachable; | |
| 11325 | try cases_extra.appendNTimes(0, need_elems); | |
| 11326 | } | |
| 11327 | ||
| 11315 | 11328 | { |
| 11316 | 11329 | // Non-bitcast cases |
| 11317 | 11330 | var it = in_mem_coercible.iterator(.{ .kind = .unset }); |
| ... | ... | @@ -11734,7 +11747,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp |
| 11734 | 11747 | sub_block.need_debug_scope = null; // this body is emitted regardless |
| 11735 | 11748 | defer sub_block.instructions.deinit(gpa); |
| 11736 | 11749 | |
| 11737 | try sema.analyzeBodyRuntimeBreak(&sub_block, non_error_case.body); | |
| 11750 | const non_error_hint = try sema.analyzeBodyRuntimeBreak(&sub_block, non_error_case.body); | |
| 11738 | 11751 | const true_instructions = try sub_block.instructions.toOwnedSlice(gpa); |
| 11739 | 11752 | defer gpa.free(true_instructions); |
| 11740 | 11753 | |
| ... | ... | @@ -11788,6 +11801,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp |
| 11788 | 11801 | .payload = sema.addExtraAssumeCapacity(Air.CondBr{ |
| 11789 | 11802 | .then_body_len = @intCast(true_instructions.len), |
| 11790 | 11803 | .else_body_len = @intCast(sub_block.instructions.items.len), |
| 11804 | .branch_hints = .{ .true = non_error_hint, .false = .none }, | |
| 11791 | 11805 | }), |
| 11792 | 11806 | } }, |
| 11793 | 11807 | }); |
| ... | ... | @@ -12492,6 +12506,9 @@ fn analyzeSwitchRuntimeBlock( |
| 12492 | 12506 | var cases_extra = try std.ArrayListUnmanaged(u32).initCapacity(gpa, estimated_cases_extra); |
| 12493 | 12507 | defer cases_extra.deinit(gpa); |
| 12494 | 12508 | |
| 12509 | var branch_hints = try std.ArrayListUnmanaged(std.builtin.BranchHint).initCapacity(gpa, scalar_cases_len); | |
| 12510 | defer branch_hints.deinit(gpa); | |
| 12511 | ||
| 12495 | 12512 | var case_block = child_block.makeSubBlock(); |
| 12496 | 12513 | case_block.runtime_loop = null; |
| 12497 | 12514 | case_block.runtime_cond = operand_src; |
| ... | ... | @@ -12522,10 +12539,13 @@ fn analyzeSwitchRuntimeBlock( |
| 12522 | 12539 | break :blk field_ty.zigTypeTag(zcu) != .NoReturn; |
| 12523 | 12540 | } else true; |
| 12524 | 12541 | |
| 12525 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand, operand_src, allow_err_code_unwrap)) { | |
| 12526 | // nothing to do here | |
| 12527 | } else if (analyze_body) { | |
| 12528 | try spa.analyzeProngRuntime( | |
| 12542 | const prong_hint: std.builtin.BranchHint = if (err_set and | |
| 12543 | try sema.maybeErrorUnwrap(&case_block, body, operand, operand_src, allow_err_code_unwrap)) | |
| 12544 | h: { | |
| 12545 | // nothing to do here. weight against error branch | |
| 12546 | break :h .unlikely; | |
| 12547 | } else if (analyze_body) h: { | |
| 12548 | break :h try spa.analyzeProngRuntime( | |
| 12529 | 12549 | &case_block, |
| 12530 | 12550 | .normal, |
| 12531 | 12551 | body, |
| ... | ... | @@ -12538,10 +12558,12 @@ fn analyzeSwitchRuntimeBlock( |
| 12538 | 12558 | if (info.is_inline) item else .none, |
| 12539 | 12559 | info.has_tag_capture, |
| 12540 | 12560 | ); |
| 12541 | } else { | |
| 12561 | } else h: { | |
| 12542 | 12562 | _ = try case_block.addNoOp(.unreach); |
| 12543 | } | |
| 12563 | break :h .none; | |
| 12564 | }; | |
| 12544 | 12565 | |
| 12566 | try branch_hints.append(gpa, prong_hint); | |
| 12545 | 12567 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12546 | 12568 | cases_extra.appendAssumeCapacity(1); // items_len |
| 12547 | 12569 | cases_extra.appendAssumeCapacity(@intCast(case_block.instructions.items.len)); |
| ... | ... | @@ -12551,6 +12573,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12551 | 12573 | |
| 12552 | 12574 | var is_first = true; |
| 12553 | 12575 | var prev_cond_br: Air.Inst.Index = undefined; |
| 12576 | var prev_hint: std.builtin.BranchHint = undefined; | |
| 12554 | 12577 | var first_else_body: []const Air.Inst.Index = &.{}; |
| 12555 | 12578 | defer gpa.free(first_else_body); |
| 12556 | 12579 | var prev_then_body: []const Air.Inst.Index = &.{}; |
| ... | ... | @@ -12612,7 +12635,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12612 | 12635 | } })); |
| 12613 | 12636 | emit_bb = true; |
| 12614 | 12637 | |
| 12615 | try spa.analyzeProngRuntime( | |
| 12638 | const prong_hint = try spa.analyzeProngRuntime( | |
| 12616 | 12639 | &case_block, |
| 12617 | 12640 | .normal, |
| 12618 | 12641 | body, |
| ... | ... | @@ -12625,6 +12648,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12625 | 12648 | item_ref, |
| 12626 | 12649 | info.has_tag_capture, |
| 12627 | 12650 | ); |
| 12651 | try branch_hints.append(gpa, prong_hint); | |
| 12628 | 12652 | |
| 12629 | 12653 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12630 | 12654 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -12655,8 +12679,8 @@ fn analyzeSwitchRuntimeBlock( |
| 12655 | 12679 | } })); |
| 12656 | 12680 | emit_bb = true; |
| 12657 | 12681 | |
| 12658 | if (analyze_body) { | |
| 12659 | try spa.analyzeProngRuntime( | |
| 12682 | const prong_hint: std.builtin.BranchHint = if (analyze_body) h: { | |
| 12683 | break :h try spa.analyzeProngRuntime( | |
| 12660 | 12684 | &case_block, |
| 12661 | 12685 | .normal, |
| 12662 | 12686 | body, |
| ... | ... | @@ -12669,9 +12693,11 @@ fn analyzeSwitchRuntimeBlock( |
| 12669 | 12693 | item, |
| 12670 | 12694 | info.has_tag_capture, |
| 12671 | 12695 | ); |
| 12672 | } else { | |
| 12696 | } else h: { | |
| 12673 | 12697 | _ = try case_block.addNoOp(.unreach); |
| 12674 | } | |
| 12698 | break :h .none; | |
| 12699 | }; | |
| 12700 | try branch_hints.append(gpa, prong_hint); | |
| 12675 | 12701 | |
| 12676 | 12702 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12677 | 12703 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -12703,10 +12729,13 @@ fn analyzeSwitchRuntimeBlock( |
| 12703 | 12729 | |
| 12704 | 12730 | const body = sema.code.bodySlice(extra_index, info.body_len); |
| 12705 | 12731 | extra_index += info.body_len; |
| 12706 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand, operand_src, allow_err_code_unwrap)) { | |
| 12707 | // nothing to do here | |
| 12708 | } else if (analyze_body) { | |
| 12709 | try spa.analyzeProngRuntime( | |
| 12732 | const prong_hint: std.builtin.BranchHint = if (err_set and | |
| 12733 | try sema.maybeErrorUnwrap(&case_block, body, operand, operand_src, allow_err_code_unwrap)) | |
| 12734 | h: { | |
| 12735 | // nothing to do here. weight against error branch | |
| 12736 | break :h .unlikely; | |
| 12737 | } else if (analyze_body) h: { | |
| 12738 | break :h try spa.analyzeProngRuntime( | |
| 12710 | 12739 | &case_block, |
| 12711 | 12740 | .normal, |
| 12712 | 12741 | body, |
| ... | ... | @@ -12719,10 +12748,12 @@ fn analyzeSwitchRuntimeBlock( |
| 12719 | 12748 | .none, |
| 12720 | 12749 | false, |
| 12721 | 12750 | ); |
| 12722 | } else { | |
| 12751 | } else h: { | |
| 12723 | 12752 | _ = try case_block.addNoOp(.unreach); |
| 12724 | } | |
| 12753 | break :h .none; | |
| 12754 | }; | |
| 12725 | 12755 | |
| 12756 | try branch_hints.append(gpa, prong_hint); | |
| 12726 | 12757 | try cases_extra.ensureUnusedCapacity(gpa, 2 + items.len + |
| 12727 | 12758 | case_block.instructions.items.len); |
| 12728 | 12759 | |
| ... | ... | @@ -12790,23 +12821,24 @@ fn analyzeSwitchRuntimeBlock( |
| 12790 | 12821 | |
| 12791 | 12822 | const body = sema.code.bodySlice(extra_index, info.body_len); |
| 12792 | 12823 | extra_index += info.body_len; |
| 12793 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand, operand_src, allow_err_code_unwrap)) { | |
| 12794 | // nothing to do here | |
| 12795 | } else { | |
| 12796 | try spa.analyzeProngRuntime( | |
| 12797 | &case_block, | |
| 12798 | .normal, | |
| 12799 | body, | |
| 12800 | info.capture, | |
| 12801 | child_block.src(.{ .switch_capture = .{ | |
| 12802 | .switch_node_offset = switch_node_offset, | |
| 12803 | .case_idx = .{ .kind = .multi, .index = @intCast(multi_i) }, | |
| 12804 | } }), | |
| 12805 | items, | |
| 12806 | .none, | |
| 12807 | false, | |
| 12808 | ); | |
| 12809 | } | |
| 12824 | const prong_hint: std.builtin.BranchHint = if (err_set and | |
| 12825 | try sema.maybeErrorUnwrap(&case_block, body, operand, operand_src, allow_err_code_unwrap)) | |
| 12826 | h: { | |
| 12827 | // nothing to do here. weight against error branch | |
| 12828 | break :h .unlikely; | |
| 12829 | } else try spa.analyzeProngRuntime( | |
| 12830 | &case_block, | |
| 12831 | .normal, | |
| 12832 | body, | |
| 12833 | info.capture, | |
| 12834 | child_block.src(.{ .switch_capture = .{ | |
| 12835 | .switch_node_offset = switch_node_offset, | |
| 12836 | .case_idx = .{ .kind = .multi, .index = @intCast(multi_i) }, | |
| 12837 | } }), | |
| 12838 | items, | |
| 12839 | .none, | |
| 12840 | false, | |
| 12841 | ); | |
| 12810 | 12842 | |
| 12811 | 12843 | if (is_first) { |
| 12812 | 12844 | is_first = false; |
| ... | ... | @@ -12818,10 +12850,10 @@ fn analyzeSwitchRuntimeBlock( |
| 12818 | 12850 | @typeInfo(Air.CondBr).Struct.fields.len + prev_then_body.len + cond_body.len, |
| 12819 | 12851 | ); |
| 12820 | 12852 | |
| 12821 | sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = | |
| 12822 | sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 12853 | sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 12823 | 12854 | .then_body_len = @intCast(prev_then_body.len), |
| 12824 | 12855 | .else_body_len = @intCast(cond_body.len), |
| 12856 | .branch_hints = .{ .true = prev_hint, .false = .none }, | |
| 12825 | 12857 | }); |
| 12826 | 12858 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(prev_then_body)); |
| 12827 | 12859 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(cond_body)); |
| ... | ... | @@ -12829,6 +12861,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12829 | 12861 | gpa.free(prev_then_body); |
| 12830 | 12862 | prev_then_body = try case_block.instructions.toOwnedSlice(gpa); |
| 12831 | 12863 | prev_cond_br = new_cond_br; |
| 12864 | prev_hint = prong_hint; | |
| 12832 | 12865 | } |
| 12833 | 12866 | } |
| 12834 | 12867 | |
| ... | ... | @@ -12860,8 +12893,8 @@ fn analyzeSwitchRuntimeBlock( |
| 12860 | 12893 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 12861 | 12894 | emit_bb = true; |
| 12862 | 12895 | |
| 12863 | if (analyze_body) { | |
| 12864 | try spa.analyzeProngRuntime( | |
| 12896 | const prong_hint: std.builtin.BranchHint = if (analyze_body) h: { | |
| 12897 | break :h try spa.analyzeProngRuntime( | |
| 12865 | 12898 | &case_block, |
| 12866 | 12899 | .special, |
| 12867 | 12900 | special.body, |
| ... | ... | @@ -12874,9 +12907,11 @@ fn analyzeSwitchRuntimeBlock( |
| 12874 | 12907 | item_ref, |
| 12875 | 12908 | special.has_tag_capture, |
| 12876 | 12909 | ); |
| 12877 | } else { | |
| 12910 | } else h: { | |
| 12878 | 12911 | _ = try case_block.addNoOp(.unreach); |
| 12879 | } | |
| 12912 | break :h .none; | |
| 12913 | }; | |
| 12914 | try branch_hints.append(gpa, prong_hint); | |
| 12880 | 12915 | |
| 12881 | 12916 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12882 | 12917 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -12909,7 +12944,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12909 | 12944 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 12910 | 12945 | emit_bb = true; |
| 12911 | 12946 | |
| 12912 | try spa.analyzeProngRuntime( | |
| 12947 | const prong_hint = try spa.analyzeProngRuntime( | |
| 12913 | 12948 | &case_block, |
| 12914 | 12949 | .special, |
| 12915 | 12950 | special.body, |
| ... | ... | @@ -12922,6 +12957,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12922 | 12957 | item_ref, |
| 12923 | 12958 | special.has_tag_capture, |
| 12924 | 12959 | ); |
| 12960 | try branch_hints.append(gpa, prong_hint); | |
| 12925 | 12961 | |
| 12926 | 12962 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12927 | 12963 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -12943,7 +12979,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12943 | 12979 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 12944 | 12980 | emit_bb = true; |
| 12945 | 12981 | |
| 12946 | try spa.analyzeProngRuntime( | |
| 12982 | const prong_hint = try spa.analyzeProngRuntime( | |
| 12947 | 12983 | &case_block, |
| 12948 | 12984 | .special, |
| 12949 | 12985 | special.body, |
| ... | ... | @@ -12956,6 +12992,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12956 | 12992 | item_ref, |
| 12957 | 12993 | special.has_tag_capture, |
| 12958 | 12994 | ); |
| 12995 | try branch_hints.append(gpa, prong_hint); | |
| 12959 | 12996 | |
| 12960 | 12997 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12961 | 12998 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -12974,7 +13011,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12974 | 13011 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 12975 | 13012 | emit_bb = true; |
| 12976 | 13013 | |
| 12977 | try spa.analyzeProngRuntime( | |
| 13014 | const prong_hint = try spa.analyzeProngRuntime( | |
| 12978 | 13015 | &case_block, |
| 12979 | 13016 | .special, |
| 12980 | 13017 | special.body, |
| ... | ... | @@ -12987,6 +13024,7 @@ fn analyzeSwitchRuntimeBlock( |
| 12987 | 13024 | .bool_true, |
| 12988 | 13025 | special.has_tag_capture, |
| 12989 | 13026 | ); |
| 13027 | try branch_hints.append(gpa, prong_hint); | |
| 12990 | 13028 | |
| 12991 | 13029 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12992 | 13030 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -13003,7 +13041,7 @@ fn analyzeSwitchRuntimeBlock( |
| 13003 | 13041 | if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src); |
| 13004 | 13042 | emit_bb = true; |
| 13005 | 13043 | |
| 13006 | try spa.analyzeProngRuntime( | |
| 13044 | const prong_hint = try spa.analyzeProngRuntime( | |
| 13007 | 13045 | &case_block, |
| 13008 | 13046 | .special, |
| 13009 | 13047 | special.body, |
| ... | ... | @@ -13016,6 +13054,7 @@ fn analyzeSwitchRuntimeBlock( |
| 13016 | 13054 | .bool_false, |
| 13017 | 13055 | special.has_tag_capture, |
| 13018 | 13056 | ); |
| 13057 | try branch_hints.append(gpa, prong_hint); | |
| 13019 | 13058 | |
| 13020 | 13059 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 13021 | 13060 | cases_extra.appendAssumeCapacity(1); // items_len |
| ... | ... | @@ -13051,12 +13090,13 @@ fn analyzeSwitchRuntimeBlock( |
| 13051 | 13090 | } else false |
| 13052 | 13091 | else |
| 13053 | 13092 | true; |
| 13054 | if (special.body.len != 0 and err_set and | |
| 13093 | const else_hint: std.builtin.BranchHint = if (special.body.len != 0 and err_set and | |
| 13055 | 13094 | try sema.maybeErrorUnwrap(&case_block, special.body, operand, operand_src, allow_err_code_unwrap)) |
| 13056 | { | |
| 13057 | // nothing to do here | |
| 13058 | } else if (special.body.len != 0 and analyze_body and !special.is_inline) { | |
| 13059 | try spa.analyzeProngRuntime( | |
| 13095 | h: { | |
| 13096 | // nothing to do here. weight against error branch | |
| 13097 | break :h .unlikely; | |
| 13098 | } else if (special.body.len != 0 and analyze_body and !special.is_inline) h: { | |
| 13099 | break :h try spa.analyzeProngRuntime( | |
| 13060 | 13100 | &case_block, |
| 13061 | 13101 | .special, |
| 13062 | 13102 | special.body, |
| ... | ... | @@ -13069,7 +13109,7 @@ fn analyzeSwitchRuntimeBlock( |
| 13069 | 13109 | .none, |
| 13070 | 13110 | false, |
| 13071 | 13111 | ); |
| 13072 | } else { | |
| 13112 | } else h: { | |
| 13073 | 13113 | // We still need a terminator in this block, but we have proven |
| 13074 | 13114 | // that it is unreachable. |
| 13075 | 13115 | if (case_block.wantSafety()) { |
| ... | ... | @@ -13078,33 +13118,57 @@ fn analyzeSwitchRuntimeBlock( |
| 13078 | 13118 | } else { |
| 13079 | 13119 | _ = try case_block.addNoOp(.unreach); |
| 13080 | 13120 | } |
| 13081 | } | |
| 13121 | // Safety check / unreachable branches are cold. | |
| 13122 | break :h .cold; | |
| 13123 | }; | |
| 13082 | 13124 | |
| 13083 | 13125 | if (is_first) { |
| 13126 | try branch_hints.append(gpa, else_hint); | |
| 13084 | 13127 | final_else_body = case_block.instructions.items; |
| 13085 | 13128 | } else { |
| 13129 | try branch_hints.append(gpa, .none); // we have the range conditionals first | |
| 13086 | 13130 | try sema.air_extra.ensureUnusedCapacity(gpa, prev_then_body.len + |
| 13087 | 13131 | @typeInfo(Air.CondBr).Struct.fields.len + case_block.instructions.items.len); |
| 13088 | 13132 | |
| 13089 | sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = | |
| 13090 | sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 13133 | sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 13091 | 13134 | .then_body_len = @intCast(prev_then_body.len), |
| 13092 | 13135 | .else_body_len = @intCast(case_block.instructions.items.len), |
| 13136 | .branch_hints = .{ .true = prev_hint, .false = else_hint }, | |
| 13093 | 13137 | }); |
| 13094 | 13138 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(prev_then_body)); |
| 13095 | 13139 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); |
| 13096 | 13140 | final_else_body = first_else_body; |
| 13097 | 13141 | } |
| 13142 | } else { | |
| 13143 | try branch_hints.append(gpa, .none); | |
| 13098 | 13144 | } |
| 13099 | 13145 | |
| 13146 | assert(branch_hints.items.len == cases_len + 1); | |
| 13147 | ||
| 13100 | 13148 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.SwitchBr).Struct.fields.len + |
| 13101 | cases_extra.items.len + final_else_body.len); | |
| 13149 | cases_extra.items.len + final_else_body.len + | |
| 13150 | (std.math.divCeil(usize, branch_hints.items.len, 10) catch unreachable)); // branch hints | |
| 13102 | 13151 | |
| 13103 | 13152 | const payload_index = sema.addExtraAssumeCapacity(Air.SwitchBr{ |
| 13104 | 13153 | .cases_len = @intCast(cases_len), |
| 13105 | 13154 | .else_body_len = @intCast(final_else_body.len), |
| 13106 | 13155 | }); |
| 13107 | 13156 | |
| 13157 | { | |
| 13158 | // Add branch hints. | |
| 13159 | var cur_bag: u32 = 0; | |
| 13160 | for (branch_hints.items, 0..) |hint, idx| { | |
| 13161 | const idx_in_bag = idx % 10; | |
| 13162 | cur_bag |= @as(u32, @intFromEnum(hint)) << @intCast(idx_in_bag * 3); | |
| 13163 | if (idx_in_bag == 9) { | |
| 13164 | sema.air_extra.appendAssumeCapacity(cur_bag); | |
| 13165 | cur_bag = 0; | |
| 13166 | } | |
| 13167 | } | |
| 13168 | if (branch_hints.items.len % 10 != 0) { | |
| 13169 | sema.air_extra.appendAssumeCapacity(cur_bag); | |
| 13170 | } | |
| 13171 | } | |
| 13108 | 13172 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(cases_extra.items)); |
| 13109 | 13173 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(final_else_body)); |
| 13110 | 13174 | |
| ... | ... | @@ -19165,6 +19229,10 @@ fn zirBoolBr( |
| 19165 | 19229 | const lhs_result: Air.Inst.Ref = if (is_bool_or) .bool_true else .bool_false; |
| 19166 | 19230 | _ = try lhs_block.addBr(block_inst, lhs_result); |
| 19167 | 19231 | |
| 19232 | const parent_hint = sema.branch_hint; | |
| 19233 | defer sema.branch_hint = parent_hint; | |
| 19234 | sema.branch_hint = null; | |
| 19235 | ||
| 19168 | 19236 | const rhs_result = try sema.resolveInlineBody(rhs_block, body, inst); |
| 19169 | 19237 | const rhs_noret = sema.typeOf(rhs_result).isNoReturn(zcu); |
| 19170 | 19238 | const coerced_rhs_result = if (!rhs_noret) rhs: { |
| ... | ... | @@ -19173,7 +19241,17 @@ fn zirBoolBr( |
| 19173 | 19241 | break :rhs coerced_result; |
| 19174 | 19242 | } else rhs_result; |
| 19175 | 19243 | |
| 19176 | const result = sema.finishCondBr(parent_block, &child_block, &then_block, &else_block, lhs, block_inst); | |
| 19244 | const rhs_hint = sema.branch_hint orelse .none; | |
| 19245 | ||
| 19246 | const result = try sema.finishCondBr( | |
| 19247 | parent_block, | |
| 19248 | &child_block, | |
| 19249 | &then_block, | |
| 19250 | &else_block, | |
| 19251 | lhs, | |
| 19252 | block_inst, | |
| 19253 | if (is_bool_or) .{ .true = .none, .false = rhs_hint } else .{ .true = rhs_hint, .false = .none }, | |
| 19254 | ); | |
| 19177 | 19255 | if (!rhs_noret) { |
| 19178 | 19256 | if (try sema.resolveDefinedValue(rhs_block, rhs_src, coerced_rhs_result)) |rhs_val| { |
| 19179 | 19257 | if (is_bool_or and rhs_val.toBool()) { |
| ... | ... | @@ -19195,6 +19273,7 @@ fn finishCondBr( |
| 19195 | 19273 | else_block: *Block, |
| 19196 | 19274 | cond: Air.Inst.Ref, |
| 19197 | 19275 | block_inst: Air.Inst.Index, |
| 19276 | branch_hints: Air.CondBr.BranchHints, | |
| 19198 | 19277 | ) !Air.Inst.Ref { |
| 19199 | 19278 | const gpa = sema.gpa; |
| 19200 | 19279 | |
| ... | ... | @@ -19205,6 +19284,7 @@ fn finishCondBr( |
| 19205 | 19284 | const cond_br_payload = sema.addExtraAssumeCapacity(Air.CondBr{ |
| 19206 | 19285 | .then_body_len = @intCast(then_block.instructions.items.len), |
| 19207 | 19286 | .else_body_len = @intCast(else_block.instructions.items.len), |
| 19287 | .branch_hints = branch_hints, | |
| 19208 | 19288 | }); |
| 19209 | 19289 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(then_block.instructions.items)); |
| 19210 | 19290 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(else_block.instructions.items)); |
| ... | ... | @@ -19339,6 +19419,11 @@ fn zirCondbr( |
| 19339 | 19419 | if (try sema.resolveDefinedValue(parent_block, cond_src, cond)) |cond_val| { |
| 19340 | 19420 | const body = if (cond_val.toBool()) then_body else else_body; |
| 19341 | 19421 | |
| 19422 | // We can propagate `.cold` hints from this branch since it's comptime-known | |
| 19423 | // to be taken from the parent branch. | |
| 19424 | const parent_hint = sema.branch_hint; | |
| 19425 | defer sema.branch_hint = parent_hint orelse if (sema.branch_hint == .cold) .cold else null; | |
| 19426 | ||
| 19342 | 19427 | try sema.maybeErrorUnwrapCondbr(parent_block, body, extra.data.condition, cond_src); |
| 19343 | 19428 | // We use `analyzeBodyInner` since we want to propagate any comptime control flow to the caller. |
| 19344 | 19429 | return sema.analyzeBodyInner(parent_block, body); |
| ... | ... | @@ -19355,7 +19440,7 @@ fn zirCondbr( |
| 19355 | 19440 | sub_block.need_debug_scope = null; // this body is emitted regardless |
| 19356 | 19441 | defer sub_block.instructions.deinit(gpa); |
| 19357 | 19442 | |
| 19358 | try sema.analyzeBodyRuntimeBreak(&sub_block, then_body); | |
| 19443 | const true_hint = try sema.analyzeBodyRuntimeBreak(&sub_block, then_body); | |
| 19359 | 19444 | const true_instructions = try sub_block.instructions.toOwnedSlice(gpa); |
| 19360 | 19445 | defer gpa.free(true_instructions); |
| 19361 | 19446 | |
| ... | ... | @@ -19371,11 +19456,13 @@ fn zirCondbr( |
| 19371 | 19456 | break :blk try sub_block.addTyOp(.unwrap_errunion_err, result_ty, err_operand); |
| 19372 | 19457 | }; |
| 19373 | 19458 | |
| 19374 | if (err_cond != null and try sema.maybeErrorUnwrap(&sub_block, else_body, err_cond.?, cond_src, false)) { | |
| 19375 | // nothing to do | |
| 19376 | } else { | |
| 19377 | try sema.analyzeBodyRuntimeBreak(&sub_block, else_body); | |
| 19378 | } | |
| 19459 | const false_hint: std.builtin.BranchHint = if (err_cond != null and | |
| 19460 | try sema.maybeErrorUnwrap(&sub_block, else_body, err_cond.?, cond_src, false)) | |
| 19461 | h: { | |
| 19462 | // nothing to do here. weight against error branch | |
| 19463 | break :h .unlikely; | |
| 19464 | } else try sema.analyzeBodyRuntimeBreak(&sub_block, else_body); | |
| 19465 | ||
| 19379 | 19466 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len + |
| 19380 | 19467 | true_instructions.len + sub_block.instructions.items.len); |
| 19381 | 19468 | _ = try parent_block.addInst(.{ |
| ... | ... | @@ -19385,6 +19472,7 @@ fn zirCondbr( |
| 19385 | 19472 | .payload = sema.addExtraAssumeCapacity(Air.CondBr{ |
| 19386 | 19473 | .then_body_len = @intCast(true_instructions.len), |
| 19387 | 19474 | .else_body_len = @intCast(sub_block.instructions.items.len), |
| 19475 | .branch_hints = .{ .true = true_hint, .false = false_hint }, | |
| 19388 | 19476 | }), |
| 19389 | 19477 | } }, |
| 19390 | 19478 | }); |
| ... | ... | @@ -19409,6 +19497,11 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError! |
| 19409 | 19497 | } |
| 19410 | 19498 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(parent_block, operand_src, err_union); |
| 19411 | 19499 | if (is_non_err != .none) { |
| 19500 | // We can propagate `.cold` hints from this branch since it's comptime-known | |
| 19501 | // to be taken from the parent branch. | |
| 19502 | const parent_hint = sema.branch_hint; | |
| 19503 | defer sema.branch_hint = parent_hint orelse if (sema.branch_hint == .cold) .cold else null; | |
| 19504 | ||
| 19412 | 19505 | const is_non_err_val = (try sema.resolveDefinedValue(parent_block, operand_src, is_non_err)).?; |
| 19413 | 19506 | if (is_non_err_val.toBool()) { |
| 19414 | 19507 | return sema.analyzeErrUnionPayload(parent_block, src, err_union_ty, err_union, operand_src, false); |
| ... | ... | @@ -19422,13 +19515,19 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError! |
| 19422 | 19515 | var sub_block = parent_block.makeSubBlock(); |
| 19423 | 19516 | defer sub_block.instructions.deinit(sema.gpa); |
| 19424 | 19517 | |
| 19518 | const parent_hint = sema.branch_hint; | |
| 19519 | defer sema.branch_hint = parent_hint; | |
| 19520 | ||
| 19425 | 19521 | // This body is guaranteed to end with noreturn and has no breaks. |
| 19426 | 19522 | try sema.analyzeBodyInner(&sub_block, body); |
| 19427 | 19523 | |
| 19524 | // The only interesting hint here is `.cold`, which can come from e.g. `errdefer @panic`. | |
| 19525 | const is_cold = sema.branch_hint == .cold; | |
| 19526 | ||
| 19428 | 19527 | try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Try).Struct.fields.len + |
| 19429 | 19528 | sub_block.instructions.items.len); |
| 19430 | 19529 | const try_inst = try parent_block.addInst(.{ |
| 19431 | .tag = .@"try", | |
| 19530 | .tag = if (is_cold) .try_cold else .@"try", | |
| 19432 | 19531 | .data = .{ .pl_op = .{ |
| 19433 | 19532 | .operand = err_union, |
| 19434 | 19533 | .payload = sema.addExtraAssumeCapacity(Air.Try{ |
| ... | ... | @@ -19458,6 +19557,11 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr |
| 19458 | 19557 | } |
| 19459 | 19558 | const is_non_err = try sema.analyzeIsNonErrComptimeOnly(parent_block, operand_src, err_union); |
| 19460 | 19559 | if (is_non_err != .none) { |
| 19560 | // We can propagate `.cold` hints from this branch since it's comptime-known | |
| 19561 | // to be taken from the parent branch. | |
| 19562 | const parent_hint = sema.branch_hint; | |
| 19563 | defer sema.branch_hint = parent_hint orelse if (sema.branch_hint == .cold) .cold else null; | |
| 19564 | ||
| 19461 | 19565 | const is_non_err_val = (try sema.resolveDefinedValue(parent_block, operand_src, is_non_err)).?; |
| 19462 | 19566 | if (is_non_err_val.toBool()) { |
| 19463 | 19567 | return sema.analyzeErrUnionPayloadPtr(parent_block, src, operand, false, false); |
| ... | ... | @@ -19471,9 +19575,15 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr |
| 19471 | 19575 | var sub_block = parent_block.makeSubBlock(); |
| 19472 | 19576 | defer sub_block.instructions.deinit(sema.gpa); |
| 19473 | 19577 | |
| 19578 | const parent_hint = sema.branch_hint; | |
| 19579 | defer sema.branch_hint = parent_hint; | |
| 19580 | ||
| 19474 | 19581 | // This body is guaranteed to end with noreturn and has no breaks. |
| 19475 | 19582 | try sema.analyzeBodyInner(&sub_block, body); |
| 19476 | 19583 | |
| 19584 | // The only interesting hint here is `.cold`, which can come from e.g. `errdefer @panic`. | |
| 19585 | const is_cold = sema.branch_hint == .cold; | |
| 19586 | ||
| 19477 | 19587 | const operand_ty = sema.typeOf(operand); |
| 19478 | 19588 | const ptr_info = operand_ty.ptrInfo(zcu); |
| 19479 | 19589 | const res_ty = try pt.ptrTypeSema(.{ |
| ... | ... | @@ -19489,7 +19599,7 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr |
| 19489 | 19599 | try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).Struct.fields.len + |
| 19490 | 19600 | sub_block.instructions.items.len); |
| 19491 | 19601 | const try_inst = try parent_block.addInst(.{ |
| 19492 | .tag = .try_ptr, | |
| 19602 | .tag = if (is_cold) .try_ptr_cold else .try_ptr, | |
| 19493 | 19603 | .data = .{ .ty_pl = .{ |
| 19494 | 19604 | .ty = res_ty_ref, |
| 19495 | 19605 | .payload = sema.addExtraAssumeCapacity(Air.TryPtr{ |
| ... | ... | @@ -19741,6 +19851,8 @@ fn retWithErrTracing( |
| 19741 | 19851 | const cond_br_payload = sema.addExtraAssumeCapacity(Air.CondBr{ |
| 19742 | 19852 | .then_body_len = @intCast(then_block.instructions.items.len), |
| 19743 | 19853 | .else_body_len = @intCast(else_block.instructions.items.len), |
| 19854 | // weight against error branch | |
| 19855 | .branch_hints = .{ .true = .likely, .false = .unlikely }, | |
| 19744 | 19856 | }); |
| 19745 | 19857 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(then_block.instructions.items)); |
| 19746 | 19858 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(else_block.instructions.items)); |
| ... | ... | @@ -26753,6 +26865,7 @@ fn zirBuiltinValue(sema: *Sema, extended: Zir.Inst.Extended.InstData) CompileErr |
| 26753 | 26865 | .export_options => "ExportOptions", |
| 26754 | 26866 | .extern_options => "ExternOptions", |
| 26755 | 26867 | .type_info => "Type", |
| 26868 | .branch_hint => "BranchHint", | |
| 26756 | 26869 | |
| 26757 | 26870 | // Values are handled here. |
| 26758 | 26871 | .calling_convention_c => { |
| ... | ... | @@ -26778,6 +26891,27 @@ fn zirBuiltinValue(sema: *Sema, extended: Zir.Inst.Extended.InstData) CompileErr |
| 26778 | 26891 | return Air.internedToRef(ty.toIntern()); |
| 26779 | 26892 | } |
| 26780 | 26893 | |
| 26894 | fn zirBranchHint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { | |
| 26895 | const pt = sema.pt; | |
| 26896 | const zcu = pt.zcu; | |
| 26897 | ||
| 26898 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | |
| 26899 | const uncoerced_hint = try sema.resolveInst(extra.operand); | |
| 26900 | const operand_src = block.builtinCallArgSrc(extra.node, 0); | |
| 26901 | ||
| 26902 | const hint_ty = try pt.getBuiltinType("BranchHint"); | |
| 26903 | const coerced_hint = try sema.coerce(block, hint_ty, uncoerced_hint, operand_src); | |
| 26904 | const hint_val = try sema.resolveConstDefinedValue(block, operand_src, coerced_hint, .{ | |
| 26905 | .needed_comptime_reason = "operand to '@branchHint' must be comptime-known", | |
| 26906 | }); | |
| 26907 | ||
| 26908 | // We only apply the first hint in a branch. | |
| 26909 | // This allows user-provided hints to override implicit cold hints. | |
| 26910 | if (sema.branch_hint == null) { | |
| 26911 | sema.branch_hint = zcu.toEnum(std.builtin.BranchHint, hint_val); | |
| 26912 | } | |
| 26913 | } | |
| 26914 | ||
| 26781 | 26915 | fn requireRuntimeBlock(sema: *Sema, block: *Block, src: LazySrcLoc, runtime_src: ?LazySrcLoc) !void { |
| 26782 | 26916 | if (block.is_comptime) { |
| 26783 | 26917 | const msg = msg: { |
| ... | ... | @@ -27333,13 +27467,17 @@ fn addSafetyCheckExtra( |
| 27333 | 27467 | |
| 27334 | 27468 | sema.air_instructions.appendAssumeCapacity(.{ |
| 27335 | 27469 | .tag = .cond_br, |
| 27336 | .data = .{ .pl_op = .{ | |
| 27337 | .operand = ok, | |
| 27338 | .payload = sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 27339 | .then_body_len = 1, | |
| 27340 | .else_body_len = @intCast(fail_block.instructions.items.len), | |
| 27341 | }), | |
| 27342 | } }, | |
| 27470 | .data = .{ | |
| 27471 | .pl_op = .{ | |
| 27472 | .operand = ok, | |
| 27473 | .payload = sema.addExtraAssumeCapacity(Air.CondBr{ | |
| 27474 | .then_body_len = 1, | |
| 27475 | .else_body_len = @intCast(fail_block.instructions.items.len), | |
| 27476 | // safety check failure branch is cold | |
| 27477 | .branch_hints = .{ .true = .likely, .false = .cold }, | |
| 27478 | }), | |
| 27479 | }, | |
| 27480 | }, | |
| 27343 | 27481 | }); |
| 27344 | 27482 | sema.air_extra.appendAssumeCapacity(@intFromEnum(br_inst)); |
| 27345 | 27483 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(fail_block.instructions.items)); |
| ... | ... | @@ -27536,6 +27674,7 @@ fn safetyCheckFormatted( |
| 27536 | 27674 | try sema.addSafetyCheckExtra(parent_block, ok, &fail_block); |
| 27537 | 27675 | } |
| 27538 | 27676 | |
| 27677 | /// This does not set `sema.branch_hint`. | |
| 27539 | 27678 | fn safetyPanic(sema: *Sema, block: *Block, src: LazySrcLoc, panic_id: Zcu.PanicId) CompileError!void { |
| 27540 | 27679 | const msg_nav_index = try sema.preparePanicId(block, src, panic_id); |
| 27541 | 27680 | const msg_inst = try sema.analyzeNavVal(block, src, msg_nav_index); |
| ... | ... | @@ -37185,7 +37324,7 @@ pub fn addExtraAssumeCapacity(sema: *Sema, extra: anytype) u32 { |
| 37185 | 37324 | inline for (fields) |field| { |
| 37186 | 37325 | sema.air_extra.appendAssumeCapacity(switch (field.type) { |
| 37187 | 37326 | u32 => @field(extra, field.name), |
| 37188 | i32 => @bitCast(@field(extra, field.name)), | |
| 37327 | i32, Air.CondBr.BranchHints => @bitCast(@field(extra, field.name)), | |
| 37189 | 37328 | Air.Inst.Ref, InternPool.Index => @intFromEnum(@field(extra, field.name)), |
| 37190 | 37329 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 37191 | 37330 | }); |
| ... | ... | @@ -38253,6 +38392,12 @@ fn maybeDerefSliceAsArray( |
| 38253 | 38392 | |
| 38254 | 38393 | fn analyzeUnreachable(sema: *Sema, block: *Block, src: LazySrcLoc, safety_check: bool) !void { |
| 38255 | 38394 | if (safety_check and block.wantSafety()) { |
| 38395 | // We only apply the first hint in a branch. | |
| 38396 | // This allows user-provided hints to override implicit cold hints. | |
| 38397 | if (sema.branch_hint == null) { | |
| 38398 | sema.branch_hint = .cold; | |
| 38399 | } | |
| 38400 | ||
| 38256 | 38401 | try sema.safetyPanic(block, src, .unreach); |
| 38257 | 38402 | } else { |
| 38258 | 38403 | _ = try block.addNoOp(.unreach); |
src/Zcu/PerThread.zig+2| ... | ... | @@ -2188,6 +2188,8 @@ fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaError! |
| 2188 | 2188 | }); |
| 2189 | 2189 | } |
| 2190 | 2190 | |
| 2191 | func.setBranchHint(ip, sema.branch_hint orelse .none); | |
| 2192 | ||
| 2191 | 2193 | // If we don't get an error return trace from a caller, create our own. |
| 2192 | 2194 | if (func.analysisUnordered(ip).calls_or_awaits_errorable_fn and |
| 2193 | 2195 | zcu.comp.config.any_error_tracing and |
src/arch/aarch64/CodeGen.zig+18-24| ... | ... | @@ -795,7 +795,9 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 795 | 795 | .addrspace_cast => return self.fail("TODO implement addrspace_cast", .{}), |
| 796 | 796 | |
| 797 | 797 | .@"try" => try self.airTry(inst), |
| 798 | .try_cold => try self.airTry(inst), | |
| 798 | 799 | .try_ptr => try self.airTryPtr(inst), |
| 800 | .try_ptr_cold => try self.airTryPtr(inst), | |
| 799 | 801 | |
| 800 | 802 | .dbg_stmt => try self.airDbgStmt(inst), |
| 801 | 803 | .dbg_inline_block => try self.airDbgInlineBlock(inst), |
| ... | ... | @@ -5092,25 +5094,17 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) ! |
| 5092 | 5094 | } |
| 5093 | 5095 | |
| 5094 | 5096 | fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5095 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5096 | const condition_ty = self.typeOf(pl_op.operand); | |
| 5097 | const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 5097 | const switch_br = self.air.unwrapSwitch(inst); | |
| 5098 | const condition_ty = self.typeOf(switch_br.operand); | |
| 5098 | 5099 | const liveness = try self.liveness.getSwitchBr( |
| 5099 | 5100 | self.gpa, |
| 5100 | 5101 | inst, |
| 5101 | switch_br.data.cases_len + 1, | |
| 5102 | switch_br.cases_len + 1, | |
| 5102 | 5103 | ); |
| 5103 | 5104 | defer self.gpa.free(liveness.deaths); |
| 5104 | 5105 | |
| 5105 | var extra_index: usize = switch_br.end; | |
| 5106 | var case_i: u32 = 0; | |
| 5107 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 5108 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 5109 | const items = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra[case.end..][0..case.data.items_len])); | |
| 5110 | assert(items.len > 0); | |
| 5111 | const case_body: []const Air.Inst.Index = @ptrCast(self.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 5112 | extra_index = case.end + items.len + case_body.len; | |
| 5113 | ||
| 5106 | var it = switch_br.iterateCases(); | |
| 5107 | while (it.next()) |case| { | |
| 5114 | 5108 | // For every item, we compare it to condition and branch into |
| 5115 | 5109 | // the prong if they are equal. After we compared to all |
| 5116 | 5110 | // items, we branch into the next prong (or if no other prongs |
| ... | ... | @@ -5126,11 +5120,11 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5126 | 5120 | // prong: ... |
| 5127 | 5121 | // ... |
| 5128 | 5122 | // out: ... |
| 5129 | const branch_into_prong_relocs = try self.gpa.alloc(u32, items.len); | |
| 5123 | const branch_into_prong_relocs = try self.gpa.alloc(u32, case.items.len); | |
| 5130 | 5124 | defer self.gpa.free(branch_into_prong_relocs); |
| 5131 | 5125 | |
| 5132 | for (items, 0..) |item, idx| { | |
| 5133 | const cmp_result = try self.cmp(.{ .inst = pl_op.operand }, .{ .inst = item }, condition_ty, .neq); | |
| 5126 | for (case.items, 0..) |item, idx| { | |
| 5127 | const cmp_result = try self.cmp(.{ .inst = switch_br.operand }, .{ .inst = item }, condition_ty, .neq); | |
| 5134 | 5128 | branch_into_prong_relocs[idx] = try self.condBr(cmp_result); |
| 5135 | 5129 | } |
| 5136 | 5130 | |
| ... | ... | @@ -5156,11 +5150,11 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5156 | 5150 | _ = self.branch_stack.pop(); |
| 5157 | 5151 | } |
| 5158 | 5152 | |
| 5159 | try self.ensureProcessDeathCapacity(liveness.deaths[case_i].len); | |
| 5160 | for (liveness.deaths[case_i]) |operand| { | |
| 5153 | try self.ensureProcessDeathCapacity(liveness.deaths[case.idx].len); | |
| 5154 | for (liveness.deaths[case.idx]) |operand| { | |
| 5161 | 5155 | self.processDeath(operand); |
| 5162 | 5156 | } |
| 5163 | try self.genBody(case_body); | |
| 5157 | try self.genBody(case.body); | |
| 5164 | 5158 | |
| 5165 | 5159 | // Revert to the previous register and stack allocation state. |
| 5166 | 5160 | var saved_case_branch = self.branch_stack.pop(); |
| ... | ... | @@ -5178,8 +5172,8 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5178 | 5172 | try self.performReloc(branch_away_from_prong_reloc); |
| 5179 | 5173 | } |
| 5180 | 5174 | |
| 5181 | if (switch_br.data.else_body_len > 0) { | |
| 5182 | const else_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 5175 | if (switch_br.else_body_len > 0) { | |
| 5176 | const else_body = it.elseBody(); | |
| 5183 | 5177 | |
| 5184 | 5178 | // Capture the state of register and stack allocation state so that we can revert to it. |
| 5185 | 5179 | const parent_next_stack_offset = self.next_stack_offset; |
| ... | ... | @@ -5218,7 +5212,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5218 | 5212 | // in airCondBr. |
| 5219 | 5213 | } |
| 5220 | 5214 | |
| 5221 | return self.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none }); | |
| 5215 | return self.finishAir(inst, .unreach, .{ switch_br.operand, .none, .none }); | |
| 5222 | 5216 | } |
| 5223 | 5217 | |
| 5224 | 5218 | fn performReloc(self: *Self, inst: Mir.Inst.Index) !void { |
| ... | ... | @@ -6363,14 +6357,14 @@ fn wantSafety(self: *Self) bool { |
| 6363 | 6357 | } |
| 6364 | 6358 | |
| 6365 | 6359 | fn fail(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 6366 | @setCold(true); | |
| 6360 | @branchHint(.cold); | |
| 6367 | 6361 | assert(self.err_msg == null); |
| 6368 | 6362 | self.err_msg = try ErrorMsg.create(self.gpa, self.src_loc, format, args); |
| 6369 | 6363 | return error.CodegenFail; |
| 6370 | 6364 | } |
| 6371 | 6365 | |
| 6372 | 6366 | fn failSymbol(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 6373 | @setCold(true); | |
| 6367 | @branchHint(.cold); | |
| 6374 | 6368 | assert(self.err_msg == null); |
| 6375 | 6369 | self.err_msg = try ErrorMsg.create(self.gpa, self.src_loc, format, args); |
| 6376 | 6370 | return error.CodegenFail; |
src/arch/aarch64/Emit.zig+1-1| ... | ... | @@ -430,7 +430,7 @@ fn writeInstruction(emit: *Emit, instruction: Instruction) !void { |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | fn fail(emit: *Emit, comptime format: []const u8, args: anytype) InnerError { |
| 433 | @setCold(true); | |
| 433 | @branchHint(.cold); | |
| 434 | 434 | assert(emit.err_msg == null); |
| 435 | 435 | const comp = emit.bin_file.comp; |
| 436 | 436 | const gpa = comp.gpa; |
src/arch/arm/CodeGen.zig+18-24| ... | ... | @@ -782,7 +782,9 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 782 | 782 | .addrspace_cast => return self.fail("TODO implement addrspace_cast", .{}), |
| 783 | 783 | |
| 784 | 784 | .@"try" => try self.airTry(inst), |
| 785 | .try_cold => try self.airTry(inst), | |
| 785 | 786 | .try_ptr => try self.airTryPtr(inst), |
| 787 | .try_ptr_cold => try self.airTryPtr(inst), | |
| 786 | 788 | |
| 787 | 789 | .dbg_stmt => try self.airDbgStmt(inst), |
| 788 | 790 | .dbg_inline_block => try self.airDbgInlineBlock(inst), |
| ... | ... | @@ -5040,25 +5042,17 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) ! |
| 5040 | 5042 | } |
| 5041 | 5043 | |
| 5042 | 5044 | fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5043 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5044 | const condition_ty = self.typeOf(pl_op.operand); | |
| 5045 | const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 5045 | const switch_br = self.air.unwrapSwitch(inst); | |
| 5046 | const condition_ty = self.typeOf(switch_br.operand); | |
| 5046 | 5047 | const liveness = try self.liveness.getSwitchBr( |
| 5047 | 5048 | self.gpa, |
| 5048 | 5049 | inst, |
| 5049 | switch_br.data.cases_len + 1, | |
| 5050 | switch_br.cases_len + 1, | |
| 5050 | 5051 | ); |
| 5051 | 5052 | defer self.gpa.free(liveness.deaths); |
| 5052 | 5053 | |
| 5053 | var extra_index: usize = switch_br.end; | |
| 5054 | var case_i: u32 = 0; | |
| 5055 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 5056 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 5057 | const items: []const Air.Inst.Ref = @ptrCast(self.air.extra[case.end..][0..case.data.items_len]); | |
| 5058 | assert(items.len > 0); | |
| 5059 | const case_body: []const Air.Inst.Index = @ptrCast(self.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 5060 | extra_index = case.end + items.len + case_body.len; | |
| 5061 | ||
| 5054 | var it = switch_br.iterateCases(); | |
| 5055 | while (it.next()) |case| { | |
| 5062 | 5056 | // For every item, we compare it to condition and branch into |
| 5063 | 5057 | // the prong if they are equal. After we compared to all |
| 5064 | 5058 | // items, we branch into the next prong (or if no other prongs |
| ... | ... | @@ -5074,11 +5068,11 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5074 | 5068 | // prong: ... |
| 5075 | 5069 | // ... |
| 5076 | 5070 | // out: ... |
| 5077 | const branch_into_prong_relocs = try self.gpa.alloc(u32, items.len); | |
| 5071 | const branch_into_prong_relocs = try self.gpa.alloc(u32, case.items.len); | |
| 5078 | 5072 | defer self.gpa.free(branch_into_prong_relocs); |
| 5079 | 5073 | |
| 5080 | for (items, 0..) |item, idx| { | |
| 5081 | const cmp_result = try self.cmp(.{ .inst = pl_op.operand }, .{ .inst = item }, condition_ty, .neq); | |
| 5074 | for (case.items, 0..) |item, idx| { | |
| 5075 | const cmp_result = try self.cmp(.{ .inst = switch_br.operand }, .{ .inst = item }, condition_ty, .neq); | |
| 5082 | 5076 | branch_into_prong_relocs[idx] = try self.condBr(cmp_result); |
| 5083 | 5077 | } |
| 5084 | 5078 | |
| ... | ... | @@ -5104,11 +5098,11 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5104 | 5098 | _ = self.branch_stack.pop(); |
| 5105 | 5099 | } |
| 5106 | 5100 | |
| 5107 | try self.ensureProcessDeathCapacity(liveness.deaths[case_i].len); | |
| 5108 | for (liveness.deaths[case_i]) |operand| { | |
| 5101 | try self.ensureProcessDeathCapacity(liveness.deaths[case.idx].len); | |
| 5102 | for (liveness.deaths[case.idx]) |operand| { | |
| 5109 | 5103 | self.processDeath(operand); |
| 5110 | 5104 | } |
| 5111 | try self.genBody(case_body); | |
| 5105 | try self.genBody(case.body); | |
| 5112 | 5106 | |
| 5113 | 5107 | // Revert to the previous register and stack allocation state. |
| 5114 | 5108 | var saved_case_branch = self.branch_stack.pop(); |
| ... | ... | @@ -5126,8 +5120,8 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5126 | 5120 | try self.performReloc(branch_away_from_prong_reloc); |
| 5127 | 5121 | } |
| 5128 | 5122 | |
| 5129 | if (switch_br.data.else_body_len > 0) { | |
| 5130 | const else_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 5123 | if (switch_br.else_body_len > 0) { | |
| 5124 | const else_body = it.elseBody(); | |
| 5131 | 5125 | |
| 5132 | 5126 | // Capture the state of register and stack allocation state so that we can revert to it. |
| 5133 | 5127 | const parent_next_stack_offset = self.next_stack_offset; |
| ... | ... | @@ -5166,7 +5160,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 5166 | 5160 | // in airCondBr. |
| 5167 | 5161 | } |
| 5168 | 5162 | |
| 5169 | return self.finishAir(inst, .unreach, .{ pl_op.operand, .none, .none }); | |
| 5163 | return self.finishAir(inst, .unreach, .{ switch_br.operand, .none, .none }); | |
| 5170 | 5164 | } |
| 5171 | 5165 | |
| 5172 | 5166 | fn performReloc(self: *Self, inst: Mir.Inst.Index) !void { |
| ... | ... | @@ -6319,7 +6313,7 @@ fn wantSafety(self: *Self) bool { |
| 6319 | 6313 | } |
| 6320 | 6314 | |
| 6321 | 6315 | fn fail(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 6322 | @setCold(true); | |
| 6316 | @branchHint(.cold); | |
| 6323 | 6317 | assert(self.err_msg == null); |
| 6324 | 6318 | const gpa = self.gpa; |
| 6325 | 6319 | self.err_msg = try ErrorMsg.create(gpa, self.src_loc, format, args); |
| ... | ... | @@ -6327,7 +6321,7 @@ fn fail(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 6327 | 6321 | } |
| 6328 | 6322 | |
| 6329 | 6323 | fn failSymbol(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 6330 | @setCold(true); | |
| 6324 | @branchHint(.cold); | |
| 6331 | 6325 | assert(self.err_msg == null); |
| 6332 | 6326 | const gpa = self.gpa; |
| 6333 | 6327 | self.err_msg = try ErrorMsg.create(gpa, self.src_loc, format, args); |
src/arch/arm/Emit.zig+1-1| ... | ... | @@ -348,7 +348,7 @@ fn writeInstruction(emit: *Emit, instruction: Instruction) !void { |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | fn fail(emit: *Emit, comptime format: []const u8, args: anytype) InnerError { |
| 351 | @setCold(true); | |
| 351 | @branchHint(.cold); | |
| 352 | 352 | assert(emit.err_msg == null); |
| 353 | 353 | const comp = emit.bin_file.comp; |
| 354 | 354 | const gpa = comp.gpa; |
src/arch/riscv64/CodeGen.zig+18-25| ... | ... | @@ -1640,7 +1640,9 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1640 | 1640 | .addrspace_cast => return func.fail("TODO: addrspace_cast", .{}), |
| 1641 | 1641 | |
| 1642 | 1642 | .@"try" => try func.airTry(inst), |
| 1643 | .try_cold => try func.airTry(inst), | |
| 1643 | 1644 | .try_ptr => return func.fail("TODO: try_ptr", .{}), |
| 1645 | .try_ptr_cold => return func.fail("TODO: try_ptr_cold", .{}), | |
| 1644 | 1646 | |
| 1645 | 1647 | .dbg_var_ptr, |
| 1646 | 1648 | .dbg_var_val, |
| ... | ... | @@ -5659,38 +5661,30 @@ fn lowerBlock(func: *Func, inst: Air.Inst.Index, body: []const Air.Inst.Index) ! |
| 5659 | 5661 | } |
| 5660 | 5662 | |
| 5661 | 5663 | fn airSwitchBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5662 | const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5663 | const condition_ty = func.typeOf(pl_op.operand); | |
| 5664 | const switch_br = func.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 5665 | var extra_index: usize = switch_br.end; | |
| 5666 | var case_i: u32 = 0; | |
| 5667 | const liveness = try func.liveness.getSwitchBr(func.gpa, inst, switch_br.data.cases_len + 1); | |
| 5664 | const switch_br = func.air.unwrapSwitch(inst); | |
| 5665 | ||
| 5666 | const liveness = try func.liveness.getSwitchBr(func.gpa, inst, switch_br.cases_len + 1); | |
| 5668 | 5667 | defer func.gpa.free(liveness.deaths); |
| 5669 | 5668 | |
| 5670 | const condition = try func.resolveInst(pl_op.operand); | |
| 5669 | const condition = try func.resolveInst(switch_br.operand); | |
| 5670 | const condition_ty = func.typeOf(switch_br.operand); | |
| 5671 | 5671 | |
| 5672 | 5672 | // If the condition dies here in this switch instruction, process |
| 5673 | 5673 | // that death now instead of later as this has an effect on |
| 5674 | 5674 | // whether it needs to be spilled in the branches |
| 5675 | 5675 | if (func.liveness.operandDies(inst, 0)) { |
| 5676 | if (pl_op.operand.toIndex()) |op_inst| try func.processDeath(op_inst); | |
| 5676 | if (switch_br.operand.toIndex()) |op_inst| try func.processDeath(op_inst); | |
| 5677 | 5677 | } |
| 5678 | 5678 | |
| 5679 | 5679 | func.scope_generation += 1; |
| 5680 | 5680 | const state = try func.saveState(); |
| 5681 | 5681 | |
| 5682 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 5683 | const case = func.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 5684 | const items: []const Air.Inst.Ref = | |
| 5685 | @ptrCast(func.air.extra[case.end..][0..case.data.items_len]); | |
| 5686 | const case_body: []const Air.Inst.Index = | |
| 5687 | @ptrCast(func.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 5688 | extra_index = case.end + items.len + case_body.len; | |
| 5689 | ||
| 5690 | var relocs = try func.gpa.alloc(Mir.Inst.Index, items.len); | |
| 5682 | var it = switch_br.iterateCases(); | |
| 5683 | while (it.next()) |case| { | |
| 5684 | var relocs = try func.gpa.alloc(Mir.Inst.Index, case.items.len); | |
| 5691 | 5685 | defer func.gpa.free(relocs); |
| 5692 | 5686 | |
| 5693 | for (items, relocs, 0..) |item, *reloc, i| { | |
| 5687 | for (case.items, relocs, 0..) |item, *reloc, i| { | |
| 5694 | 5688 | const item_mcv = try func.resolveInst(item); |
| 5695 | 5689 | |
| 5696 | 5690 | const cond_lock = switch (condition) { |
| ... | ... | @@ -5724,10 +5718,10 @@ fn airSwitchBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5724 | 5718 | reloc.* = try func.condBr(condition_ty, .{ .register = cmp_reg }); |
| 5725 | 5719 | } |
| 5726 | 5720 | |
| 5727 | for (liveness.deaths[case_i]) |operand| try func.processDeath(operand); | |
| 5721 | for (liveness.deaths[case.idx]) |operand| try func.processDeath(operand); | |
| 5728 | 5722 | |
| 5729 | 5723 | for (relocs[0 .. relocs.len - 1]) |reloc| func.performReloc(reloc); |
| 5730 | try func.genBody(case_body); | |
| 5724 | try func.genBody(case.body); | |
| 5731 | 5725 | try func.restoreState(state, &.{}, .{ |
| 5732 | 5726 | .emit_instructions = false, |
| 5733 | 5727 | .update_tracking = true, |
| ... | ... | @@ -5738,9 +5732,8 @@ fn airSwitchBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5738 | 5732 | func.performReloc(relocs[relocs.len - 1]); |
| 5739 | 5733 | } |
| 5740 | 5734 | |
| 5741 | if (switch_br.data.else_body_len > 0) { | |
| 5742 | const else_body: []const Air.Inst.Index = | |
| 5743 | @ptrCast(func.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 5735 | if (switch_br.else_body_len > 0) { | |
| 5736 | const else_body = it.elseBody(); | |
| 5744 | 5737 | |
| 5745 | 5738 | const else_deaths = liveness.deaths.len - 1; |
| 5746 | 5739 | for (liveness.deaths[else_deaths]) |operand| try func.processDeath(operand); |
| ... | ... | @@ -8230,14 +8223,14 @@ fn wantSafety(func: *Func) bool { |
| 8230 | 8223 | } |
| 8231 | 8224 | |
| 8232 | 8225 | fn fail(func: *Func, comptime format: []const u8, args: anytype) InnerError { |
| 8233 | @setCold(true); | |
| 8226 | @branchHint(.cold); | |
| 8234 | 8227 | assert(func.err_msg == null); |
| 8235 | 8228 | func.err_msg = try ErrorMsg.create(func.gpa, func.src_loc, format, args); |
| 8236 | 8229 | return error.CodegenFail; |
| 8237 | 8230 | } |
| 8238 | 8231 | |
| 8239 | 8232 | fn failSymbol(func: *Func, comptime format: []const u8, args: anytype) InnerError { |
| 8240 | @setCold(true); | |
| 8233 | @branchHint(.cold); | |
| 8241 | 8234 | assert(func.err_msg == null); |
| 8242 | 8235 | func.err_msg = try ErrorMsg.create(func.gpa, func.src_loc, format, args); |
| 8243 | 8236 | return error.CodegenFail; |
src/arch/riscv64/Lower.zig+1-1| ... | ... | @@ -583,7 +583,7 @@ fn pushPopRegList(lower: *Lower, comptime spilling: bool, reg_list: Mir.Register |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | pub fn fail(lower: *Lower, comptime format: []const u8, args: anytype) Error { |
| 586 | @setCold(true); | |
| 586 | @branchHint(.cold); | |
| 587 | 587 | assert(lower.err_msg == null); |
| 588 | 588 | lower.err_msg = try ErrorMsg.create(lower.allocator, lower.src_loc, format, args); |
| 589 | 589 | return error.LowerFail; |
src/arch/sparc64/CodeGen.zig+3-1| ... | ... | @@ -637,7 +637,9 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 637 | 637 | .addrspace_cast => @panic("TODO try self.airAddrSpaceCast(int)"), |
| 638 | 638 | |
| 639 | 639 | .@"try" => try self.airTry(inst), |
| 640 | .try_cold => try self.airTry(inst), | |
| 640 | 641 | .try_ptr => @panic("TODO try self.airTryPtr(inst)"), |
| 642 | .try_ptr_cold => @panic("TODO try self.airTryPtrCold(inst)"), | |
| 641 | 643 | |
| 642 | 644 | .dbg_stmt => try self.airDbgStmt(inst), |
| 643 | 645 | .dbg_inline_block => try self.airDbgInlineBlock(inst), |
| ... | ... | @@ -3531,7 +3533,7 @@ fn errUnionPayload(self: *Self, error_union_mcv: MCValue, error_union_ty: Type) |
| 3531 | 3533 | } |
| 3532 | 3534 | |
| 3533 | 3535 | fn fail(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 3534 | @setCold(true); | |
| 3536 | @branchHint(.cold); | |
| 3535 | 3537 | assert(self.err_msg == null); |
| 3536 | 3538 | const gpa = self.gpa; |
| 3537 | 3539 | self.err_msg = try ErrorMsg.create(gpa, self.src_loc, format, args); |
src/arch/sparc64/Emit.zig+1-1| ... | ... | @@ -511,7 +511,7 @@ fn dbgAdvancePCAndLine(emit: *Emit, line: u32, column: u32) !void { |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | fn fail(emit: *Emit, comptime format: []const u8, args: anytype) InnerError { |
| 514 | @setCold(true); | |
| 514 | @branchHint(.cold); | |
| 515 | 515 | assert(emit.err_msg == null); |
| 516 | 516 | const comp = emit.bin_file.comp; |
| 517 | 517 | const gpa = comp.gpa; |
src/arch/wasm/CodeGen.zig+16-20| ... | ... | @@ -1913,7 +1913,9 @@ fn genInst(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1913 | 1913 | .get_union_tag => func.airGetUnionTag(inst), |
| 1914 | 1914 | |
| 1915 | 1915 | .@"try" => func.airTry(inst), |
| 1916 | .try_cold => func.airTry(inst), | |
| 1916 | 1917 | .try_ptr => func.airTryPtr(inst), |
| 1918 | .try_ptr_cold => func.airTryPtr(inst), | |
| 1917 | 1919 | |
| 1918 | 1920 | .dbg_stmt => func.airDbgStmt(inst), |
| 1919 | 1921 | .dbg_inline_block => func.airDbgInlineBlock(inst), |
| ... | ... | @@ -4041,37 +4043,31 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4041 | 4043 | const zcu = pt.zcu; |
| 4042 | 4044 | // result type is always 'noreturn' |
| 4043 | 4045 | const blocktype = wasm.block_empty; |
| 4044 | const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 4045 | const target = try func.resolveInst(pl_op.operand); | |
| 4046 | const target_ty = func.typeOf(pl_op.operand); | |
| 4047 | const switch_br = func.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 4048 | const liveness = try func.liveness.getSwitchBr(func.gpa, inst, switch_br.data.cases_len + 1); | |
| 4046 | const switch_br = func.air.unwrapSwitch(inst); | |
| 4047 | const target = try func.resolveInst(switch_br.operand); | |
| 4048 | const target_ty = func.typeOf(switch_br.operand); | |
| 4049 | const liveness = try func.liveness.getSwitchBr(func.gpa, inst, switch_br.cases_len + 1); | |
| 4049 | 4050 | defer func.gpa.free(liveness.deaths); |
| 4050 | 4051 | |
| 4051 | var extra_index: usize = switch_br.end; | |
| 4052 | var case_i: u32 = 0; | |
| 4053 | ||
| 4054 | 4052 | // a list that maps each value with its value and body based on the order inside the list. |
| 4055 | 4053 | const CaseValue = struct { integer: i32, value: Value }; |
| 4056 | 4054 | var case_list = try std.ArrayList(struct { |
| 4057 | 4055 | values: []const CaseValue, |
| 4058 | 4056 | body: []const Air.Inst.Index, |
| 4059 | }).initCapacity(func.gpa, switch_br.data.cases_len); | |
| 4057 | }).initCapacity(func.gpa, switch_br.cases_len); | |
| 4060 | 4058 | defer for (case_list.items) |case| { |
| 4061 | 4059 | func.gpa.free(case.values); |
| 4062 | 4060 | } else case_list.deinit(); |
| 4063 | 4061 | |
| 4064 | 4062 | var lowest_maybe: ?i32 = null; |
| 4065 | 4063 | var highest_maybe: ?i32 = null; |
| 4066 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 4067 | const case = func.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 4068 | const items: []const Air.Inst.Ref = @ptrCast(func.air.extra[case.end..][0..case.data.items_len]); | |
| 4069 | const case_body: []const Air.Inst.Index = @ptrCast(func.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 4070 | extra_index = case.end + items.len + case_body.len; | |
| 4071 | const values = try func.gpa.alloc(CaseValue, items.len); | |
| 4064 | ||
| 4065 | var it = switch_br.iterateCases(); | |
| 4066 | while (it.next()) |case| { | |
| 4067 | const values = try func.gpa.alloc(CaseValue, case.items.len); | |
| 4072 | 4068 | errdefer func.gpa.free(values); |
| 4073 | 4069 | |
| 4074 | for (items, 0..) |ref, i| { | |
| 4070 | for (case.items, 0..) |ref, i| { | |
| 4075 | 4071 | const item_val = (try func.air.value(ref, pt)).?; |
| 4076 | 4072 | const int_val = func.valueAsI32(item_val); |
| 4077 | 4073 | if (lowest_maybe == null or int_val < lowest_maybe.?) { |
| ... | ... | @@ -4083,7 +4079,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4083 | 4079 | values[i] = .{ .integer = int_val, .value = item_val }; |
| 4084 | 4080 | } |
| 4085 | 4081 | |
| 4086 | case_list.appendAssumeCapacity(.{ .values = values, .body = case_body }); | |
| 4082 | case_list.appendAssumeCapacity(.{ .values = values, .body = case.body }); | |
| 4087 | 4083 | try func.startBlock(.block, blocktype); |
| 4088 | 4084 | } |
| 4089 | 4085 | |
| ... | ... | @@ -4097,7 +4093,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4097 | 4093 | // TODO: Benchmark this to find a proper value, LLVM seems to draw the line at '40~45'. |
| 4098 | 4094 | const is_sparse = highest - lowest > 50 or target_ty.bitSize(zcu) > 32; |
| 4099 | 4095 | |
| 4100 | const else_body: []const Air.Inst.Index = @ptrCast(func.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 4096 | const else_body = it.elseBody(); | |
| 4101 | 4097 | const has_else_body = else_body.len != 0; |
| 4102 | 4098 | if (has_else_body) { |
| 4103 | 4099 | try func.startBlock(.block, blocktype); |
| ... | ... | @@ -4140,11 +4136,11 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4140 | 4136 | // for errors that are not present in any branch. This is fine as this default |
| 4141 | 4137 | // case will never be hit for those cases but we do save runtime cost and size |
| 4142 | 4138 | // by using a jump table for this instead of if-else chains. |
| 4143 | break :blk if (has_else_body or target_ty.zigTypeTag(zcu) == .ErrorSet) case_i else unreachable; | |
| 4139 | break :blk if (has_else_body or target_ty.zigTypeTag(zcu) == .ErrorSet) switch_br.cases_len else unreachable; | |
| 4144 | 4140 | }; |
| 4145 | 4141 | func.mir_extra.appendAssumeCapacity(idx); |
| 4146 | 4142 | } else if (has_else_body) { |
| 4147 | func.mir_extra.appendAssumeCapacity(case_i); // default branch | |
| 4143 | func.mir_extra.appendAssumeCapacity(switch_br.cases_len); // default branch | |
| 4148 | 4144 | } |
| 4149 | 4145 | try func.endBlock(); |
| 4150 | 4146 | } |
src/arch/wasm/Emit.zig+1-1| ... | ... | @@ -252,7 +252,7 @@ fn offset(self: Emit) u32 { |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | fn fail(emit: *Emit, comptime format: []const u8, args: anytype) InnerError { |
| 255 | @setCold(true); | |
| 255 | @branchHint(.cold); | |
| 256 | 256 | std.debug.assert(emit.error_msg == null); |
| 257 | 257 | const comp = emit.bin_file.base.comp; |
| 258 | 258 | const zcu = comp.zcu.?; |
src/arch/x86_64/CodeGen.zig+17-25| ... | ... | @@ -2262,7 +2262,9 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 2262 | 2262 | .addrspace_cast => return self.fail("TODO implement addrspace_cast", .{}), |
| 2263 | 2263 | |
| 2264 | 2264 | .@"try" => try self.airTry(inst), |
| 2265 | .try_cold => try self.airTry(inst), // TODO | |
| 2265 | 2266 | .try_ptr => try self.airTryPtr(inst), |
| 2267 | .try_ptr_cold => try self.airTryPtr(inst), // TODO | |
| 2266 | 2268 | |
| 2267 | 2269 | .dbg_stmt => try self.airDbgStmt(inst), |
| 2268 | 2270 | .dbg_inline_block => try self.airDbgInlineBlock(inst), |
| ... | ... | @@ -13631,38 +13633,29 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) ! |
| 13631 | 13633 | } |
| 13632 | 13634 | |
| 13633 | 13635 | fn airSwitchBr(self: *Self, inst: Air.Inst.Index) !void { |
| 13634 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 13635 | const condition = try self.resolveInst(pl_op.operand); | |
| 13636 | const condition_ty = self.typeOf(pl_op.operand); | |
| 13637 | const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 13638 | var extra_index: usize = switch_br.end; | |
| 13639 | var case_i: u32 = 0; | |
| 13640 | const liveness = try self.liveness.getSwitchBr(self.gpa, inst, switch_br.data.cases_len + 1); | |
| 13636 | const switch_br = self.air.unwrapSwitch(inst); | |
| 13637 | const condition = try self.resolveInst(switch_br.operand); | |
| 13638 | const condition_ty = self.typeOf(switch_br.operand); | |
| 13639 | const liveness = try self.liveness.getSwitchBr(self.gpa, inst, switch_br.cases_len + 1); | |
| 13641 | 13640 | defer self.gpa.free(liveness.deaths); |
| 13642 | 13641 | |
| 13643 | 13642 | // If the condition dies here in this switch instruction, process |
| 13644 | 13643 | // that death now instead of later as this has an effect on |
| 13645 | 13644 | // whether it needs to be spilled in the branches |
| 13646 | 13645 | if (self.liveness.operandDies(inst, 0)) { |
| 13647 | if (pl_op.operand.toIndex()) |op_inst| try self.processDeath(op_inst); | |
| 13646 | if (switch_br.operand.toIndex()) |op_inst| try self.processDeath(op_inst); | |
| 13648 | 13647 | } |
| 13649 | 13648 | |
| 13650 | 13649 | self.scope_generation += 1; |
| 13651 | 13650 | const state = try self.saveState(); |
| 13652 | 13651 | |
| 13653 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 13654 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 13655 | const items: []const Air.Inst.Ref = | |
| 13656 | @ptrCast(self.air.extra[case.end..][0..case.data.items_len]); | |
| 13657 | const case_body: []const Air.Inst.Index = | |
| 13658 | @ptrCast(self.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 13659 | extra_index = case.end + items.len + case_body.len; | |
| 13660 | ||
| 13661 | var relocs = try self.gpa.alloc(Mir.Inst.Index, items.len); | |
| 13652 | var it = switch_br.iterateCases(); | |
| 13653 | while (it.next()) |case| { | |
| 13654 | var relocs = try self.gpa.alloc(Mir.Inst.Index, case.items.len); | |
| 13662 | 13655 | defer self.gpa.free(relocs); |
| 13663 | 13656 | |
| 13664 | 13657 | try self.spillEflagsIfOccupied(); |
| 13665 | for (items, relocs, 0..) |item, *reloc, i| { | |
| 13658 | for (case.items, relocs, 0..) |item, *reloc, i| { | |
| 13666 | 13659 | const item_mcv = try self.resolveInst(item); |
| 13667 | 13660 | const cc: Condition = switch (condition) { |
| 13668 | 13661 | .eflags => |cc| switch (item_mcv.immediate) { |
| ... | ... | @@ -13678,10 +13671,10 @@ fn airSwitchBr(self: *Self, inst: Air.Inst.Index) !void { |
| 13678 | 13671 | reloc.* = try self.asmJccReloc(if (i < relocs.len - 1) cc else cc.negate(), undefined); |
| 13679 | 13672 | } |
| 13680 | 13673 | |
| 13681 | for (liveness.deaths[case_i]) |operand| try self.processDeath(operand); | |
| 13674 | for (liveness.deaths[case.idx]) |operand| try self.processDeath(operand); | |
| 13682 | 13675 | |
| 13683 | 13676 | for (relocs[0 .. relocs.len - 1]) |reloc| self.performReloc(reloc); |
| 13684 | try self.genBody(case_body); | |
| 13677 | try self.genBody(case.body); | |
| 13685 | 13678 | try self.restoreState(state, &.{}, .{ |
| 13686 | 13679 | .emit_instructions = false, |
| 13687 | 13680 | .update_tracking = true, |
| ... | ... | @@ -13692,9 +13685,8 @@ fn airSwitchBr(self: *Self, inst: Air.Inst.Index) !void { |
| 13692 | 13685 | self.performReloc(relocs[relocs.len - 1]); |
| 13693 | 13686 | } |
| 13694 | 13687 | |
| 13695 | if (switch_br.data.else_body_len > 0) { | |
| 13696 | const else_body: []const Air.Inst.Index = | |
| 13697 | @ptrCast(self.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 13688 | if (switch_br.else_body_len > 0) { | |
| 13689 | const else_body = it.elseBody(); | |
| 13698 | 13690 | |
| 13699 | 13691 | const else_deaths = liveness.deaths.len - 1; |
| 13700 | 13692 | for (liveness.deaths[else_deaths]) |operand| try self.processDeath(operand); |
| ... | ... | @@ -19211,7 +19203,7 @@ fn resolveCallingConventionValues( |
| 19211 | 19203 | } |
| 19212 | 19204 | |
| 19213 | 19205 | fn fail(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 19214 | @setCold(true); | |
| 19206 | @branchHint(.cold); | |
| 19215 | 19207 | assert(self.err_msg == null); |
| 19216 | 19208 | const gpa = self.gpa; |
| 19217 | 19209 | self.err_msg = try ErrorMsg.create(gpa, self.src_loc, format, args); |
| ... | ... | @@ -19219,7 +19211,7 @@ fn fail(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 19219 | 19211 | } |
| 19220 | 19212 | |
| 19221 | 19213 | fn failSymbol(self: *Self, comptime format: []const u8, args: anytype) InnerError { |
| 19222 | @setCold(true); | |
| 19214 | @branchHint(.cold); | |
| 19223 | 19215 | assert(self.err_msg == null); |
| 19224 | 19216 | const gpa = self.gpa; |
| 19225 | 19217 | self.err_msg = try ErrorMsg.create(gpa, self.src_loc, format, args); |
src/arch/x86_64/Lower.zig+1-1| ... | ... | @@ -293,7 +293,7 @@ pub fn lowerMir(lower: *Lower, index: Mir.Inst.Index) Error!struct { |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | pub fn fail(lower: *Lower, comptime format: []const u8, args: anytype) Error { |
| 296 | @setCold(true); | |
| 296 | @branchHint(.cold); | |
| 297 | 297 | assert(lower.err_msg == null); |
| 298 | 298 | lower.err_msg = try Zcu.ErrorMsg.create(lower.allocator, lower.src_loc, format, args); |
| 299 | 299 | return error.LowerFail; |
src/codegen/c.zig+20-25| ... | ... | @@ -626,7 +626,7 @@ pub const DeclGen = struct { |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | fn fail(dg: *DeclGen, comptime format: []const u8, args: anytype) error{ AnalysisFail, OutOfMemory } { |
| 629 | @setCold(true); | |
| 629 | @branchHint(.cold); | |
| 630 | 630 | const zcu = dg.pt.zcu; |
| 631 | 631 | const src_loc = zcu.navSrcLoc(dg.pass.nav); |
| 632 | 632 | dg.error_msg = try Zcu.ErrorMsg.create(dg.gpa, src_loc, format, args); |
| ... | ... | @@ -1786,7 +1786,7 @@ pub const DeclGen = struct { |
| 1786 | 1786 | else => unreachable, |
| 1787 | 1787 | } |
| 1788 | 1788 | } |
| 1789 | if (fn_val.getFunction(zcu)) |func| if (func.analysisUnordered(ip).is_cold) | |
| 1789 | if (fn_val.getFunction(zcu)) |func| if (func.analysisUnordered(ip).branch_hint == .cold) | |
| 1790 | 1790 | try w.writeAll("zig_cold "); |
| 1791 | 1791 | if (fn_info.return_type == .noreturn_type) try w.writeAll("zig_noreturn "); |
| 1792 | 1792 | |
| ... | ... | @@ -3290,8 +3290,10 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, |
| 3290 | 3290 | .prefetch => try airPrefetch(f, inst), |
| 3291 | 3291 | .addrspace_cast => return f.fail("TODO: C backend: implement addrspace_cast", .{}), |
| 3292 | 3292 | |
| 3293 | .@"try" => try airTry(f, inst), | |
| 3294 | .try_ptr => try airTryPtr(f, inst), | |
| 3293 | .@"try" => try airTry(f, inst), | |
| 3294 | .try_cold => try airTry(f, inst), | |
| 3295 | .try_ptr => try airTryPtr(f, inst), | |
| 3296 | .try_ptr_cold => try airTryPtr(f, inst), | |
| 3295 | 3297 | |
| 3296 | 3298 | .dbg_stmt => try airDbgStmt(f, inst), |
| 3297 | 3299 | .dbg_inline_block => try airDbgInlineBlock(f, inst), |
| ... | ... | @@ -4988,11 +4990,10 @@ fn airCondBr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4988 | 4990 | fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4989 | 4991 | const pt = f.object.dg.pt; |
| 4990 | 4992 | const zcu = pt.zcu; |
| 4991 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 4992 | const condition = try f.resolveInst(pl_op.operand); | |
| 4993 | try reap(f, inst, &.{pl_op.operand}); | |
| 4994 | const condition_ty = f.typeOf(pl_op.operand); | |
| 4995 | const switch_br = f.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 4993 | const switch_br = f.air.unwrapSwitch(inst); | |
| 4994 | const condition = try f.resolveInst(switch_br.operand); | |
| 4995 | try reap(f, inst, &.{switch_br.operand}); | |
| 4996 | const condition_ty = f.typeOf(switch_br.operand); | |
| 4996 | 4997 | const writer = f.object.writer(); |
| 4997 | 4998 | |
| 4998 | 4999 | try writer.writeAll("switch ("); |
| ... | ... | @@ -5013,22 +5014,16 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5013 | 5014 | f.object.indent_writer.pushIndent(); |
| 5014 | 5015 | |
| 5015 | 5016 | const gpa = f.object.dg.gpa; |
| 5016 | const liveness = try f.liveness.getSwitchBr(gpa, inst, switch_br.data.cases_len + 1); | |
| 5017 | const liveness = try f.liveness.getSwitchBr(gpa, inst, switch_br.cases_len + 1); | |
| 5017 | 5018 | defer gpa.free(liveness.deaths); |
| 5018 | 5019 | |
| 5019 | 5020 | // On the final iteration we do not need to fix any state. This is because, like in the `else` |
| 5020 | 5021 | // branch of a `cond_br`, our parent has to do it for this entire body anyway. |
| 5021 | const last_case_i = switch_br.data.cases_len - @intFromBool(switch_br.data.else_body_len == 0); | |
| 5022 | ||
| 5023 | var extra_index: usize = switch_br.end; | |
| 5024 | for (0..switch_br.data.cases_len) |case_i| { | |
| 5025 | const case = f.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 5026 | const items = @as([]const Air.Inst.Ref, @ptrCast(f.air.extra[case.end..][0..case.data.items_len])); | |
| 5027 | const case_body: []const Air.Inst.Index = | |
| 5028 | @ptrCast(f.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 5029 | extra_index = case.end + case.data.items_len + case_body.len; | |
| 5022 | const last_case_i = switch_br.cases_len - @intFromBool(switch_br.else_body_len == 0); | |
| 5030 | 5023 | |
| 5031 | for (items) |item| { | |
| 5024 | var it = switch_br.iterateCases(); | |
| 5025 | while (it.next()) |case| { | |
| 5026 | for (case.items) |item| { | |
| 5032 | 5027 | try f.object.indent_writer.insertNewline(); |
| 5033 | 5028 | try writer.writeAll("case "); |
| 5034 | 5029 | const item_value = try f.air.value(item, pt); |
| ... | ... | @@ -5046,19 +5041,19 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5046 | 5041 | } |
| 5047 | 5042 | try writer.writeByte(' '); |
| 5048 | 5043 | |
| 5049 | if (case_i != last_case_i) { | |
| 5050 | try genBodyResolveState(f, inst, liveness.deaths[case_i], case_body, false); | |
| 5044 | if (case.idx != last_case_i) { | |
| 5045 | try genBodyResolveState(f, inst, liveness.deaths[case.idx], case.body, false); | |
| 5051 | 5046 | } else { |
| 5052 | for (liveness.deaths[case_i]) |death| { | |
| 5047 | for (liveness.deaths[case.idx]) |death| { | |
| 5053 | 5048 | try die(f, inst, death.toRef()); |
| 5054 | 5049 | } |
| 5055 | try genBody(f, case_body); | |
| 5050 | try genBody(f, case.body); | |
| 5056 | 5051 | } |
| 5057 | 5052 | |
| 5058 | 5053 | // The case body must be noreturn so we don't need to insert a break. |
| 5059 | 5054 | } |
| 5060 | 5055 | |
| 5061 | const else_body: []const Air.Inst.Index = @ptrCast(f.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 5056 | const else_body = it.elseBody(); | |
| 5062 | 5057 | try f.object.indent_writer.insertNewline(); |
| 5063 | 5058 | if (else_body.len > 0) { |
| 5064 | 5059 | // Note that this must be the last case (i.e. the `last_case_i` case was not hit above) |
src/codegen/llvm.zig+160-75| ... | ... | @@ -898,9 +898,9 @@ pub const Object = struct { |
| 898 | 898 | const i32_2 = try builder.intConst(.i32, 2); |
| 899 | 899 | const i32_3 = try builder.intConst(.i32, 3); |
| 900 | 900 | const debug_info_version = try builder.debugModuleFlag( |
| 901 | try builder.debugConstant(i32_2), | |
| 901 | try builder.metadataConstant(i32_2), | |
| 902 | 902 | try builder.metadataString("Debug Info Version"), |
| 903 | try builder.debugConstant(i32_3), | |
| 903 | try builder.metadataConstant(i32_3), | |
| 904 | 904 | ); |
| 905 | 905 | |
| 906 | 906 | switch (comp.config.debug_format) { |
| ... | ... | @@ -908,9 +908,9 @@ pub const Object = struct { |
| 908 | 908 | .dwarf => |f| { |
| 909 | 909 | const i32_4 = try builder.intConst(.i32, 4); |
| 910 | 910 | const dwarf_version = try builder.debugModuleFlag( |
| 911 | try builder.debugConstant(i32_2), | |
| 911 | try builder.metadataConstant(i32_2), | |
| 912 | 912 | try builder.metadataString("Dwarf Version"), |
| 913 | try builder.debugConstant(i32_4), | |
| 913 | try builder.metadataConstant(i32_4), | |
| 914 | 914 | ); |
| 915 | 915 | switch (f) { |
| 916 | 916 | .@"32" => { |
| ... | ... | @@ -921,9 +921,9 @@ pub const Object = struct { |
| 921 | 921 | }, |
| 922 | 922 | .@"64" => { |
| 923 | 923 | const dwarf64 = try builder.debugModuleFlag( |
| 924 | try builder.debugConstant(i32_2), | |
| 924 | try builder.metadataConstant(i32_2), | |
| 925 | 925 | try builder.metadataString("DWARF64"), |
| 926 | try builder.debugConstant(.@"1"), | |
| 926 | try builder.metadataConstant(.@"1"), | |
| 927 | 927 | ); |
| 928 | 928 | try builder.debugNamed(try builder.metadataString("llvm.module.flags"), &.{ |
| 929 | 929 | debug_info_version, |
| ... | ... | @@ -935,9 +935,9 @@ pub const Object = struct { |
| 935 | 935 | }, |
| 936 | 936 | .code_view => { |
| 937 | 937 | const code_view = try builder.debugModuleFlag( |
| 938 | try builder.debugConstant(i32_2), | |
| 938 | try builder.metadataConstant(i32_2), | |
| 939 | 939 | try builder.metadataString("CodeView"), |
| 940 | try builder.debugConstant(.@"1"), | |
| 940 | try builder.metadataConstant(.@"1"), | |
| 941 | 941 | ); |
| 942 | 942 | try builder.debugNamed(try builder.metadataString("llvm.module.flags"), &.{ |
| 943 | 943 | debug_info_version, |
| ... | ... | @@ -1122,12 +1122,12 @@ pub const Object = struct { |
| 1122 | 1122 | |
| 1123 | 1123 | self.builder.debugForwardReferenceSetType( |
| 1124 | 1124 | self.debug_enums_fwd_ref, |
| 1125 | try self.builder.debugTuple(self.debug_enums.items), | |
| 1125 | try self.builder.metadataTuple(self.debug_enums.items), | |
| 1126 | 1126 | ); |
| 1127 | 1127 | |
| 1128 | 1128 | self.builder.debugForwardReferenceSetType( |
| 1129 | 1129 | self.debug_globals_fwd_ref, |
| 1130 | try self.builder.debugTuple(self.debug_globals.items), | |
| 1130 | try self.builder.metadataTuple(self.debug_globals.items), | |
| 1131 | 1131 | ); |
| 1132 | 1132 | } |
| 1133 | 1133 | } |
| ... | ... | @@ -1369,7 +1369,7 @@ pub const Object = struct { |
| 1369 | 1369 | _ = try attributes.removeFnAttr(.alignstack); |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | if (func_analysis.is_cold) { | |
| 1372 | if (func_analysis.branch_hint == .cold) { | |
| 1373 | 1373 | try attributes.addFnAttr(.cold, &o.builder); |
| 1374 | 1374 | } else { |
| 1375 | 1375 | _ = try attributes.removeFnAttr(.cold); |
| ... | ... | @@ -1978,7 +1978,7 @@ pub const Object = struct { |
| 1978 | 1978 | try o.lowerDebugType(int_ty), |
| 1979 | 1979 | ty.abiSize(zcu) * 8, |
| 1980 | 1980 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 1981 | try o.builder.debugTuple(enumerators), | |
| 1981 | try o.builder.metadataTuple(enumerators), | |
| 1982 | 1982 | ); |
| 1983 | 1983 | |
| 1984 | 1984 | try o.debug_type_map.put(gpa, ty, debug_enum_type); |
| ... | ... | @@ -2087,7 +2087,7 @@ pub const Object = struct { |
| 2087 | 2087 | .none, // Underlying type |
| 2088 | 2088 | ty.abiSize(zcu) * 8, |
| 2089 | 2089 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2090 | try o.builder.debugTuple(&.{ | |
| 2090 | try o.builder.metadataTuple(&.{ | |
| 2091 | 2091 | debug_ptr_type, |
| 2092 | 2092 | debug_len_type, |
| 2093 | 2093 | }), |
| ... | ... | @@ -2167,10 +2167,10 @@ pub const Object = struct { |
| 2167 | 2167 | try o.lowerDebugType(ty.childType(zcu)), |
| 2168 | 2168 | ty.abiSize(zcu) * 8, |
| 2169 | 2169 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2170 | try o.builder.debugTuple(&.{ | |
| 2170 | try o.builder.metadataTuple(&.{ | |
| 2171 | 2171 | try o.builder.debugSubrange( |
| 2172 | try o.builder.debugConstant(try o.builder.intConst(.i64, 0)), | |
| 2173 | try o.builder.debugConstant(try o.builder.intConst(.i64, ty.arrayLen(zcu))), | |
| 2172 | try o.builder.metadataConstant(try o.builder.intConst(.i64, 0)), | |
| 2173 | try o.builder.metadataConstant(try o.builder.intConst(.i64, ty.arrayLen(zcu))), | |
| 2174 | 2174 | ), |
| 2175 | 2175 | }), |
| 2176 | 2176 | ); |
| ... | ... | @@ -2210,10 +2210,10 @@ pub const Object = struct { |
| 2210 | 2210 | debug_elem_type, |
| 2211 | 2211 | ty.abiSize(zcu) * 8, |
| 2212 | 2212 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2213 | try o.builder.debugTuple(&.{ | |
| 2213 | try o.builder.metadataTuple(&.{ | |
| 2214 | 2214 | try o.builder.debugSubrange( |
| 2215 | try o.builder.debugConstant(try o.builder.intConst(.i64, 0)), | |
| 2216 | try o.builder.debugConstant(try o.builder.intConst(.i64, ty.vectorLen(zcu))), | |
| 2215 | try o.builder.metadataConstant(try o.builder.intConst(.i64, 0)), | |
| 2216 | try o.builder.metadataConstant(try o.builder.intConst(.i64, ty.vectorLen(zcu))), | |
| 2217 | 2217 | ), |
| 2218 | 2218 | }), |
| 2219 | 2219 | ); |
| ... | ... | @@ -2288,7 +2288,7 @@ pub const Object = struct { |
| 2288 | 2288 | .none, // Underlying type |
| 2289 | 2289 | ty.abiSize(zcu) * 8, |
| 2290 | 2290 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2291 | try o.builder.debugTuple(&.{ | |
| 2291 | try o.builder.metadataTuple(&.{ | |
| 2292 | 2292 | debug_data_type, |
| 2293 | 2293 | debug_some_type, |
| 2294 | 2294 | }), |
| ... | ... | @@ -2367,7 +2367,7 @@ pub const Object = struct { |
| 2367 | 2367 | .none, // Underlying type |
| 2368 | 2368 | ty.abiSize(zcu) * 8, |
| 2369 | 2369 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2370 | try o.builder.debugTuple(&fields), | |
| 2370 | try o.builder.metadataTuple(&fields), | |
| 2371 | 2371 | ); |
| 2372 | 2372 | |
| 2373 | 2373 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_error_union_type); |
| ... | ... | @@ -2447,7 +2447,7 @@ pub const Object = struct { |
| 2447 | 2447 | .none, // Underlying type |
| 2448 | 2448 | ty.abiSize(zcu) * 8, |
| 2449 | 2449 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2450 | try o.builder.debugTuple(fields.items), | |
| 2450 | try o.builder.metadataTuple(fields.items), | |
| 2451 | 2451 | ); |
| 2452 | 2452 | |
| 2453 | 2453 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_struct_type); |
| ... | ... | @@ -2520,7 +2520,7 @@ pub const Object = struct { |
| 2520 | 2520 | .none, // Underlying type |
| 2521 | 2521 | ty.abiSize(zcu) * 8, |
| 2522 | 2522 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2523 | try o.builder.debugTuple(fields.items), | |
| 2523 | try o.builder.metadataTuple(fields.items), | |
| 2524 | 2524 | ); |
| 2525 | 2525 | |
| 2526 | 2526 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_struct_type); |
| ... | ... | @@ -2561,7 +2561,7 @@ pub const Object = struct { |
| 2561 | 2561 | .none, // Underlying type |
| 2562 | 2562 | ty.abiSize(zcu) * 8, |
| 2563 | 2563 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2564 | try o.builder.debugTuple( | |
| 2564 | try o.builder.metadataTuple( | |
| 2565 | 2565 | &.{try o.lowerDebugType(Type.fromInterned(union_type.enum_tag_ty))}, |
| 2566 | 2566 | ), |
| 2567 | 2567 | ); |
| ... | ... | @@ -2623,7 +2623,7 @@ pub const Object = struct { |
| 2623 | 2623 | .none, // Underlying type |
| 2624 | 2624 | ty.abiSize(zcu) * 8, |
| 2625 | 2625 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2626 | try o.builder.debugTuple(fields.items), | |
| 2626 | try o.builder.metadataTuple(fields.items), | |
| 2627 | 2627 | ); |
| 2628 | 2628 | |
| 2629 | 2629 | o.builder.debugForwardReferenceSetType(debug_union_fwd_ref, debug_union_type); |
| ... | ... | @@ -2682,7 +2682,7 @@ pub const Object = struct { |
| 2682 | 2682 | .none, // Underlying type |
| 2683 | 2683 | ty.abiSize(zcu) * 8, |
| 2684 | 2684 | (ty.abiAlignment(zcu).toByteUnits() orelse 0) * 8, |
| 2685 | try o.builder.debugTuple(&full_fields), | |
| 2685 | try o.builder.metadataTuple(&full_fields), | |
| 2686 | 2686 | ); |
| 2687 | 2687 | |
| 2688 | 2688 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_tagged_union_type); |
| ... | ... | @@ -2735,7 +2735,7 @@ pub const Object = struct { |
| 2735 | 2735 | } |
| 2736 | 2736 | |
| 2737 | 2737 | const debug_function_type = try o.builder.debugSubroutineType( |
| 2738 | try o.builder.debugTuple(debug_param_types.items), | |
| 2738 | try o.builder.metadataTuple(debug_param_types.items), | |
| 2739 | 2739 | ); |
| 2740 | 2740 | |
| 2741 | 2741 | try o.debug_type_map.put(gpa, ty, debug_function_type); |
| ... | ... | @@ -4571,7 +4571,7 @@ pub const Object = struct { |
| 4571 | 4571 | const bad_value_block = try wip.block(1, "BadValue"); |
| 4572 | 4572 | const tag_int_value = wip.arg(0); |
| 4573 | 4573 | var wip_switch = |
| 4574 | try wip.@"switch"(tag_int_value, bad_value_block, @intCast(enum_type.names.len)); | |
| 4574 | try wip.@"switch"(tag_int_value, bad_value_block, @intCast(enum_type.names.len), .none); | |
| 4575 | 4575 | defer wip_switch.finish(&wip); |
| 4576 | 4576 | |
| 4577 | 4577 | for (0..enum_type.names.len) |field_index| { |
| ... | ... | @@ -4618,7 +4618,7 @@ pub const NavGen = struct { |
| 4618 | 4618 | } |
| 4619 | 4619 | |
| 4620 | 4620 | fn todo(ng: *NavGen, comptime format: []const u8, args: anytype) Error { |
| 4621 | @setCold(true); | |
| 4621 | @branchHint(.cold); | |
| 4622 | 4622 | assert(ng.err_msg == null); |
| 4623 | 4623 | const o = ng.object; |
| 4624 | 4624 | const gpa = o.gpa; |
| ... | ... | @@ -4784,7 +4784,7 @@ pub const FuncGen = struct { |
| 4784 | 4784 | } |
| 4785 | 4785 | |
| 4786 | 4786 | fn todo(self: *FuncGen, comptime format: []const u8, args: anytype) Error { |
| 4787 | @setCold(true); | |
| 4787 | @branchHint(.cold); | |
| 4788 | 4788 | return self.ng.todo(format, args); |
| 4789 | 4789 | } |
| 4790 | 4790 | |
| ... | ... | @@ -4958,8 +4958,10 @@ pub const FuncGen = struct { |
| 4958 | 4958 | .ret_addr => try self.airRetAddr(inst), |
| 4959 | 4959 | .frame_addr => try self.airFrameAddress(inst), |
| 4960 | 4960 | .cond_br => try self.airCondBr(inst), |
| 4961 | .@"try" => try self.airTry(body[i..]), | |
| 4962 | .try_ptr => try self.airTryPtr(inst), | |
| 4961 | .@"try" => try self.airTry(body[i..], false), | |
| 4962 | .try_cold => try self.airTry(body[i..], true), | |
| 4963 | .try_ptr => try self.airTryPtr(inst, false), | |
| 4964 | .try_ptr_cold => try self.airTryPtr(inst, true), | |
| 4963 | 4965 | .intcast => try self.airIntCast(inst), |
| 4964 | 4966 | .trunc => try self.airTrunc(inst), |
| 4965 | 4967 | .fptrunc => try self.airFptrunc(inst), |
| ... | ... | @@ -5506,6 +5508,7 @@ pub const FuncGen = struct { |
| 5506 | 5508 | const panic_nav = ip.getNav(panic_func.owner_nav); |
| 5507 | 5509 | const fn_info = zcu.typeToFunc(Type.fromInterned(panic_nav.typeOf(ip))).?; |
| 5508 | 5510 | const panic_global = try o.resolveLlvmFunction(panic_func.owner_nav); |
| 5511 | _ = try fg.wip.callIntrinsicAssumeCold(); | |
| 5509 | 5512 | _ = try fg.wip.call( |
| 5510 | 5513 | .normal, |
| 5511 | 5514 | toLlvmCallConv(fn_info.cc, target), |
| ... | ... | @@ -5794,7 +5797,7 @@ pub const FuncGen = struct { |
| 5794 | 5797 | const mixed_block = try self.wip.block(1, "Mixed"); |
| 5795 | 5798 | const both_pl_block = try self.wip.block(1, "BothNonNull"); |
| 5796 | 5799 | const end_block = try self.wip.block(3, "End"); |
| 5797 | var wip_switch = try self.wip.@"switch"(lhs_rhs_ored, mixed_block, 2); | |
| 5800 | var wip_switch = try self.wip.@"switch"(lhs_rhs_ored, mixed_block, 2, .none); | |
| 5798 | 5801 | defer wip_switch.finish(&self.wip); |
| 5799 | 5802 | try wip_switch.addCase( |
| 5800 | 5803 | try o.builder.intConst(llvm_i2, 0b00), |
| ... | ... | @@ -5948,21 +5951,62 @@ pub const FuncGen = struct { |
| 5948 | 5951 | const then_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra.end..][0..extra.data.then_body_len]); |
| 5949 | 5952 | const else_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]); |
| 5950 | 5953 | |
| 5954 | const Hint = enum { | |
| 5955 | none, | |
| 5956 | unpredictable, | |
| 5957 | then_likely, | |
| 5958 | else_likely, | |
| 5959 | then_cold, | |
| 5960 | else_cold, | |
| 5961 | }; | |
| 5962 | const hint: Hint = switch (extra.data.branch_hints.true) { | |
| 5963 | .none => switch (extra.data.branch_hints.false) { | |
| 5964 | .none => .none, | |
| 5965 | .likely => .else_likely, | |
| 5966 | .unlikely => .then_likely, | |
| 5967 | .cold => .else_cold, | |
| 5968 | .unpredictable => .unpredictable, | |
| 5969 | }, | |
| 5970 | .likely => switch (extra.data.branch_hints.false) { | |
| 5971 | .none => .then_likely, | |
| 5972 | .likely => .unpredictable, | |
| 5973 | .unlikely => .then_likely, | |
| 5974 | .cold => .else_cold, | |
| 5975 | .unpredictable => .unpredictable, | |
| 5976 | }, | |
| 5977 | .unlikely => switch (extra.data.branch_hints.false) { | |
| 5978 | .none => .else_likely, | |
| 5979 | .likely => .else_likely, | |
| 5980 | .unlikely => .unpredictable, | |
| 5981 | .cold => .else_cold, | |
| 5982 | .unpredictable => .unpredictable, | |
| 5983 | }, | |
| 5984 | .cold => .then_cold, | |
| 5985 | .unpredictable => .unpredictable, | |
| 5986 | }; | |
| 5987 | ||
| 5951 | 5988 | const then_block = try self.wip.block(1, "Then"); |
| 5952 | 5989 | const else_block = try self.wip.block(1, "Else"); |
| 5953 | _ = try self.wip.brCond(cond, then_block, else_block); | |
| 5990 | _ = try self.wip.brCond(cond, then_block, else_block, switch (hint) { | |
| 5991 | .none, .then_cold, .else_cold => .none, | |
| 5992 | .unpredictable => .unpredictable, | |
| 5993 | .then_likely => .then_likely, | |
| 5994 | .else_likely => .else_likely, | |
| 5995 | }); | |
| 5954 | 5996 | |
| 5955 | 5997 | self.wip.cursor = .{ .block = then_block }; |
| 5998 | if (hint == .then_cold) _ = try self.wip.callIntrinsicAssumeCold(); | |
| 5956 | 5999 | try self.genBodyDebugScope(null, then_body); |
| 5957 | 6000 | |
| 5958 | 6001 | self.wip.cursor = .{ .block = else_block }; |
| 6002 | if (hint == .else_cold) _ = try self.wip.callIntrinsicAssumeCold(); | |
| 5959 | 6003 | try self.genBodyDebugScope(null, else_body); |
| 5960 | 6004 | |
| 5961 | 6005 | // No need to reset the insert cursor since this instruction is noreturn. |
| 5962 | 6006 | return .none; |
| 5963 | 6007 | } |
| 5964 | 6008 | |
| 5965 | fn airTry(self: *FuncGen, body_tail: []const Air.Inst.Index) !Builder.Value { | |
| 6009 | fn airTry(self: *FuncGen, body_tail: []const Air.Inst.Index, err_cold: bool) !Builder.Value { | |
| 5966 | 6010 | const o = self.ng.object; |
| 5967 | 6011 | const pt = o.pt; |
| 5968 | 6012 | const zcu = pt.zcu; |
| ... | ... | @@ -5975,10 +6019,10 @@ pub const FuncGen = struct { |
| 5975 | 6019 | const payload_ty = self.typeOfIndex(inst); |
| 5976 | 6020 | const can_elide_load = if (isByRef(payload_ty, zcu)) self.canElideLoad(body_tail) else false; |
| 5977 | 6021 | const is_unused = self.liveness.isUnused(inst); |
| 5978 | return lowerTry(self, err_union, body, err_union_ty, false, can_elide_load, is_unused); | |
| 6022 | return lowerTry(self, err_union, body, err_union_ty, false, can_elide_load, is_unused, err_cold); | |
| 5979 | 6023 | } |
| 5980 | 6024 | |
| 5981 | fn airTryPtr(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value { | |
| 6025 | fn airTryPtr(self: *FuncGen, inst: Air.Inst.Index, err_cold: bool) !Builder.Value { | |
| 5982 | 6026 | const o = self.ng.object; |
| 5983 | 6027 | const zcu = o.pt.zcu; |
| 5984 | 6028 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| ... | ... | @@ -5987,7 +6031,7 @@ pub const FuncGen = struct { |
| 5987 | 6031 | const body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra.end..][0..extra.data.body_len]); |
| 5988 | 6032 | const err_union_ty = self.typeOf(extra.data.ptr).childType(zcu); |
| 5989 | 6033 | const is_unused = self.liveness.isUnused(inst); |
| 5990 | return lowerTry(self, err_union_ptr, body, err_union_ty, true, true, is_unused); | |
| 6034 | return lowerTry(self, err_union_ptr, body, err_union_ty, true, true, is_unused, err_cold); | |
| 5991 | 6035 | } |
| 5992 | 6036 | |
| 5993 | 6037 | fn lowerTry( |
| ... | ... | @@ -5998,6 +6042,7 @@ pub const FuncGen = struct { |
| 5998 | 6042 | operand_is_ptr: bool, |
| 5999 | 6043 | can_elide_load: bool, |
| 6000 | 6044 | is_unused: bool, |
| 6045 | err_cold: bool, | |
| 6001 | 6046 | ) !Builder.Value { |
| 6002 | 6047 | const o = fg.ng.object; |
| 6003 | 6048 | const pt = o.pt; |
| ... | ... | @@ -6036,9 +6081,10 @@ pub const FuncGen = struct { |
| 6036 | 6081 | |
| 6037 | 6082 | const return_block = try fg.wip.block(1, "TryRet"); |
| 6038 | 6083 | const continue_block = try fg.wip.block(1, "TryCont"); |
| 6039 | _ = try fg.wip.brCond(is_err, return_block, continue_block); | |
| 6084 | _ = try fg.wip.brCond(is_err, return_block, continue_block, if (err_cold) .none else .else_likely); | |
| 6040 | 6085 | |
| 6041 | 6086 | fg.wip.cursor = .{ .block = return_block }; |
| 6087 | if (err_cold) _ = try fg.wip.callIntrinsicAssumeCold(); | |
| 6042 | 6088 | try fg.genBodyDebugScope(null, body); |
| 6043 | 6089 | |
| 6044 | 6090 | fg.wip.cursor = .{ .block = continue_block }; |
| ... | ... | @@ -6065,9 +6111,11 @@ pub const FuncGen = struct { |
| 6065 | 6111 | |
| 6066 | 6112 | fn airSwitchBr(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value { |
| 6067 | 6113 | const o = self.ng.object; |
| 6068 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6069 | const cond = try self.resolveInst(pl_op.operand); | |
| 6070 | const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 6114 | ||
| 6115 | const switch_br = self.air.unwrapSwitch(inst); | |
| 6116 | ||
| 6117 | const cond = try self.resolveInst(switch_br.operand); | |
| 6118 | ||
| 6071 | 6119 | const else_block = try self.wip.block(1, "Default"); |
| 6072 | 6120 | const llvm_usize = try o.lowerType(Type.usize); |
| 6073 | 6121 | const cond_int = if (cond.typeOfWip(&self.wip).isPointer(&o.builder)) |
| ... | ... | @@ -6075,34 +6123,70 @@ pub const FuncGen = struct { |
| 6075 | 6123 | else |
| 6076 | 6124 | cond; |
| 6077 | 6125 | |
| 6078 | var extra_index: usize = switch_br.end; | |
| 6079 | var case_i: u32 = 0; | |
| 6080 | var llvm_cases_len: u32 = 0; | |
| 6081 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 6082 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 6083 | const items: []const Air.Inst.Ref = | |
| 6084 | @ptrCast(self.air.extra[case.end..][0..case.data.items_len]); | |
| 6085 | const case_body = self.air.extra[case.end + items.len ..][0..case.data.body_len]; | |
| 6086 | extra_index = case.end + case.data.items_len + case_body.len; | |
| 6126 | const llvm_cases_len = llvm_cases_len: { | |
| 6127 | var len: u32 = 0; | |
| 6128 | var it = switch_br.iterateCases(); | |
| 6129 | while (it.next()) |case| len += @intCast(case.items.len); | |
| 6130 | break :llvm_cases_len len; | |
| 6131 | }; | |
| 6132 | ||
| 6133 | const weights: Builder.Function.Instruction.BrCond.Weights = weights: { | |
| 6134 | // First pass. If any weights are `.unpredictable`, unpredictable. | |
| 6135 | // If all are `.none` or `.cold`, none. | |
| 6136 | var any_likely = false; | |
| 6137 | for (0..switch_br.cases_len) |case_idx| { | |
| 6138 | switch (switch_br.getHint(@intCast(case_idx))) { | |
| 6139 | .none, .cold => {}, | |
| 6140 | .likely, .unlikely => any_likely = true, | |
| 6141 | .unpredictable => break :weights .unpredictable, | |
| 6142 | } | |
| 6143 | } | |
| 6144 | switch (switch_br.getElseHint()) { | |
| 6145 | .none, .cold => {}, | |
| 6146 | .likely, .unlikely => any_likely = true, | |
| 6147 | .unpredictable => break :weights .unpredictable, | |
| 6148 | } | |
| 6149 | if (!any_likely) break :weights .none; | |
| 6087 | 6150 | |
| 6088 | llvm_cases_len += @intCast(items.len); | |
| 6089 | } | |
| 6151 | var weights = try self.gpa.alloc(Builder.Metadata, llvm_cases_len + 1); | |
| 6152 | defer self.gpa.free(weights); | |
| 6090 | 6153 | |
| 6091 | var wip_switch = try self.wip.@"switch"(cond_int, else_block, llvm_cases_len); | |
| 6092 | defer wip_switch.finish(&self.wip); | |
| 6154 | const else_weight: u32 = switch (switch_br.getElseHint()) { | |
| 6155 | .unpredictable => unreachable, | |
| 6156 | .none, .cold => 1000, | |
| 6157 | .likely => 2000, | |
| 6158 | .unlikely => 1, | |
| 6159 | }; | |
| 6160 | weights[0] = try o.builder.metadataConstant(try o.builder.intConst(.i32, else_weight)); | |
| 6161 | ||
| 6162 | var weight_idx: usize = 1; | |
| 6163 | var it = switch_br.iterateCases(); | |
| 6164 | while (it.next()) |case| { | |
| 6165 | const weight_val: u32 = switch (switch_br.getHint(case.idx)) { | |
| 6166 | .unpredictable => unreachable, | |
| 6167 | .none, .cold => 1000, | |
| 6168 | .likely => 2000, | |
| 6169 | .unlikely => 1, | |
| 6170 | }; | |
| 6171 | const weight_meta = try o.builder.metadataConstant(try o.builder.intConst(.i32, weight_val)); | |
| 6172 | @memset(weights[weight_idx..][0..case.items.len], weight_meta); | |
| 6173 | weight_idx += case.items.len; | |
| 6174 | } | |
| 6175 | ||
| 6176 | assert(weight_idx == weights.len); | |
| 6093 | 6177 | |
| 6094 | extra_index = switch_br.end; | |
| 6095 | case_i = 0; | |
| 6096 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 6097 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 6098 | const items: []const Air.Inst.Ref = | |
| 6099 | @ptrCast(self.air.extra[case.end..][0..case.data.items_len]); | |
| 6100 | const case_body: []const Air.Inst.Index = @ptrCast(self.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 6101 | extra_index = case.end + case.data.items_len + case_body.len; | |
| 6178 | const branch_weights_str = try o.builder.metadataString("branch_weights"); | |
| 6179 | const tuple = try o.builder.strTuple(branch_weights_str, weights); | |
| 6180 | break :weights @enumFromInt(@intFromEnum(tuple)); | |
| 6181 | }; | |
| 6102 | 6182 | |
| 6103 | const case_block = try self.wip.block(@intCast(items.len), "Case"); | |
| 6183 | var wip_switch = try self.wip.@"switch"(cond_int, else_block, llvm_cases_len, weights); | |
| 6184 | defer wip_switch.finish(&self.wip); | |
| 6104 | 6185 | |
| 6105 | for (items) |item| { | |
| 6186 | var it = switch_br.iterateCases(); | |
| 6187 | while (it.next()) |case| { | |
| 6188 | const case_block = try self.wip.block(@intCast(case.items.len), "Case"); | |
| 6189 | for (case.items) |item| { | |
| 6106 | 6190 | const llvm_item = (try self.resolveInst(item)).toConst().?; |
| 6107 | 6191 | const llvm_int_item = if (llvm_item.typeOf(&o.builder).isPointer(&o.builder)) |
| 6108 | 6192 | try o.builder.castConst(.ptrtoint, llvm_item, llvm_usize) |
| ... | ... | @@ -6110,13 +6194,14 @@ pub const FuncGen = struct { |
| 6110 | 6194 | llvm_item; |
| 6111 | 6195 | try wip_switch.addCase(llvm_int_item, case_block, &self.wip); |
| 6112 | 6196 | } |
| 6113 | ||
| 6114 | 6197 | self.wip.cursor = .{ .block = case_block }; |
| 6115 | try self.genBodyDebugScope(null, case_body); | |
| 6198 | if (switch_br.getHint(case.idx) == .cold) _ = try self.wip.callIntrinsicAssumeCold(); | |
| 6199 | try self.genBodyDebugScope(null, case.body); | |
| 6116 | 6200 | } |
| 6117 | 6201 | |
| 6202 | const else_body = it.elseBody(); | |
| 6118 | 6203 | self.wip.cursor = .{ .block = else_block }; |
| 6119 | const else_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 6204 | if (switch_br.getElseHint() == .cold) _ = try self.wip.callIntrinsicAssumeCold(); | |
| 6120 | 6205 | if (else_body.len != 0) { |
| 6121 | 6206 | try self.genBodyDebugScope(null, else_body); |
| 6122 | 6207 | } else { |
| ... | ... | @@ -7748,7 +7833,7 @@ pub const FuncGen = struct { |
| 7748 | 7833 | |
| 7749 | 7834 | const fail_block = try fg.wip.block(1, "OverflowFail"); |
| 7750 | 7835 | const ok_block = try fg.wip.block(1, "OverflowOk"); |
| 7751 | _ = try fg.wip.brCond(overflow_bit, fail_block, ok_block); | |
| 7836 | _ = try fg.wip.brCond(overflow_bit, fail_block, ok_block, .none); | |
| 7752 | 7837 | |
| 7753 | 7838 | fg.wip.cursor = .{ .block = fail_block }; |
| 7754 | 7839 | try fg.buildSimplePanic(.integer_overflow); |
| ... | ... | @@ -9389,7 +9474,7 @@ pub const FuncGen = struct { |
| 9389 | 9474 | self.wip.cursor = .{ .block = loop_block }; |
| 9390 | 9475 | const it_ptr = try self.wip.phi(.ptr, ""); |
| 9391 | 9476 | const end = try self.wip.icmp(.ne, it_ptr.toValue(), end_ptr, ""); |
| 9392 | _ = try self.wip.brCond(end, body_block, end_block); | |
| 9477 | _ = try self.wip.brCond(end, body_block, end_block, .none); | |
| 9393 | 9478 | |
| 9394 | 9479 | self.wip.cursor = .{ .block = body_block }; |
| 9395 | 9480 | const elem_abi_align = elem_ty.abiAlignment(zcu); |
| ... | ... | @@ -9427,7 +9512,7 @@ pub const FuncGen = struct { |
| 9427 | 9512 | const cond = try self.cmp(.normal, .neq, Type.usize, len, usize_zero); |
| 9428 | 9513 | const memset_block = try self.wip.block(1, "MemsetTrapSkip"); |
| 9429 | 9514 | const end_block = try self.wip.block(2, "MemsetTrapEnd"); |
| 9430 | _ = try self.wip.brCond(cond, memset_block, end_block); | |
| 9515 | _ = try self.wip.brCond(cond, memset_block, end_block, .none); | |
| 9431 | 9516 | self.wip.cursor = .{ .block = memset_block }; |
| 9432 | 9517 | _ = try self.wip.callMemSet(dest_ptr, dest_ptr_align, fill_byte, len, access_kind); |
| 9433 | 9518 | _ = try self.wip.br(end_block); |
| ... | ... | @@ -9462,7 +9547,7 @@ pub const FuncGen = struct { |
| 9462 | 9547 | const cond = try self.cmp(.normal, .neq, Type.usize, len, usize_zero); |
| 9463 | 9548 | const memcpy_block = try self.wip.block(1, "MemcpyTrapSkip"); |
| 9464 | 9549 | const end_block = try self.wip.block(2, "MemcpyTrapEnd"); |
| 9465 | _ = try self.wip.brCond(cond, memcpy_block, end_block); | |
| 9550 | _ = try self.wip.brCond(cond, memcpy_block, end_block, .none); | |
| 9466 | 9551 | self.wip.cursor = .{ .block = memcpy_block }; |
| 9467 | 9552 | _ = try self.wip.callMemCpy( |
| 9468 | 9553 | dest_ptr, |
| ... | ... | @@ -9632,7 +9717,7 @@ pub const FuncGen = struct { |
| 9632 | 9717 | const valid_block = try self.wip.block(@intCast(names.len), "Valid"); |
| 9633 | 9718 | const invalid_block = try self.wip.block(1, "Invalid"); |
| 9634 | 9719 | const end_block = try self.wip.block(2, "End"); |
| 9635 | var wip_switch = try self.wip.@"switch"(operand, invalid_block, @intCast(names.len)); | |
| 9720 | var wip_switch = try self.wip.@"switch"(operand, invalid_block, @intCast(names.len), .none); | |
| 9636 | 9721 | defer wip_switch.finish(&self.wip); |
| 9637 | 9722 | |
| 9638 | 9723 | for (0..names.len) |name_index| { |
| ... | ... | @@ -9708,7 +9793,7 @@ pub const FuncGen = struct { |
| 9708 | 9793 | const named_block = try wip.block(@intCast(enum_type.names.len), "Named"); |
| 9709 | 9794 | const unnamed_block = try wip.block(1, "Unnamed"); |
| 9710 | 9795 | const tag_int_value = wip.arg(0); |
| 9711 | var wip_switch = try wip.@"switch"(tag_int_value, unnamed_block, @intCast(enum_type.names.len)); | |
| 9796 | var wip_switch = try wip.@"switch"(tag_int_value, unnamed_block, @intCast(enum_type.names.len), .none); | |
| 9712 | 9797 | defer wip_switch.finish(&wip); |
| 9713 | 9798 | |
| 9714 | 9799 | for (0..enum_type.names.len) |field_index| { |
| ... | ... | @@ -9858,7 +9943,7 @@ pub const FuncGen = struct { |
| 9858 | 9943 | const cond = try self.wip.icmp(.ult, i, llvm_vector_len, ""); |
| 9859 | 9944 | const loop_then = try self.wip.block(1, "ReduceLoopThen"); |
| 9860 | 9945 | |
| 9861 | _ = try self.wip.brCond(cond, loop_then, loop_exit); | |
| 9946 | _ = try self.wip.brCond(cond, loop_then, loop_exit, .none); | |
| 9862 | 9947 | |
| 9863 | 9948 | { |
| 9864 | 9949 | self.wip.cursor = .{ .block = loop_then }; |
src/codegen/llvm/Builder.zig+316-101| ... | ... | @@ -4817,12 +4817,22 @@ pub const Function = struct { |
| 4817 | 4817 | cond: Value, |
| 4818 | 4818 | then: Block.Index, |
| 4819 | 4819 | @"else": Block.Index, |
| 4820 | weights: Weights, | |
| 4821 | pub const Weights = enum(u32) { | |
| 4822 | // We can do this as metadata indices 0 and 1 are reserved. | |
| 4823 | none = 0, | |
| 4824 | unpredictable = 1, | |
| 4825 | /// These values should be converted to `Metadata` to be used | |
| 4826 | /// in a `prof` annotation providing branch weights. | |
| 4827 | _, | |
| 4828 | }; | |
| 4820 | 4829 | }; |
| 4821 | 4830 | |
| 4822 | 4831 | pub const Switch = struct { |
| 4823 | 4832 | val: Value, |
| 4824 | 4833 | default: Block.Index, |
| 4825 | 4834 | cases_len: u32, |
| 4835 | weights: BrCond.Weights, | |
| 4826 | 4836 | //case_vals: [cases_len]Constant, |
| 4827 | 4837 | //case_blocks: [cases_len]Block.Index, |
| 4828 | 4838 | }; |
| ... | ... | @@ -4969,7 +4979,8 @@ pub const Function = struct { |
| 4969 | 4979 | }; |
| 4970 | 4980 | pub const Info = packed struct(u32) { |
| 4971 | 4981 | call_conv: CallConv, |
| 4972 | _: u22 = undefined, | |
| 4982 | has_op_bundle_cold: bool, | |
| 4983 | _: u21 = undefined, | |
| 4973 | 4984 | }; |
| 4974 | 4985 | }; |
| 4975 | 4986 | |
| ... | ... | @@ -5036,6 +5047,7 @@ pub const Function = struct { |
| 5036 | 5047 | FunctionAttributes, |
| 5037 | 5048 | Type, |
| 5038 | 5049 | Value, |
| 5050 | Instruction.BrCond.Weights, | |
| 5039 | 5051 | => @enumFromInt(value), |
| 5040 | 5052 | MemoryAccessInfo, |
| 5041 | 5053 | Instruction.Alloca.Info, |
| ... | ... | @@ -5201,6 +5213,7 @@ pub const WipFunction = struct { |
| 5201 | 5213 | cond: Value, |
| 5202 | 5214 | then: Block.Index, |
| 5203 | 5215 | @"else": Block.Index, |
| 5216 | weights: enum { none, unpredictable, then_likely, else_likely }, | |
| 5204 | 5217 | ) Allocator.Error!Instruction.Index { |
| 5205 | 5218 | assert(cond.typeOfWip(self) == .i1); |
| 5206 | 5219 | try self.ensureUnusedExtraCapacity(1, Instruction.BrCond, 0); |
| ... | ... | @@ -5210,6 +5223,22 @@ pub const WipFunction = struct { |
| 5210 | 5223 | .cond = cond, |
| 5211 | 5224 | .then = then, |
| 5212 | 5225 | .@"else" = @"else", |
| 5226 | .weights = switch (weights) { | |
| 5227 | .none => .none, | |
| 5228 | .unpredictable => .unpredictable, | |
| 5229 | .then_likely, .else_likely => w: { | |
| 5230 | const branch_weights_str = try self.builder.metadataString("branch_weights"); | |
| 5231 | const unlikely_const = try self.builder.metadataConstant(try self.builder.intConst(.i32, 1)); | |
| 5232 | const likely_const = try self.builder.metadataConstant(try self.builder.intConst(.i32, 2000)); | |
| 5233 | const weight_vals: [2]Metadata = switch (weights) { | |
| 5234 | .none, .unpredictable => unreachable, | |
| 5235 | .then_likely => .{ likely_const, unlikely_const }, | |
| 5236 | .else_likely => .{ unlikely_const, likely_const }, | |
| 5237 | }; | |
| 5238 | const tuple = try self.builder.strTuple(branch_weights_str, &weight_vals); | |
| 5239 | break :w @enumFromInt(@intFromEnum(tuple)); | |
| 5240 | }, | |
| 5241 | }, | |
| 5213 | 5242 | }), |
| 5214 | 5243 | }); |
| 5215 | 5244 | then.ptr(self).branches += 1; |
| ... | ... | @@ -5248,6 +5277,7 @@ pub const WipFunction = struct { |
| 5248 | 5277 | val: Value, |
| 5249 | 5278 | default: Block.Index, |
| 5250 | 5279 | cases_len: u32, |
| 5280 | weights: Instruction.BrCond.Weights, | |
| 5251 | 5281 | ) Allocator.Error!WipSwitch { |
| 5252 | 5282 | try self.ensureUnusedExtraCapacity(1, Instruction.Switch, cases_len * 2); |
| 5253 | 5283 | const instruction = try self.addInst(null, .{ |
| ... | ... | @@ -5256,6 +5286,7 @@ pub const WipFunction = struct { |
| 5256 | 5286 | .val = val, |
| 5257 | 5287 | .default = default, |
| 5258 | 5288 | .cases_len = cases_len, |
| 5289 | .weights = weights, | |
| 5259 | 5290 | }), |
| 5260 | 5291 | }); |
| 5261 | 5292 | _ = self.extra.addManyAsSliceAssumeCapacity(cases_len * 2); |
| ... | ... | @@ -5895,6 +5926,20 @@ pub const WipFunction = struct { |
| 5895 | 5926 | callee: Value, |
| 5896 | 5927 | args: []const Value, |
| 5897 | 5928 | name: []const u8, |
| 5929 | ) Allocator.Error!Value { | |
| 5930 | return self.callInner(kind, call_conv, function_attributes, ty, callee, args, name, false); | |
| 5931 | } | |
| 5932 | ||
| 5933 | fn callInner( | |
| 5934 | self: *WipFunction, | |
| 5935 | kind: Instruction.Call.Kind, | |
| 5936 | call_conv: CallConv, | |
| 5937 | function_attributes: FunctionAttributes, | |
| 5938 | ty: Type, | |
| 5939 | callee: Value, | |
| 5940 | args: []const Value, | |
| 5941 | name: []const u8, | |
| 5942 | has_op_bundle_cold: bool, | |
| 5898 | 5943 | ) Allocator.Error!Value { |
| 5899 | 5944 | const ret_ty = ty.functionReturn(self.builder); |
| 5900 | 5945 | assert(ty.isFunction(self.builder)); |
| ... | ... | @@ -5918,7 +5963,10 @@ pub const WipFunction = struct { |
| 5918 | 5963 | .tail_fast => .@"tail call fast", |
| 5919 | 5964 | }, |
| 5920 | 5965 | .data = self.addExtraAssumeCapacity(Instruction.Call{ |
| 5921 | .info = .{ .call_conv = call_conv }, | |
| 5966 | .info = .{ | |
| 5967 | .call_conv = call_conv, | |
| 5968 | .has_op_bundle_cold = has_op_bundle_cold, | |
| 5969 | }, | |
| 5922 | 5970 | .attributes = function_attributes, |
| 5923 | 5971 | .ty = ty, |
| 5924 | 5972 | .callee = callee, |
| ... | ... | @@ -5964,6 +6012,20 @@ pub const WipFunction = struct { |
| 5964 | 6012 | ); |
| 5965 | 6013 | } |
| 5966 | 6014 | |
| 6015 | pub fn callIntrinsicAssumeCold(self: *WipFunction) Allocator.Error!Value { | |
| 6016 | const intrinsic = try self.builder.getIntrinsic(.assume, &.{}); | |
| 6017 | return self.callInner( | |
| 6018 | .normal, | |
| 6019 | CallConv.default, | |
| 6020 | .none, | |
| 6021 | intrinsic.typeOf(self.builder), | |
| 6022 | intrinsic.toValue(self.builder), | |
| 6023 | &.{try self.builder.intValue(.i1, 1)}, | |
| 6024 | "", | |
| 6025 | true, | |
| 6026 | ); | |
| 6027 | } | |
| 6028 | ||
| 5967 | 6029 | pub fn callMemCpy( |
| 5968 | 6030 | self: *WipFunction, |
| 5969 | 6031 | dst: Value, |
| ... | ... | @@ -6040,7 +6102,7 @@ pub const WipFunction = struct { |
| 6040 | 6102 | |
| 6041 | 6103 | break :blk metadata; |
| 6042 | 6104 | }, |
| 6043 | .constant => |constant| try self.builder.debugConstant(constant), | |
| 6105 | .constant => |constant| try self.builder.metadataConstant(constant), | |
| 6044 | 6106 | .metadata => |metadata| metadata, |
| 6045 | 6107 | }; |
| 6046 | 6108 | } |
| ... | ... | @@ -6099,6 +6161,7 @@ pub const WipFunction = struct { |
| 6099 | 6161 | FunctionAttributes, |
| 6100 | 6162 | Type, |
| 6101 | 6163 | Value, |
| 6164 | Instruction.BrCond.Weights, | |
| 6102 | 6165 | => @intFromEnum(value), |
| 6103 | 6166 | MemoryAccessInfo, |
| 6104 | 6167 | Instruction.Alloca.Info, |
| ... | ... | @@ -6380,6 +6443,7 @@ pub const WipFunction = struct { |
| 6380 | 6443 | .cond = instructions.map(extra.cond), |
| 6381 | 6444 | .then = extra.then, |
| 6382 | 6445 | .@"else" = extra.@"else", |
| 6446 | .weights = extra.weights, | |
| 6383 | 6447 | }); |
| 6384 | 6448 | }, |
| 6385 | 6449 | .call, |
| ... | ... | @@ -6522,6 +6586,7 @@ pub const WipFunction = struct { |
| 6522 | 6586 | .val = instructions.map(extra.data.val), |
| 6523 | 6587 | .default = extra.data.default, |
| 6524 | 6588 | .cases_len = extra.data.cases_len, |
| 6589 | .weights = extra.data.weights, | |
| 6525 | 6590 | }); |
| 6526 | 6591 | wip_extra.appendSlice(case_vals); |
| 6527 | 6592 | wip_extra.appendSlice(case_blocks); |
| ... | ... | @@ -6744,6 +6809,7 @@ pub const WipFunction = struct { |
| 6744 | 6809 | FunctionAttributes, |
| 6745 | 6810 | Type, |
| 6746 | 6811 | Value, |
| 6812 | Instruction.BrCond.Weights, | |
| 6747 | 6813 | => @intFromEnum(value), |
| 6748 | 6814 | MemoryAccessInfo, |
| 6749 | 6815 | Instruction.Alloca.Info, |
| ... | ... | @@ -6792,6 +6858,7 @@ pub const WipFunction = struct { |
| 6792 | 6858 | FunctionAttributes, |
| 6793 | 6859 | Type, |
| 6794 | 6860 | Value, |
| 6861 | Instruction.BrCond.Weights, | |
| 6795 | 6862 | => @enumFromInt(value), |
| 6796 | 6863 | MemoryAccessInfo, |
| 6797 | 6864 | Instruction.Alloca.Info, |
| ... | ... | @@ -7697,6 +7764,7 @@ pub const MetadataString = enum(u32) { |
| 7697 | 7764 | |
| 7698 | 7765 | pub const Metadata = enum(u32) { |
| 7699 | 7766 | none = 0, |
| 7767 | empty_tuple = 1, | |
| 7700 | 7768 | _, |
| 7701 | 7769 | |
| 7702 | 7770 | const first_forward_reference = 1 << 29; |
| ... | ... | @@ -7734,6 +7802,7 @@ pub const Metadata = enum(u32) { |
| 7734 | 7802 | enumerator_signed_negative, |
| 7735 | 7803 | subrange, |
| 7736 | 7804 | tuple, |
| 7805 | str_tuple, | |
| 7737 | 7806 | module_flag, |
| 7738 | 7807 | expression, |
| 7739 | 7808 | local_var, |
| ... | ... | @@ -7779,6 +7848,7 @@ pub const Metadata = enum(u32) { |
| 7779 | 7848 | .enumerator_signed_negative, |
| 7780 | 7849 | .subrange, |
| 7781 | 7850 | .tuple, |
| 7851 | .str_tuple, | |
| 7782 | 7852 | .module_flag, |
| 7783 | 7853 | .local_var, |
| 7784 | 7854 | .parameter, |
| ... | ... | @@ -8043,6 +8113,13 @@ pub const Metadata = enum(u32) { |
| 8043 | 8113 | // elements: [elements_len]Metadata |
| 8044 | 8114 | }; |
| 8045 | 8115 | |
| 8116 | pub const StrTuple = struct { | |
| 8117 | str: MetadataString, | |
| 8118 | elements_len: u32, | |
| 8119 | ||
| 8120 | // elements: [elements_len]Metadata | |
| 8121 | }; | |
| 8122 | ||
| 8046 | 8123 | pub const ModuleFlag = struct { |
| 8047 | 8124 | behavior: Metadata, |
| 8048 | 8125 | name: MetadataString, |
| ... | ... | @@ -8355,7 +8432,7 @@ pub const Metadata = enum(u32) { |
| 8355 | 8432 | }; |
| 8356 | 8433 | |
| 8357 | 8434 | pub fn init(options: Options) Allocator.Error!Builder { |
| 8358 | var self = Builder{ | |
| 8435 | var self: Builder = .{ | |
| 8359 | 8436 | .gpa = options.allocator, |
| 8360 | 8437 | .strip = options.strip, |
| 8361 | 8438 | |
| ... | ... | @@ -8454,7 +8531,9 @@ pub fn init(options: Options) Allocator.Error!Builder { |
| 8454 | 8531 | assert(try self.intConst(.i32, 0) == .@"0"); |
| 8455 | 8532 | assert(try self.intConst(.i32, 1) == .@"1"); |
| 8456 | 8533 | assert(try self.noneConst(.token) == .none); |
| 8457 | if (!self.strip) assert(try self.debugNone() == .none); | |
| 8534 | ||
| 8535 | assert(try self.metadataNone() == .none); | |
| 8536 | assert(try self.metadataTuple(&.{}) == .empty_tuple); | |
| 8458 | 8537 | |
| 8459 | 8538 | try self.metadata_string_indices.append(self.gpa, 0); |
| 8460 | 8539 | assert(try self.metadataString("") == .none); |
| ... | ... | @@ -9683,6 +9762,13 @@ pub fn printUnbuffered( |
| 9683 | 9762 | extra.then.toInst(&function).fmt(function_index, self), |
| 9684 | 9763 | extra.@"else".toInst(&function).fmt(function_index, self), |
| 9685 | 9764 | }); |
| 9765 | switch (extra.weights) { | |
| 9766 | .none => {}, | |
| 9767 | .unpredictable => try writer.writeAll(", !unpredictable !{}"), | |
| 9768 | _ => try writer.print("{}", .{ | |
| 9769 | try metadata_formatter.fmt(", !prof ", @as(Metadata, @enumFromInt(@intFromEnum(extra.weights)))), | |
| 9770 | }), | |
| 9771 | } | |
| 9686 | 9772 | }, |
| 9687 | 9773 | .call, |
| 9688 | 9774 | .@"call fast", |
| ... | ... | @@ -9727,6 +9813,9 @@ pub fn printUnbuffered( |
| 9727 | 9813 | }); |
| 9728 | 9814 | } |
| 9729 | 9815 | try writer.writeByte(')'); |
| 9816 | if (extra.data.info.has_op_bundle_cold) { | |
| 9817 | try writer.writeAll(" [ \"cold\"() ]"); | |
| 9818 | } | |
| 9730 | 9819 | const call_function_attributes = extra.data.attributes.func(self); |
| 9731 | 9820 | if (call_function_attributes != .none) try writer.print(" #{d}", .{ |
| 9732 | 9821 | (try attribute_groups.getOrPutValue( |
| ... | ... | @@ -9937,6 +10026,13 @@ pub fn printUnbuffered( |
| 9937 | 10026 | }, |
| 9938 | 10027 | ); |
| 9939 | 10028 | try writer.writeAll(" ]"); |
| 10029 | switch (extra.data.weights) { | |
| 10030 | .none => {}, | |
| 10031 | .unpredictable => try writer.writeAll(", !unpredictable !{}"), | |
| 10032 | _ => try writer.print("{}", .{ | |
| 10033 | try metadata_formatter.fmt(", !prof ", @as(Metadata, @enumFromInt(@intFromEnum(extra.data.weights)))), | |
| 10034 | }), | |
| 10035 | } | |
| 9940 | 10036 | }, |
| 9941 | 10037 | .va_arg => |tag| { |
| 9942 | 10038 | const extra = function.extraData(Function.Instruction.VaArg, instruction.data); |
| ... | ... | @@ -10285,6 +10381,17 @@ pub fn printUnbuffered( |
| 10285 | 10381 | }); |
| 10286 | 10382 | try writer.writeAll("}\n"); |
| 10287 | 10383 | }, |
| 10384 | .str_tuple => { | |
| 10385 | var extra = self.metadataExtraDataTrail(Metadata.StrTuple, metadata_item.data); | |
| 10386 | const elements = extra.trail.next(extra.data.elements_len, Metadata, self); | |
| 10387 | try writer.print("!{{{[str]%}", .{ | |
| 10388 | .str = try metadata_formatter.fmt("", extra.data.str), | |
| 10389 | }); | |
| 10390 | for (elements) |element| try writer.print("{[element]%}", .{ | |
| 10391 | .element = try metadata_formatter.fmt("", element), | |
| 10392 | }); | |
| 10393 | try writer.writeAll("}\n"); | |
| 10394 | }, | |
| 10288 | 10395 | .module_flag => { |
| 10289 | 10396 | const extra = self.metadataExtraData(Metadata.ModuleFlag, metadata_item.data); |
| 10290 | 10397 | try writer.print("!{{{[behavior]%}{[name]%}{[constant]%}}}\n", .{ |
| ... | ... | @@ -11797,9 +11904,9 @@ pub fn debugNamed(self: *Builder, name: MetadataString, operands: []const Metada |
| 11797 | 11904 | self.debugNamedAssumeCapacity(name, operands); |
| 11798 | 11905 | } |
| 11799 | 11906 | |
| 11800 | fn debugNone(self: *Builder) Allocator.Error!Metadata { | |
| 11907 | fn metadataNone(self: *Builder) Allocator.Error!Metadata { | |
| 11801 | 11908 | try self.ensureUnusedMetadataCapacity(1, NoExtra, 0); |
| 11802 | return self.debugNoneAssumeCapacity(); | |
| 11909 | return self.metadataNoneAssumeCapacity(); | |
| 11803 | 11910 | } |
| 11804 | 11911 | |
| 11805 | 11912 | pub fn debugFile( |
| ... | ... | @@ -12088,12 +12195,21 @@ pub fn debugExpression( |
| 12088 | 12195 | return self.debugExpressionAssumeCapacity(elements); |
| 12089 | 12196 | } |
| 12090 | 12197 | |
| 12091 | pub fn debugTuple( | |
| 12198 | pub fn metadataTuple( | |
| 12092 | 12199 | self: *Builder, |
| 12093 | 12200 | elements: []const Metadata, |
| 12094 | 12201 | ) Allocator.Error!Metadata { |
| 12095 | 12202 | try self.ensureUnusedMetadataCapacity(1, Metadata.Tuple, elements.len); |
| 12096 | return self.debugTupleAssumeCapacity(elements); | |
| 12203 | return self.metadataTupleAssumeCapacity(elements); | |
| 12204 | } | |
| 12205 | ||
| 12206 | pub fn strTuple( | |
| 12207 | self: *Builder, | |
| 12208 | str: MetadataString, | |
| 12209 | elements: []const Metadata, | |
| 12210 | ) Allocator.Error!Metadata { | |
| 12211 | try self.ensureUnusedMetadataCapacity(1, Metadata.StrTuple, elements.len); | |
| 12212 | return self.strTupleAssumeCapacity(str, elements); | |
| 12097 | 12213 | } |
| 12098 | 12214 | |
| 12099 | 12215 | pub fn debugModuleFlag( |
| ... | ... | @@ -12164,9 +12280,9 @@ pub fn debugGlobalVarExpression( |
| 12164 | 12280 | return self.debugGlobalVarExpressionAssumeCapacity(variable, expression); |
| 12165 | 12281 | } |
| 12166 | 12282 | |
| 12167 | pub fn debugConstant(self: *Builder, value: Constant) Allocator.Error!Metadata { | |
| 12283 | pub fn metadataConstant(self: *Builder, value: Constant) Allocator.Error!Metadata { | |
| 12168 | 12284 | try self.ensureUnusedMetadataCapacity(1, NoExtra, 0); |
| 12169 | return self.debugConstantAssumeCapacity(value); | |
| 12285 | return self.metadataConstantAssumeCapacity(value); | |
| 12170 | 12286 | } |
| 12171 | 12287 | |
| 12172 | 12288 | pub fn debugForwardReferenceSetType(self: *Builder, fwd_ref: Metadata, ty: Metadata) void { |
| ... | ... | @@ -12261,8 +12377,7 @@ fn debugNamedAssumeCapacity(self: *Builder, name: MetadataString, operands: []co |
| 12261 | 12377 | }; |
| 12262 | 12378 | } |
| 12263 | 12379 | |
| 12264 | pub fn debugNoneAssumeCapacity(self: *Builder) Metadata { | |
| 12265 | assert(!self.strip); | |
| 12380 | pub fn metadataNoneAssumeCapacity(self: *Builder) Metadata { | |
| 12266 | 12381 | return self.metadataSimpleAssumeCapacity(.none, .{}); |
| 12267 | 12382 | } |
| 12268 | 12383 | |
| ... | ... | @@ -12738,11 +12853,10 @@ fn debugExpressionAssumeCapacity( |
| 12738 | 12853 | return @enumFromInt(gop.index); |
| 12739 | 12854 | } |
| 12740 | 12855 | |
| 12741 | fn debugTupleAssumeCapacity( | |
| 12856 | fn metadataTupleAssumeCapacity( | |
| 12742 | 12857 | self: *Builder, |
| 12743 | 12858 | elements: []const Metadata, |
| 12744 | 12859 | ) Metadata { |
| 12745 | assert(!self.strip); | |
| 12746 | 12860 | const Key = struct { |
| 12747 | 12861 | elements: []const Metadata, |
| 12748 | 12862 | }; |
| ... | ... | @@ -12785,6 +12899,55 @@ fn debugTupleAssumeCapacity( |
| 12785 | 12899 | return @enumFromInt(gop.index); |
| 12786 | 12900 | } |
| 12787 | 12901 | |
| 12902 | fn strTupleAssumeCapacity( | |
| 12903 | self: *Builder, | |
| 12904 | str: MetadataString, | |
| 12905 | elements: []const Metadata, | |
| 12906 | ) Metadata { | |
| 12907 | const Key = struct { | |
| 12908 | str: MetadataString, | |
| 12909 | elements: []const Metadata, | |
| 12910 | }; | |
| 12911 | const Adapter = struct { | |
| 12912 | builder: *const Builder, | |
| 12913 | pub fn hash(_: @This(), key: Key) u32 { | |
| 12914 | var hasher = comptime std.hash.Wyhash.init(std.hash.uint32(@intFromEnum(Metadata.Tag.tuple))); | |
| 12915 | hasher.update(std.mem.sliceAsBytes(key.elements)); | |
| 12916 | return @truncate(hasher.final()); | |
| 12917 | } | |
| 12918 | ||
| 12919 | pub fn eql(ctx: @This(), lhs_key: Key, _: void, rhs_index: usize) bool { | |
| 12920 | if (.str_tuple != ctx.builder.metadata_items.items(.tag)[rhs_index]) return false; | |
| 12921 | const rhs_data = ctx.builder.metadata_items.items(.data)[rhs_index]; | |
| 12922 | var rhs_extra = ctx.builder.metadataExtraDataTrail(Metadata.StrTuple, rhs_data); | |
| 12923 | return rhs_extra.data.str == lhs_key.str and std.mem.eql( | |
| 12924 | Metadata, | |
| 12925 | lhs_key.elements, | |
| 12926 | rhs_extra.trail.next(rhs_extra.data.elements_len, Metadata, ctx.builder), | |
| 12927 | ); | |
| 12928 | } | |
| 12929 | }; | |
| 12930 | ||
| 12931 | const gop = self.metadata_map.getOrPutAssumeCapacityAdapted( | |
| 12932 | Key{ .str = str, .elements = elements }, | |
| 12933 | Adapter{ .builder = self }, | |
| 12934 | ); | |
| 12935 | ||
| 12936 | if (!gop.found_existing) { | |
| 12937 | gop.key_ptr.* = {}; | |
| 12938 | gop.value_ptr.* = {}; | |
| 12939 | self.metadata_items.appendAssumeCapacity(.{ | |
| 12940 | .tag = .str_tuple, | |
| 12941 | .data = self.addMetadataExtraAssumeCapacity(Metadata.StrTuple{ | |
| 12942 | .str = str, | |
| 12943 | .elements_len = @intCast(elements.len), | |
| 12944 | }), | |
| 12945 | }); | |
| 12946 | self.metadata_extra.appendSliceAssumeCapacity(@ptrCast(elements)); | |
| 12947 | } | |
| 12948 | return @enumFromInt(gop.index); | |
| 12949 | } | |
| 12950 | ||
| 12788 | 12951 | fn debugModuleFlagAssumeCapacity( |
| 12789 | 12952 | self: *Builder, |
| 12790 | 12953 | behavior: Metadata, |
| ... | ... | @@ -12875,8 +13038,7 @@ fn debugGlobalVarExpressionAssumeCapacity( |
| 12875 | 13038 | }); |
| 12876 | 13039 | } |
| 12877 | 13040 | |
| 12878 | fn debugConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { | |
| 12879 | assert(!self.strip); | |
| 13041 | fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { | |
| 12880 | 13042 | const Adapter = struct { |
| 12881 | 13043 | builder: *const Builder, |
| 12882 | 13044 | pub fn hash(_: @This(), key: Constant) u32 { |
| ... | ... | @@ -13755,15 +13917,18 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 13755 | 13917 | } |
| 13756 | 13918 | |
| 13757 | 13919 | // METADATA_KIND_BLOCK |
| 13758 | if (!self.strip) { | |
| 13920 | { | |
| 13759 | 13921 | const MetadataKindBlock = ir.MetadataKindBlock; |
| 13760 | 13922 | var metadata_kind_block = try module_block.enterSubBlock(MetadataKindBlock, true); |
| 13761 | 13923 | |
| 13762 | inline for (@typeInfo(ir.MetadataKind).Enum.fields) |field| { | |
| 13763 | try metadata_kind_block.writeAbbrev(MetadataKindBlock.Kind{ | |
| 13764 | .id = field.value, | |
| 13765 | .name = field.name, | |
| 13766 | }); | |
| 13924 | inline for (@typeInfo(ir.FixedMetadataKind).Enum.fields) |field| { | |
| 13925 | // don't include `dbg` in stripped functions | |
| 13926 | if (!(self.strip and std.mem.eql(u8, field.name, "dbg"))) { | |
| 13927 | try metadata_kind_block.writeAbbrev(MetadataKindBlock.Kind{ | |
| 13928 | .id = field.value, | |
| 13929 | .name = field.name, | |
| 13930 | }); | |
| 13931 | } | |
| 13767 | 13932 | } |
| 13768 | 13933 | |
| 13769 | 13934 | try metadata_kind_block.end(); |
| ... | ... | @@ -13808,14 +13973,14 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 13808 | 13973 | const metadata_adapter = MetadataAdapter.init(self, constant_adapter); |
| 13809 | 13974 | |
| 13810 | 13975 | // METADATA_BLOCK |
| 13811 | if (!self.strip) { | |
| 13976 | { | |
| 13812 | 13977 | const MetadataBlock = ir.MetadataBlock; |
| 13813 | 13978 | var metadata_block = try module_block.enterSubBlock(MetadataBlock, true); |
| 13814 | 13979 | |
| 13815 | 13980 | const MetadataBlockWriter = @TypeOf(metadata_block); |
| 13816 | 13981 | |
| 13817 | 13982 | // Emit all MetadataStrings |
| 13818 | { | |
| 13983 | if (self.metadata_string_map.count() > 1) { | |
| 13819 | 13984 | const strings_offset, const strings_size = blk: { |
| 13820 | 13985 | var strings_offset: u32 = 0; |
| 13821 | 13986 | var strings_size: u32 = 0; |
| ... | ... | @@ -14046,7 +14211,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14046 | 14211 | else |
| 14047 | 14212 | -%val << 1 | 1); |
| 14048 | 14213 | } |
| 14049 | try metadata_block.writeUnabbrev(MetadataBlock.Enumerator.id, record.items); | |
| 14214 | try metadata_block.writeUnabbrev(@intFromEnum(MetadataBlock.Enumerator.id), record.items); | |
| 14050 | 14215 | continue; |
| 14051 | 14216 | }; |
| 14052 | 14217 | try metadata_block.writeAbbrevAdapted(MetadataBlock.Enumerator{ |
| ... | ... | @@ -14085,6 +14250,22 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14085 | 14250 | .elements = elements, |
| 14086 | 14251 | }, metadata_adapter); |
| 14087 | 14252 | }, |
| 14253 | .str_tuple => { | |
| 14254 | var extra = self.metadataExtraDataTrail(Metadata.StrTuple, data); | |
| 14255 | ||
| 14256 | const elements = extra.trail.next(extra.data.elements_len, Metadata, self); | |
| 14257 | ||
| 14258 | const all_elems = try self.gpa.alloc(Metadata, elements.len + 1); | |
| 14259 | defer self.gpa.free(all_elems); | |
| 14260 | all_elems[0] = @enumFromInt(metadata_adapter.getMetadataStringIndex(extra.data.str)); | |
| 14261 | for (elements, all_elems[1..]) |elem, *out_elem| { | |
| 14262 | out_elem.* = @enumFromInt(metadata_adapter.getMetadataIndex(elem)); | |
| 14263 | } | |
| 14264 | ||
| 14265 | try metadata_block.writeAbbrev(MetadataBlock.Node{ | |
| 14266 | .elements = all_elems, | |
| 14267 | }); | |
| 14268 | }, | |
| 14088 | 14269 | .module_flag => { |
| 14089 | 14270 | const extra = self.metadataExtraData(Metadata.ModuleFlag, data); |
| 14090 | 14271 | try metadata_block.writeAbbrev(MetadataBlock.Node{ |
| ... | ... | @@ -14177,7 +14358,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14177 | 14358 | |
| 14178 | 14359 | try metadata_block.writeAbbrev(MetadataBlock.GlobalDeclAttachment{ |
| 14179 | 14360 | .value = @enumFromInt(constant_adapter.getConstantIndex(global.toConst())), |
| 14180 | .kind = ir.MetadataKind.dbg, | |
| 14361 | .kind = .dbg, | |
| 14181 | 14362 | .metadata = @enumFromInt(metadata_adapter.getMetadataIndex(global_ptr.dbg) - 1), |
| 14182 | 14363 | }); |
| 14183 | 14364 | } |
| ... | ... | @@ -14186,6 +14367,18 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14186 | 14367 | try metadata_block.end(); |
| 14187 | 14368 | } |
| 14188 | 14369 | |
| 14370 | // OPERAND_BUNDLE_TAGS_BLOCK | |
| 14371 | { | |
| 14372 | const OperandBundleTags = ir.OperandBundleTags; | |
| 14373 | var operand_bundle_tags_block = try module_block.enterSubBlock(OperandBundleTags, true); | |
| 14374 | ||
| 14375 | try operand_bundle_tags_block.writeAbbrev(OperandBundleTags.OperandBundleTag{ | |
| 14376 | .tag = "cold", | |
| 14377 | }); | |
| 14378 | ||
| 14379 | try operand_bundle_tags_block.end(); | |
| 14380 | } | |
| 14381 | ||
| 14189 | 14382 | // Block info |
| 14190 | 14383 | { |
| 14191 | 14384 | const BlockInfo = ir.BlockInfo; |
| ... | ... | @@ -14220,20 +14413,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14220 | 14413 | constant_adapter: ConstantAdapter, |
| 14221 | 14414 | metadata_adapter: MetadataAdapter, |
| 14222 | 14415 | func: *const Function, |
| 14223 | instruction_index: u32 = 0, | |
| 14224 | ||
| 14225 | pub fn init( | |
| 14226 | const_adapter: ConstantAdapter, | |
| 14227 | meta_adapter: MetadataAdapter, | |
| 14228 | func: *const Function, | |
| 14229 | ) @This() { | |
| 14230 | return .{ | |
| 14231 | .constant_adapter = const_adapter, | |
| 14232 | .metadata_adapter = meta_adapter, | |
| 14233 | .func = func, | |
| 14234 | .instruction_index = 0, | |
| 14235 | }; | |
| 14236 | } | |
| 14416 | instruction_index: Function.Instruction.Index, | |
| 14237 | 14417 | |
| 14238 | 14418 | pub fn get(adapter: @This(), value: anytype, comptime field_name: []const u8) @TypeOf(value) { |
| 14239 | 14419 | _ = field_name; |
| ... | ... | @@ -14254,7 +14434,6 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14254 | 14434 | .instruction => |instruction| instruction.valueIndex(adapter.func) + adapter.firstInstr(), |
| 14255 | 14435 | .constant => |constant| adapter.constant_adapter.getConstantIndex(constant), |
| 14256 | 14436 | .metadata => |metadata| { |
| 14257 | assert(!adapter.func.strip); | |
| 14258 | 14437 | const real_metadata = metadata.unwrap(adapter.metadata_adapter.builder); |
| 14259 | 14438 | if (@intFromEnum(real_metadata) < Metadata.first_local_metadata) |
| 14260 | 14439 | return adapter.metadata_adapter.getMetadataIndex(real_metadata) - 1; |
| ... | ... | @@ -14282,19 +14461,12 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14282 | 14461 | } |
| 14283 | 14462 | |
| 14284 | 14463 | pub fn offset(adapter: @This()) u32 { |
| 14285 | return @as( | |
| 14286 | Function.Instruction.Index, | |
| 14287 | @enumFromInt(adapter.instruction_index), | |
| 14288 | ).valueIndex(adapter.func) + adapter.firstInstr(); | |
| 14464 | return adapter.instruction_index.valueIndex(adapter.func) + adapter.firstInstr(); | |
| 14289 | 14465 | } |
| 14290 | 14466 | |
| 14291 | 14467 | fn firstInstr(adapter: @This()) u32 { |
| 14292 | 14468 | return adapter.constant_adapter.numConstants(); |
| 14293 | 14469 | } |
| 14294 | ||
| 14295 | pub fn next(adapter: *@This()) void { | |
| 14296 | adapter.instruction_index += 1; | |
| 14297 | } | |
| 14298 | 14470 | }; |
| 14299 | 14471 | |
| 14300 | 14472 | for (self.functions.items, 0..) |func, func_index| { |
| ... | ... | @@ -14307,7 +14479,12 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14307 | 14479 | |
| 14308 | 14480 | try function_block.writeAbbrev(FunctionBlock.DeclareBlocks{ .num_blocks = func.blocks.len }); |
| 14309 | 14481 | |
| 14310 | var adapter = FunctionAdapter.init(constant_adapter, metadata_adapter, &func); | |
| 14482 | var adapter: FunctionAdapter = .{ | |
| 14483 | .constant_adapter = constant_adapter, | |
| 14484 | .metadata_adapter = metadata_adapter, | |
| 14485 | .func = &func, | |
| 14486 | .instruction_index = @enumFromInt(0), | |
| 14487 | }; | |
| 14311 | 14488 | |
| 14312 | 14489 | // Emit function level metadata block |
| 14313 | 14490 | if (!func.strip and func.debug_values.len > 0) { |
| ... | ... | @@ -14330,21 +14507,27 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14330 | 14507 | var has_location = false; |
| 14331 | 14508 | |
| 14332 | 14509 | var block_incoming_len: u32 = undefined; |
| 14333 | for (0..func.instructions.len) |instr_index| { | |
| 14334 | const tag = tags[instr_index]; | |
| 14335 | ||
| 14510 | for (tags, datas, 0..) |tag, data, instr_index| { | |
| 14511 | adapter.instruction_index = @enumFromInt(instr_index); | |
| 14336 | 14512 | record.clearRetainingCapacity(); |
| 14337 | 14513 | |
| 14338 | 14514 | switch (tag) { |
| 14339 | .block => block_incoming_len = datas[instr_index], | |
| 14340 | .arg => {}, | |
| 14515 | .arg => continue, | |
| 14516 | .block => { | |
| 14517 | block_incoming_len = data; | |
| 14518 | continue; | |
| 14519 | }, | |
| 14341 | 14520 | .@"unreachable" => try function_block.writeAbbrev(FunctionBlock.Unreachable{}), |
| 14342 | 14521 | .call, |
| 14343 | 14522 | .@"musttail call", |
| 14344 | 14523 | .@"notail call", |
| 14345 | 14524 | .@"tail call", |
| 14346 | 14525 | => |kind| { |
| 14347 | var extra = func.extraDataTrail(Function.Instruction.Call, datas[instr_index]); | |
| 14526 | var extra = func.extraDataTrail(Function.Instruction.Call, data); | |
| 14527 | ||
| 14528 | if (extra.data.info.has_op_bundle_cold) { | |
| 14529 | try function_block.writeAbbrev(FunctionBlock.ColdOperandBundle{}); | |
| 14530 | } | |
| 14348 | 14531 | |
| 14349 | 14532 | const call_conv = extra.data.info.call_conv; |
| 14350 | 14533 | const args = extra.trail.next(extra.data.args_len, Value, &func); |
| ... | ... | @@ -14367,7 +14550,11 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14367 | 14550 | .@"notail call fast", |
| 14368 | 14551 | .@"tail call fast", |
| 14369 | 14552 | => |kind| { |
| 14370 | var extra = func.extraDataTrail(Function.Instruction.Call, datas[instr_index]); | |
| 14553 | var extra = func.extraDataTrail(Function.Instruction.Call, data); | |
| 14554 | ||
| 14555 | if (extra.data.info.has_op_bundle_cold) { | |
| 14556 | try function_block.writeAbbrev(FunctionBlock.ColdOperandBundle{}); | |
| 14557 | } | |
| 14371 | 14558 | |
| 14372 | 14559 | const call_conv = extra.data.info.call_conv; |
| 14373 | 14560 | const args = extra.trail.next(extra.data.args_len, Value, &func); |
| ... | ... | @@ -14405,7 +14592,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14405 | 14592 | .srem, |
| 14406 | 14593 | .ashr, |
| 14407 | 14594 | => |kind| { |
| 14408 | const extra = func.extraData(Function.Instruction.Binary, datas[instr_index]); | |
| 14595 | const extra = func.extraData(Function.Instruction.Binary, data); | |
| 14409 | 14596 | try function_block.writeAbbrev(FunctionBlock.Binary{ |
| 14410 | 14597 | .opcode = kind.toBinaryOpcode(), |
| 14411 | 14598 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| ... | ... | @@ -14417,7 +14604,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14417 | 14604 | .@"lshr exact", |
| 14418 | 14605 | .@"ashr exact", |
| 14419 | 14606 | => |kind| { |
| 14420 | const extra = func.extraData(Function.Instruction.Binary, datas[instr_index]); | |
| 14607 | const extra = func.extraData(Function.Instruction.Binary, data); | |
| 14421 | 14608 | try function_block.writeAbbrev(FunctionBlock.BinaryExact{ |
| 14422 | 14609 | .opcode = kind.toBinaryOpcode(), |
| 14423 | 14610 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| ... | ... | @@ -14437,7 +14624,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14437 | 14624 | .@"shl nuw", |
| 14438 | 14625 | .@"shl nuw nsw", |
| 14439 | 14626 | => |kind| { |
| 14440 | const extra = func.extraData(Function.Instruction.Binary, datas[instr_index]); | |
| 14627 | const extra = func.extraData(Function.Instruction.Binary, data); | |
| 14441 | 14628 | try function_block.writeAbbrev(FunctionBlock.BinaryNoWrap{ |
| 14442 | 14629 | .opcode = kind.toBinaryOpcode(), |
| 14443 | 14630 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| ... | ... | @@ -14468,7 +14655,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14468 | 14655 | .@"frem fast", |
| 14469 | 14656 | .@"fsub fast", |
| 14470 | 14657 | => |kind| { |
| 14471 | const extra = func.extraData(Function.Instruction.Binary, datas[instr_index]); | |
| 14658 | const extra = func.extraData(Function.Instruction.Binary, data); | |
| 14472 | 14659 | try function_block.writeAbbrev(FunctionBlock.BinaryFast{ |
| 14473 | 14660 | .opcode = kind.toBinaryOpcode(), |
| 14474 | 14661 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| ... | ... | @@ -14479,7 +14666,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14479 | 14666 | .alloca, |
| 14480 | 14667 | .@"alloca inalloca", |
| 14481 | 14668 | => |kind| { |
| 14482 | const extra = func.extraData(Function.Instruction.Alloca, datas[instr_index]); | |
| 14669 | const extra = func.extraData(Function.Instruction.Alloca, data); | |
| 14483 | 14670 | const alignment = extra.info.alignment.toLlvm(); |
| 14484 | 14671 | try function_block.writeAbbrev(FunctionBlock.Alloca{ |
| 14485 | 14672 | .inst_type = extra.type, |
| ... | ... | @@ -14508,7 +14695,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14508 | 14695 | .sext, |
| 14509 | 14696 | .zext, |
| 14510 | 14697 | => |kind| { |
| 14511 | const extra = func.extraData(Function.Instruction.Cast, datas[instr_index]); | |
| 14698 | const extra = func.extraData(Function.Instruction.Cast, data); | |
| 14512 | 14699 | try function_block.writeAbbrev(FunctionBlock.Cast{ |
| 14513 | 14700 | .val = adapter.getOffsetValueIndex(extra.val), |
| 14514 | 14701 | .type_index = extra.type, |
| ... | ... | @@ -14542,7 +14729,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14542 | 14729 | .@"icmp ule", |
| 14543 | 14730 | .@"icmp ult", |
| 14544 | 14731 | => |kind| { |
| 14545 | const extra = func.extraData(Function.Instruction.Binary, datas[instr_index]); | |
| 14732 | const extra = func.extraData(Function.Instruction.Binary, data); | |
| 14546 | 14733 | try function_block.writeAbbrev(FunctionBlock.Cmp{ |
| 14547 | 14734 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| 14548 | 14735 | .rhs = adapter.getOffsetValueIndex(extra.rhs), |
| ... | ... | @@ -14566,7 +14753,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14566 | 14753 | .@"fcmp fast une", |
| 14567 | 14754 | .@"fcmp fast uno", |
| 14568 | 14755 | => |kind| { |
| 14569 | const extra = func.extraData(Function.Instruction.Binary, datas[instr_index]); | |
| 14756 | const extra = func.extraData(Function.Instruction.Binary, data); | |
| 14570 | 14757 | try function_block.writeAbbrev(FunctionBlock.CmpFast{ |
| 14571 | 14758 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| 14572 | 14759 | .rhs = adapter.getOffsetValueIndex(extra.rhs), |
| ... | ... | @@ -14575,14 +14762,14 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14575 | 14762 | }); |
| 14576 | 14763 | }, |
| 14577 | 14764 | .fneg => try function_block.writeAbbrev(FunctionBlock.FNeg{ |
| 14578 | .val = adapter.getOffsetValueIndex(@enumFromInt(datas[instr_index])), | |
| 14765 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | |
| 14579 | 14766 | }), |
| 14580 | 14767 | .@"fneg fast" => try function_block.writeAbbrev(FunctionBlock.FNegFast{ |
| 14581 | .val = adapter.getOffsetValueIndex(@enumFromInt(datas[instr_index])), | |
| 14768 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | |
| 14582 | 14769 | .fast_math = FastMath.fast, |
| 14583 | 14770 | }), |
| 14584 | 14771 | .extractvalue => { |
| 14585 | var extra = func.extraDataTrail(Function.Instruction.ExtractValue, datas[instr_index]); | |
| 14772 | var extra = func.extraDataTrail(Function.Instruction.ExtractValue, data); | |
| 14586 | 14773 | const indices = extra.trail.next(extra.data.indices_len, u32, &func); |
| 14587 | 14774 | try function_block.writeAbbrev(FunctionBlock.ExtractValue{ |
| 14588 | 14775 | .val = adapter.getOffsetValueIndex(extra.data.val), |
| ... | ... | @@ -14590,7 +14777,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14590 | 14777 | }); |
| 14591 | 14778 | }, |
| 14592 | 14779 | .insertvalue => { |
| 14593 | var extra = func.extraDataTrail(Function.Instruction.InsertValue, datas[instr_index]); | |
| 14780 | var extra = func.extraDataTrail(Function.Instruction.InsertValue, data); | |
| 14594 | 14781 | const indices = extra.trail.next(extra.data.indices_len, u32, &func); |
| 14595 | 14782 | try function_block.writeAbbrev(FunctionBlock.InsertValue{ |
| 14596 | 14783 | .val = adapter.getOffsetValueIndex(extra.data.val), |
| ... | ... | @@ -14599,14 +14786,14 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14599 | 14786 | }); |
| 14600 | 14787 | }, |
| 14601 | 14788 | .extractelement => { |
| 14602 | const extra = func.extraData(Function.Instruction.ExtractElement, datas[instr_index]); | |
| 14789 | const extra = func.extraData(Function.Instruction.ExtractElement, data); | |
| 14603 | 14790 | try function_block.writeAbbrev(FunctionBlock.ExtractElement{ |
| 14604 | 14791 | .val = adapter.getOffsetValueIndex(extra.val), |
| 14605 | 14792 | .index = adapter.getOffsetValueIndex(extra.index), |
| 14606 | 14793 | }); |
| 14607 | 14794 | }, |
| 14608 | 14795 | .insertelement => { |
| 14609 | const extra = func.extraData(Function.Instruction.InsertElement, datas[instr_index]); | |
| 14796 | const extra = func.extraData(Function.Instruction.InsertElement, data); | |
| 14610 | 14797 | try function_block.writeAbbrev(FunctionBlock.InsertElement{ |
| 14611 | 14798 | .val = adapter.getOffsetValueIndex(extra.val), |
| 14612 | 14799 | .elem = adapter.getOffsetValueIndex(extra.elem), |
| ... | ... | @@ -14614,7 +14801,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14614 | 14801 | }); |
| 14615 | 14802 | }, |
| 14616 | 14803 | .select => { |
| 14617 | const extra = func.extraData(Function.Instruction.Select, datas[instr_index]); | |
| 14804 | const extra = func.extraData(Function.Instruction.Select, data); | |
| 14618 | 14805 | try function_block.writeAbbrev(FunctionBlock.Select{ |
| 14619 | 14806 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| 14620 | 14807 | .rhs = adapter.getOffsetValueIndex(extra.rhs), |
| ... | ... | @@ -14622,7 +14809,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14622 | 14809 | }); |
| 14623 | 14810 | }, |
| 14624 | 14811 | .@"select fast" => { |
| 14625 | const extra = func.extraData(Function.Instruction.Select, datas[instr_index]); | |
| 14812 | const extra = func.extraData(Function.Instruction.Select, data); | |
| 14626 | 14813 | try function_block.writeAbbrev(FunctionBlock.SelectFast{ |
| 14627 | 14814 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| 14628 | 14815 | .rhs = adapter.getOffsetValueIndex(extra.rhs), |
| ... | ... | @@ -14631,7 +14818,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14631 | 14818 | }); |
| 14632 | 14819 | }, |
| 14633 | 14820 | .shufflevector => { |
| 14634 | const extra = func.extraData(Function.Instruction.ShuffleVector, datas[instr_index]); | |
| 14821 | const extra = func.extraData(Function.Instruction.ShuffleVector, data); | |
| 14635 | 14822 | try function_block.writeAbbrev(FunctionBlock.ShuffleVector{ |
| 14636 | 14823 | .lhs = adapter.getOffsetValueIndex(extra.lhs), |
| 14637 | 14824 | .rhs = adapter.getOffsetValueIndex(extra.rhs), |
| ... | ... | @@ -14641,7 +14828,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14641 | 14828 | .getelementptr, |
| 14642 | 14829 | .@"getelementptr inbounds", |
| 14643 | 14830 | => |kind| { |
| 14644 | var extra = func.extraDataTrail(Function.Instruction.GetElementPtr, datas[instr_index]); | |
| 14831 | var extra = func.extraDataTrail(Function.Instruction.GetElementPtr, data); | |
| 14645 | 14832 | const indices = extra.trail.next(extra.data.indices_len, Value, &func); |
| 14646 | 14833 | try function_block.writeAbbrevAdapted( |
| 14647 | 14834 | FunctionBlock.GetElementPtr{ |
| ... | ... | @@ -14654,7 +14841,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14654 | 14841 | ); |
| 14655 | 14842 | }, |
| 14656 | 14843 | .load => { |
| 14657 | const extra = func.extraData(Function.Instruction.Load, datas[instr_index]); | |
| 14844 | const extra = func.extraData(Function.Instruction.Load, data); | |
| 14658 | 14845 | try function_block.writeAbbrev(FunctionBlock.Load{ |
| 14659 | 14846 | .ptr = adapter.getOffsetValueIndex(extra.ptr), |
| 14660 | 14847 | .ty = extra.type, |
| ... | ... | @@ -14663,7 +14850,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14663 | 14850 | }); |
| 14664 | 14851 | }, |
| 14665 | 14852 | .@"load atomic" => { |
| 14666 | const extra = func.extraData(Function.Instruction.Load, datas[instr_index]); | |
| 14853 | const extra = func.extraData(Function.Instruction.Load, data); | |
| 14667 | 14854 | try function_block.writeAbbrev(FunctionBlock.LoadAtomic{ |
| 14668 | 14855 | .ptr = adapter.getOffsetValueIndex(extra.ptr), |
| 14669 | 14856 | .ty = extra.type, |
| ... | ... | @@ -14674,7 +14861,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14674 | 14861 | }); |
| 14675 | 14862 | }, |
| 14676 | 14863 | .store => { |
| 14677 | const extra = func.extraData(Function.Instruction.Store, datas[instr_index]); | |
| 14864 | const extra = func.extraData(Function.Instruction.Store, data); | |
| 14678 | 14865 | try function_block.writeAbbrev(FunctionBlock.Store{ |
| 14679 | 14866 | .ptr = adapter.getOffsetValueIndex(extra.ptr), |
| 14680 | 14867 | .val = adapter.getOffsetValueIndex(extra.val), |
| ... | ... | @@ -14683,7 +14870,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14683 | 14870 | }); |
| 14684 | 14871 | }, |
| 14685 | 14872 | .@"store atomic" => { |
| 14686 | const extra = func.extraData(Function.Instruction.Store, datas[instr_index]); | |
| 14873 | const extra = func.extraData(Function.Instruction.Store, data); | |
| 14687 | 14874 | try function_block.writeAbbrev(FunctionBlock.StoreAtomic{ |
| 14688 | 14875 | .ptr = adapter.getOffsetValueIndex(extra.ptr), |
| 14689 | 14876 | .val = adapter.getOffsetValueIndex(extra.val), |
| ... | ... | @@ -14695,11 +14882,11 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14695 | 14882 | }, |
| 14696 | 14883 | .br => { |
| 14697 | 14884 | try function_block.writeAbbrev(FunctionBlock.BrUnconditional{ |
| 14698 | .block = datas[instr_index], | |
| 14885 | .block = data, | |
| 14699 | 14886 | }); |
| 14700 | 14887 | }, |
| 14701 | 14888 | .br_cond => { |
| 14702 | const extra = func.extraData(Function.Instruction.BrCond, datas[instr_index]); | |
| 14889 | const extra = func.extraData(Function.Instruction.BrCond, data); | |
| 14703 | 14890 | try function_block.writeAbbrev(FunctionBlock.BrConditional{ |
| 14704 | 14891 | .then_block = @intFromEnum(extra.then), |
| 14705 | 14892 | .else_block = @intFromEnum(extra.@"else"), |
| ... | ... | @@ -14707,7 +14894,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14707 | 14894 | }); |
| 14708 | 14895 | }, |
| 14709 | 14896 | .@"switch" => { |
| 14710 | var extra = func.extraDataTrail(Function.Instruction.Switch, datas[instr_index]); | |
| 14897 | var extra = func.extraDataTrail(Function.Instruction.Switch, data); | |
| 14711 | 14898 | |
| 14712 | 14899 | try record.ensureUnusedCapacity(self.gpa, 3 + extra.data.cases_len * 2); |
| 14713 | 14900 | |
| ... | ... | @@ -14730,7 +14917,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14730 | 14917 | try function_block.writeUnabbrev(12, record.items); |
| 14731 | 14918 | }, |
| 14732 | 14919 | .va_arg => { |
| 14733 | const extra = func.extraData(Function.Instruction.VaArg, datas[instr_index]); | |
| 14920 | const extra = func.extraData(Function.Instruction.VaArg, data); | |
| 14734 | 14921 | try function_block.writeAbbrev(FunctionBlock.VaArg{ |
| 14735 | 14922 | .list_type = extra.list.typeOf(@enumFromInt(func_index), self), |
| 14736 | 14923 | .list = adapter.getOffsetValueIndex(extra.list), |
| ... | ... | @@ -14740,7 +14927,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14740 | 14927 | .phi, |
| 14741 | 14928 | .@"phi fast", |
| 14742 | 14929 | => |kind| { |
| 14743 | var extra = func.extraDataTrail(Function.Instruction.Phi, datas[instr_index]); | |
| 14930 | var extra = func.extraDataTrail(Function.Instruction.Phi, data); | |
| 14744 | 14931 | const vals = extra.trail.next(block_incoming_len, Value, &func); |
| 14745 | 14932 | const blocks = extra.trail.next(block_incoming_len, Function.Block.Index, &func); |
| 14746 | 14933 | |
| ... | ... | @@ -14764,11 +14951,11 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14764 | 14951 | try function_block.writeUnabbrev(16, record.items); |
| 14765 | 14952 | }, |
| 14766 | 14953 | .ret => try function_block.writeAbbrev(FunctionBlock.Ret{ |
| 14767 | .val = adapter.getOffsetValueIndex(@enumFromInt(datas[instr_index])), | |
| 14954 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | |
| 14768 | 14955 | }), |
| 14769 | 14956 | .@"ret void" => try function_block.writeAbbrev(FunctionBlock.RetVoid{}), |
| 14770 | 14957 | .atomicrmw => { |
| 14771 | const extra = func.extraData(Function.Instruction.AtomicRmw, datas[instr_index]); | |
| 14958 | const extra = func.extraData(Function.Instruction.AtomicRmw, data); | |
| 14772 | 14959 | try function_block.writeAbbrev(FunctionBlock.AtomicRmw{ |
| 14773 | 14960 | .ptr = adapter.getOffsetValueIndex(extra.ptr), |
| 14774 | 14961 | .val = adapter.getOffsetValueIndex(extra.val), |
| ... | ... | @@ -14782,7 +14969,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14782 | 14969 | .cmpxchg, |
| 14783 | 14970 | .@"cmpxchg weak", |
| 14784 | 14971 | => |kind| { |
| 14785 | const extra = func.extraData(Function.Instruction.CmpXchg, datas[instr_index]); | |
| 14972 | const extra = func.extraData(Function.Instruction.CmpXchg, data); | |
| 14786 | 14973 | |
| 14787 | 14974 | try function_block.writeAbbrev(FunctionBlock.CmpXchg{ |
| 14788 | 14975 | .ptr = adapter.getOffsetValueIndex(extra.ptr), |
| ... | ... | @@ -14797,7 +14984,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14797 | 14984 | }); |
| 14798 | 14985 | }, |
| 14799 | 14986 | .fence => { |
| 14800 | const info: MemoryAccessInfo = @bitCast(datas[instr_index]); | |
| 14987 | const info: MemoryAccessInfo = @bitCast(data); | |
| 14801 | 14988 | try function_block.writeAbbrev(FunctionBlock.Fence{ |
| 14802 | 14989 | .ordering = info.success_ordering, |
| 14803 | 14990 | .sync_scope = info.sync_scope, |
| ... | ... | @@ -14806,7 +14993,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14806 | 14993 | } |
| 14807 | 14994 | |
| 14808 | 14995 | if (!func.strip) { |
| 14809 | if (func.debug_locations.get(@enumFromInt(instr_index))) |debug_location| { | |
| 14996 | if (func.debug_locations.get(adapter.instruction_index)) |debug_location| { | |
| 14810 | 14997 | switch (debug_location) { |
| 14811 | 14998 | .no_location => has_location = false, |
| 14812 | 14999 | .location => |location| { |
| ... | ... | @@ -14823,8 +15010,6 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14823 | 15010 | try function_block.writeAbbrev(FunctionBlock.DebugLocAgain{}); |
| 14824 | 15011 | } |
| 14825 | 15012 | } |
| 14826 | ||
| 14827 | adapter.next(); | |
| 14828 | 15013 | } |
| 14829 | 15014 | |
| 14830 | 15015 | // VALUE_SYMTAB |
| ... | ... | @@ -14850,18 +15035,48 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 14850 | 15035 | } |
| 14851 | 15036 | |
| 14852 | 15037 | // METADATA_ATTACHMENT_BLOCK |
| 14853 | if (!func.strip) blk: { | |
| 14854 | const dbg = func.global.ptrConst(self).dbg; | |
| 14855 | ||
| 14856 | if (dbg == .none) break :blk; | |
| 14857 | ||
| 15038 | { | |
| 14858 | 15039 | const MetadataAttachmentBlock = ir.MetadataAttachmentBlock; |
| 14859 | 15040 | var metadata_attach_block = try function_block.enterSubBlock(MetadataAttachmentBlock, false); |
| 14860 | 15041 | |
| 14861 | try metadata_attach_block.writeAbbrev(MetadataAttachmentBlock.AttachmentSingle{ | |
| 14862 | .kind = ir.MetadataKind.dbg, | |
| 14863 | .metadata = @enumFromInt(metadata_adapter.getMetadataIndex(dbg) - 1), | |
| 14864 | }); | |
| 15042 | dbg: { | |
| 15043 | if (func.strip) break :dbg; | |
| 15044 | const dbg = func.global.ptrConst(self).dbg; | |
| 15045 | if (dbg == .none) break :dbg; | |
| 15046 | try metadata_attach_block.writeAbbrev(MetadataAttachmentBlock.AttachmentGlobalSingle{ | |
| 15047 | .kind = .dbg, | |
| 15048 | .metadata = @enumFromInt(metadata_adapter.getMetadataIndex(dbg) - 1), | |
| 15049 | }); | |
| 15050 | } | |
| 15051 | ||
| 15052 | var instr_index: u32 = 0; | |
| 15053 | for (func.instructions.items(.tag), func.instructions.items(.data)) |instr_tag, data| switch (instr_tag) { | |
| 15054 | .arg, .block => {}, // not an actual instruction | |
| 15055 | else => { | |
| 15056 | instr_index += 1; | |
| 15057 | }, | |
| 15058 | .br_cond, .@"switch" => { | |
| 15059 | const weights = switch (instr_tag) { | |
| 15060 | .br_cond => func.extraData(Function.Instruction.BrCond, data).weights, | |
| 15061 | .@"switch" => func.extraData(Function.Instruction.Switch, data).weights, | |
| 15062 | else => unreachable, | |
| 15063 | }; | |
| 15064 | switch (weights) { | |
| 15065 | .none => {}, | |
| 15066 | .unpredictable => try metadata_attach_block.writeAbbrev(MetadataAttachmentBlock.AttachmentInstructionSingle{ | |
| 15067 | .inst = instr_index, | |
| 15068 | .kind = .unpredictable, | |
| 15069 | .metadata = @enumFromInt(metadata_adapter.getMetadataIndex(.empty_tuple) - 1), | |
| 15070 | }), | |
| 15071 | _ => try metadata_attach_block.writeAbbrev(MetadataAttachmentBlock.AttachmentInstructionSingle{ | |
| 15072 | .inst = instr_index, | |
| 15073 | .kind = .prof, | |
| 15074 | .metadata = @enumFromInt(metadata_adapter.getMetadataIndex(@enumFromInt(@intFromEnum(weights))) - 1), | |
| 15075 | }), | |
| 15076 | } | |
| 15077 | instr_index += 1; | |
| 15078 | }, | |
| 15079 | }; | |
| 14865 | 15080 | |
| 14866 | 15081 | try metadata_attach_block.end(); |
| 14867 | 15082 | } |
src/codegen/llvm/ir.zig+198-29| ... | ... | @@ -20,8 +20,142 @@ const ColumnAbbrev = AbbrevOp{ .vbr = 8 }; |
| 20 | 20 | |
| 21 | 21 | const BlockAbbrev = AbbrevOp{ .vbr = 6 }; |
| 22 | 22 | |
| 23 | pub const MetadataKind = enum(u1) { | |
| 23 | /// Unused tags are commented out so that they are omitted in the generated | |
| 24 | /// bitcode, which scans over this enum using reflection. | |
| 25 | pub const FixedMetadataKind = enum(u8) { | |
| 24 | 26 | dbg = 0, |
| 27 | //tbaa = 1, | |
| 28 | prof = 2, | |
| 29 | //fpmath = 3, | |
| 30 | //range = 4, | |
| 31 | //@"tbaa.struct" = 5, | |
| 32 | //@"invariant.load" = 6, | |
| 33 | //@"alias.scope" = 7, | |
| 34 | //@"noalias" = 8, | |
| 35 | //nontemporal = 9, | |
| 36 | //@"llvm.mem.parallel_loop_access" = 10, | |
| 37 | //nonnull = 11, | |
| 38 | //dereferenceable = 12, | |
| 39 | //dereferenceable_or_null = 13, | |
| 40 | //@"make.implicit" = 14, | |
| 41 | unpredictable = 15, | |
| 42 | //@"invariant.group" = 16, | |
| 43 | //@"align" = 17, | |
| 44 | //@"llvm.loop" = 18, | |
| 45 | //type = 19, | |
| 46 | //section_prefix = 20, | |
| 47 | //absolute_symbol = 21, | |
| 48 | //associated = 22, | |
| 49 | //callees = 23, | |
| 50 | //irr_loop = 24, | |
| 51 | //@"llvm.access.group" = 25, | |
| 52 | //callback = 26, | |
| 53 | //@"llvm.preserve.access.index" = 27, | |
| 54 | //vcall_visibility = 28, | |
| 55 | //noundef = 29, | |
| 56 | //annotation = 30, | |
| 57 | //nosanitize = 31, | |
| 58 | //func_sanitize = 32, | |
| 59 | //exclude = 33, | |
| 60 | //memprof = 34, | |
| 61 | //callsite = 35, | |
| 62 | //kcfi_type = 36, | |
| 63 | //pcsections = 37, | |
| 64 | //DIAssignID = 38, | |
| 65 | //@"coro.outside.frame" = 39, | |
| 66 | }; | |
| 67 | ||
| 68 | pub const MetadataCode = enum(u8) { | |
| 69 | /// MDSTRING: [values] | |
| 70 | STRING_OLD = 1, | |
| 71 | /// VALUE: [type num, value num] | |
| 72 | VALUE = 2, | |
| 73 | /// NODE: [n x md num] | |
| 74 | NODE = 3, | |
| 75 | /// STRING: [values] | |
| 76 | NAME = 4, | |
| 77 | /// DISTINCT_NODE: [n x md num] | |
| 78 | DISTINCT_NODE = 5, | |
| 79 | /// [n x [id, name]] | |
| 80 | KIND = 6, | |
| 81 | /// [distinct, line, col, scope, inlined-at?] | |
| 82 | LOCATION = 7, | |
| 83 | /// OLD_NODE: [n x (type num, value num)] | |
| 84 | OLD_NODE = 8, | |
| 85 | /// OLD_FN_NODE: [n x (type num, value num)] | |
| 86 | OLD_FN_NODE = 9, | |
| 87 | /// NAMED_NODE: [n x mdnodes] | |
| 88 | NAMED_NODE = 10, | |
| 89 | /// [m x [value, [n x [id, mdnode]]] | |
| 90 | ATTACHMENT = 11, | |
| 91 | /// [distinct, tag, vers, header, n x md num] | |
| 92 | GENERIC_DEBUG = 12, | |
| 93 | /// [distinct, count, lo] | |
| 94 | SUBRANGE = 13, | |
| 95 | /// [isUnsigned|distinct, value, name] | |
| 96 | ENUMERATOR = 14, | |
| 97 | /// [distinct, tag, name, size, align, enc] | |
| 98 | BASIC_TYPE = 15, | |
| 99 | /// [distinct, filename, directory, checksumkind, checksum] | |
| 100 | FILE = 16, | |
| 101 | /// [distinct, ...] | |
| 102 | DERIVED_TYPE = 17, | |
| 103 | /// [distinct, ...] | |
| 104 | COMPOSITE_TYPE = 18, | |
| 105 | /// [distinct, flags, types, cc] | |
| 106 | SUBROUTINE_TYPE = 19, | |
| 107 | /// [distinct, ...] | |
| 108 | COMPILE_UNIT = 20, | |
| 109 | /// [distinct, ...] | |
| 110 | SUBPROGRAM = 21, | |
| 111 | /// [distinct, scope, file, line, column] | |
| 112 | LEXICAL_BLOCK = 22, | |
| 113 | ///[distinct, scope, file, discriminator] | |
| 114 | LEXICAL_BLOCK_FILE = 23, | |
| 115 | /// [distinct, scope, file, name, line, exportSymbols] | |
| 116 | NAMESPACE = 24, | |
| 117 | /// [distinct, scope, name, type, ...] | |
| 118 | TEMPLATE_TYPE = 25, | |
| 119 | /// [distinct, scope, name, type, value, ...] | |
| 120 | TEMPLATE_VALUE = 26, | |
| 121 | /// [distinct, ...] | |
| 122 | GLOBAL_VAR = 27, | |
| 123 | /// [distinct, ...] | |
| 124 | LOCAL_VAR = 28, | |
| 125 | /// [distinct, n x element] | |
| 126 | EXPRESSION = 29, | |
| 127 | /// [distinct, name, file, line, ...] | |
| 128 | OBJC_PROPERTY = 30, | |
| 129 | /// [distinct, tag, scope, entity, line, name] | |
| 130 | IMPORTED_ENTITY = 31, | |
| 131 | /// [distinct, scope, name, ...] | |
| 132 | MODULE = 32, | |
| 133 | /// [distinct, macinfo, line, name, value] | |
| 134 | MACRO = 33, | |
| 135 | /// [distinct, macinfo, line, file, ...] | |
| 136 | MACRO_FILE = 34, | |
| 137 | /// [count, offset] blob([lengths][chars]) | |
| 138 | STRINGS = 35, | |
| 139 | /// [valueid, n x [id, mdnode]] | |
| 140 | GLOBAL_DECL_ATTACHMENT = 36, | |
| 141 | /// [distinct, var, expr] | |
| 142 | GLOBAL_VAR_EXPR = 37, | |
| 143 | /// [offset] | |
| 144 | INDEX_OFFSET = 38, | |
| 145 | /// [bitpos] | |
| 146 | INDEX = 39, | |
| 147 | /// [distinct, scope, name, file, line] | |
| 148 | LABEL = 40, | |
| 149 | /// [distinct, name, size, align,...] | |
| 150 | STRING_TYPE = 41, | |
| 151 | /// [distinct, scope, name, variable,...] | |
| 152 | COMMON_BLOCK = 44, | |
| 153 | /// [distinct, count, lo, up, stride] | |
| 154 | GENERIC_SUBRANGE = 45, | |
| 155 | /// [n x [type num, value num]] | |
| 156 | ARG_LIST = 46, | |
| 157 | /// [distinct, ...] | |
| 158 | ASSIGN_ID = 47, | |
| 25 | 159 | }; |
| 26 | 160 | |
| 27 | 161 | pub const Identification = struct { |
| ... | ... | @@ -622,16 +756,29 @@ pub const MetadataAttachmentBlock = struct { |
| 622 | 756 | pub const id = 16; |
| 623 | 757 | |
| 624 | 758 | pub const abbrevs = [_]type{ |
| 625 | AttachmentSingle, | |
| 759 | AttachmentGlobalSingle, | |
| 760 | AttachmentInstructionSingle, | |
| 626 | 761 | }; |
| 627 | 762 | |
| 628 | pub const AttachmentSingle = struct { | |
| 763 | pub const AttachmentGlobalSingle = struct { | |
| 629 | 764 | pub const ops = [_]AbbrevOp{ |
| 630 | .{ .literal = 11 }, | |
| 765 | .{ .literal = @intFromEnum(MetadataCode.ATTACHMENT) }, | |
| 631 | 766 | .{ .fixed = 1 }, |
| 632 | 767 | MetadataAbbrev, |
| 633 | 768 | }; |
| 634 | kind: MetadataKind, | |
| 769 | kind: FixedMetadataKind, | |
| 770 | metadata: Builder.Metadata, | |
| 771 | }; | |
| 772 | ||
| 773 | pub const AttachmentInstructionSingle = struct { | |
| 774 | pub const ops = [_]AbbrevOp{ | |
| 775 | .{ .literal = @intFromEnum(MetadataCode.ATTACHMENT) }, | |
| 776 | ValueAbbrev, | |
| 777 | .{ .fixed = 5 }, | |
| 778 | MetadataAbbrev, | |
| 779 | }; | |
| 780 | inst: u32, | |
| 781 | kind: FixedMetadataKind, | |
| 635 | 782 | metadata: Builder.Metadata, |
| 636 | 783 | }; |
| 637 | 784 | }; |
| ... | ... | @@ -666,7 +813,7 @@ pub const MetadataBlock = struct { |
| 666 | 813 | |
| 667 | 814 | pub const Strings = struct { |
| 668 | 815 | pub const ops = [_]AbbrevOp{ |
| 669 | .{ .literal = 35 }, | |
| 816 | .{ .literal = @intFromEnum(MetadataCode.STRINGS) }, | |
| 670 | 817 | .{ .vbr = 6 }, |
| 671 | 818 | .{ .vbr = 6 }, |
| 672 | 819 | .blob, |
| ... | ... | @@ -678,7 +825,7 @@ pub const MetadataBlock = struct { |
| 678 | 825 | |
| 679 | 826 | pub const File = struct { |
| 680 | 827 | pub const ops = [_]AbbrevOp{ |
| 681 | .{ .literal = 16 }, | |
| 828 | .{ .literal = @intFromEnum(MetadataCode.FILE) }, | |
| 682 | 829 | .{ .literal = 0 }, // is distinct |
| 683 | 830 | MetadataAbbrev, // filename |
| 684 | 831 | MetadataAbbrev, // directory |
| ... | ... | @@ -692,7 +839,7 @@ pub const MetadataBlock = struct { |
| 692 | 839 | |
| 693 | 840 | pub const CompileUnit = struct { |
| 694 | 841 | pub const ops = [_]AbbrevOp{ |
| 695 | .{ .literal = 20 }, | |
| 842 | .{ .literal = @intFromEnum(MetadataCode.COMPILE_UNIT) }, | |
| 696 | 843 | .{ .literal = 1 }, // is distinct |
| 697 | 844 | .{ .literal = std.dwarf.LANG.C99 }, // source language |
| 698 | 845 | MetadataAbbrev, // file |
| ... | ... | @@ -726,7 +873,7 @@ pub const MetadataBlock = struct { |
| 726 | 873 | |
| 727 | 874 | pub const Subprogram = struct { |
| 728 | 875 | pub const ops = [_]AbbrevOp{ |
| 729 | .{ .literal = 21 }, | |
| 876 | .{ .literal = @intFromEnum(MetadataCode.SUBPROGRAM) }, | |
| 730 | 877 | .{ .literal = 0b111 }, // is distinct | has sp flags | has flags |
| 731 | 878 | MetadataAbbrev, // scope |
| 732 | 879 | MetadataAbbrev, // name |
| ... | ... | @@ -763,7 +910,7 @@ pub const MetadataBlock = struct { |
| 763 | 910 | |
| 764 | 911 | pub const LexicalBlock = struct { |
| 765 | 912 | pub const ops = [_]AbbrevOp{ |
| 766 | .{ .literal = 22 }, | |
| 913 | .{ .literal = @intFromEnum(MetadataCode.LEXICAL_BLOCK) }, | |
| 767 | 914 | .{ .literal = 0 }, // is distinct |
| 768 | 915 | MetadataAbbrev, // scope |
| 769 | 916 | MetadataAbbrev, // file |
| ... | ... | @@ -779,7 +926,7 @@ pub const MetadataBlock = struct { |
| 779 | 926 | |
| 780 | 927 | pub const Location = struct { |
| 781 | 928 | pub const ops = [_]AbbrevOp{ |
| 782 | .{ .literal = 7 }, | |
| 929 | .{ .literal = @intFromEnum(MetadataCode.LOCATION) }, | |
| 783 | 930 | .{ .literal = 0 }, // is distinct |
| 784 | 931 | LineAbbrev, // line |
| 785 | 932 | ColumnAbbrev, // column |
| ... | ... | @@ -796,7 +943,7 @@ pub const MetadataBlock = struct { |
| 796 | 943 | |
| 797 | 944 | pub const BasicType = struct { |
| 798 | 945 | pub const ops = [_]AbbrevOp{ |
| 799 | .{ .literal = 15 }, | |
| 946 | .{ .literal = @intFromEnum(MetadataCode.BASIC_TYPE) }, | |
| 800 | 947 | .{ .literal = 0 }, // is distinct |
| 801 | 948 | .{ .literal = std.dwarf.TAG.base_type }, // tag |
| 802 | 949 | MetadataAbbrev, // name |
| ... | ... | @@ -813,7 +960,7 @@ pub const MetadataBlock = struct { |
| 813 | 960 | |
| 814 | 961 | pub const CompositeType = struct { |
| 815 | 962 | pub const ops = [_]AbbrevOp{ |
| 816 | .{ .literal = 18 }, | |
| 963 | .{ .literal = @intFromEnum(MetadataCode.COMPOSITE_TYPE) }, | |
| 817 | 964 | .{ .literal = 0 | 0x2 }, // is distinct | is not used in old type ref |
| 818 | 965 | .{ .fixed = 32 }, // tag |
| 819 | 966 | MetadataAbbrev, // name |
| ... | ... | @@ -852,7 +999,7 @@ pub const MetadataBlock = struct { |
| 852 | 999 | |
| 853 | 1000 | pub const DerivedType = struct { |
| 854 | 1001 | pub const ops = [_]AbbrevOp{ |
| 855 | .{ .literal = 17 }, | |
| 1002 | .{ .literal = @intFromEnum(MetadataCode.DERIVED_TYPE) }, | |
| 856 | 1003 | .{ .literal = 0 }, // is distinct |
| 857 | 1004 | .{ .fixed = 32 }, // tag |
| 858 | 1005 | MetadataAbbrev, // name |
| ... | ... | @@ -880,7 +1027,7 @@ pub const MetadataBlock = struct { |
| 880 | 1027 | |
| 881 | 1028 | pub const SubroutineType = struct { |
| 882 | 1029 | pub const ops = [_]AbbrevOp{ |
| 883 | .{ .literal = 19 }, | |
| 1030 | .{ .literal = @intFromEnum(MetadataCode.SUBROUTINE_TYPE) }, | |
| 884 | 1031 | .{ .literal = 0 | 0x2 }, // is distinct | has no old type refs |
| 885 | 1032 | .{ .literal = 0 }, // flags |
| 886 | 1033 | MetadataAbbrev, // types |
| ... | ... | @@ -891,7 +1038,7 @@ pub const MetadataBlock = struct { |
| 891 | 1038 | }; |
| 892 | 1039 | |
| 893 | 1040 | pub const Enumerator = struct { |
| 894 | pub const id = 14; | |
| 1041 | pub const id: MetadataCode = .ENUMERATOR; | |
| 895 | 1042 | |
| 896 | 1043 | pub const Flags = packed struct(u3) { |
| 897 | 1044 | distinct: bool = false, |
| ... | ... | @@ -900,7 +1047,7 @@ pub const MetadataBlock = struct { |
| 900 | 1047 | }; |
| 901 | 1048 | |
| 902 | 1049 | pub const ops = [_]AbbrevOp{ |
| 903 | .{ .literal = Enumerator.id }, | |
| 1050 | .{ .literal = @intFromEnum(Enumerator.id) }, | |
| 904 | 1051 | .{ .fixed = @bitSizeOf(Flags) }, // flags |
| 905 | 1052 | .{ .vbr = 6 }, // bit width |
| 906 | 1053 | MetadataAbbrev, // name |
| ... | ... | @@ -915,7 +1062,7 @@ pub const MetadataBlock = struct { |
| 915 | 1062 | |
| 916 | 1063 | pub const Subrange = struct { |
| 917 | 1064 | pub const ops = [_]AbbrevOp{ |
| 918 | .{ .literal = 13 }, | |
| 1065 | .{ .literal = @intFromEnum(MetadataCode.SUBRANGE) }, | |
| 919 | 1066 | .{ .literal = 0b10 }, // is distinct | version |
| 920 | 1067 | MetadataAbbrev, // count |
| 921 | 1068 | MetadataAbbrev, // lower bound |
| ... | ... | @@ -929,7 +1076,7 @@ pub const MetadataBlock = struct { |
| 929 | 1076 | |
| 930 | 1077 | pub const Expression = struct { |
| 931 | 1078 | pub const ops = [_]AbbrevOp{ |
| 932 | .{ .literal = 29 }, | |
| 1079 | .{ .literal = @intFromEnum(MetadataCode.EXPRESSION) }, | |
| 933 | 1080 | .{ .literal = 0 | (3 << 1) }, // is distinct | version |
| 934 | 1081 | MetadataArrayAbbrev, // elements |
| 935 | 1082 | }; |
| ... | ... | @@ -939,7 +1086,7 @@ pub const MetadataBlock = struct { |
| 939 | 1086 | |
| 940 | 1087 | pub const Node = struct { |
| 941 | 1088 | pub const ops = [_]AbbrevOp{ |
| 942 | .{ .literal = 3 }, | |
| 1089 | .{ .literal = @intFromEnum(MetadataCode.NODE) }, | |
| 943 | 1090 | MetadataArrayAbbrev, // elements |
| 944 | 1091 | }; |
| 945 | 1092 | |
| ... | ... | @@ -948,7 +1095,7 @@ pub const MetadataBlock = struct { |
| 948 | 1095 | |
| 949 | 1096 | pub const LocalVar = struct { |
| 950 | 1097 | pub const ops = [_]AbbrevOp{ |
| 951 | .{ .literal = 28 }, | |
| 1098 | .{ .literal = @intFromEnum(MetadataCode.LOCAL_VAR) }, | |
| 952 | 1099 | .{ .literal = 0b10 }, // is distinct | has alignment |
| 953 | 1100 | MetadataAbbrev, // scope |
| 954 | 1101 | MetadataAbbrev, // name |
| ... | ... | @@ -970,7 +1117,7 @@ pub const MetadataBlock = struct { |
| 970 | 1117 | |
| 971 | 1118 | pub const Parameter = struct { |
| 972 | 1119 | pub const ops = [_]AbbrevOp{ |
| 973 | .{ .literal = 28 }, | |
| 1120 | .{ .literal = @intFromEnum(MetadataCode.LOCAL_VAR) }, | |
| 974 | 1121 | .{ .literal = 0b10 }, // is distinct | has alignment |
| 975 | 1122 | MetadataAbbrev, // scope |
| 976 | 1123 | MetadataAbbrev, // name |
| ... | ... | @@ -993,7 +1140,7 @@ pub const MetadataBlock = struct { |
| 993 | 1140 | |
| 994 | 1141 | pub const GlobalVar = struct { |
| 995 | 1142 | pub const ops = [_]AbbrevOp{ |
| 996 | .{ .literal = 27 }, | |
| 1143 | .{ .literal = @intFromEnum(MetadataCode.GLOBAL_VAR) }, | |
| 997 | 1144 | .{ .literal = 0b101 }, // is distinct | version |
| 998 | 1145 | MetadataAbbrev, // scope |
| 999 | 1146 | MetadataAbbrev, // name |
| ... | ... | @@ -1020,7 +1167,7 @@ pub const MetadataBlock = struct { |
| 1020 | 1167 | |
| 1021 | 1168 | pub const GlobalVarExpression = struct { |
| 1022 | 1169 | pub const ops = [_]AbbrevOp{ |
| 1023 | .{ .literal = 37 }, | |
| 1170 | .{ .literal = @intFromEnum(MetadataCode.GLOBAL_VAR_EXPR) }, | |
| 1024 | 1171 | .{ .literal = 0 }, // is distinct |
| 1025 | 1172 | MetadataAbbrev, // variable |
| 1026 | 1173 | MetadataAbbrev, // expression |
| ... | ... | @@ -1032,7 +1179,7 @@ pub const MetadataBlock = struct { |
| 1032 | 1179 | |
| 1033 | 1180 | pub const Constant = struct { |
| 1034 | 1181 | pub const ops = [_]AbbrevOp{ |
| 1035 | .{ .literal = 2 }, | |
| 1182 | .{ .literal = @intFromEnum(MetadataCode.VALUE) }, | |
| 1036 | 1183 | MetadataAbbrev, // type |
| 1037 | 1184 | MetadataAbbrev, // value |
| 1038 | 1185 | }; |
| ... | ... | @@ -1043,7 +1190,7 @@ pub const MetadataBlock = struct { |
| 1043 | 1190 | |
| 1044 | 1191 | pub const Name = struct { |
| 1045 | 1192 | pub const ops = [_]AbbrevOp{ |
| 1046 | .{ .literal = 4 }, | |
| 1193 | .{ .literal = @intFromEnum(MetadataCode.NAME) }, | |
| 1047 | 1194 | .{ .array_fixed = 8 }, // name |
| 1048 | 1195 | }; |
| 1049 | 1196 | |
| ... | ... | @@ -1052,7 +1199,7 @@ pub const MetadataBlock = struct { |
| 1052 | 1199 | |
| 1053 | 1200 | pub const NamedNode = struct { |
| 1054 | 1201 | pub const ops = [_]AbbrevOp{ |
| 1055 | .{ .literal = 10 }, | |
| 1202 | .{ .literal = @intFromEnum(MetadataCode.NAMED_NODE) }, | |
| 1056 | 1203 | MetadataArrayAbbrev, // elements |
| 1057 | 1204 | }; |
| 1058 | 1205 | |
| ... | ... | @@ -1061,18 +1208,32 @@ pub const MetadataBlock = struct { |
| 1061 | 1208 | |
| 1062 | 1209 | pub const GlobalDeclAttachment = struct { |
| 1063 | 1210 | pub const ops = [_]AbbrevOp{ |
| 1064 | .{ .literal = 36 }, | |
| 1211 | .{ .literal = @intFromEnum(MetadataCode.GLOBAL_DECL_ATTACHMENT) }, | |
| 1065 | 1212 | ValueAbbrev, // value id |
| 1066 | 1213 | .{ .fixed = 1 }, // kind |
| 1067 | 1214 | MetadataAbbrev, // elements |
| 1068 | 1215 | }; |
| 1069 | 1216 | |
| 1070 | 1217 | value: Builder.Constant, |
| 1071 | kind: MetadataKind, | |
| 1218 | kind: FixedMetadataKind, | |
| 1072 | 1219 | metadata: Builder.Metadata, |
| 1073 | 1220 | }; |
| 1074 | 1221 | }; |
| 1075 | 1222 | |
| 1223 | pub const OperandBundleTags = struct { | |
| 1224 | pub const id = 21; | |
| 1225 | ||
| 1226 | pub const abbrevs = [_]type{OperandBundleTag}; | |
| 1227 | ||
| 1228 | pub const OperandBundleTag = struct { | |
| 1229 | pub const ops = [_]AbbrevOp{ | |
| 1230 | .{ .literal = 1 }, | |
| 1231 | .array_char6, | |
| 1232 | }; | |
| 1233 | tag: []const u8, | |
| 1234 | }; | |
| 1235 | }; | |
| 1236 | ||
| 1076 | 1237 | pub const FunctionMetadataBlock = struct { |
| 1077 | 1238 | pub const id = 15; |
| 1078 | 1239 | |
| ... | ... | @@ -1132,6 +1293,7 @@ pub const FunctionBlock = struct { |
| 1132 | 1293 | Fence, |
| 1133 | 1294 | DebugLoc, |
| 1134 | 1295 | DebugLocAgain, |
| 1296 | ColdOperandBundle, | |
| 1135 | 1297 | }; |
| 1136 | 1298 | |
| 1137 | 1299 | pub const DeclareBlocks = struct { |
| ... | ... | @@ -1644,6 +1806,13 @@ pub const FunctionBlock = struct { |
| 1644 | 1806 | .{ .literal = 33 }, |
| 1645 | 1807 | }; |
| 1646 | 1808 | }; |
| 1809 | ||
| 1810 | pub const ColdOperandBundle = struct { | |
| 1811 | pub const ops = [_]AbbrevOp{ | |
| 1812 | .{ .literal = 55 }, | |
| 1813 | .{ .literal = 0 }, | |
| 1814 | }; | |
| 1815 | }; | |
| 1647 | 1816 | }; |
| 1648 | 1817 | |
| 1649 | 1818 | pub const FunctionValueSymbolTable = struct { |
src/codegen/spirv.zig+18-32| ... | ... | @@ -410,7 +410,7 @@ const NavGen = struct { |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | pub fn fail(self: *NavGen, comptime format: []const u8, args: anytype) Error { |
| 413 | @setCold(true); | |
| 413 | @branchHint(.cold); | |
| 414 | 414 | const zcu = self.pt.zcu; |
| 415 | 415 | const src_loc = zcu.navSrcLoc(self.owner_nav); |
| 416 | 416 | assert(self.error_msg == null); |
| ... | ... | @@ -6173,11 +6173,10 @@ const NavGen = struct { |
| 6173 | 6173 | const pt = self.pt; |
| 6174 | 6174 | const zcu = pt.zcu; |
| 6175 | 6175 | const target = self.getTarget(); |
| 6176 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6177 | const cond_ty = self.typeOf(pl_op.operand); | |
| 6178 | const cond = try self.resolve(pl_op.operand); | |
| 6176 | const switch_br = self.air.unwrapSwitch(inst); | |
| 6177 | const cond_ty = self.typeOf(switch_br.operand); | |
| 6178 | const cond = try self.resolve(switch_br.operand); | |
| 6179 | 6179 | var cond_indirect = try self.convertToIndirect(cond_ty, cond); |
| 6180 | const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 6181 | 6180 | |
| 6182 | 6181 | const cond_words: u32 = switch (cond_ty.zigTypeTag(zcu)) { |
| 6183 | 6182 | .Bool, .ErrorSet => 1, |
| ... | ... | @@ -6204,18 +6203,15 @@ const NavGen = struct { |
| 6204 | 6203 | else => return self.todo("implement switch for type {s}", .{@tagName(cond_ty.zigTypeTag(zcu))}), |
| 6205 | 6204 | }; |
| 6206 | 6205 | |
| 6207 | const num_cases = switch_br.data.cases_len; | |
| 6206 | const num_cases = switch_br.cases_len; | |
| 6208 | 6207 | |
| 6209 | 6208 | // Compute the total number of arms that we need. |
| 6210 | 6209 | // Zig switches are grouped by condition, so we need to loop through all of them |
| 6211 | 6210 | const num_conditions = blk: { |
| 6212 | var extra_index: usize = switch_br.end; | |
| 6213 | 6211 | var num_conditions: u32 = 0; |
| 6214 | for (0..num_cases) |_| { | |
| 6215 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 6216 | const case_body = self.air.extra[case.end + case.data.items_len ..][0..case.data.body_len]; | |
| 6217 | extra_index = case.end + case.data.items_len + case_body.len; | |
| 6218 | num_conditions += case.data.items_len; | |
| 6212 | var it = switch_br.iterateCases(); | |
| 6213 | while (it.next()) |case| { | |
| 6214 | num_conditions += @intCast(case.items.len); | |
| 6219 | 6215 | } |
| 6220 | 6216 | break :blk num_conditions; |
| 6221 | 6217 | }; |
| ... | ... | @@ -6244,17 +6240,12 @@ const NavGen = struct { |
| 6244 | 6240 | |
| 6245 | 6241 | // Emit each of the cases |
| 6246 | 6242 | { |
| 6247 | var extra_index: usize = switch_br.end; | |
| 6248 | for (0..num_cases) |case_i| { | |
| 6243 | var it = switch_br.iterateCases(); | |
| 6244 | while (it.next()) |case| { | |
| 6249 | 6245 | // SPIR-V needs a literal here, which' width depends on the case condition. |
| 6250 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 6251 | const items: []const Air.Inst.Ref = @ptrCast(self.air.extra[case.end..][0..case.data.items_len]); | |
| 6252 | const case_body = self.air.extra[case.end + items.len ..][0..case.data.body_len]; | |
| 6253 | extra_index = case.end + case.data.items_len + case_body.len; | |
| 6254 | ||
| 6255 | const label = case_labels.at(case_i); | |
| 6246 | const label = case_labels.at(case.idx); | |
| 6256 | 6247 | |
| 6257 | for (items) |item| { | |
| 6248 | for (case.items) |item| { | |
| 6258 | 6249 | const value = (try self.air.value(item, pt)) orelse unreachable; |
| 6259 | 6250 | const int_val: u64 = switch (cond_ty.zigTypeTag(zcu)) { |
| 6260 | 6251 | .Bool, .Int => if (cond_ty.isSignedInt(zcu)) @bitCast(value.toSignedInt(zcu)) else value.toUnsignedInt(zcu), |
| ... | ... | @@ -6285,20 +6276,15 @@ const NavGen = struct { |
| 6285 | 6276 | } |
| 6286 | 6277 | |
| 6287 | 6278 | // Now, finally, we can start emitting each of the cases. |
| 6288 | var extra_index: usize = switch_br.end; | |
| 6289 | for (0..num_cases) |case_i| { | |
| 6290 | const case = self.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 6291 | const items: []const Air.Inst.Ref = @ptrCast(self.air.extra[case.end..][0..case.data.items_len]); | |
| 6292 | const case_body: []const Air.Inst.Index = @ptrCast(self.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 6293 | extra_index = case.end + case.data.items_len + case_body.len; | |
| 6294 | ||
| 6295 | const label = case_labels.at(case_i); | |
| 6279 | var it = switch_br.iterateCases(); | |
| 6280 | while (it.next()) |case| { | |
| 6281 | const label = case_labels.at(case.idx); | |
| 6296 | 6282 | |
| 6297 | 6283 | try self.beginSpvBlock(label); |
| 6298 | 6284 | |
| 6299 | 6285 | switch (self.control_flow) { |
| 6300 | 6286 | .structured => { |
| 6301 | const next_block = try self.genStructuredBody(.selection, case_body); | |
| 6287 | const next_block = try self.genStructuredBody(.selection, case.body); | |
| 6302 | 6288 | incoming_structured_blocks.appendAssumeCapacity(.{ |
| 6303 | 6289 | .src_label = self.current_block_label, |
| 6304 | 6290 | .next_block = next_block, |
| ... | ... | @@ -6306,12 +6292,12 @@ const NavGen = struct { |
| 6306 | 6292 | try self.func.body.emitBranch(self.spv.gpa, merge_label.?); |
| 6307 | 6293 | }, |
| 6308 | 6294 | .unstructured => { |
| 6309 | try self.genBody(case_body); | |
| 6295 | try self.genBody(case.body); | |
| 6310 | 6296 | }, |
| 6311 | 6297 | } |
| 6312 | 6298 | } |
| 6313 | 6299 | |
| 6314 | const else_body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 6300 | const else_body = it.elseBody(); | |
| 6315 | 6301 | try self.beginSpvBlock(default); |
| 6316 | 6302 | if (else_body.len != 0) { |
| 6317 | 6303 | switch (self.control_flow) { |
src/crash_report.zig+1-1| ... | ... | @@ -153,8 +153,8 @@ fn writeFilePath(file: *Zcu.File, writer: anytype) !void { |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | pub fn compilerPanic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, maybe_ret_addr: ?usize) noreturn { |
| 156 | @branchHint(.cold); | |
| 156 | 157 | PanicSwitch.preDispatch(); |
| 157 | @setCold(true); | |
| 158 | 158 | const ret_addr = maybe_ret_addr orelse @returnAddress(); |
| 159 | 159 | const stack_ctx: StackContext = .{ .current = .{ .ret_addr = ret_addr } }; |
| 160 | 160 | PanicSwitch.dispatch(error_return_trace, stack_ctx, msg); |
src/print_air.zig+25-21| ... | ... | @@ -297,8 +297,8 @@ const Writer = struct { |
| 297 | 297 | .union_init => try w.writeUnionInit(s, inst), |
| 298 | 298 | .br => try w.writeBr(s, inst), |
| 299 | 299 | .cond_br => try w.writeCondBr(s, inst), |
| 300 | .@"try" => try w.writeTry(s, inst), | |
| 301 | .try_ptr => try w.writeTryPtr(s, inst), | |
| 300 | .@"try", .try_cold => try w.writeTry(s, inst), | |
| 301 | .try_ptr, .try_ptr_cold => try w.writeTryPtr(s, inst), | |
| 302 | 302 | .switch_br => try w.writeSwitchBr(s, inst), |
| 303 | 303 | .cmpxchg_weak, .cmpxchg_strong => try w.writeCmpxchg(s, inst), |
| 304 | 304 | .fence => try w.writeFence(s, inst), |
| ... | ... | @@ -825,41 +825,40 @@ const Writer = struct { |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | fn writeSwitchBr(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void { |
| 828 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 829 | const switch_br = w.air.extraData(Air.SwitchBr, pl_op.payload); | |
| 828 | const switch_br = w.air.unwrapSwitch(inst); | |
| 829 | ||
| 830 | 830 | const liveness = if (w.liveness) |liveness| |
| 831 | liveness.getSwitchBr(w.gpa, inst, switch_br.data.cases_len + 1) catch | |
| 831 | liveness.getSwitchBr(w.gpa, inst, switch_br.cases_len + 1) catch | |
| 832 | 832 | @panic("out of memory") |
| 833 | 833 | else blk: { |
| 834 | const slice = w.gpa.alloc([]const Air.Inst.Index, switch_br.data.cases_len + 1) catch | |
| 834 | const slice = w.gpa.alloc([]const Air.Inst.Index, switch_br.cases_len + 1) catch | |
| 835 | 835 | @panic("out of memory"); |
| 836 | 836 | @memset(slice, &.{}); |
| 837 | 837 | break :blk Liveness.SwitchBrTable{ .deaths = slice }; |
| 838 | 838 | }; |
| 839 | 839 | defer w.gpa.free(liveness.deaths); |
| 840 | var extra_index: usize = switch_br.end; | |
| 841 | var case_i: u32 = 0; | |
| 842 | 840 | |
| 843 | try w.writeOperand(s, inst, 0, pl_op.operand); | |
| 841 | try w.writeOperand(s, inst, 0, switch_br.operand); | |
| 844 | 842 | if (w.skip_body) return s.writeAll(", ..."); |
| 845 | 843 | const old_indent = w.indent; |
| 846 | 844 | w.indent += 2; |
| 847 | 845 | |
| 848 | while (case_i < switch_br.data.cases_len) : (case_i += 1) { | |
| 849 | const case = w.air.extraData(Air.SwitchBr.Case, extra_index); | |
| 850 | const items = @as([]const Air.Inst.Ref, @ptrCast(w.air.extra[case.end..][0..case.data.items_len])); | |
| 851 | const case_body: []const Air.Inst.Index = @ptrCast(w.air.extra[case.end + items.len ..][0..case.data.body_len]); | |
| 852 | extra_index = case.end + case.data.items_len + case_body.len; | |
| 853 | ||
| 846 | var it = switch_br.iterateCases(); | |
| 847 | while (it.next()) |case| { | |
| 854 | 848 | try s.writeAll(", ["); |
| 855 | for (items, 0..) |item, item_i| { | |
| 849 | for (case.items, 0..) |item, item_i| { | |
| 856 | 850 | if (item_i != 0) try s.writeAll(", "); |
| 857 | 851 | try w.writeInstRef(s, item, false); |
| 858 | 852 | } |
| 859 | try s.writeAll("] => {\n"); | |
| 853 | try s.writeAll("] "); | |
| 854 | const hint = switch_br.getHint(case.idx); | |
| 855 | if (hint != .none) { | |
| 856 | try s.print(".{s} ", .{@tagName(hint)}); | |
| 857 | } | |
| 858 | try s.writeAll("=> {\n"); | |
| 860 | 859 | w.indent += 2; |
| 861 | 860 | |
| 862 | const deaths = liveness.deaths[case_i]; | |
| 861 | const deaths = liveness.deaths[case.idx]; | |
| 863 | 862 | if (deaths.len != 0) { |
| 864 | 863 | try s.writeByteNTimes(' ', w.indent); |
| 865 | 864 | for (deaths, 0..) |operand, i| { |
| ... | ... | @@ -869,15 +868,20 @@ const Writer = struct { |
| 869 | 868 | try s.writeAll("\n"); |
| 870 | 869 | } |
| 871 | 870 | |
| 872 | try w.writeBody(s, case_body); | |
| 871 | try w.writeBody(s, case.body); | |
| 873 | 872 | w.indent -= 2; |
| 874 | 873 | try s.writeByteNTimes(' ', w.indent); |
| 875 | 874 | try s.writeAll("}"); |
| 876 | 875 | } |
| 877 | 876 | |
| 878 | const else_body: []const Air.Inst.Index = @ptrCast(w.air.extra[extra_index..][0..switch_br.data.else_body_len]); | |
| 877 | const else_body = it.elseBody(); | |
| 879 | 878 | if (else_body.len != 0) { |
| 880 | try s.writeAll(", else => {\n"); | |
| 879 | try s.writeAll(", else "); | |
| 880 | const hint = switch_br.getElseHint(); | |
| 881 | if (hint != .none) { | |
| 882 | try s.print(".{s} ", .{@tagName(hint)}); | |
| 883 | } | |
| 884 | try s.writeAll("=> {\n"); | |
| 881 | 885 | w.indent += 2; |
| 882 | 886 | |
| 883 | 887 | const deaths = liveness.deaths[liveness.deaths.len - 1]; |
src/print_zir.zig+2-15| ... | ... | @@ -429,7 +429,6 @@ const Writer = struct { |
| 429 | 429 | .elem_val_imm => try self.writeElemValImm(stream, inst), |
| 430 | 430 | |
| 431 | 431 | .@"export" => try self.writePlNodeExport(stream, inst), |
| 432 | .export_value => try self.writePlNodeExportValue(stream, inst), | |
| 433 | 432 | |
| 434 | 433 | .call => try self.writeCall(stream, inst, .direct), |
| 435 | 434 | .field_call => try self.writeCall(stream, inst, .field), |
| ... | ... | @@ -565,7 +564,6 @@ const Writer = struct { |
| 565 | 564 | .fence, |
| 566 | 565 | .set_float_mode, |
| 567 | 566 | .set_align_stack, |
| 568 | .set_cold, | |
| 569 | 567 | .wasm_memory_size, |
| 570 | 568 | .int_from_error, |
| 571 | 569 | .error_from_int, |
| ... | ... | @@ -574,6 +572,7 @@ const Writer = struct { |
| 574 | 572 | .work_item_id, |
| 575 | 573 | .work_group_size, |
| 576 | 574 | .work_group_id, |
| 575 | .branch_hint, | |
| 577 | 576 | => { |
| 578 | 577 | const inst_data = self.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 579 | 578 | try self.writeInstRef(stream, inst_data.operand); |
| ... | ... | @@ -1007,20 +1006,8 @@ const Writer = struct { |
| 1007 | 1006 | fn writePlNodeExport(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { |
| 1008 | 1007 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; |
| 1009 | 1008 | const extra = self.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; |
| 1010 | const decl_name = self.code.nullTerminatedString(extra.decl_name); | |
| 1011 | 1009 | |
| 1012 | try self.writeInstRef(stream, extra.namespace); | |
| 1013 | try stream.print(", {p}, ", .{std.zig.fmtId(decl_name)}); | |
| 1014 | try self.writeInstRef(stream, extra.options); | |
| 1015 | try stream.writeAll(") "); | |
| 1016 | try self.writeSrcNode(stream, inst_data.src_node); | |
| 1017 | } | |
| 1018 | ||
| 1019 | fn writePlNodeExportValue(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { | |
| 1020 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1021 | const extra = self.code.extraData(Zir.Inst.ExportValue, inst_data.payload_index).data; | |
| 1022 | ||
| 1023 | try self.writeInstRef(stream, extra.operand); | |
| 1010 | try self.writeInstRef(stream, extra.exported); | |
| 1024 | 1011 | try stream.writeAll(", "); |
| 1025 | 1012 | try self.writeInstRef(stream, extra.options); |
| 1026 | 1013 | try stream.writeAll(") "); |
stage1/zig1.wasm| Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ |
test/behavior.zig+1| ... | ... | @@ -12,6 +12,7 @@ test { |
| 12 | 12 | _ = @import("behavior/bitcast.zig"); |
| 13 | 13 | _ = @import("behavior/bitreverse.zig"); |
| 14 | 14 | _ = @import("behavior/bool.zig"); |
| 15 | _ = @import("behavior/builtin_functions_returning_void_or_noreturn.zig"); | |
| 15 | 16 | _ = @import("behavior/byteswap.zig"); |
| 16 | 17 | _ = @import("behavior/byval_arg_var.zig"); |
| 17 | 18 | _ = @import("behavior/call.zig"); |
test/behavior/basic.zig+83-6| ... | ... | @@ -107,13 +107,90 @@ test "non const ptr to aliased type" { |
| 107 | 107 | try expect(?*int == ?*i32); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | test "cold function" { | |
| 111 | thisIsAColdFn(); | |
| 112 | comptime thisIsAColdFn(); | |
| 110 | test "function branch hints" { | |
| 111 | const S = struct { | |
| 112 | fn none() void { | |
| 113 | @branchHint(.none); | |
| 114 | } | |
| 115 | fn likely() void { | |
| 116 | @branchHint(.likely); | |
| 117 | } | |
| 118 | fn unlikely() void { | |
| 119 | @branchHint(.unlikely); | |
| 120 | } | |
| 121 | fn cold() void { | |
| 122 | @branchHint(.cold); | |
| 123 | } | |
| 124 | fn unpredictable() void { | |
| 125 | @branchHint(.unpredictable); | |
| 126 | } | |
| 127 | }; | |
| 128 | S.none(); | |
| 129 | S.likely(); | |
| 130 | S.unlikely(); | |
| 131 | S.cold(); | |
| 132 | S.unpredictable(); | |
| 133 | comptime S.none(); | |
| 134 | comptime S.likely(); | |
| 135 | comptime S.unlikely(); | |
| 136 | comptime S.cold(); | |
| 137 | comptime S.unpredictable(); | |
| 138 | } | |
| 139 | ||
| 140 | test "if branch hints" { | |
| 141 | var t: bool = undefined; | |
| 142 | t = true; | |
| 143 | if (t) { | |
| 144 | @branchHint(.likely); | |
| 145 | } else { | |
| 146 | @branchHint(.cold); | |
| 147 | } | |
| 113 | 148 | } |
| 114 | 149 | |
| 115 | fn thisIsAColdFn() void { | |
| 116 | @setCold(true); | |
| 150 | test "switch branch hints" { | |
| 151 | var t: bool = undefined; | |
| 152 | t = true; | |
| 153 | switch (t) { | |
| 154 | true => { | |
| 155 | @branchHint(.likely); | |
| 156 | }, | |
| 157 | false => { | |
| 158 | @branchHint(.cold); | |
| 159 | }, | |
| 160 | } | |
| 161 | } | |
| 162 | ||
| 163 | test "orelse branch hints" { | |
| 164 | var x: ?u32 = undefined; | |
| 165 | x = 123; | |
| 166 | const val = x orelse val: { | |
| 167 | @branchHint(.cold); | |
| 168 | break :val 456; | |
| 169 | }; | |
| 170 | try expect(val == 123); | |
| 171 | } | |
| 172 | ||
| 173 | test "catch branch hints" { | |
| 174 | var x: error{Bad}!u32 = undefined; | |
| 175 | x = 123; | |
| 176 | const val = x catch val: { | |
| 177 | @branchHint(.cold); | |
| 178 | break :val 456; | |
| 179 | }; | |
| 180 | try expect(val == 123); | |
| 181 | } | |
| 182 | ||
| 183 | test "and/or branch hints" { | |
| 184 | var t: bool = undefined; | |
| 185 | t = true; | |
| 186 | try expect(t or b: { | |
| 187 | @branchHint(.unlikely); | |
| 188 | break :b false; | |
| 189 | }); | |
| 190 | try expect(t and b: { | |
| 191 | @branchHint(.likely); | |
| 192 | break :b true; | |
| 193 | }); | |
| 117 | 194 | } |
| 118 | 195 | |
| 119 | 196 | test "unicode escape in character literal" { |
| ... | ... | @@ -734,7 +811,7 @@ test "extern variable with non-pointer opaque type" { |
| 734 | 811 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest; |
| 735 | 812 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; // TODO |
| 736 | 813 | |
| 737 | @export(var_to_export, .{ .name = "opaque_extern_var" }); | |
| 814 | @export(&var_to_export, .{ .name = "opaque_extern_var" }); | |
| 738 | 815 | try expect(@as(*align(1) u32, @ptrCast(&opaque_extern_var)).* == 42); |
| 739 | 816 | } |
| 740 | 817 | extern var opaque_extern_var: opaque {}; |
test/behavior/builtin_functions_returning_void_or_noreturn.zig+1-2| ... | ... | @@ -15,14 +15,13 @@ test { |
| 15 | 15 | var val: u8 = undefined; |
| 16 | 16 | try testing.expectEqual({}, @atomicStore(u8, &val, 0, .unordered)); |
| 17 | 17 | try testing.expectEqual(void, @TypeOf(@breakpoint())); |
| 18 | try testing.expectEqual({}, @export(x, .{ .name = "x" })); | |
| 18 | try testing.expectEqual({}, @export(&x, .{ .name = "x" })); | |
| 19 | 19 | try testing.expectEqual({}, @fence(.acquire)); |
| 20 | 20 | try testing.expectEqual({}, @memcpy(@as([*]u8, @ptrFromInt(1))[0..0], @as([*]u8, @ptrFromInt(1))[0..0])); |
| 21 | 21 | try testing.expectEqual({}, @memset(@as([*]u8, @ptrFromInt(1))[0..0], undefined)); |
| 22 | 22 | try testing.expectEqual(noreturn, @TypeOf(if (true) @panic("") else {})); |
| 23 | 23 | try testing.expectEqual({}, @prefetch(&val, .{})); |
| 24 | 24 | try testing.expectEqual({}, @setAlignStack(16)); |
| 25 | try testing.expectEqual({}, @setCold(true)); | |
| 26 | 25 | try testing.expectEqual({}, @setEvalBranchQuota(0)); |
| 27 | 26 | try testing.expectEqual({}, @setFloatMode(.optimized)); |
| 28 | 27 | try testing.expectEqual({}, @setRuntimeSafety(true)); |
test/behavior/export_builtin.zig+6-26| ... | ... | @@ -2,7 +2,7 @@ const builtin = @import("builtin"); |
| 2 | 2 | const std = @import("std"); |
| 3 | 3 | const expect = std.testing.expect; |
| 4 | 4 | |
| 5 | test "exporting enum type and value" { | |
| 5 | test "exporting enum value" { | |
| 6 | 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 7 | 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 8 | 8 | |
| ... | ... | @@ -10,7 +10,7 @@ test "exporting enum type and value" { |
| 10 | 10 | const E = enum(c_int) { one, two }; |
| 11 | 11 | const e: E = .two; |
| 12 | 12 | comptime { |
| 13 | @export(e, .{ .name = "e" }); | |
| 13 | @export(&e, .{ .name = "e" }); | |
| 14 | 14 | } |
| 15 | 15 | }; |
| 16 | 16 | try expect(S.e == .two); |
| ... | ... | @@ -23,13 +23,13 @@ test "exporting with internal linkage" { |
| 23 | 23 | const S = struct { |
| 24 | 24 | fn foo() callconv(.C) void {} |
| 25 | 25 | comptime { |
| 26 | @export(foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .internal }); | |
| 26 | @export(&foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .internal }); | |
| 27 | 27 | } |
| 28 | 28 | }; |
| 29 | 29 | S.foo(); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | test "exporting using field access" { | |
| 32 | test "exporting using namespace access" { | |
| 33 | 33 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 34 | 34 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 35 | 35 | |
| ... | ... | @@ -38,7 +38,7 @@ test "exporting using field access" { |
| 38 | 38 | const x: u32 = 5; |
| 39 | 39 | }; |
| 40 | 40 | comptime { |
| 41 | @export(Inner.x, .{ .name = "foo", .linkage = .internal }); | |
| 41 | @export(&Inner.x, .{ .name = "foo", .linkage = .internal }); | |
| 42 | 42 | } |
| 43 | 43 | }; |
| 44 | 44 | |
| ... | ... | @@ -57,29 +57,9 @@ test "exporting comptime-known value" { |
| 57 | 57 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 58 | 58 | |
| 59 | 59 | const x: u32 = 10; |
| 60 | @export(x, .{ .name = "exporting_comptime_known_value_foo" }); | |
| 60 | @export(&x, .{ .name = "exporting_comptime_known_value_foo" }); | |
| 61 | 61 | const S = struct { |
| 62 | 62 | extern const exporting_comptime_known_value_foo: u32; |
| 63 | 63 | }; |
| 64 | 64 | try expect(S.exporting_comptime_known_value_foo == 10); |
| 65 | 65 | } |
| 66 | ||
| 67 | test "exporting comptime var" { | |
| 68 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 69 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | |
| 70 | if (builtin.zig_backend == .stage2_x86_64 and | |
| 71 | (builtin.target.ofmt != .elf and | |
| 72 | builtin.target.ofmt != .macho and | |
| 73 | builtin.target.ofmt != .coff)) return error.SkipZigTest; | |
| 74 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | |
| 75 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 76 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 77 | ||
| 78 | comptime var x: u32 = 5; | |
| 79 | @export(x, .{ .name = "exporting_comptime_var_foo" }); | |
| 80 | x = 7; // modifying this now shouldn't change anything | |
| 81 | const S = struct { | |
| 82 | extern const exporting_comptime_var_foo: u32; | |
| 83 | }; | |
| 84 | try expect(S.exporting_comptime_var_foo == 5); | |
| 85 | } |
test/behavior/export_c_keywords.zig+12-12| ... | ... | @@ -24,21 +24,21 @@ export fn some_non_c_keyword_function() Id { |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | comptime { |
| 27 | @export(int, .{ .name = "long" }); | |
| 28 | @export(int, .{ .name = "an_alias_of_int" }); | |
| 27 | @export(&int, .{ .name = "long" }); | |
| 28 | @export(&int, .{ .name = "an_alias_of_int" }); | |
| 29 | 29 | |
| 30 | @export(some_non_c_keyword_variable, .{ .name = "void" }); | |
| 31 | @export(some_non_c_keyword_variable, .{ .name = "an_alias_of_some_non_c_keyword_variable" }); | |
| 30 | @export(&some_non_c_keyword_variable, .{ .name = "void" }); | |
| 31 | @export(&some_non_c_keyword_variable, .{ .name = "an_alias_of_some_non_c_keyword_variable" }); | |
| 32 | 32 | |
| 33 | @export(@"if", .{ .name = "else" }); | |
| 34 | @export(@"if", .{ .name = "an_alias_of_if" }); | |
| 33 | @export(&@"if", .{ .name = "else" }); | |
| 34 | @export(&@"if", .{ .name = "an_alias_of_if" }); | |
| 35 | 35 | |
| 36 | @export(some_non_c_keyword_constant, .{ .name = "switch" }); | |
| 37 | @export(some_non_c_keyword_constant, .{ .name = "an_alias_of_some_non_c_keyword_constant" }); | |
| 36 | @export(&some_non_c_keyword_constant, .{ .name = "switch" }); | |
| 37 | @export(&some_non_c_keyword_constant, .{ .name = "an_alias_of_some_non_c_keyword_constant" }); | |
| 38 | 38 | |
| 39 | @export(float, .{ .name = "double" }); | |
| 40 | @export(float, .{ .name = "an_alias_of_float" }); | |
| 39 | @export(&float, .{ .name = "double" }); | |
| 40 | @export(&float, .{ .name = "an_alias_of_float" }); | |
| 41 | 41 | |
| 42 | @export(some_non_c_keyword_function, .{ .name = "break" }); | |
| 43 | @export(some_non_c_keyword_function, .{ .name = "an_alias_of_some_non_c_keyword_function" }); | |
| 42 | @export(&some_non_c_keyword_function, .{ .name = "break" }); | |
| 43 | @export(&some_non_c_keyword_function, .{ .name = "an_alias_of_some_non_c_keyword_function" }); | |
| 44 | 44 | } |
test/behavior/generics.zig+1-1| ... | ... | @@ -320,7 +320,7 @@ test "generic function instantiation non-duplicates" { |
| 320 | 320 | |
| 321 | 321 | const S = struct { |
| 322 | 322 | fn copy(comptime T: type, dest: []T, source: []const T) void { |
| 323 | @export(foo, .{ .name = "test_generic_instantiation_non_dupe" }); | |
| 323 | @export(&foo, .{ .name = "test_generic_instantiation_non_dupe" }); | |
| 324 | 324 | for (source, 0..) |s, i| dest[i] = s; |
| 325 | 325 | } |
| 326 | 326 |
test/cases/compile_errors/@export_with_undeclared_identifier.zig deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | export fn a() void { | |
| 2 | @export(bogus, .{ .name = "bogus_alias" }); | |
| 3 | } | |
| 4 | ||
| 5 | // error | |
| 6 | // backend=stage2 | |
| 7 | // target=native | |
| 8 | // | |
| 9 | // :2:13: error: use of undeclared identifier 'bogus' |
test/cases/compile_errors/export_with_empty_name_string.zig+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | pub export fn entry() void {} |
| 2 | 2 | comptime { |
| 3 | @export(entry, .{ .name = "" }); | |
| 3 | @export(&entry, .{ .name = "" }); | |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | // error |
| 7 | 7 | // backend=llvm |
| 8 | 8 | // target=native |
| 9 | 9 | // |
| 10 | // :3:24: error: exported symbol name cannot be empty | |
| 10 | // :3:25: error: exported symbol name cannot be empty |
test/cases/compile_errors/exported_enum_without_explicit_integer_tag_type.zig+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | const E = enum { one, two }; |
| 2 | 2 | comptime { |
| 3 | @export(E, .{ .name = "E" }); | |
| 3 | @export(&E, .{ .name = "E" }); | |
| 4 | 4 | } |
| 5 | 5 | const e: E = .two; |
| 6 | 6 | comptime { |
| 7 | @export(e, .{ .name = "e" }); | |
| 7 | @export(&e, .{ .name = "e" }); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | // error |
test/cases/compile_errors/exporting_primitive_values.zig deleted-29| ... | ... | @@ -1,29 +0,0 @@ |
| 1 | pub export fn entry1() void { | |
| 2 | @export(u100, .{ .name = "a" }); | |
| 3 | } | |
| 4 | pub export fn entry3() void { | |
| 5 | @export(undefined, .{ .name = "b" }); | |
| 6 | } | |
| 7 | pub export fn entry4() void { | |
| 8 | @export(null, .{ .name = "c" }); | |
| 9 | } | |
| 10 | pub export fn entry5() void { | |
| 11 | @export(false, .{ .name = "d" }); | |
| 12 | } | |
| 13 | pub export fn entry6() void { | |
| 14 | @export(u8, .{ .name = "e" }); | |
| 15 | } | |
| 16 | pub export fn entry7() void { | |
| 17 | @export(u65535, .{ .name = "f" }); | |
| 18 | } | |
| 19 | ||
| 20 | // error | |
| 21 | // backend=llvm | |
| 22 | // target=native | |
| 23 | // | |
| 24 | // :2:13: error: unable to export primitive value | |
| 25 | // :5:13: error: unable to export primitive value | |
| 26 | // :8:13: error: unable to export primitive value | |
| 27 | // :11:13: error: unable to export primitive value | |
| 28 | // :14:13: error: unable to export primitive value | |
| 29 | // :17:13: error: unable to export primitive value |
test/cases/compile_errors/function-only_builtins_outside_function.zig+2-2| ... | ... | @@ -3,7 +3,7 @@ comptime { |
| 3 | 3 | } |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | @setCold(true); | |
| 6 | @branchHint(.cold); | |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | comptime { |
| ... | ... | @@ -55,7 +55,7 @@ comptime { |
| 55 | 55 | // target=native |
| 56 | 56 | // |
| 57 | 57 | // :2:5: error: '@setAlignStack' outside function scope |
| 58 | // :6:5: error: '@setCold' outside function scope | |
| 58 | // :6:5: error: '@branchHint' outside function scope | |
| 59 | 59 | // :10:5: error: '@src' outside function scope |
| 60 | 60 | // :14:5: error: '@returnAddress' outside function scope |
| 61 | 61 | // :18:5: error: '@frameAddress' outside function scope |
test/cases/compile_errors/invalid_branch_hint.zig created+41| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | const globl = g: { | |
| 2 | @branchHint(.none); | |
| 3 | break :g {}; | |
| 4 | }; | |
| 5 | ||
| 6 | comptime { | |
| 7 | @branchHint(.none); | |
| 8 | } | |
| 9 | ||
| 10 | test { | |
| 11 | @branchHint(.none); | |
| 12 | } | |
| 13 | ||
| 14 | export fn foo() void { | |
| 15 | { | |
| 16 | @branchHint(.none); | |
| 17 | } | |
| 18 | } | |
| 19 | ||
| 20 | export fn bar() void { | |
| 21 | _ = (b: { | |
| 22 | @branchHint(.none); | |
| 23 | break :b true; | |
| 24 | }) or true; | |
| 25 | } | |
| 26 | ||
| 27 | export fn qux() void { | |
| 28 | (b: { | |
| 29 | @branchHint(.none); | |
| 30 | break :b @as(?void, {}); | |
| 31 | }) orelse unreachable; | |
| 32 | } | |
| 33 | ||
| 34 | // error | |
| 35 | // | |
| 36 | // :2:5: error: '@branchHint' outside function scope | |
| 37 | // :7:5: error: '@branchHint' outside function scope | |
| 38 | // :11:5: error: '@branchHint' must appear as the first statement in a function or conditional branch | |
| 39 | // :16:9: error: '@branchHint' must appear as the first statement in a function or conditional branch | |
| 40 | // :22:9: error: '@branchHint' must appear as the first statement in a function or conditional branch | |
| 41 | // :29:9: error: '@branchHint' must appear as the first statement in a function or conditional branch |
test/cases/compile_errors/missing_member_in_namespace_export.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | const S = struct {}; | |
| 2 | comptime { | |
| 3 | @export(S.foo, .{ .name = "foo" }); | |
| 4 | } | |
| 5 | ||
| 6 | // error | |
| 7 | // target=native | |
| 8 | // | |
| 9 | // :3:14: error: struct 'tmp.S' has no member named 'foo' | |
| 10 | // :1:11: note: struct declared here |
test/cases/compile_errors/wrong_types_given_to_export.zig+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | fn entry() callconv(.C) void {} |
| 2 | 2 | comptime { |
| 3 | @export(entry, .{ .name = "entry", .linkage = @as(u32, 1234) }); | |
| 3 | @export(&entry, .{ .name = "entry", .linkage = @as(u32, 1234) }); | |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | // error |
| 7 | 7 | // backend=stage2 |
| 8 | 8 | // target=native |
| 9 | 9 | // |
| 10 | // :3:41: error: expected type 'builtin.GlobalLinkage', found 'u32' | |
| 10 | // :3:42: error: expected type 'builtin.GlobalLinkage', found 'u32' | |
| 11 | 11 | // :?:?: note: enum declared here |
test/link/elf.zig+2-2| ... | ... | @@ -937,8 +937,8 @@ fn testEmitStaticLib(b: *Build, opts: Options) *Step { |
| 937 | 937 | \\} |
| 938 | 938 | \\export var strongBar: usize = 100; |
| 939 | 939 | \\comptime { |
| 940 | \\ @export(weakFoo, .{ .name = "weakFoo", .linkage = .weak }); | |
| 941 | \\ @export(strongBar, .{ .name = "strongBarAlias", .linkage = .strong }); | |
| 940 | \\ @export(&weakFoo, .{ .name = "weakFoo", .linkage = .weak }); | |
| 941 | \\ @export(&strongBar, .{ .name = "strongBarAlias", .linkage = .strong }); | |
| 942 | 942 | \\} |
| 943 | 943 | , |
| 944 | 944 | }); |
test/link/macho.zig+2-2| ... | ... | @@ -196,7 +196,7 @@ fn testDuplicateDefinitions(b: *Build, opts: Options) *Step { |
| 196 | 196 | const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = |
| 197 | 197 | \\var x: usize = 1; |
| 198 | 198 | \\export fn strong() void { x += 1; } |
| 199 | \\comptime { @export(weakImpl, .{ .name = "weak", .linkage = .weak }); } | |
| 199 | \\comptime { @export(&weakImpl, .{ .name = "weak", .linkage = .weak }); } | |
| 200 | 200 | \\fn weakImpl() callconv(.C) void { x += 1; } |
| 201 | 201 | \\extern fn weak() void; |
| 202 | 202 | \\pub fn main() void { |
| ... | ... | @@ -1676,7 +1676,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step { |
| 1676 | 1676 | \\ return x; |
| 1677 | 1677 | \\} |
| 1678 | 1678 | \\comptime { |
| 1679 | \\ @export(foo, .{ .name = "bar", .linkage = .strong }); | |
| 1679 | \\ @export(&foo, .{ .name = "bar", .linkage = .strong }); | |
| 1680 | 1680 | \\} |
| 1681 | 1681 | }); |
| 1682 | 1682 |
test/standalone/global_linkage/obj1.zig+2-2| ... | ... | @@ -2,6 +2,6 @@ var internal_integer: usize = 1; |
| 2 | 2 | var obj1_integer: usize = 421; |
| 3 | 3 | |
| 4 | 4 | comptime { |
| 5 | @export(internal_integer, .{ .name = "internal_integer", .linkage = .internal }); | |
| 6 | @export(obj1_integer, .{ .name = "obj1_integer", .linkage = .strong }); | |
| 5 | @export(&internal_integer, .{ .name = "internal_integer", .linkage = .internal }); | |
| 6 | @export(&obj1_integer, .{ .name = "obj1_integer", .linkage = .strong }); | |
| 7 | 7 | } |
test/standalone/global_linkage/obj2.zig+2-2| ... | ... | @@ -2,6 +2,6 @@ var internal_integer: usize = 2; |
| 2 | 2 | var obj2_integer: usize = 422; |
| 3 | 3 | |
| 4 | 4 | comptime { |
| 5 | @export(internal_integer, .{ .name = "internal_integer", .linkage = .internal }); | |
| 6 | @export(obj2_integer, .{ .name = "obj2_integer", .linkage = .strong }); | |
| 5 | @export(&internal_integer, .{ .name = "internal_integer", .linkage = .internal }); | |
| 6 | @export(&obj2_integer, .{ .name = "obj2_integer", .linkage = .strong }); | |
| 7 | 7 | } |
tools/gen_outline_atomics.zig+1-1| ... | ... | @@ -48,7 +48,7 @@ pub fn main() !void { |
| 48 | 48 | @tagName(op), n.toBytes(), @tagName(order), |
| 49 | 49 | }); |
| 50 | 50 | try writeFunction(arena, w, name, op, n, order); |
| 51 | try footer.writer().print(" @export({s}, .{{ .name = \"{s}\", .linkage = linkage }});\n", .{ | |
| 51 | try footer.writer().print(" @export(&{s}, .{{ .name = \"{s}\", .linkage = linkage }});\n", .{ | |
| 52 | 52 | name, name, |
| 53 | 53 | }); |
| 54 | 54 | } |