summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-11-23 19:30:43 +0000
committerDan Gohman <dan433584@gmail.com>2015-11-23 19:30:43 +0000
commitaa0a4bd05b4e99b6f749112604bb942d42988814 (patch)
treec57861e9d550298d358fb0a0523b14f111c2e387 /llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
parent941ad901462adf558966847041f79cd7af70ebf8 (diff)
downloadbcm5719-llvm-aa0a4bd05b4e99b6f749112604bb942d42988814.tar.gz
bcm5719-llvm-aa0a4bd05b4e99b6f749112604bb942d42988814.zip
[WebAssembly] Don't use set_local instructions explicitly.
The current approach to using get_local and set_local is to use them implicitly, as register uses and defs. Introduce new copy instructions which are themselves no-ops except for the get_local and set_local that they imply, so that we use get_local and set_local consistently. llvm-svn: 253905
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
index 1fa79020a2e..5922f95f039 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
@@ -98,6 +98,14 @@ multiclass LOCAL<WebAssemblyRegClass vt> {
// TODO: set_local returns its operand value
def SET_LOCAL_#vt : I<(outs), (ins i32imm:$regno, vt:$src), [],
"set_local\t$regno, $src">;
+
+ // COPY_LOCAL is not an actual instruction in wasm, but since we allow
+ // get_local and set_local to be implicit, we can have a COPY_LOCAL which
+ // is actually a no-op because all the work is done in the implied
+ // get_local and set_local.
+ let isAsCheapAsAMove = 1 in
+ def COPY_LOCAL_#vt : I<(outs vt:$res), (ins vt:$src), [],
+ "copy_local\t$res, $src">;
}
defm : LOCAL<I32>;
defm : LOCAL<I64>;
OpenPOWER on IntegriCloud