Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
jit.h
Go to the documentation of this file.
1/* -*- C -*-
2 * Serene programming language
3 * Copyright (C) 2019-2026 Sameer Rahmani <[email protected]>
4 *
5 * This library is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <llvm-c/LLJIT.h>
22
23#include "serene/rt/errors.h"
24
26typedef struct srn_mm_t srn_mm_t;
27
28typedef struct srn_jit_module_t {
29 LLVMOrcThreadSafeModuleRef tsm;
32
34
35typedef struct srn_jit_t {
36 LLVMOrcLLJITRef llvm_jit;
37 LLVMOrcLLJITBuilderRef builder;
39
40[[gnu::nonnull(1)]] srn_jit_t *srn_jit_make(srn_mm_t *mm);
41
42/// Creates a jit engine and sets the given `result` to it.
43[[gnu::nonnull(1)]] int srn_jit_init(srn_jit_t *result);
44[[gnu::nonnull(1)]] int srn_jit_shutdown(srn_jit_t *jit);
45
46/// Add a module to the jit compiler
47[[gnu::nonnull(1)]] srn_error_t *srn_jit_add_module(srn_context_t *ctx,
48 srn_jit_module_t *module);
int srn_jit_shutdown(srn_jit_t *jit)
Definition jit.c:75
srn_jit_t * srn_jit_make(srn_mm_t *mm)
Definition jit.c:44
struct srn_context_t srn_context_t
Definition jit.h:33
srn_error_t * srn_jit_add_module(srn_context_t *ctx, srn_jit_module_t *module)
Add a module to the jit compiler.
Definition jit.c:83
int srn_jit_init(srn_jit_t *result)
Creates a jit engine and sets the given result to it.
Engine is a structure to own the long living and main pieces of the compiler.
Definition engine.h:49
LLVMOrcThreadSafeModuleRef tsm
Definition jit.h:29
srn_context_t * ctx
Definition jit.h:30
LLVMOrcLLJITRef llvm_jit
Definition jit.h:36
LLVMOrcLLJITBuilderRef builder
Definition jit.h:37
Main memory manager structure that will own all the allocated blocks and data.
Definition interface.h:112