[PATCH] D76049: [WebAssembly] Support swiftself and swifterror for WebAssembly target
Yuta Saito via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 13 19:26:18 PDT 2020
kateinoigakukun marked 2 inline comments as done.
kateinoigakukun added a comment.
Here is Swift calling convention docs and there is description about swiftself and swifterror.
https://llvm.org/docs/LangRef.html#parameter-attributes
https://github.com/apple/swift/blob/master/docs/ABI/CallingConvention.rst#self
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:296
+ // For swiftcc, emit additional swiftself and swifterror arguments
+ // if there aren't any. These additional arguments are also added for caller
+ // signature. They are necessary to match callee and caller signature for
----------------
dschuff wrote:
> Is the idea here that some functions will have explicit swiftself/swifterror arguments in the IR and others won't (in which case, we create them when lowering)? Why the difference?
When the function doesn't have swiftself and swifterror, it can be called without swiftself and swifterror arguments directly.
swiftcc allows the number of arguments variance only when calling the function through function pointer, it's not allowed for direct function call. (As far as I know, this is helpful for static analysis to make it easier to inline or optimize)
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:299
+ // indirect call.
+ if (F.getCallingConv() == CallingConv::Swift) {
+ MVT PtrVT = MVT::getIntegerVT(TM.createDataLayout().getPointerSizeInBits());
----------------
dschuff wrote:
> would it make sense to move all of this logic directly into `computeSignatureVTs`? It's repeated below and I think always right after a call to that.
I think it makes sense!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76049/new/
https://reviews.llvm.org/D76049
More information about the llvm-commits
mailing list