blob: 4642236366e4540d97adee3fe98c2a864a7592ac [file] [log] [blame]
Thomas Livelyd99af232019-02-05 00:49:55 +00001// WebAssemblyInstrBulkMemory.td - bulk memory codegen support --*- tablegen -*-
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// WebAssembly bulk memory codegen constructs.
11///
12//===----------------------------------------------------------------------===//
13
14// Instruction requiring HasBulkMemory and the bulk memory prefix byte
15multiclass BULK_I<dag oops_r, dag iops_r, dag oops_s, dag iops_s,
16 list<dag> pattern_r, string asmstr_r = "",
17 string asmstr_s = "", bits<32> simdop = -1> {
18 defm "" : I<oops_r, iops_r, oops_s, iops_s, pattern_r, asmstr_r, asmstr_s,
19 !or(0xfc00, !and(0xff, simdop))>,
20 Requires<[HasBulkMemory]>;
21}
22
23// Bespoke types and nodes for bulk memory ops
24def wasm_memcpy_t : SDTypeProfile<0, 3,
25 [SDTCisPtrTy<0>, SDTCisPtrTy<1>, SDTCisInt<2>]
26>;
27def wasm_memcpy : SDNode<"WebAssemblyISD::MEMORY_COPY", wasm_memcpy_t,
28 [SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;
29
30//===----------------------------------------------------------------------===//
31// memory.copy
32//===----------------------------------------------------------------------===//
33
34let mayLoad = 1, mayStore = 1 in
35defm MEMORY_COPY : BULK_I<(outs), (ins I32:$dst, I32:$src, I32:$len),
36 (outs), (ins),
37 [(wasm_memcpy I32:$dst, I32:$src, I32:$len)],
38 "memory.copy\t$dst, $src, $len",
39 "memory.copy", 0x0a>;