From b7a8e4c591e805d3f22a8afac140355c89567c4c Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Mon, 24 Aug 2015 22:00:04 +0000 Subject: [PATCH] Missing print. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245883 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../WebAssembly/WebAssemblyAsmPrinter.cpp | 1 + .../WebAssembly/WebAssemblyISelLowering.cpp | 26 +++++++++---------- test/CodeGen/WebAssembly/call.ll | 9 ++++--- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index a3cbcbbeaf6..a5a31aba70b 100644 --- a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -85,6 +85,7 @@ static SmallString<32> Name(const WebAssemblyInstrInfo *TII, } void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) { + DEBUG(dbgs() << "EmitInstruction: " << *MI << '\n'); SmallString<128> Str; raw_svector_ostream OS(Str); diff --git a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index d9efc190b5b..6d3466b39f1 100644 --- a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -209,7 +209,6 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, SmallVectorImpl &Outs = CLI.Outs; SmallVectorImpl &OutVals = CLI.OutVals; - Type *retTy = CLI.RetTy; bool IsStructRet = (Outs.empty()) ? false : Outs[0].Flags.isSRet(); if (IsStructRet) fail(DL, DAG, "WebAssembly doesn't support struct return yet"); @@ -217,7 +216,6 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, fail(DL, DAG, "WebAssembly doesn't support more than 1 returned value yet"); SmallVectorImpl &Ins = CLI.Ins; - ArgListTy &Args = CLI.getArgs(); bool IsVarArg = CLI.IsVarArg; if (IsVarArg) fail(DL, DAG, "WebAssembly doesn't support varargs yet"); @@ -227,27 +225,29 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, unsigned NumBytes = CCInfo.getNextStackOffset(); auto PtrVT = getPointerTy(MF.getDataLayout()); - auto Zero = DAG.getConstant(0, CLI.DL, PtrVT, true); - auto NB = DAG.getConstant(NumBytes, CLI.DL, PtrVT, true); - Chain = DAG.getCALLSEQ_START(Chain, NB, CLI.DL); + auto Zero = DAG.getConstant(0, DL, PtrVT, true); + auto NB = DAG.getConstant(NumBytes, DL, PtrVT, true); + Chain = DAG.getCALLSEQ_START(Chain, NB, DL); SmallVector Ops; Ops.push_back(Chain); - Ops.push_back(CLI.Callee); - Ops.append(CLI.OutVals.begin(), CLI.OutVals.end()); + Ops.push_back(Callee); + Ops.append(OutVals.begin(), OutVals.end()); SmallVector Tys; - for (const auto &In : CLI.Ins) + for (const auto &In : Ins) Tys.push_back(In.VT); Tys.push_back(MVT::Other); - SDVTList TyList = CLI.DAG.getVTList(Tys); - SDValue Res = CLI.DAG.getNode(WebAssemblyISD::CALL, CLI.DL, TyList, Ops); - InVals.push_back(Res); - Chain = Res.getValue(1); + SDVTList TyList = DAG.getVTList(Tys); + SDValue Res = DAG.getNode(WebAssemblyISD::CALL, DL, TyList, Ops); + if (!Ins.empty()) { + InVals.push_back(Res); + Chain = Res.getValue(1); + } // FIXME: handle CLI.RetSExt and CLI.RetZExt? - Chain = CLI.DAG.getCALLSEQ_END(Chain, NB, Zero, SDValue(), CLI.DL); + Chain = DAG.getCALLSEQ_END(Chain, NB, Zero, SDValue(), DL); return Chain; } diff --git a/test/CodeGen/WebAssembly/call.ll b/test/CodeGen/WebAssembly/call.ll index e5d468b3cd1..c605285d521 100644 --- a/test/CodeGen/WebAssembly/call.ll +++ b/test/CodeGen/WebAssembly/call.ll @@ -5,13 +5,14 @@ target datalayout = "e-p:32:32-i64:64-v128:8:128-n32:64-S128" target triple = "wasm32-unknown-unknown" -declare void @nullary() +declare void @void_nullary() +declare void @int32_nullary() -; CHECK-LABEL: call_nullary: +; CHECK-LABEL: call_void_nullary: ; CHECK-NEXT: (call @foo) ; CHECK-NEXT: (return) -define void @call_nullary() { - call void @nullary() +define void @call_void_nullary() { + call void @void_nullary() ret void } -- 2.34.1