modified codegen backend to use set module
This commit is contained in:
parent
932e1fa961
commit
d0cd74c697
|
@ -1,4 +1,5 @@
|
|||
|
||||
#include "set/types.h"
|
||||
#include <codegen/backend.h>
|
||||
#include <sys/log.h>
|
||||
|
||||
|
@ -67,7 +68,7 @@ BackendError set_backend(const codegen_init init_func, const codegen_deinit dein
|
|||
return new_backend_error(Success);
|
||||
}
|
||||
|
||||
BackendError generate_code(const AST_NODE_PTR root, void** output) {
|
||||
BackendError generate_code(const Module* root, void** output) {
|
||||
DEBUG("generating code with backend: %s", CodegenBackend.name);
|
||||
|
||||
if (CodegenBackend.codegen_func == NULL) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#ifndef CODEGN_BACKEND_H_
|
||||
#define CODEGN_BACKEND_H_
|
||||
|
||||
#include <set/types.h>
|
||||
#include <ast/ast.h>
|
||||
|
||||
typedef struct BackendImplError_t {
|
||||
|
@ -29,7 +30,7 @@ typedef struct BackendError_t {
|
|||
* @brief Function called by the compiler backend to generate an intermediate format
|
||||
* from AST. Returns a custom container for its intermediate language.
|
||||
*/
|
||||
typedef BackendError (*codegen)(const AST_NODE_PTR, void**);
|
||||
typedef BackendError (*codegen)(const Module*, void**);
|
||||
|
||||
/**
|
||||
* @brief Initialize the code generation backend.
|
||||
|
@ -77,7 +78,7 @@ BackendError deinit_backend(void);
|
|||
* @return BackendError
|
||||
*/
|
||||
[[nodiscard]]
|
||||
BackendError generate_code(const AST_NODE_PTR root, void** code);
|
||||
BackendError generate_code(const Module* root, void** code);
|
||||
|
||||
/**
|
||||
* @brief Create a new backend error
|
||||
|
|
|
@ -10,7 +10,7 @@ typedef enum LLVMBackendError_t {
|
|||
UnresolvedImport
|
||||
} LLVMBackendError;
|
||||
|
||||
static BackendError llvm_backend_codegen(const AST_NODE_PTR module_node, void**) {
|
||||
static BackendError llvm_backend_codegen(const Module* unit, void**) {
|
||||
// we start with a LLVM module
|
||||
LLVMContextRef context = LLVMContextCreate();
|
||||
LLVMModuleRef module = LLVMModuleCreateWithNameInContext("gemstone application", context);
|
||||
|
|
Loading…
Reference in New Issue