added: verification of llvm module after compilation
This commit is contained in:
parent
14c5ba320c
commit
30230249ae
|
@ -4,6 +4,7 @@
|
||||||
#include <llvm-c/Target.h>
|
#include <llvm-c/Target.h>
|
||||||
#include <llvm-c/TargetMachine.h>
|
#include <llvm-c/TargetMachine.h>
|
||||||
#include <llvm-c/Types.h>
|
#include <llvm-c/Types.h>
|
||||||
|
#include <llvm-c/Analysis.h>
|
||||||
#include <llvm/backend.h>
|
#include <llvm/backend.h>
|
||||||
#include <llvm/parser.h>
|
#include <llvm/parser.h>
|
||||||
#include <llvm/llvm-ir/types.h>
|
#include <llvm/llvm-ir/types.h>
|
||||||
|
@ -203,6 +204,15 @@ static BackendError build_module(LLVMBackendCompileUnit* unit,
|
||||||
// TODO: implement functions
|
// TODO: implement functions
|
||||||
err = impl_functions(unit, global_scope, module->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;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue