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

[WebAssembly] Enable multivalue return when multivalue ABI is used #88492

Merged
merged 1 commit into from
Apr 23, 2024

Commits on Apr 12, 2024

  1. [WebAssembly] Enable multivalue return when multivalue ABI is used

    Multivalue feature of WebAssembly has been standardized for several
    years now. I think it makes sense to be able to enable it in the feature
    section by default for our clang/llvm-produced binaries so that the
    multivalue feature can be used as necessary when necessary within our
    toolchain and also when running other optimizers (e.g. wasm-opt) after
    the LLVM code generation.
    
    But some WebAssembly toolchains, such as Emscripten, do not provide
    both mulvalue-returning and not-multivalue-returning versions of
    libraries. Also allowing the uses of multivalue in the features section
    does not necessarily mean we generate them whenever we can to the
    fullest, which is a different code generation / optimization option.
    
    So this makes the lowering of multivalue returns conditional on the use
    of 'experimental-mv' target ABI. This ABI is turned off by default and
    turned on by passing `-Xclang -target-abi -Xclang experimental-mv` to
    `clang`, or `-target-abi experimental-mv` to `clang -cc1` or `llc`.
    
    But the purpose of this PR is not tying the multivalue lowering to this
    specific 'experimental-mv'. 'experimental-mv' is just one multivalue ABI
    we currently have, and it is still experimental, meaning it is not very
    well optimized or tuned for performance. (e.g. it does not have the
    limitation of the max number of multivalue-lowered values, which can be
    detrimental to performance.) We may change the name of this ABI, or
    improve it, or add a new multivalue ABI in the future. Also I heard that
    WASI is planning to add their multivalue ABI soon. So the plan is,
    whenever any one of multivalue ABIs is enabled, we enable the lowering
    of multivalue returns in the backend. We currently have only
    'experimental-mv' in the repo so we only check for that in this PR.
    
    Related past discussions:
     llvm#82714
    WebAssembly/tool-conventions#223 (comment)
    aheejin committed Apr 12, 2024
    Configuration menu
    Copy the full SHA
    6ecbb86 View commit details
    Browse the repository at this point in the history