diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 4d67af46e..2e1e505f2 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -486,6 +486,7 @@ namespace lbAbiAmd64Win64 { switch (calling_convention) { case ProcCC_Odin: case ProcCC_Contextless: + return true; case ProcCC_VectorCall: return true; } @@ -501,12 +502,27 @@ namespace lbAbiAmd64Win64 { if (is_vectorcall(calling_convention)) { if (kind == LLVMStructTypeKind || kind == LLVMArrayTypeKind) { + #if 0 i64 sz = lb_sizeof(t); if (sz <= 8) { args[i] = lb_arg_type_direct(t, LLVMIntTypeInContext(c, 8*cast(unsigned)sz), nullptr, nullptr); } else { args[i] = lb_arg_type_indirect(t, nullptr); } + #else + i64 sz = lb_sizeof(t); + switch (sz) { + case 1: + case 2: + case 4: + case 8: + args[i] = lb_arg_type_direct(t, LLVMIntTypeInContext(c, 8*cast(unsigned)sz), nullptr, nullptr); + break; + default: + args[i] = lb_arg_type_indirect(t, nullptr); + break; + } + #endif } if (kind == LLVMVectorTypeKind) { diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp index e4297300f..7bd9da036 100644 --- a/src/llvm_backend.hpp +++ b/src/llvm_backend.hpp @@ -741,6 +741,7 @@ lbCallingConventionKind const lb_calling_convention_map[ProcCC_MAX] = { lbCallingConvention_PreserveMost, // ProcCC_PreserveMost, lbCallingConvention_PreserveAll, // ProcCC_PreserveAll, + lbCallingConvention_X86_VectorCall, // ProcCC_VectorCall, }; enum : LLVMDWARFTypeEncoding { diff --git a/src/parser.hpp b/src/parser.hpp index e712c136a..8955608de 100644 --- a/src/parser.hpp +++ b/src/parser.hpp @@ -305,7 +305,7 @@ enum ProcCallingConvention : i32 { ProcCC_PreserveMost = 12, ProcCC_PreserveAll = 13, - ProcCC_VectorCall = 14, + ProcCC_VectorCall = 14, ProcCC_MAX,