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

expose tablegen API #1945

Open
gogo2464 opened this issue Dec 25, 2022 · 7 comments
Open

expose tablegen API #1945

gogo2464 opened this issue Dec 25, 2022 · 7 comments
Labels

Comments

@gogo2464
Copy link

I am writting a cryptanalysis library. I need to get statistics on opcodes repartition on the code. So I need to generate any valid assembled <-> disassembled instructions on a BiBTreeMap in rust.

I need to implement bindings for tablegen to this library : https://github.com/capstone-rust/capstone-rs/ and I imagine the library author needs an exposed library first.

Could you assign me to this issue please?

The files I want to edit are here: https://github.com/capstone-engine/capstone/tree/next/suite/synctools/tablegen

@gogo2464
Copy link
Author

It is the bad branch. Anyway I plan to add api in https://github.com/capstone-engine/capstone/tree/master/include/capstone

@XVilka
Copy link
Contributor

XVilka commented Jan 4, 2023

It's related to the work being done by @Rot127, see #1936 (comment)

@Rot127
Copy link
Collaborator

Rot127 commented Jun 4, 2023

@gogo2464 If I understand your problem correctly you need primarily information what bit in an instruction encodes what (regs, imms, opcode etc.) + certain constraints.
It seems your issue is related to #2031?

If you need access to the TableGen definitions in all its detail, I highly recommend to write a new backend for TableGen and generate the map there. Simply because there is no reasonable way to provide access to all records of the .td files.

If you are still interested in this it is probably better to wait until the main auto-sync work is done (minimum requirement is #2026) and then discuss how to add this info.

To learn how we generate code with the help of refactored TableGen backends, see the llvm-capstone docs.

@gogo2464
Copy link
Author

gogo2464 commented Jun 4, 2023

I currently have hardcoded the statistics. This is very imprecise. Can I wait in order to overwrite my hardcoded value with more specific data please?

@Rot127
Copy link
Collaborator

Rot127 commented Jun 4, 2023

Yes, of cause. Feel free to come back to it when you find time.

@XVilka
Copy link
Contributor

XVilka commented Apr 7, 2024

@gogo2464 now that auto-sync code was refactored and merged, could you please check the code and if anything is missing.

@Rot127
Copy link
Collaborator

Rot127 commented Apr 7, 2024

@gogo2464 And please check if #2296 was merged before. It is a refactor and clean up PR for the scripts. So use the code from there please.

@Rot127 Rot127 added question LLVM Anything LLVM related code-generation labels Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants