llvm.org GIT mirror llvm / caf175c
WebAssembly: handle `ret void`. Summary: Use -1 as numoperands for the return SDTypeProfile, denoting that return is variadic. Note that the patterns in InstrControl.td still need to match the inputs, so this ins't an "anything goes" variadic on ret! The next step will be to handle other local types (not just int32). Reviewers: sunfish Subscribers: llvm-commits, jfb Differential Revision: http://reviews.llvm.org/D11692 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243783 91177308-0d34-0410-b5e6-96231b3b80d8 JF Bastien 5 years ago
4 changed file(s) with 13 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
145145
146146 SmallVector RetOps(1, Chain);
147147 RetOps.append(OutVals.begin(), OutVals.end());
148 const SDValue Ops[] = {Chain, OutVals.front()};
149 Chain = DAG.getNode(WebAssemblyISD::RETURN, DL, MVT::Other, Ops);
148 Chain = DAG.getNode(WebAssemblyISD::RETURN, DL, MVT::Other, RetOps);
150149
151150 return Chain;
152151 }
2828 isBarrier = 1 in {
2929 //FIXME return more than just int32.
3030 def RETURN : I<(outs), (ins Int32:$val), [(WebAssemblyreturn Int32:$val)]>;
31 def RETURN_VOID : I<(outs), (ins), [(WebAssemblyreturn)]>;
3132 } // hasSideEffects = 1, isReturn = 1, isTerminator = 1, hasCtrlDep = 1,
3233 // isBarrier = 1
2525 //===----------------------------------------------------------------------===//
2626
2727 def SDT_WebAssemblyArgument : SDTypeProfile<1, 1, [SDTCisVT<1, i32>]>;
28 def SDT_WebAssemblyReturn : SDTypeProfile<0, 1, []>;
28 def SDT_WebAssemblyReturn : SDTypeProfile<0, -1, []>;
2929
3030 //===----------------------------------------------------------------------===//
3131 // WebAssembly-specific DAG Nodes.
0 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
1
2 target datalayout = "e-p:32:32-i64:64-v128:8:128-n32:64-S128"
3 target triple = "wasm32-unknown-unknown"
4
5 ; CHECK-LABEL: return_void:
6 ; CHECK-NEXT: (RETURN_VOID)
7 define void @return_void() {
8 ret void
9 }