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

C-API for llvm-dialects and generated dialects #70

Open
vchuravy opened this issue Oct 26, 2023 · 1 comment
Open

C-API for llvm-dialects and generated dialects #70

vchuravy opened this issue Oct 26, 2023 · 1 comment

Comments

@vchuravy
Copy link
Contributor

It would be awesome if llvm-dialects could use the tablegen definitions to generate a C-API automatically.
But how to do so is probably worth some discussion.

As an example this is the current IRBuilder API:

https://github.com/llvm/llvm-project/blob/7fe29e585723c8a90e798b3d852f2c54efb6f5dd/llvm/include/llvm-c/Core.h#L3742-L3753

But there are also delightful enums like: https://github.com/llvm/llvm-project/blob/7fe29e585723c8a90e798b3d852f2c54efb6f5dd/llvm/include/llvm-c/Core.h#L60

@nhaehnle
Copy link
Member

It'd probably end up in a state similar to the LLVM C API where sometimes: the C API is strictly a wrapper around the C++ API and some features may not immediately be available in the C API.

I could imagine this working as a second set of llvm-dialects-tblgen actions: one to generate an .inc file for a C header, and one to generate an .inc file for a C++ source that implements the functions exposed by the C header by referring back to the C++ functions.

Layering it in this way ensures that the two APIs agree about how operands are represented etc.

Not sure about the enums...

In terms of project management: We (AMD) have no use for it, but I'd be happy to accept such a feature as long as it has testing that's roughly comparable with what's there for the C++ API.

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