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

LLVM parser in Vellvm? #10

Open
wintersmind opened this issue Sep 22, 2014 · 3 comments
Open

LLVM parser in Vellvm? #10

wintersmind opened this issue Sep 22, 2014 · 3 comments

Comments

@wintersmind
Copy link

This is also a question, not an issue (is there a better place to post questions?): I assume there is a Vellvm parser somewhere in the repo, to allow transformation of source code to some sort of AST representation. If so, could someone identify its location for me? Thanks, -chris

@dgarbuzov
Copy link
Contributor

The AST is generated from the ott definitions in src/Vellvm/syntax_base.ott. If you have ott in your path, you can generate the Coq file with make src/Vellvm/syntax_base.v. It is somewhat simplified and out of date: it doesn't include e.g. metadata, aliases, exception handling instructions, etc.

There is, unfortunately, no parser in the repository. Previously, Vellvm used a (heavily) modified version of the LLVM OCaml bindings to generate an AST from the in-memory C++ representation of the IR. Due to changes in LLVM's interals, these will only compile against LLVM 3.0, which itself doesn't compile with relatively new versions of GCC or Clang!

I actually started writing an updated AST/parser without dependencies on the rest of the project based on the AST of the llvm-general library but haven't gotten very far. I can update this issue if that ever becomes usable.

@wintersmind
Copy link
Author

Thanks for the info. So I guess the ott definitions allow Vellvm to recognize LLVM IR code written in the syntax defined e.g. in the POPL12 paper, so there isn't a practical need for a parser to experiment with non-trivial code examples.

@dgarbuzov
Copy link
Contributor

I don't think Ott really helps us with parsing, though I haven't kept up with new versions.

Like I mentioned above, the OCaml bindings that were used to generate the AST from LLVM bitcode don't work with newer versions of LLVM. If we would like to, for example, test the Vellvm interpreter using recent versions of LLVM we really do need a replacement. Writing a standalone parser and new AST seems better from a maintenance and code reuse perspective than trying to update Vellvm's AST and the OCaml bindings.

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