Skip to content

Moving WebAssembly inline assembly forward #136382

Open
@tgross35

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 #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:

  1. Syntax seems to be the biggest question (see below discussion), WAT vs. LLVM's format
  2. 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?
  3. Should we be restricting dir specs (in, out, lateout, inout, inlateout) or options (pure, nomem, readonly, preserves_flags, noreturn, nostack, raw)? We should probably reject preserves_flags. I'm not sure if lateout and inlateout make sense.
  4. 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.

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-discussionCategory: Discussion or questions that doesn't represent real issues.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions