| author | |
| committer | |
| log | ea3f5905f0635d0c0cb3983ba5ca6c92859e9d81 |
| tree | 8a6005d4eea0b538141a7620236debfcf914b709 |
| parent | 9416b4d993e5e386c9208e9a52e4e881eee8cf72 |
Closes ziglang/zig#115856 files changed, 13 insertions(+), 0 deletions(-)
lib/std/builtin.zig+1| ... | @@ -147,6 +147,7 @@ pub const CallingConvention = enum { | ... | @@ -147,6 +147,7 @@ pub const CallingConvention = enum { |
| 147 | AAPCS, | 147 | AAPCS, |
| 148 | AAPCSVFP, | 148 | AAPCSVFP, |
| 149 | SysV, | 149 | SysV, |
| 150 | Win64, | ||
| 150 | PtxKernel, | 151 | PtxKernel, |
| 151 | }; | 152 | }; |
| 152 | 153 |
src/codegen/llvm.zig+1| ... | @@ -7940,6 +7940,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca | ... | @@ -7940,6 +7940,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca |
| 7940 | }, | 7940 | }, |
| 7941 | .Signal => .AVR_SIGNAL, | 7941 | .Signal => .AVR_SIGNAL, |
| 7942 | .SysV => .X86_64_SysV, | 7942 | .SysV => .X86_64_SysV, |
| 7943 | .Win64 => .Win64, | ||
| 7943 | .PtxKernel => return switch (target.cpu.arch) { | 7944 | .PtxKernel => return switch (target.cpu.arch) { |
| 7944 | .nvptx, .nvptx64 => .PTX_Kernel, | 7945 | .nvptx, .nvptx64 => .PTX_Kernel, |
| 7945 | else => unreachable, | 7946 | else => unreachable, |
src/stage1/all_types.hpp+1| ... | @@ -84,6 +84,7 @@ enum CallingConvention { | ... | @@ -84,6 +84,7 @@ enum CallingConvention { |
| 84 | CallingConventionAAPCS, | 84 | CallingConventionAAPCS, |
| 85 | CallingConventionAAPCSVFP, | 85 | CallingConventionAAPCSVFP, |
| 86 | CallingConventionSysV, | 86 | CallingConventionSysV, |
| 87 | CallingConventionWin64, | ||
| 87 | CallingConventionPtxKernel | 88 | CallingConventionPtxKernel |
| 88 | }; | 89 | }; |
| 89 | 90 |
src/stage1/analyze.cpp+4| ... | @@ -991,6 +991,7 @@ const char *calling_convention_name(CallingConvention cc) { | ... | @@ -991,6 +991,7 @@ const char *calling_convention_name(CallingConvention cc) { |
| 991 | case CallingConventionAAPCSVFP: return "AAPCSVFP"; | 991 | case CallingConventionAAPCSVFP: return "AAPCSVFP"; |
| 992 | case CallingConventionInline: return "Inline"; | 992 | case CallingConventionInline: return "Inline"; |
| 993 | case CallingConventionSysV: return "SysV"; | 993 | case CallingConventionSysV: return "SysV"; |
| 994 | case CallingConventionWin64: return "Win64"; | ||
| 994 | case CallingConventionPtxKernel: return "PtxKernel"; | 995 | case CallingConventionPtxKernel: return "PtxKernel"; |
| 995 | } | 996 | } |
| 996 | zig_unreachable(); | 997 | zig_unreachable(); |
| ... | @@ -1015,6 +1016,7 @@ bool calling_convention_allows_zig_types(CallingConvention cc) { | ... | @@ -1015,6 +1016,7 @@ bool calling_convention_allows_zig_types(CallingConvention cc) { |
| 1015 | case CallingConventionAAPCS: | 1016 | case CallingConventionAAPCS: |
| 1016 | case CallingConventionAAPCSVFP: | 1017 | case CallingConventionAAPCSVFP: |
| 1017 | case CallingConventionSysV: | 1018 | case CallingConventionSysV: |
| 1019 | case CallingConventionWin64: | ||
| 1018 | return false; | 1020 | return false; |
| 1019 | } | 1021 | } |
| 1020 | zig_unreachable(); | 1022 | zig_unreachable(); |
| ... | @@ -2006,6 +2008,7 @@ Error emit_error_unless_callconv_allowed_for_target(CodeGen *g, AstNode *source_ | ... | @@ -2006,6 +2008,7 @@ Error emit_error_unless_callconv_allowed_for_target(CodeGen *g, AstNode *source_ |
| 2006 | allowed_platforms = "ARM"; | 2008 | allowed_platforms = "ARM"; |
| 2007 | break; | 2009 | break; |
| 2008 | case CallingConventionSysV: | 2010 | case CallingConventionSysV: |
| 2011 | case CallingConventionWin64: | ||
| 2009 | if (g->zig_target->arch != ZigLLVM_x86_64) | 2012 | if (g->zig_target->arch != ZigLLVM_x86_64) |
| 2010 | allowed_platforms = "x86_64"; | 2013 | allowed_platforms = "x86_64"; |
| 2011 | break; | 2014 | break; |
| ... | @@ -3846,6 +3849,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) { | ... | @@ -3846,6 +3849,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) { |
| 3846 | case CallingConventionAAPCS: | 3849 | case CallingConventionAAPCS: |
| 3847 | case CallingConventionAAPCSVFP: | 3850 | case CallingConventionAAPCSVFP: |
| 3848 | case CallingConventionSysV: | 3851 | case CallingConventionSysV: |
| 3852 | case CallingConventionWin64: | ||
| 3849 | case CallingConventionPtxKernel: | 3853 | case CallingConventionPtxKernel: |
| 3850 | add_fn_export(g, fn_table_entry, buf_ptr(&fn_table_entry->symbol_name), | 3854 | add_fn_export(g, fn_table_entry, buf_ptr(&fn_table_entry->symbol_name), |
| 3851 | GlobalLinkageIdStrong, fn_cc); | 3855 | GlobalLinkageIdStrong, fn_cc); |
src/stage1/codegen.cpp+5| ... | @@ -209,6 +209,9 @@ static ZigLLVM_CallingConv get_llvm_cc(CodeGen *g, CallingConvention cc) { | ... | @@ -209,6 +209,9 @@ static ZigLLVM_CallingConv get_llvm_cc(CodeGen *g, CallingConvention cc) { |
| 209 | case CallingConventionSysV: | 209 | case CallingConventionSysV: |
| 210 | assert(g->zig_target->arch == ZigLLVM_x86_64); | 210 | assert(g->zig_target->arch == ZigLLVM_x86_64); |
| 211 | return ZigLLVM_X86_64_SysV; | 211 | return ZigLLVM_X86_64_SysV; |
| 212 | case CallingConventionWin64: | ||
| 213 | assert(g->zig_target->arch == ZigLLVM_x86_64); | ||
| 214 | return ZigLLVM_Win64; | ||
| 212 | case CallingConventionPtxKernel: | 215 | case CallingConventionPtxKernel: |
| 213 | assert(g->zig_target->arch == ZigLLVM_nvptx || | 216 | assert(g->zig_target->arch == ZigLLVM_nvptx || |
| 214 | g->zig_target->arch == ZigLLVM_nvptx64); | 217 | g->zig_target->arch == ZigLLVM_nvptx64); |
| ... | @@ -359,6 +362,7 @@ static bool cc_want_sret_attr(CallingConvention cc) { | ... | @@ -359,6 +362,7 @@ static bool cc_want_sret_attr(CallingConvention cc) { |
| 359 | case CallingConventionAAPCS: | 362 | case CallingConventionAAPCS: |
| 360 | case CallingConventionAAPCSVFP: | 363 | case CallingConventionAAPCSVFP: |
| 361 | case CallingConventionSysV: | 364 | case CallingConventionSysV: |
| 365 | case CallingConventionWin64: | ||
| 362 | case CallingConventionPtxKernel: | 366 | case CallingConventionPtxKernel: |
| 363 | return true; | 367 | return true; |
| 364 | case CallingConventionAsync: | 368 | case CallingConventionAsync: |
| ... | @@ -10033,6 +10037,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { | ... | @@ -10033,6 +10037,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 10033 | static_assert(CallingConventionAAPCS == 12, ""); | 10037 | static_assert(CallingConventionAAPCS == 12, ""); |
| 10034 | static_assert(CallingConventionAAPCSVFP == 13, ""); | 10038 | static_assert(CallingConventionAAPCSVFP == 13, ""); |
| 10035 | static_assert(CallingConventionSysV == 14, ""); | 10039 | static_assert(CallingConventionSysV == 14, ""); |
| 10040 | static_assert(CallingConventionWin64 == 15, ""); | ||
| 10036 | 10041 | ||
| 10037 | static_assert(BuiltinPtrSizeOne == 0, ""); | 10042 | static_assert(BuiltinPtrSizeOne == 0, ""); |
| 10038 | static_assert(BuiltinPtrSizeMany == 1, ""); | 10043 | static_assert(BuiltinPtrSizeMany == 1, ""); |
src/stage1/ir.cpp+1| ... | @@ -11743,6 +11743,7 @@ static Stage1AirInst *ir_analyze_instruction_export(IrAnalyze *ira, Stage1ZirIns | ... | @@ -11743,6 +11743,7 @@ static Stage1AirInst *ir_analyze_instruction_export(IrAnalyze *ira, Stage1ZirIns |
| 11743 | case CallingConventionAAPCS: | 11743 | case CallingConventionAAPCS: |
| 11744 | case CallingConventionAAPCSVFP: | 11744 | case CallingConventionAAPCSVFP: |
| 11745 | case CallingConventionSysV: | 11745 | case CallingConventionSysV: |
| 11746 | case CallingConventionWin64: | ||
| 11746 | case CallingConventionPtxKernel: | 11747 | case CallingConventionPtxKernel: |
| 11747 | add_fn_export(ira->codegen, fn_entry, buf_ptr(symbol_name), global_linkage_id, cc); | 11748 | add_fn_export(ira->codegen, fn_entry, buf_ptr(symbol_name), global_linkage_id, cc); |
| 11748 | fn_entry->section_name = section_name; | 11749 | fn_entry->section_name = section_name; |