Closed joek13 closed 3 months ago
There is a call to LLVM::verifyModule at the end of ASTProgram::codegen(), but it does not have the functionality described above. I'll have to look at how "llc" initiates its analysis to see if we can run that process just before returning.
We have a new version of the verifyModule logic that reports more granular error messages. Hopefully this resolves the issue, but we did not inject a codegen error to test it.
This issue is a continuation of a discussion started in class on Tue, Nov 22.
While extending codegen for the class project, I sometimes make mistakes and my compiler erroneously emits invalid bitcode. In these situations
tipc
exits successfully, but linking the malformed.bc
fails with the enigmaticerror: Invalid record (Producer: 'LLVM14.0.6' Reader: 'LLVM 14.0.6')
.In these cases I can often get a more descriptive error message by running
./bin/build.sh --asm problem.tip && llc problem.tip.ll
.Would it be possible to integrate
llc
-style bitcode validation intipc
? That way invalid bitcode is caught bytipc
and we can emit a more informative error message instead of waiting for linking to fail.