Allow use of pthreads to parallelize codegen.

This commit is contained in:
Christoffer Lerno
2021-05-09 17:17:37 +02:00
committed by Christoffer Lerno
parent f7919edb35
commit 15a65d0c97
15 changed files with 185 additions and 160 deletions

View File

@@ -15,7 +15,9 @@ void gencontext_begin_module(GenContext *c)
const char *full_path = c->ast_context->file->full_path;
char *mangled_module_name = strformat("%s-%s", c->ast_context->module->name->module, c->ast_context->file->name);
c->module = LLVMModuleCreateWithNameInContext(mangled_module_name, c->context);
LLVMSetModuleDataLayout(c->module, target_data_layout());
c->machine = llvm_target_machine_create();
c->target_data = LLVMCreateTargetDataLayout(c->machine);
LLVMSetModuleDataLayout(c->module, c->target_data);
LLVMSetSourceFileName(c->module, full_path, strlen(c->ast_context->file->full_path));
LLVMTypeRef options_type = LLVMInt8TypeInContext(c->context);