aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-06-03 21:23:30 +0100
committergingerBill <bill@gingerbill.org>2020-06-03 21:23:30 +0100
commit37a3abdaaa0daa3fca0f8b649f67f069ca54443a (patch)
tree7d5980995f84e01b0c2f263657f18bce53760145 /src/llvm_backend.cpp
parentac709b8afb788c795f7cdb1ccfeb2bfe55f2df51 (diff)
Fix calling convention stuff with LLVM C API
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index be0b09372..e5058983f 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -2032,7 +2032,7 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity) {
if (build_context.metrics.os != TargetOs_js) {
cc_kind = lb_calling_convention_map[pt->Proc.calling_convention];
}
- LLVMSetFunctionCallConv(p->value, lb_calling_convention_map[pt->Proc.calling_convention]);
+ LLVMSetFunctionCallConv(p->value, cc_kind);
lbValue proc_value = {p->value, p->type};
lb_add_entity(m, entity, proc_value);
lb_add_member(m, p->name, proc_value);
@@ -2172,8 +2172,12 @@ lbProcedure *lb_create_dummy_procedure(lbModule *m, String link_name, Type *type
p->value = LLVMAddFunction(m->mod, c_link_name, func_type);
Type *pt = p->type;
-
- LLVMSetFunctionCallConv(p->value, lb_calling_convention_map[pt->Proc.calling_convention]);
+ lbCallingConventionKind cc_kind = lbCallingConvention_C;
+ // TODO(bill): Clean up this logic
+ if (build_context.metrics.os != TargetOs_js) {
+ cc_kind = lb_calling_convention_map[pt->Proc.calling_convention];
+ }
+ LLVMSetFunctionCallConv(p->value, cc_kind);
lbValue proc_value = {p->value, p->type};
lb_add_member(m, p->name, proc_value);
lb_add_procedure_value(m, p);