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

Add ability to get named metadata objects from bitcode modules. #1079

Open
jumanji144 opened this issue Sep 21, 2024 · 2 comments
Open

Add ability to get named metadata objects from bitcode modules. #1079

jumanji144 opened this issue Sep 21, 2024 · 2 comments
Labels
feature_request Feature Request

Comments

@jumanji144
Copy link


Feature request

Hello, i have recently been using this library to parse some data from the DXIL directx shader , which uses llvm bitcode to store it's bytecode and type information. Long story short, it uses named metadata to store important information about buffer structures. Using llvmlite it seems i wasn't able to obtain named metadata from ModuleRef objects from bitcode, whilst the ir Module is able to.

As llvmlite uses llvm::Module already for it's ModuleRef, wouldn't it be trivial to implement a function to use the getNamedMetadata function of llvm::Module

Am i doing something wrong, or is it just not implemented?

Best regards

@gmarkall gmarkall added the feature_request Feature Request label Sep 24, 2024
@gmarkall
Copy link
Member

I think it's just not implemented, things tend to be implemented on an as-needed basis. If getNamedMetadata() were implemented, what methods of the resulting NamedMDNode would you want to use (e.g. dump())? I think some would also need to be implemented to fully provide the functionality you want - does that align with your understanding?

@jumanji144
Copy link
Author

Well ideally it would be the same as for the ir, but that the nodes use the llvm backing nodes instead, but ofc then the question would be if it should be reused or some higher order abstractions to be placed between both ir and backend.

To be honest, i would also just be fine with a method to obtain a ir Module from a ModuleRef, as then they would be convertible to and from.

This could be implemented in many ways, as for example printing a ModuleRef results in llvm ir assembly, which could be parsed into a ir object? or a direct conversion?

Again i am open to the implementation, i just want access to named and unnamed metadata from llvm bitcode

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

No branches or pull requests

2 participants