moved module generation to backend parser
This commit is contained in:
parent
d0cd74c697
commit
78e6310b05
|
@ -3,24 +3,14 @@
|
|||
#include <sys/log.h>
|
||||
#include <ast/ast.h>
|
||||
#include <llvm/backend.h>
|
||||
#include <llvm-c/Types.h>
|
||||
#include <llvm-c/Core.h>
|
||||
#include <llvm/parser.h>
|
||||
|
||||
typedef enum LLVMBackendError_t {
|
||||
UnresolvedImport
|
||||
} LLVMBackendError;
|
||||
|
||||
static BackendError llvm_backend_codegen(const Module* unit, void**) {
|
||||
// we start with a LLVM module
|
||||
LLVMContextRef context = LLVMContextCreate();
|
||||
LLVMModuleRef module = LLVMModuleCreateWithNameInContext("gemstone application", context);
|
||||
|
||||
BackendError err;
|
||||
|
||||
LLVMDisposeModule(module);
|
||||
LLVMContextDispose(context);
|
||||
|
||||
return new_backend_error(Success);
|
||||
static BackendError llvm_backend_codegen(const Module* unit, void** output) {
|
||||
return parse_module(unit, output);
|
||||
}
|
||||
|
||||
static BackendError llvm_backend_codegen_init(void) {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
#include <llvm/parser.h>
|
||||
|
||||
BackendError parse_module(const Module* module, void**) {
|
||||
LLVMBackendCompileUnit* unit = malloc(sizeof(LLVMBackendCompileUnit));
|
||||
|
||||
// we start with a LLVM module
|
||||
unit->context = LLVMContextCreate();
|
||||
unit->module = LLVMModuleCreateWithNameInContext("gemstone application", unit->context);
|
||||
|
||||
|
||||
|
||||
LLVMDisposeModule(unit->module);
|
||||
LLVMContextDispose(unit->context);
|
||||
|
||||
return new_backend_error(Success);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
#include "set/types.h"
|
||||
#include <codegen/backend.h>
|
||||
#include <llvm-c/Types.h>
|
||||
#include <llvm-c/Core.h>
|
||||
|
||||
typedef struct LLVMBackendCompileUnit_t {
|
||||
LLVMContextRef context;
|
||||
LLVMModuleRef module;
|
||||
} LLVMBackendCompileUnit;
|
||||
|
||||
BackendError parse_module(const Module* module, void**);
|
Loading…
Reference in New Issue