aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index abcb9b4060..3d31661b1e 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -10413,6 +10413,7 @@ fn firstParamSRet(fn_info: Type.Payload.Function.Data, target: std.Target) bool
.riscv32, .riscv64 => return riscv_c_abi.classifyType(fn_info.return_type, target) == .memory,
else => return false, // TODO investigate C ABI for other architectures
},
+ .Stdcall => return !isScalar(fn_info.return_type),
else => return false,
}
}
@@ -10568,6 +10569,13 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*llvm.Type {
else => return dg.lowerType(fn_info.return_type),
}
},
+ .Stdcall => {
+ if (isScalar(fn_info.return_type)) {
+ return dg.lowerType(fn_info.return_type);
+ } else {
+ return dg.context.voidType();
+ }
+ },
else => return dg.lowerType(fn_info.return_type),
}
}
@@ -10798,6 +10806,17 @@ const ParamTypeIterator = struct {
},
}
},
+ .Stdcall => {
+ it.zig_index += 1;
+ it.llvm_index += 1;
+
+ if (isScalar(ty)) {
+ return .byval;
+ } else {
+ it.byval_attr = true;
+ return .byref;
+ }
+ },
else => {
it.zig_index += 1;
it.llvm_index += 1;