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

Inline assembly support #3911

Open
keynmol opened this issue May 8, 2024 · 0 comments
Open

Inline assembly support #3911

keynmol opened this issue May 8, 2024 · 0 comments

Comments

@keynmol
Copy link
Contributor

keynmol commented May 8, 2024

This is a tracking issue for allowing to use inline assembly from Scala Native programs.

The mechanism by which this can be achieved is using the "Inline assembler expressions" in LLVM IR: https://llvm.org/docs/LangRef.html#inline-assembler-expressions

Prior art:

Considerations:

  • Syntax - the main thing we'd need to support is some sort of string interpolation to allow referencing Scala definitions, translating them into addresses/constant values, and wiring in those translations in the LLVM IR
    Example:
val hello = 24
val str = c"yo"

inline_assembly(asm"""
mov X1, #5
mov W2, %${hello} ; transformed into the address of hello
mov W3, %${str}  ; transformed into the address of str in constant pool
""")

Reading material:

I'm not actually working on it, especially given I can't get any C examples to run on my Mac. This is merely an information dump

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

1 participant