Skip to content

Commit 37cd37d

Browse files
committed
Factor out common types.
1 parent 8d77589 commit 37cd37d

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,27 @@ multiclass BULK_I<dag oops_r, dag iops_r, dag oops_s, dag iops_s,
2222

2323
// Bespoke types and nodes for bulk memory ops
2424

25-
// memory.copy (may trap on empty ranges)
26-
def wasm_memory_copy_t : SDTypeProfile<0, 5,
25+
def wasm_memcpylike_t : SDTypeProfile<0, 5,
2726
[SDTCisInt<0>, SDTCisInt<1>, SDTCisPtrTy<2>, SDTCisPtrTy<3>, SDTCisInt<4>]
2827
>;
29-
def wasm_memory_copy : SDNode<"WebAssemblyISD::MEMORY_COPY", wasm_memory_copy_t,
28+
def wasm_memsetlike_t : SDTypeProfile<0, 4,
29+
[SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisInt<2>, SDTCisInt<3>]
30+
>;
31+
32+
// memory.copy (may trap on empty ranges)
33+
def wasm_memory_copy : SDNode<"WebAssemblyISD::MEMORY_COPY", wasm_memcpylike_t,
3034
[SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;
3135

3236
// memory.copy with a branch to avoid trapping
33-
def wasm_memcpy_t : SDTypeProfile<0, 5,
34-
[SDTCisInt<0>, SDTCisInt<1>, SDTCisPtrTy<2>, SDTCisPtrTy<3>, SDTCisInt<4>]
35-
>;
36-
def wasm_memcpy : SDNode<"WebAssemblyISD::MEMCPY", wasm_memcpy_t,
37+
def wasm_memcpy : SDNode<"WebAssemblyISD::MEMCPY", wasm_memcpylike_t,
3738
[SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;
3839

3940
// memory.fill (may trap on empty ranges)
40-
def wasm_memory_fill_t : SDTypeProfile<0, 4,
41-
[SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisInt<2>, SDTCisInt<3>]
42-
>;
43-
def wasm_memory_fill : SDNode<"WebAssemblyISD::MEMORY_FILL", wasm_memory_fill_t,
41+
def wasm_memory_fill : SDNode<"WebAssemblyISD::MEMORY_FILL", wasm_memsetlike_t,
4442
[SDNPHasChain, SDNPMayStore]>;
4543

4644
// memory.fill with a branch to avoid trapping
47-
def wasm_memset_t : SDTypeProfile<0, 4,
48-
[SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisInt<2>, SDTCisInt<3>]
49-
>;
50-
def wasm_memset : SDNode<"WebAssemblyISD::MEMSET", wasm_memset_t,
45+
def wasm_memset : SDNode<"WebAssemblyISD::MEMSET", wasm_memsetlike_t,
5146
[SDNPHasChain, SDNPMayStore]>;
5247

5348
// A multiclass for defining Wasm's raw bulk-memory `memory.*` instructions.

0 commit comments

Comments
 (0)