Skip to content

Refactored TableGen backends #8

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

Merged
merged 19 commits into from
May 19, 2023

Conversation

Rot127
Copy link
Collaborator

@Rot127 Rot127 commented May 8, 2023

Adds the refactored TableGen backends used by auto-sync (capstone-engine/capstone#1949).

The refactor basically adds two printer classes. One for LLVM and one for Capstone. Emitter backends then call methods of one of those to emit the code.

For some emitter backends the PrinterCapstone class will generate additional mapping tables.

This design is not really sophisticated but works for our use case and is relatively easy to fix in case of conflicts during rebase. But it has some inherent problems when it comes to emitting anything else then the code generated by the emitter backends.

Unfortunately this is a problem from LLVM. See the discussion here (starting at comment from nhaehnle): https://reviews.llvm.org/D138323

Refactoring the emitter backends needs a lot of work and involvement from the LLVM folks, which there seems to be no motivation for currently.

@reitowo
Copy link

reitowo commented May 11, 2023

Hope all auto-sync related PRs can be merged soon~

@Rot127
Copy link
Collaborator Author

Rot127 commented May 11, 2023

@cnSchwarzer Me as well :D

Please be aware though, even if the ARM related PRs are merged the auto-sync work is not finalized yet. If you are looking into it for development purposes, please base your work on the PPC branches (capstone-engine/capstone#2013 and https://github.com/Rot127/llvm-capstone/tree/tblgen_capstone_backends_ppc).
auto-sync will not be stable until v5.1.

@reitowo
Copy link

reitowo commented May 11, 2023

Thanks for notice! It seems I just come into this timing that capstone is switching architecture :) Looking forward to this.

@Rot127
Copy link
Collaborator Author

Rot127 commented May 11, 2023

It seems I just come into this timing that capstone is switching architecture

The API for disasm() etc. will stay the same. But each arch module will have (sometimes significant) changes because they will be closer to LLVM (see the Possibly breaking changes list in capstone-engine/capstone#1949).

@kabeor
Copy link
Member

kabeor commented May 19, 2023

@Rot127 Plz pr to auto-sync branch, release/x.x is just for archive llvm code.

@Rot127 Rot127 changed the base branch from release/16.x to auto-sync May 19, 2023 09:39
@Rot127
Copy link
Collaborator Author

Rot127 commented May 19, 2023

@kabeor Done

@kabeor
Copy link
Member

kabeor commented May 19, 2023

Great! Merged.

@kabeor kabeor merged commit 83cdb5a into capstone-engine:auto-sync May 19, 2023
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

Successfully merging this pull request may close these issues.

5 participants