15ca0bacaSJF Bastien//===- WebAssemblyInstrCall.td-WebAssembly Call codegen support -*- tablegen -*- 25ca0bacaSJF Bastien// 35ca0bacaSJF Bastien// The LLVM Compiler Infrastructure 45ca0bacaSJF Bastien// 55ca0bacaSJF Bastien// This file is distributed under the University of Illinois Open Source 65ca0bacaSJF Bastien// License. See LICENSE.TXT for details. 75ca0bacaSJF Bastien// 85ca0bacaSJF Bastien//===----------------------------------------------------------------------===// 95ca0bacaSJF Bastien/// 105ca0bacaSJF Bastien/// \file 115ca0bacaSJF Bastien/// \brief WebAssembly Call operand code-gen constructs. 125ca0bacaSJF Bastien/// 135ca0bacaSJF Bastien//===----------------------------------------------------------------------===// 145ca0bacaSJF Bastien 15af111db8SJF Bastien// The call sequence start/end LLVM-isms isn't useful to WebAssembly since it's 16af111db8SJF Bastien// a virtual ISA. 17af111db8SJF Bastienlet isCodeGenOnly = 1 in { 18af111db8SJF Bastiendef : I<(outs), (ins i64imm:$amt), 19af111db8SJF Bastien [(WebAssemblycallseq_start timm:$amt)]>; 20af111db8SJF Bastiendef : I<(outs), (ins i64imm:$amt1, i64imm:$amt2), 21af111db8SJF Bastien [(WebAssemblycallseq_end timm:$amt1, timm:$amt2)]>; 22af111db8SJF Bastien} // isCodeGenOnly = 1 23af111db8SJF Bastien 24af111db8SJF Bastienmulticlass CALL<WebAssemblyRegClass vt> { 25af111db8SJF Bastien def CALL_#vt : I<(outs vt:$dst), (ins Int32:$callee, variable_ops), 26*f71abef7SDan Gohman [(set vt:$dst, (WebAssemblycall1 Int32:$callee))]>; 27af111db8SJF Bastien} 28af111db8SJF Bastienlet Uses = [SP32, SP64], isCall = 1 in { 29af111db8SJF Bastien defm : CALL<Int32>; 30af111db8SJF Bastien defm : CALL<Int64>; 31af111db8SJF Bastien defm : CALL<Float32>; 32af111db8SJF Bastien defm : CALL<Float64>; 33*f71abef7SDan Gohman 34*f71abef7SDan Gohman def CALL_VOID : I<(outs), (ins Int32:$callee, variable_ops), 35*f71abef7SDan Gohman [(WebAssemblycall0 Int32:$callee)]>; 36af111db8SJF Bastien} // Uses = [SP32,SP64], isCall = 1 37af111db8SJF Bastien 385ca0bacaSJF Bastien/* 395ca0bacaSJF Bastien * TODO(jfb): Add the following. 405ca0bacaSJF Bastien * 415ca0bacaSJF Bastien * call_direct: call function directly 425ca0bacaSJF Bastien * call_indirect: call function indirectly 435ca0bacaSJF Bastien * addressof: obtain a function pointer value for a given function 445ca0bacaSJF Bastien */ 45