Skip to content

[LLVM][DecoderEmitter] Add option to use lambdas in decodeToMCInst #144814

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jurahul
Copy link
Contributor

@jurahul jurahul commented Jun 18, 2025

Add option use-lambda-in-decode-to-mcinst to use a table of lambdas instead of a switch case in the generated decodeToMCInst function.

When the number of switch cases in this function is large, the generated code takes a long time to compile in release builds. Using a table of lambdas instead improves the compile time significantly (~3x speedup in compiling the code in a downstream target). This option will allow targets to opt into this mode if they desire for better build times.

Tested with check-llvm-mc with the option enabled by default.

…oMCInst

Add option `use-lambda-in-decode-to-mcinst` to use a table of lambdas
instead of a switch case in the generated `decodeToMCInst` function.

When the number of switch cases in this function is large, the generated
code takes a long time to compile in release builds. Using a table of
lambdas instead improves the compile time significantly (~3x speedup
in compiling the code in a downstream target). This option will allow
targets to opt into this mode if they desire for better build times.

Tested with `check-llvm-mc` with the option enabled by default.
@jurahul jurahul force-pushed the decoder_to_mcinst_lambda branch from 665180b to a0f7142 Compare June 19, 2025 01:27
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.

1 participant