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*d0bf9812SDan Gohman  def CALL_#vt : I<(outs vt:$dst), (ins I32:$callee, variable_ops),
26*d0bf9812SDan Gohman                   [(set vt:$dst, (WebAssemblycall1 I32:$callee))]>;
27af111db8SJF Bastien}
28af111db8SJF Bastienlet Uses = [SP32, SP64], isCall = 1 in {
29*d0bf9812SDan Gohman  defm : CALL<I32>;
30*d0bf9812SDan Gohman  defm : CALL<I64>;
31*d0bf9812SDan Gohman  defm : CALL<F32>;
32*d0bf9812SDan Gohman  defm : CALL<F64>;
33f71abef7SDan Gohman
34*d0bf9812SDan Gohman  def CALL_VOID : I<(outs), (ins I32:$callee, variable_ops),
35*d0bf9812SDan Gohman                    [(WebAssemblycall0 I32:$callee)]>;
36af111db8SJF Bastien} // Uses = [SP32,SP64], isCall = 1
37af111db8SJF Bastien
385ca0bacaSJF Bastien/*
395ca0bacaSJF Bastien * TODO(jfb): Add the following.
405ca0bacaSJF Bastien *
41*d0bf9812SDan Gohman * call: 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