[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llc-style bitcode validation #72

Closed
joek13 opened this issue Nov 22, 2022 · 2 comments
Closed

llc-style bitcode validation #72

joek13 opened this issue Nov 22, 2022 · 2 comments

Comments

@joek13
Copy link
joek13 commented Nov 22, 2022

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 enigmatic error: 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 in tipc? That way invalid bitcode is caught by tipc and we can emit a more informative error message instead of waiting for linking to fail.

@matthewbdwyer
Copy link
Owner

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.

@matthewbdwyer
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants