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 28multiclass RETURN<WebAssemblyRegClass vt> { 29 def RETURN_#vt : I<(outs), (ins vt:$val), [(WebAssemblyreturn vt:$val)]>; 30} 31let isReturn = 1, isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 in { 32 defm : RETURN<Int32>; 33 defm : RETURN<Int64>; 34 defm : RETURN<Float32>; 35 defm : RETURN<Float64>; 36 def RETURN_VOID : I<(outs), (ins), [(WebAssemblyreturn)]>; 37} // isReturn = 1, isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 38