diff options
| author | gingerBill <bill@gingerbill.org> | 2020-03-08 17:57:46 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-03-08 17:57:46 +0000 |
| commit | 5a02ebe2c8caff530f51df97691554a74c97aba9 (patch) | |
| tree | c3169b9a4f6dce1a9807ca2a6c14f8c1fd9e3a68 /src | |
| parent | dae817e5ab786180ebcd284fb27195db5ae5ec00 (diff) | |
Fix foreign import dependencies; Fix `lbParamPass_Integer` ABI
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend.cpp | 12 | ||||
| -rw-r--r-- | src/llvm_backend.hpp | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 2b6604f44..0aecebf83 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -1137,8 +1137,8 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity) { p->body = pl->body; p->tags = pt->Proc.tags; p->inlining = ProcInlining_none; - p->is_foreign = false; - p->is_export = false; + p->is_foreign = entity->Procedure.is_foreign; + p->is_export = entity->Procedure.is_export; p->is_entry_point = false; gbAllocator a = heap_allocator(); @@ -1206,6 +1206,12 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity) { lb_add_proc_attribute_at_index(p, offset+parameter_index, "nocapture"); } + + if (entity->Procedure.is_foreign) { + lb_add_foreign_library_path(p->module, entity->Procedure.foreign_library); + } + + { // Debug Information unsigned line = cast(unsigned)entity->token.pos.line; @@ -1379,7 +1385,7 @@ lbValue lb_add_param(lbProcedure *p, Entity *e, Ast *expr, Type *abi_type, i32 i case lbParamPass_Integer: { lbAddr l = lb_add_local(p, e->type, e, false, index); - lbValue iptr = lb_emit_conv(p, l.addr, alloc_type_pointer(p->type)); + lbValue iptr = lb_emit_conv(p, l.addr, alloc_type_pointer(abi_type)); lb_emit_store(p, iptr, v); return lb_addr_load(p, l); } diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp index d99babce7..a58dcdf8b 100644 --- a/src/llvm_backend.hpp +++ b/src/llvm_backend.hpp @@ -279,6 +279,7 @@ void lb_push_context_onto_stack(lbProcedure *p, lbAddr ctx); lbAddr lb_add_global_generated(lbModule *m, Type *type, lbValue value={}); lbAddr lb_add_local(lbProcedure *p, Type *type, Entity *e=nullptr, bool zero_init=true, i32 param_index=0); +void lb_add_foreign_library_path(lbModule *m, Entity *e); lbValue lb_typeid(lbModule *m, Type *type, Type *typeid_type=t_typeid); |