diff --git a/src/llvm/backend.c b/src/llvm/backend.c index 5bf2b21..5abcb95 100644 --- a/src/llvm/backend.c +++ b/src/llvm/backend.c @@ -3,24 +3,14 @@ #include #include #include -#include -#include +#include 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) { diff --git a/src/llvm/parser.c b/src/llvm/parser.c new file mode 100644 index 0000000..7a6fd55 --- /dev/null +++ b/src/llvm/parser.c @@ -0,0 +1,17 @@ + +#include + +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); +} diff --git a/src/llvm/parser.h b/src/llvm/parser.h new file mode 100644 index 0000000..ceb908c --- /dev/null +++ b/src/llvm/parser.h @@ -0,0 +1,12 @@ + +#include "set/types.h" +#include +#include +#include + +typedef struct LLVMBackendCompileUnit_t { + LLVMContextRef context; + LLVMModuleRef module; +} LLVMBackendCompileUnit; + +BackendError parse_module(const Module* module, void**);