summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2019-10-09 21:42:08 +0000
committerThomas Lively <tlively@google.com>2019-10-09 21:42:08 +0000
commit00f9e5aa76f4932098da375545ee144d884eced3 (patch)
tree93f1c4c66045344f64c393e2eff419601c61aa3b /llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
parentffb26d9c7830f0f957caca155c2c56e173043906 (diff)
downloadbcm5719-llvm-00f9e5aa76f4932098da375545ee144d884eced3.tar.gz
bcm5719-llvm-00f9e5aa76f4932098da375545ee144d884eced3.zip
[WebAssembly] Make returns variadic
Summary: This is necessary and sufficient to get simple cases of multiple return working with multivalue enabled. More complex cases will require block and loop signatures to be generalized to potentially be type indices as well. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68684 llvm-svn: 374235
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 538234384af..aff379585f2 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -852,8 +852,8 @@ bool WebAssemblyTargetLowering::CanLowerReturn(
CallingConv::ID /*CallConv*/, MachineFunction & /*MF*/, bool /*IsVarArg*/,
const SmallVectorImpl<ISD::OutputArg> &Outs,
LLVMContext & /*Context*/) const {
- // WebAssembly can't currently handle returning tuples.
- return Outs.size() <= 1;
+ // WebAssembly can only handle returning tuples with multivalue enabled
+ return Subtarget->hasMultivalue() || Outs.size() <= 1;
}
SDValue WebAssemblyTargetLowering::LowerReturn(
@@ -861,7 +861,8 @@ SDValue WebAssemblyTargetLowering::LowerReturn(
const SmallVectorImpl<ISD::OutputArg> &Outs,
const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
SelectionDAG &DAG) const {
- assert(Outs.size() <= 1 && "WebAssembly can only return up to one value");
+ assert(Subtarget->hasMultivalue() ||
+ Outs.size() <= 1 && "MVP WebAssembly can only return up to one value");
if (!callingConvSupported(CallConv))
fail(DL, DAG, "WebAssembly doesn't support non-C calling conventions");
OpenPOWER on IntegriCloud