Merge remote-tracking branch 'origin/85-implement-llvm-backend' into 85-implement-llvm-backend

This commit is contained in:
Sven Vogel 2024-06-06 11:26:36 +02:00
commit b843a9aa79
1 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <llvm-c/Target.h>
#include <llvm-c/TargetMachine.h>
#include <llvm-c/Types.h>
#include <llvm-c/Analysis.h>
#include <llvm/backend.h>
#include <llvm/parser.h>
#include <llvm/llvm-ir/types.h>
@ -205,6 +206,15 @@ static BackendError build_module(LLVMBackendCompileUnit* unit,
// TODO: implement functions
err = impl_functions(unit, global_scope, module->functions);
char* error = NULL;
LLVMVerifyModule(unit->module, LLVMAbortProcessAction, &error);
if (error) {
print_message(Error, "Unable to compile due to: %s", error);
LLVMDisposeMessage(error);
err = new_backend_impl_error(Implementation, NULL, "LLVM backend verification error, see stdout");
}
return err;
}