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> { 25*05a17aa8SDan Gohman def CALL_#vt : I<(outs vt:$dst), (ins global:$callee, variable_ops), 26*05a17aa8SDan Gohman [(set vt:$dst, (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee)))]>; 27*05a17aa8SDan Gohman def CALL_INDIRECT_#vt : I<(outs vt:$dst), (ins I32:$callee, variable_ops), 28d0bf9812SDan Gohman [(set vt:$dst, (WebAssemblycall1 I32:$callee))]>; 29af111db8SJF Bastien} 30af111db8SJF Bastienlet Uses = [SP32, SP64], isCall = 1 in { 31d0bf9812SDan Gohman defm : CALL<I32>; 32d0bf9812SDan Gohman defm : CALL<I64>; 33d0bf9812SDan Gohman defm : CALL<F32>; 34d0bf9812SDan Gohman defm : CALL<F64>; 35f71abef7SDan Gohman 36*05a17aa8SDan Gohman def CALL_VOID : I<(outs), (ins global:$callee, variable_ops), 37*05a17aa8SDan Gohman [(WebAssemblycall0 (WebAssemblywrapper tglobaladdr:$callee))]>; 38*05a17aa8SDan Gohman def CALL_INDIRECT_VOID : I<(outs), (ins I32:$callee, variable_ops), 39d0bf9812SDan Gohman [(WebAssemblycall0 I32:$callee)]>; 40af111db8SJF Bastien} // Uses = [SP32,SP64], isCall = 1 41af111db8SJF Bastien 425ca0bacaSJF Bastien/* 435ca0bacaSJF Bastien * TODO(jfb): Add the following. 445ca0bacaSJF Bastien * 455ca0bacaSJF Bastien * addressof: obtain a function pointer value for a given function 465ca0bacaSJF Bastien */ 47