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

Yuta Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 12 01:36:48 PDT 2020


kateinoigakukun created this revision.
kateinoigakukun added a project: LLVM.
Herald added subscribers: llvm-commits, sunfish, aheejin, hiraditya, jgravelle-google, sbc100, dschuff.
kateinoigakukun added reviewers: sbc100, sunfish.

Support swiftself and swifterror for WebAssembly

Support signature difference for swiftself and swifterror when cc is swiftcc.

e.g.

  declare swiftcc void @foo(i32, i32)
  @data = global i8* bitcast (void (i32, i32)* @foo to i8*)
  define swiftcc void @bar() {
    %1 = load i8*, i8** @data
    %2 = bitcast i8* %1 to void (i32, i32, i32)*
    call swiftcc void %2(i32 1, i32 2, i32 swiftself 3)
    ret void
  }

For swiftcc, emit additional swiftself and swifterror parameters if there aren't while lowering. These additional parameters are added for both callee and caller.
They are necessary to match callee and caller signature for indirect call.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76049

Files:
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/test/CodeGen/WebAssembly/swiftcc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76049.249851.patch
Type: text/x-patch
Size: 9654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200312/6c119c41/attachment.bin>


More information about the llvm-commits mailing list