| author | |
| committer | |
| log | dbf9c7b548a56653c9267dbb615d7119974ecca5 |
| tree | 91593852dcb3aaf381f64e25be289beb6370f305 |
| parent | 49eea79ec20b319ee2aa89bcbfd481111b5caa27 |
Only for use with the C backend at the moment.8 files changed, 43 insertions(+), 0 deletions(-)
lib/std/Target.zig+1| ... | @@ -1754,6 +1754,7 @@ pub const Cpu = struct { | ... | @@ -1754,6 +1754,7 @@ pub const Cpu = struct { |
| 1754 | => &.{ .wasm64, .wasm32 }, | 1754 | => &.{ .wasm64, .wasm32 }, |
| 1755 | 1755 | ||
| 1756 | .arc_sysv, | 1756 | .arc_sysv, |
| 1757 | .arc_interrupt, | ||
| 1757 | => &.{.arc}, | 1758 | => &.{.arc}, |
| 1758 | 1759 | ||
| 1759 | .avr_gnu, | 1760 | .avr_gnu, |
lib/std/builtin.zig+17| ... | @@ -277,6 +277,7 @@ pub const CallingConvention = union(enum(u8)) { | ... | @@ -277,6 +277,7 @@ pub const CallingConvention = union(enum(u8)) { |
| 277 | 277 | ||
| 278 | /// The standard `arc` calling convention. | 278 | /// The standard `arc` calling convention. |
| 279 | arc_sysv: CommonOptions, | 279 | arc_sysv: CommonOptions, |
| 280 | arc_interrupt: ArcInterruptOptions, | ||
| 280 | 281 | ||
| 281 | // Calling conventions for the `avr` architecture. | 282 | // Calling conventions for the `avr` architecture. |
| 282 | avr_gnu, | 283 | avr_gnu, |
| ... | @@ -368,6 +369,22 @@ pub const CallingConvention = union(enum(u8)) { | ... | @@ -368,6 +369,22 @@ pub const CallingConvention = union(enum(u8)) { |
| 368 | register_params: u2 = 0, | 369 | register_params: u2 = 0, |
| 369 | }; | 370 | }; |
| 370 | 371 | ||
| 372 | /// Options for the `arc_interrupt` calling convention. | ||
| 373 | pub const ArcInterruptOptions = struct { | ||
| 374 | /// The boundary the stack is aligned to when the function is called. | ||
| 375 | /// `null` means the default for this calling convention. | ||
| 376 | incoming_stack_alignment: ?u64 = null, | ||
| 377 | /// The kind of interrupt being received. | ||
| 378 | type: InterruptType, | ||
| 379 | |||
| 380 | pub const InterruptType = enum(u2) { | ||
| 381 | ilink1, | ||
| 382 | ilink2, | ||
| 383 | ilink, | ||
| 384 | firq, | ||
| 385 | }; | ||
| 386 | }; | ||
| 387 | |||
| 371 | /// Options for the `arm_interrupt` calling convention. | 388 | /// Options for the `arm_interrupt` calling convention. |
| 372 | pub const ArmInterruptOptions = struct { | 389 | pub const ArmInterruptOptions = struct { |
| 373 | /// The boundary the stack is aligned to when the function is called. | 390 | /// The boundary the stack is aligned to when the function is called. |
src/InternPool.zig+9| ... | @@ -12950,6 +12950,11 @@ const PackedCallingConvention = packed struct(u18) { | ... | @@ -12950,6 +12950,11 @@ const PackedCallingConvention = packed struct(u18) { |
| 12950 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12950 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12951 | .extra = pl.register_params, | 12951 | .extra = pl.register_params, |
| 12952 | }, | 12952 | }, |
| 12953 | std.builtin.CallingConvention.ArcInterruptOptions => .{ | ||
| 12954 | .tag = tag, | ||
| 12955 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | ||
| 12956 | .extra = @intFromEnum(pl.type), | ||
| 12957 | }, | ||
| 12953 | std.builtin.CallingConvention.ArmInterruptOptions => .{ | 12958 | std.builtin.CallingConvention.ArmInterruptOptions => .{ |
| 12954 | .tag = tag, | 12959 | .tag = tag, |
| 12955 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12960 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| ... | @@ -12984,6 +12989,10 @@ const PackedCallingConvention = packed struct(u18) { | ... | @@ -12984,6 +12989,10 @@ const PackedCallingConvention = packed struct(u18) { |
| 12984 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12989 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12985 | .register_params = @intCast(cc.extra), | 12990 | .register_params = @intCast(cc.extra), |
| 12986 | }, | 12991 | }, |
| 12992 | std.builtin.CallingConvention.ArcInterruptOptions => .{ | ||
| 12993 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | ||
| 12994 | .type = @enumFromInt(cc.extra), | ||
| 12995 | }, | ||
| 12987 | std.builtin.CallingConvention.ArmInterruptOptions => .{ | 12996 | std.builtin.CallingConvention.ArmInterruptOptions => .{ |
| 12988 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12997 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12989 | .type = @enumFromInt(cc.extra), | 12998 | .type = @enumFromInt(cc.extra), |
src/Sema.zig+6| ... | @@ -9122,6 +9122,7 @@ fn callConvIsCallable(cc: std.builtin.CallingConvention.Tag) bool { | ... | @@ -9122,6 +9122,7 @@ fn callConvIsCallable(cc: std.builtin.CallingConvention.Tag) bool { |
| 9122 | return switch (cc) { | 9122 | return switch (cc) { |
| 9123 | .naked, | 9123 | .naked, |
| 9124 | 9124 | ||
| 9125 | .arc_interrupt, | ||
| 9125 | .arm_interrupt, | 9126 | .arm_interrupt, |
| 9126 | .avr_interrupt, | 9127 | .avr_interrupt, |
| 9127 | .avr_signal, | 9128 | .avr_signal, |
| ... | @@ -9284,6 +9285,7 @@ fn funcCommon( | ... | @@ -9284,6 +9285,7 @@ fn funcCommon( |
| 9284 | else => return sema.fail(block, param_src, "'{s}' calling convention supports up to 2 parameters, found {d}", .{ @tagName(cc), i + 1 }), | 9285 | else => return sema.fail(block, param_src, "'{s}' calling convention supports up to 2 parameters, found {d}", .{ @tagName(cc), i + 1 }), |
| 9285 | } | 9286 | } |
| 9286 | }, | 9287 | }, |
| 9288 | .arc_interrupt, | ||
| 9287 | .arm_interrupt, | 9289 | .arm_interrupt, |
| 9288 | .mips64_interrupt, | 9290 | .mips64_interrupt, |
| 9289 | .mips_interrupt, | 9291 | .mips_interrupt, |
| ... | @@ -9515,6 +9517,7 @@ fn finishFunc( | ... | @@ -9515,6 +9517,7 @@ fn finishFunc( |
| 9515 | .mips_interrupt, | 9517 | .mips_interrupt, |
| 9516 | .riscv64_interrupt, | 9518 | .riscv64_interrupt, |
| 9517 | .riscv32_interrupt, | 9519 | .riscv32_interrupt, |
| 9520 | .arc_interrupt, | ||
| 9518 | .avr_interrupt, | 9521 | .avr_interrupt, |
| 9519 | .csky_interrupt, | 9522 | .csky_interrupt, |
| 9520 | .m68k_interrupt, | 9523 | .m68k_interrupt, |
| ... | @@ -30038,6 +30041,9 @@ fn callconvCoerceAllowed( | ... | @@ -30038,6 +30041,9 @@ fn callconvCoerceAllowed( |
| 30038 | std.builtin.CallingConvention.X86RegparmOptions => { | 30041 | std.builtin.CallingConvention.X86RegparmOptions => { |
| 30039 | if (src_data.register_params != dest_data.register_params) return false; | 30042 | if (src_data.register_params != dest_data.register_params) return false; |
| 30040 | }, | 30043 | }, |
| 30044 | std.builtin.CallingConvention.ArcInterruptOptions => { | ||
| 30045 | if (src_data.type != dest_data.type) return false; | ||
| 30046 | }, | ||
| 30041 | std.builtin.CallingConvention.ArmInterruptOptions => { | 30047 | std.builtin.CallingConvention.ArmInterruptOptions => { |
| 30042 | if (src_data.type != dest_data.type) return false; | 30048 | if (src_data.type != dest_data.type) return false; |
| 30043 | }, | 30049 | }, |
src/Zcu.zig+3| ... | @@ -4475,6 +4475,9 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu | ... | @@ -4475,6 +4475,9 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.builtin.CallingConvention) union(enu |
| 4475 | .arm_aapcs_vfp, | 4475 | .arm_aapcs_vfp, |
| 4476 | => |opts| opts.incoming_stack_alignment == null, | 4476 | => |opts| opts.incoming_stack_alignment == null, |
| 4477 | 4477 | ||
| 4478 | .arc_interrupt, | ||
| 4479 | => |opts| opts.incoming_stack_alignment == null, | ||
| 4480 | |||
| 4478 | .arm_interrupt, | 4481 | .arm_interrupt, |
| 4479 | => |opts| opts.incoming_stack_alignment == null, | 4482 | => |opts| opts.incoming_stack_alignment == null, |
| 4480 | 4483 |
src/codegen/c.zig+4| ... | @@ -8077,6 +8077,10 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8 | ... | @@ -8077,6 +8077,10 @@ fn toCallingConvention(cc: std.builtin.CallingConvention, zcu: *Zcu) ?[]const u8 |
| 8077 | .arm_aapcs => "pcs(\"aapcs\")", | 8077 | .arm_aapcs => "pcs(\"aapcs\")", |
| 8078 | .arm_aapcs_vfp => "pcs(\"aapcs-vfp\")", | 8078 | .arm_aapcs_vfp => "pcs(\"aapcs-vfp\")", |
| 8079 | 8079 | ||
| 8080 | .arc_interrupt => |opts| switch (opts.type) { | ||
| 8081 | inline else => |t| "interrupt(\"" ++ @tagName(t) ++ "\")", | ||
| 8082 | }, | ||
| 8083 | |||
| 8080 | .arm_interrupt => |opts| switch (opts.type) { | 8084 | .arm_interrupt => |opts| switch (opts.type) { |
| 8081 | .generic => "interrupt", | 8085 | .generic => "interrupt", |
| 8082 | .irq => "interrupt(\"IRQ\")", | 8086 | .irq => "interrupt(\"IRQ\")", |
src/codegen/llvm.zig+2| ... | @@ -11816,6 +11816,7 @@ pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: *const std.Targ | ... | @@ -11816,6 +11816,7 @@ pub fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: *const std.Targ |
| 11816 | const incoming_stack_alignment: ?u64, const register_params: u2 = switch (cc) { | 11816 | const incoming_stack_alignment: ?u64, const register_params: u2 = switch (cc) { |
| 11817 | inline else => |pl| switch (@TypeOf(pl)) { | 11817 | inline else => |pl| switch (@TypeOf(pl)) { |
| 11818 | void => .{ null, 0 }, | 11818 | void => .{ null, 0 }, |
| 11819 | std.builtin.CallingConvention.ArcInterruptOptions, | ||
| 11819 | std.builtin.CallingConvention.ArmInterruptOptions, | 11820 | std.builtin.CallingConvention.ArmInterruptOptions, |
| 11820 | std.builtin.CallingConvention.RiscvInterruptOptions, | 11821 | std.builtin.CallingConvention.RiscvInterruptOptions, |
| 11821 | std.builtin.CallingConvention.MipsInterruptOptions, | 11822 | std.builtin.CallingConvention.MipsInterruptOptions, |
| ... | @@ -11919,6 +11920,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s | ... | @@ -11919,6 +11920,7 @@ fn toLlvmCallConvTag(cc_tag: std.builtin.CallingConvention.Tag, target: *const s |
| 11919 | .powerpc_aix_altivec, | 11920 | .powerpc_aix_altivec, |
| 11920 | .wasm_mvp, | 11921 | .wasm_mvp, |
| 11921 | .arc_sysv, | 11922 | .arc_sysv, |
| 11923 | .arc_interrupt, | ||
| 11922 | .avr_gnu, | 11924 | .avr_gnu, |
| 11923 | .bpf_std, | 11925 | .bpf_std, |
| 11924 | .csky_sysv, | 11926 | .csky_sysv, |
src/link/Dwarf.zig+1| ... | @@ -3917,6 +3917,7 @@ fn updateLazyType( | ... | @@ -3917,6 +3917,7 @@ fn updateLazyType( |
| 3917 | .mips_interrupt, | 3917 | .mips_interrupt, |
| 3918 | .riscv64_interrupt, | 3918 | .riscv64_interrupt, |
| 3919 | .riscv32_interrupt, | 3919 | .riscv32_interrupt, |
| 3920 | .arc_interrupt, | ||
| 3920 | .avr_builtin, | 3921 | .avr_builtin, |
| 3921 | .avr_signal, | 3922 | .avr_signal, |
| 3922 | .avr_interrupt, | 3923 | .avr_interrupt, |