summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2017-08-31 21:51:48 +0000
committerDerek Schuff <dschuff@google.com>2017-08-31 21:51:48 +0000
commit0f3bc0f47847c36d3f7ac1709d45491fa8be5b4d (patch)
tree03287d56232e6b007e3a3e09fa0f3bdf90d73c32 /llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
parenta3b9fe6acdf60b91b460358858daf57bdb88bdbd (diff)
downloadbcm5719-llvm-0f3bc0f47847c36d3f7ac1709d45491fa8be5b4d.tar.gz
bcm5719-llvm-0f3bc0f47847c36d3f7ac1709d45491fa8be5b4d.zip
[WebAssembly] Refactor load ISel tablegen patterns into classes
Not all of these will be able to be used by atomics because tablegen, but it still seems like a good change by itself. Differential Revision: https://reviews.llvm.org/D37345 llvm-svn: 312287
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
index fd50f59c44b..355802f760b 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
@@ -18,16 +18,17 @@
let Defs = [ARGUMENTS] in {
// TODO: add the rest of the atomic loads
-// TODO: factor out 0xfe atomic prefix?
-def ATOMIC_LOAD_I32 : ATOMIC_I<(outs I32:$dst),
- (ins P2Align:$p2align, offset32_op:$off, I32:$addr),
- [], "i32.atomic.load\t$dst, ${off}(${addr})${p2align}",
- 0xfe10>;
+def ATOMIC_LOAD_I32 : CLoadI32<"i32.atomic.load", 0xfe10>;
+def ATOMIC_LOAD_I64 : CLoadI64<"i64.atomic.load", 0xfe11>;
} // Defs = [ARGUMENTS]
// Select loads with no constant offset.
let Predicates = [HasAtomics] in {
-def : Pat<(i32 (atomic_load I32:$addr)), (ATOMIC_LOAD_I32 0, 0, $addr)>;
+class ALoadPatNoOffset<ValueType ty, SDNode node, I inst> :
+ Pat<(ty (node I32:$addr)), (inst 0, 0, $addr)>;
+def : ALoadPatNoOffset<i32, atomic_load, ATOMIC_LOAD_I32>;
+def : ALoadPatNoOffset<i64, atomic_load, ATOMIC_LOAD_I64>;
+
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud