[PATCH] D71484: [WebAssembly][InstrEmitter] Foundation for multivalue call lowering

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 11:10:17 PST 2019


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

WebAssembly is unique among upstream targets in that it does not at
any point use physical registers to store values. Instead, it uses
virtual registers to model positions in its value stack. This means
that some target-independent lowering activities that would use
physical registers need to use virtual registers instead for
WebAssembly and similar downstream targets. This CL generalizes the
existing `usesPhysRegsForPEI` lowering hook to
`usesPhysRegsForValues` in preparation for using it in more places.

One such place is in InstrEmitter for instructions that have variadic
defs. On register machines, it only makes sense for these defs to be
physical registers, but for WebAssembly they must be virtual registers
like any other values. This CL changes InstrEmitter to check the new
target lowering hook to determine whether variadic defs should be
physical or virtual registers.

These changes are necessary to support a generalized CALL instruction
for WebAssembly that is capable of returning an arbitrary number of
arguments. Fully implementing that instruction will require additional
changes that are described in comments here but left for a follow up
commit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71484

Files:
  llvm/include/llvm/Target/TargetMachine.h
  llvm/lib/CodeGen/PrologEpilogInserter.cpp
  llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
  llvm/lib/Target/WebAssembly/WebAssemblyISD.def
  llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td
  llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h
  llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp
  llvm/test/CodeGen/WebAssembly/multivalue.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71484.233836.patch
Type: text/x-patch
Size: 16664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191213/1c3a0f40/attachment.bin>


More information about the llvm-commits mailing list