[llvm] r247118 - [WebAssembly] Fix lowering of calls with more than one argument.
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 18:52:45 PDT 2015
Author: djg
Date: Tue Sep 8 20:52:45 2015
New Revision: 247118
URL: http://llvm.org/viewvc/llvm-project?rev=247118&view=rev
Log:
[WebAssembly] Fix lowering of calls with more than one argument.
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/trunk/test/CodeGen/WebAssembly/call.ll
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp?rev=247118&r1=247117&r2=247118&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp Tue Sep 8 20:52:45 2015
@@ -228,16 +228,19 @@ WebAssemblyTargetLowering::LowerCall(Cal
SmallVectorImpl<ISD::OutputArg> &Outs = CLI.Outs;
SmallVectorImpl<SDValue> &OutVals = CLI.OutVals;
+
bool IsStructRet = (Outs.empty()) ? false : Outs[0].Flags.isSRet();
if (IsStructRet)
fail(DL, DAG, "WebAssembly doesn't support struct return yet");
- if (Outs.size() > 1)
- fail(DL, DAG, "WebAssembly doesn't support more than 1 returned value yet");
SmallVectorImpl<ISD::InputArg> &Ins = CLI.Ins;
+ if (Ins.size() > 1)
+ fail(DL, DAG, "WebAssembly doesn't support more than 1 returned value yet");
+
bool IsVarArg = CLI.IsVarArg;
if (IsVarArg)
fail(DL, DAG, "WebAssembly doesn't support varargs yet");
+
// Analyze operands of the call, assigning locations to each operand.
SmallVector<CCValAssign, 16> ArgLocs;
CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
Modified: llvm/trunk/test/CodeGen/WebAssembly/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/call.ll?rev=247118&r1=247117&r2=247118&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/call.ll (original)
+++ llvm/trunk/test/CodeGen/WebAssembly/call.ll Tue Sep 8 20:52:45 2015
@@ -7,6 +7,7 @@ target triple = "wasm32-unknown-unknown"
declare i32 @i32_nullary()
declare i32 @i32_unary(i32)
+declare i32 @i32_binary(i32, i32)
declare i64 @i64_nullary()
declare float @float_nullary()
declare double @double_nullary()
@@ -62,6 +63,18 @@ define i32 @call_i32_unary(i32 %a) {
ret i32 %r
}
+; CHECK-LABEL: (func $call_i32_binary
+; CHECK-NEXT: (param i32) (param i32) (result i32)
+; CHECK-NEXT: (setlocal @0 (argument 1))
+; CHECK-NEXT: (setlocal @1 (argument 0))
+; CHECK-NEXT: (setlocal @2 (global $i32_binary))
+; CHECK-NEXT: (setlocal @3 (call @2 @1 @0))
+; CHECK-NEXT: (return @3)
+define i32 @call_i32_binary(i32 %a, i32 %b) {
+ %r = call i32 @i32_binary(i32 %a, i32 %b)
+ ret i32 %r
+}
+
; FIXME test the following:
; - Functions without return.
; - More argument combinations.
More information about the llvm-commits
mailing list