aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_abi.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-03-01 12:15:28 +0000
committergingerBill <bill@gingerbill.org>2021-03-01 12:15:28 +0000
commit302742689b68d36e2adc49eda5f480da182d2653 (patch)
tree2b7ad46b7656f65e3d0c2b25cffd9f87a21328da /src/llvm_abi.cpp
parentee04dde7c286731effcb9cd426fc4a576e8f1a5f (diff)
Patch win64 ABI problem caused by a bug in LLVM for 128 bit integers
Diffstat (limited to 'src/llvm_abi.cpp')
-rw-r--r--src/llvm_abi.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp
index 1f408fa17..f7891735d 100644
--- a/src/llvm_abi.cpp
+++ b/src/llvm_abi.cpp
@@ -400,7 +400,12 @@ namespace lbAbi386 {
lb_is_type_kind(type, LLVMIntegerTypeKind) &&
type == LLVMIntTypeInContext(c, 128)) {
// NOTE(bill): Because Windows AMD64 is weird
- LLVMTypeRef cast_type = LLVMVectorType(LLVMInt64TypeInContext(c), 2);
+ // TODO(bill): LLVM is probably bugged here and doesn't correctly generate the right code
+ // So even though it is "technically" wrong, no cast might be the best option
+ LLVMTypeRef cast_type = nullptr;
+ if (!is_return) {
+ cast_type = LLVMVectorType(LLVMInt64TypeInContext(c), 2);
+ }
return lb_arg_type_direct(type, cast_type, nullptr, nullptr);
}