Moving WebAssembly inline assembly forward
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I'm opening this issue to consolidate some scattered discussion about what is needed to make inline assembly for Wasm work. This is tracked along with the other architectures at https://github.com/rust-lang/rust/issues/93335. That thread notes:
- It must have clobber_abi.
- It must be possible to clobber every register that is normally clobbered by a function call.
- Generally review that the exposed register classes make sense.
So, for Wasm specifically:
- Syntax seems to be the biggest question (see below discussion), WAT vs. LLVM's format
- There are not any registers to be clobbered. Should there be some way to indicate the asm clobbers the top N elements on the stack?
- Should we be restricting dir specs (
in,out,lateout,inout,inlateout) or options (pure,nomem,readonly,preserves_flags,noreturn,nostack,raw)? We should probably rejectpreserves_flags. I'm not sure iflateoutandinlateoutmake sense. - Is the LLVM side generally considered stable? It appears unchanging, but I don't see any of its constraints documented in langref https://llvm.org/docs/LangRef.html#inline-asm-constraint-string
Cc @daxpedda @hanna-kruppe @alexcrichton @hoodmane @solomatov, I think you have all been involved in the wasm-inline-asm discussion in different places.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the related issue #93335 and the LLVM inline-assembly constraint documentation linked in this issue. Review the open Wasm questions about syntax, stack clobbers, operand directions, options, and LLVM stability. Done means the required behavior and constraints for Wasm inline assembly are resolved clearly enough to guide implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100