JF Bastien | 5ca0bac | 2015-07-10 18:23:10 +0000 | [diff] [blame] | 1 | //===- WebAssemblyInstrCall.td-WebAssembly Call codegen support -*- tablegen -*- |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// \brief WebAssembly Call operand code-gen constructs. |
| 12 | /// |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
JF Bastien | af111db | 2015-08-24 22:16:48 +0000 | [diff] [blame] | 15 | // The call sequence start/end LLVM-isms isn't useful to WebAssembly since it's |
| 16 | // a virtual ISA. |
| 17 | let isCodeGenOnly = 1 in { |
| 18 | def : I<(outs), (ins i64imm:$amt), |
| 19 | [(WebAssemblycallseq_start timm:$amt)]>; |
| 20 | def : I<(outs), (ins i64imm:$amt1, i64imm:$amt2), |
| 21 | [(WebAssemblycallseq_end timm:$amt1, timm:$amt2)]>; |
| 22 | } // isCodeGenOnly = 1 |
| 23 | |
| 24 | multiclass CALL<WebAssemblyRegClass vt> { |
| 25 | def CALL_#vt : I<(outs vt:$dst), (ins Int32:$callee, variable_ops), |
Dan Gohman | f71abef | 2015-09-09 16:13:47 +0000 | [diff] [blame] | 26 | [(set vt:$dst, (WebAssemblycall1 Int32:$callee))]>; |
JF Bastien | af111db | 2015-08-24 22:16:48 +0000 | [diff] [blame] | 27 | } |
| 28 | let Uses = [SP32, SP64], isCall = 1 in { |
| 29 | defm : CALL<Int32>; |
| 30 | defm : CALL<Int64>; |
| 31 | defm : CALL<Float32>; |
| 32 | defm : CALL<Float64>; |
Dan Gohman | f71abef | 2015-09-09 16:13:47 +0000 | [diff] [blame] | 33 | |
| 34 | def CALL_VOID : I<(outs), (ins Int32:$callee, variable_ops), |
| 35 | [(WebAssemblycall0 Int32:$callee)]>; |
JF Bastien | af111db | 2015-08-24 22:16:48 +0000 | [diff] [blame] | 36 | } // Uses = [SP32,SP64], isCall = 1 |
| 37 | |
JF Bastien | 5ca0bac | 2015-07-10 18:23:10 +0000 | [diff] [blame] | 38 | /* |
| 39 | * TODO(jfb): Add the following. |
| 40 | * |
| 41 | * call_direct: call function directly |
| 42 | * call_indirect: call function indirectly |
| 43 | * addressof: obtain a function pointer value for a given function |
| 44 | */ |