Add a module to the jit compiler.
88 {
91
92 LLVMOrcLLJITRef j = ctx->
engine->jit->llvm_jit;
93
94 LLVMOrcJITDylibRef jd = LLVMOrcLLJITGetMainJITDylib(j);
95 LLVMErrorRef err = LLVMOrcLLJITAddLLVMIRModule(j, jd, module->
tsm);
97
98 if (err != nullptr) {
99
100
101
102
103
104
105
106 char *jit_err_msg = LLVMGetErrorMessage(err);
107 char *msg =
srn_copy_bytes(ctx, jit_err_msg, strlen(jit_err_msg) + 1,
alignof(
char));
109 LLVMDisposeErrorMessage(jit_err_msg);
110 }
111 return srn_err;
112}
srn_error_t * srn_errors_make(const srn_context_t *ctx, srn_error_tag_t tag, const char *msg, void *caller)
Build an error in ctx's memory, tagged tag and carrying msg.
srn_engine_t * engine
Long term state of the compiler.
A runtime error, a tag classifying the failure and a human-readable message.
LLVMOrcThreadSafeModuleRef tsm
#define PANIC_IF_NULL(ptr)
char * srn_copy_bytes(const srn_context_t *ctx, const char *src, size_t len, size_t alignment)