diff options
author | Dan Gohman <dan433584@gmail.com> | 2016-05-21 00:21:56 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2016-05-21 00:21:56 +0000 |
commit | b7c2400fa744c032dc96a2e180f24425911bc794 (patch) | |
tree | 484ce7a4b2401ae6b97de9e54543eb83d598703b /llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td | |
parent | 2907e51246a8cf0a440fa1767f94dc10eda195eb (diff) | |
download | bcm5719-llvm-b7c2400fa744c032dc96a2e180f24425911bc794.tar.gz bcm5719-llvm-b7c2400fa744c032dc96a2e180f24425911bc794.zip |
[WebAssembly] Optimize away return instructions using fallthroughs.
This saves a small amount of code size, and is a first small step toward
passing values on the stack across block boundaries.
Differential Review: http://reviews.llvm.org/D20450
llvm-svn: 270294
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td index ba4e1f989a9..444e275c6eb 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td @@ -71,6 +71,10 @@ def END_LOOP : I<(outs), (ins), [], "end_loop">; multiclass RETURN<WebAssemblyRegClass vt> { def RETURN_#vt : I<(outs), (ins vt:$val), [(WebAssemblyreturn vt:$val)], "return \t$val">; + // Equivalent to RETURN_#vt, for use at the end of a function when wasm + // semantics return by falling off the end of the block. + let isCodeGenOnly = 1 in + def FALLTHROUGH_RETURN_#vt : I<(outs), (ins vt:$val), []>; } let isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 in { @@ -80,6 +84,10 @@ let isReturn = 1 in { defm : RETURN<F32>; defm : RETURN<F64>; def RETURN_VOID : I<(outs), (ins), [(WebAssemblyreturn)], "return">; + + // This is to RETURN_VOID what FALLTHROUGH_RETURN_#vt is to RETURN_#vt. + let isCodeGenOnly = 1 in + def FALLTHROUGH_RETURN_VOID : I<(outs), (ins), []>; } // isReturn = 1 def UNREACHABLE : I<(outs), (ins), [(trap)], "unreachable">; } // isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 |