WebAssembly: handle `ret void`.
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyInstrInfo.td
1 // WebAssemblyInstrInfo.td-Describe the WebAssembly Instructions-*- 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 Instruction definitions.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 //===----------------------------------------------------------------------===//
16 // WebAssembly Instruction Predicate Definitions.
17 //===----------------------------------------------------------------------===//
18
19 def HasAddr32 : Predicate<"!Subtarget->hasAddr64()">;
20 def HasAddr64 : Predicate<"Subtarget->hasAddr64()">;
21 def HasSIMD128 : Predicate<"Subtarget->hasSIMD128()">,
22                            AssemblerPredicate<"FeatureSIMD128", "simd128">;
23
24 //===----------------------------------------------------------------------===//
25 // WebAssembly-specific DAG Node Types.
26 //===----------------------------------------------------------------------===//
27
28 def SDT_WebAssemblyArgument : SDTypeProfile<1, 1, [SDTCisVT<1, i32>]>;
29 def SDT_WebAssemblyReturn   : SDTypeProfile<0, -1, []>;
30
31 //===----------------------------------------------------------------------===//
32 // WebAssembly-specific DAG Nodes.
33 //===----------------------------------------------------------------------===//
34
35 def WebAssemblyargument : SDNode<"WebAssemblyISD::ARGUMENT",
36                                  SDT_WebAssemblyArgument>;
37 def WebAssemblyreturn   : SDNode<"WebAssemblyISD::RETURN",
38                                  SDT_WebAssemblyReturn,
39                                  [SDNPHasChain, SDNPSideEffect]>;
40
41 //===----------------------------------------------------------------------===//
42 // WebAssembly-specific Operands.
43 //===----------------------------------------------------------------------===//
44
45 /*
46  * TODO(jfb): Add the following.
47  *
48  * get_local: read the current value of a local variable
49  * set_local: set the current value of a local variable
50 */
51
52 //===----------------------------------------------------------------------===//
53 // WebAssembly Instruction Format Definitions.
54 //===----------------------------------------------------------------------===//
55
56 include "WebAssemblyInstrFormats.td"
57
58 def ARGUMENT : I<(outs Int32:$res), (ins i32imm:$argno),
59                  [(set Int32:$res, (WebAssemblyargument timm:$argno))]>;
60
61 //===----------------------------------------------------------------------===//
62 // Additional sets of instructions.
63 //===----------------------------------------------------------------------===//
64
65 include "WebAssemblyInstrMemory.td"
66 include "WebAssemblyInstrCall.td"
67 include "WebAssemblyInstrControl.td"
68 include "WebAssemblyInstrInteger.td"
69 include "WebAssemblyInstrFloat.td"
70 include "WebAssemblyInstrConv.td"
71 include "WebAssemblyInstrAtomics.td"
72 include "WebAssemblyInstrSIMD.td"