[PATCH] D76049: [WebAssembly] Support swiftself and swifterror for WebAssembly target

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 16:13:13 PDT 2020


dschuff added a comment.

I assume there's some kind of ABI doc that says how swiftself and swifterror are supposed to work and be lowered, is there one other than just the langref?



================
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
----------------
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?


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:299
+  // indirect call.
+  if (F.getCallingConv() == CallingConv::Swift) {
+    MVT PtrVT = MVT::getIntegerVT(TM.createDataLayout().getPointerSizeInBits());
----------------
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.


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:815
+      CLI.Outs.push_back(Arg);
+      SDValue ArgVal = DAG.getUNDEF(PtrVT);
+      CLI.OutVals.push_back(ArgVal);
----------------
I assume this will actually be hooked up to some value instead of being undef? Where should these values actually come from? Are all functions expected to have these params?


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