aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2019-12-29 19:34:54 +0100
committerLemonBoy <thatlemon@gmail.com>2020-01-02 18:57:08 +0100
commit0ccac79c8ebc1ed56dbdab068076a86924a015bc (patch)
treea7dfe2ba2535f7d4c50f2f8bae07e97df1a2ef19 /src/codegen.cpp
parent08a26fea0918fba1dd315781fa96d457da5bcb50 (diff)
downloadzig-0ccac79c8ebc1ed56dbdab068076a86924a015bc.tar.gz
zig-0ccac79c8ebc1ed56dbdab068076a86924a015bc.zip
Implement Thiscall CC
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index b83767f9d6..23a9103877 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -301,6 +301,10 @@ static LLVMCallConv get_llvm_cc(CodeGen *g, CallingConvention cc) {
return LLVMAARCH64VectorCallCallConv;
#endif
return LLVMCCallConv;
+ case CallingConventionThiscall:
+ if (g->zig_target->arch == ZigLLVM_x86)
+ return LLVMX86ThisCallCallConv;
+ return LLVMCCallConv;
case CallingConventionAsync:
return LLVMFastCallConv;
case CallingConventionAPCS:
@@ -424,6 +428,7 @@ static bool cc_want_sret_attr(CallingConvention cc) {
case CallingConventionStdcall:
case CallingConventionFastcall:
case CallingConventionVectorcall:
+ case CallingConventionThiscall:
case CallingConventionAPCS:
case CallingConventionAAPCS:
case CallingConventionAAPCSVFP:
@@ -8512,9 +8517,10 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
static_assert(CallingConventionStdcall == 7, "");
static_assert(CallingConventionFastcall == 8, "");
static_assert(CallingConventionVectorcall == 9, "");
- static_assert(CallingConventionAPCS == 10, "");
- static_assert(CallingConventionAAPCS == 11, "");
- static_assert(CallingConventionAAPCSVFP == 12, "");
+ static_assert(CallingConventionThiscall == 10, "");
+ static_assert(CallingConventionAPCS == 11, "");
+ static_assert(CallingConventionAAPCS == 12, "");
+ static_assert(CallingConventionAAPCSVFP == 13, "");
static_assert(FnInlineAuto == 0, "");
static_assert(FnInlineAlways == 1, "");