3025e24fb843058dac36bba14878537db641eb99
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyInstrControl.td
1 //===- WebAssemblyInstrControl.td-WebAssembly control-flow ------*- 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 control-flow code-gen constructs.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 /*
16  * TODO(jfb): Add the following.
17  *
18  * block: a fixed-length sequence of statements
19  * if: if statement
20  * do_while: do while statement, basically a loop with a conditional branch
21  * forever: infinite loop statement (like while (1)), basically an unconditional
22  *          branch (back to the top of the loop)
23  * continue: continue to start of nested loop
24  * break: break to end from nested loop or block
25  * switch: switch statement with fallthrough
26  */
27
28 multiclass RETURN<WebAssemblyRegClass vt> {
29   def RETURN_#vt : I<(outs), (ins vt:$val), [(WebAssemblyreturn vt:$val)]>;
30 }
31 let hasSideEffects = 1, isReturn = 1, isTerminator = 1, hasCtrlDep = 1,
32     isBarrier = 1 in {
33   defm : RETURN<Int32>;
34   defm : RETURN<Int64>;
35   defm : RETURN<Float32>;
36   defm : RETURN<Float64>;
37   def RETURN_VOID : I<(outs), (ins), [(WebAssemblyreturn)]>;
38 } // hasSideEffects = 1, isReturn = 1, isTerminator = 1, hasCtrlDep = 1,
39   // isBarrier = 1