Page MenuHomePhabricator

[WebAssembly] Add experimental multivalue calling ABI
ClosedPublic

Authored by tlively on Jan 17 2020, 6:34 PM.

Details

Summary

For now, this ABI simply expands all possible aggregate arguments and
returns all possible aggregates directly. This ABI will change rapidly
as we prototype and benchmark a new ABI that takes advantage of
multivalue return and possibly other changes from the MVP ABI.

Diff Detail

Event Timeline

tlively created this revision.Jan 17 2020, 6:34 PM

Unit tests: fail. 61974 tests passed, 2 failed and 783 were skipped.

failed: LLVM.Bindings/Go/go.test
failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_sharedtimedmutex_requirements/thread_sharedtimedmutex_class/try_lock.pass.cpp

clang-tidy: unknown.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

aheejin added inline comments.Jan 21 2020, 5:59 PM
clang/lib/CodeGen/TargetInfo.cpp
741

Nit: Do we need _?

clang/test/CodeGen/wasm-arguments.c
19–20

The comment here includes only the MVP case. Shouldn't we update this? Ditto for the other comments below.

102

Why is the union passed as an int for MV?

tlively marked 3 inline comments as done.Feb 3 2020, 2:52 PM
tlively added inline comments.
clang/lib/CodeGen/TargetInfo.cpp
741

I was cargo culting the ARM targets here. It may be that some compilers get confused when the type and variable have the same name in this situation?

clang/test/CodeGen/wasm-arguments.c
19–20

I think there is some value in having the comments describe the expected stable behavior and let the "EXPERIMENTAL" speak for itself. The only thing I can think of adding to the comment is "... in non-experimental ABIs", but that doesn't seem too valuable to have.

102

Unions cannot be represented precisely in LLVM IR. I believe they are just represented as their largest component, as this one is. From an ABI point of view it is either an int or a struct containing a single int, both of which are passed by value in our ABI.

aheejin accepted this revision.Feb 4 2020, 2:19 PM
aheejin added inline comments.
clang/lib/CodeGen/TargetInfo.cpp
741

I don't think so. We have many cases that use the same name for a parameter and its corresponding field in constructors.

clang/test/CodeGen/wasm-arguments.c
19–20

Then we can maybe add one-line comment for EXPERIMENTAL-MVs too in case its results deviates from MVP?

This revision is now accepted and ready to land.Feb 4 2020, 2:19 PM
tlively marked 2 inline comments as done.Feb 4 2020, 8:42 PM
tlively added inline comments.
clang/lib/CodeGen/TargetInfo.cpp
741

Ok, dropped it!

clang/test/CodeGen/wasm-arguments.c
19–20

Sounds good 👍

This revision was automatically updated to reflect the committed changes.