| author | |
| committer | |
| log | af1d777b27641e2dedb70d19e3e4f5b04fa62a6e |
| tree | ec307648b1243d20ae40334fe2b0a3a9ef7da32c |
| parent | 4fa453ce20ceaee254a7d127a4a99be2260ec605 |
| signature |
Only supported in CBE.8 files changed, 48 insertions(+), 0 deletions(-)
lib/std/Target.zig+1| ... | ... | @@ -1923,6 +1923,7 @@ pub const Cpu = struct { |
| 1923 | 1923 | |
| 1924 | 1924 | .sh_gnu, |
| 1925 | 1925 | .sh_renesas, |
| 1926 | .sh_interrupt, | |
| 1926 | 1927 | => &.{ .sh, .sheb }, |
| 1927 | 1928 | |
| 1928 | 1929 | .ve_sysv, |
lib/std/builtin.zig+20| ... | ... | @@ -342,6 +342,7 @@ pub const CallingConvention = union(enum(u8)) { |
| 342 | 342 | // Calling conventions for the `sh`/`sheb` architecture. |
| 343 | 343 | sh_gnu: CommonOptions, |
| 344 | 344 | sh_renesas: CommonOptions, |
| 345 | sh_interrupt: ShInterruptOptions, | |
| 345 | 346 | |
| 346 | 347 | /// The standard `ve` calling convention. |
| 347 | 348 | ve_sysv: CommonOptions, |
| ... | ... | @@ -476,6 +477,25 @@ pub const CallingConvention = union(enum(u8)) { |
| 476 | 477 | }; |
| 477 | 478 | }; |
| 478 | 479 | |
| 480 | /// Options for the `sh_interrupt` calling convention. | |
| 481 | pub const ShInterruptOptions = struct { | |
| 482 | /// The boundary the stack is aligned to when the function is called. | |
| 483 | /// `null` means the default for this calling convention. | |
| 484 | incoming_stack_alignment: ?u64 = null, | |
| 485 | save: SaveBehavior = .full, | |
| 486 | ||
| 487 | pub const SaveBehavior = enum(u3) { | |
| 488 | /// Save only fpscr (if applicable). | |
| 489 | fpscr, | |
| 490 | /// Save only high-numbered registers, i.e. r0 through r7 are *not* saved. | |
| 491 | high, | |
| 492 | /// Save all registers normally. | |
| 493 | full, | |
| 494 | /// Save all registers using the CPU's fast register bank. | |
| 495 | bank, | |
| 496 | }; | |
| 497 | }; | |
| 498 | ||
| 479 | 499 | /// Returns the array of `std.Target.Cpu.Arch` to which this `CallingConvention` applies. |
| 480 | 500 | /// Asserts that `cc` is not `.auto`, `.@"async"`, `.naked`, or `.@"inline"`. |
| 481 | 501 | pub fn archs(cc: CallingConvention) []const std.Target.Cpu.Arch { |
src/InternPool.zig+9| ... | ... | @@ -12975,6 +12975,11 @@ const PackedCallingConvention = packed struct(u18) { |
| 12975 | 12975 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12976 | 12976 | .extra = @intFromEnum(pl.mode), |
| 12977 | 12977 | }, |
| 12978 | std.builtin.CallingConvention.ShInterruptOptions => .{ | |
| 12979 | .tag = tag, | |
| 12980 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | |
| 12981 | .extra = @intFromEnum(pl.save), | |
| 12982 | }, | |
| 12978 | 12983 | else => comptime unreachable, |
| 12979 | 12984 | }, |
| 12980 | 12985 | }; |
| ... | ... | @@ -13014,6 +13019,10 @@ const PackedCallingConvention = packed struct(u18) { |
| 13014 | 13019 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 13015 | 13020 | .mode = @enumFromInt(cc.extra), |
| 13016 | 13021 | }, |
| 13022 | std.builtin.CallingConvention.ShInterruptOptions => .{ | |
| 13023 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | |
| 13024 | .save = @enumFromInt(cc.extra), | |
| 13025 | }, | |
| 13017 | 13026 | else => comptime unreachable, |
| 13018 | 13027 | }, |
| 13019 | 13028 | ), |
src/Sema.zig+6| ... | ... | @@ -9141,6 +9141,7 @@ fn callConvIsCallable(cc: std.builtin.CallingConvention.Tag) bool { |
| 9141 | 9141 | .msp430_interrupt, |
| 9142 | 9142 | .riscv32_interrupt, |
| 9143 | 9143 | .riscv64_interrupt, |
| 9144 | .sh_interrupt, | |
| 9144 | 9145 | .x86_interrupt, |
| 9145 | 9146 | .x86_64_interrupt, |
| 9146 | 9147 | |
| ... | ... | @@ -9301,6 +9302,7 @@ fn funcCommon( |
| 9301 | 9302 | .mips_interrupt, |
| 9302 | 9303 | .riscv64_interrupt, |
| 9303 | 9304 | .riscv32_interrupt, |
| 9305 | .sh_interrupt, | |
| 9304 | 9306 | .avr_interrupt, |
| 9305 | 9307 | .csky_interrupt, |
| 9306 | 9308 | .m68k_interrupt, |
| ... | ... | @@ -9528,6 +9530,7 @@ fn finishFunc( |
| 9528 | 9530 | .mips_interrupt, |
| 9529 | 9531 | .riscv64_interrupt, |
| 9530 | 9532 | .riscv32_interrupt, |
| 9533 | .sh_interrupt, | |
| 9531 | 9534 | .arc_interrupt, |
| 9532 | 9535 | .avr_interrupt, |
| 9533 | 9536 | .csky_interrupt, |
| ... | ... | @@ -30069,6 +30072,9 @@ fn callconvCoerceAllowed( |
| 30069 | 30072 | std.builtin.CallingConvention.RiscvInterruptOptions => { |
| 30070 | 30073 | if (src_data.mode != dest_data.mode) return false; |
| 30071 | 30074 | }, |
| 30075 | std.builtin.CallingConvention.ShInterruptOptions => { | |
| 30076 | if (src_data.save != dest_data.save) return false; | |
| 30077 | }, | |
| 30072 | 30078 | else => comptime unreachable, |
| 30073 | 30079 | } |
| 30074 | 30080 | }, |
src/Zcu.zig+3| ... | ... | @@ -4449,6 +4449,9 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu |
| 4449 | 4449 | .riscv64_interrupt, |
| 4450 | 4450 | => |opts| opts.incoming_stack_alignment == null, |
| 4451 | 4451 | |
| 4452 | .sh_interrupt, | |
| 4453 | => |opts| opts.incoming_stack_alignment == null, | |
| 4454 | ||
| 4452 | 4455 | .x86_sysv, |
| 4453 | 4456 | .x86_win, |
| 4454 | 4457 | .x86_stdcall, |
src/codegen/c.zig+6| ... | ... | @@ -8114,6 +8114,12 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8 |
| 8114 | 8114 | }, |
| 8115 | 8115 | |
| 8116 | 8116 | .sh_renesas => "renesas", |
| 8117 | .sh_interrupt => |opts| switch (opts.save) { | |
| 8118 | .fpscr => "trapa_handler", // Implies `interrupt_handler`. | |
| 8119 | .high => "interrupt_handler, nosave_low_regs", | |
| 8120 | .full => "interrupt_handler", | |
| 8121 | .bank => "interrupt_handler, resbank", | |
| 8122 | }, | |
| 8117 | 8123 | |
| 8118 | 8124 | .m68k_rtd => "m68k_rtd", |
| 8119 | 8125 |
src/codegen/llvm.zig+2| ... | ... | @@ -11837,6 +11837,7 @@ pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: *const std.Targ |
| 11837 | 11837 | std.builtin.CallingConvention.ArcInterruptOptions, |
| 11838 | 11838 | std.builtin.CallingConvention.ArmInterruptOptions, |
| 11839 | 11839 | std.builtin.CallingConvention.RiscvInterruptOptions, |
| 11840 | std.builtin.CallingConvention.ShInterruptOptions, | |
| 11840 | 11841 | std.builtin.CallingConvention.MicroblazeInterruptOptions, |
| 11841 | 11842 | std.builtin.CallingConvention.MipsInterruptOptions, |
| 11842 | 11843 | std.builtin.CallingConvention.CommonOptions, |
| ... | ... | @@ -11964,6 +11965,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s |
| 11964 | 11965 | .s390x_sysv_vx, |
| 11965 | 11966 | .sh_gnu, |
| 11966 | 11967 | .sh_renesas, |
| 11968 | .sh_interrupt, | |
| 11967 | 11969 | .ve_sysv, |
| 11968 | 11970 | .xcore_xs1, |
| 11969 | 11971 | .xcore_xs2, |
src/link/Dwarf.zig+1| ... | ... | @@ -3919,6 +3919,7 @@ fn updateLazyType( |
| 3919 | 3919 | .mips_interrupt, |
| 3920 | 3920 | .riscv64_interrupt, |
| 3921 | 3921 | .riscv32_interrupt, |
| 3922 | .sh_interrupt, | |
| 3922 | 3923 | .arc_interrupt, |
| 3923 | 3924 | .avr_builtin, |
| 3924 | 3925 | .avr_signal, |