Skip to content

Commit

Permalink
Remove WebAssemblyISD::MEMORY_COPY and add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Oct 23, 2024
1 parent 40c4c71 commit 3504893
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
7 changes: 4 additions & 3 deletions llvm/lib/Target/WebAssembly/WebAssemblyISD.def
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ HANDLE_NODETYPE(PROMOTE_LOW)
HANDLE_NODETYPE(TRUNC_SAT_ZERO_S)
HANDLE_NODETYPE(TRUNC_SAT_ZERO_U)
HANDLE_NODETYPE(DEMOTE_ZERO)
HANDLE_NODETYPE(MEMORY_COPY)
HANDLE_NODETYPE(MEMORY_FILL)

// Memory intrinsics
HANDLE_MEM_NODETYPE(GLOBAL_GET)
HANDLE_MEM_NODETYPE(GLOBAL_SET)
HANDLE_MEM_NODETYPE(TABLE_GET)
HANDLE_MEM_NODETYPE(TABLE_SET)

// Bulk memory instructions that require branching to handle empty ranges.
// Bulk memory instructions. These follow LLVM's expected semantics of
// supporting out-of-bounds pointers if the length is zero, by insertig
// a branch around Wasm's `memory.copy` and `memory.fill`, which would
// otherwise trap.
HANDLE_NODETYPE(MEMCPY)
HANDLE_NODETYPE(MEMSET)
14 changes: 4 additions & 10 deletions llvm/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,13 @@ def wasm_memset_t : SDTypeProfile<0, 4,
[SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisInt<2>, SDTCisInt<3>]
>;

// memory.copy (may trap on empty ranges)
def wasm_memory_copy : SDNode<"WebAssemblyISD::MEMORY_COPY", wasm_memcpy_t,
[SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;

// memory.copy with a branch to avoid trapping
// memory.copy with a branch to avoid trapping in the case of out-of-bounds
// pointers with empty ranges.
def wasm_memcpy : SDNode<"WebAssemblyISD::MEMCPY", wasm_memcpy_t,
[SDNPHasChain, SDNPMayLoad, SDNPMayStore]>;

// memory.fill (may trap on empty ranges)
def wasm_memory_fill : SDNode<"WebAssemblyISD::MEMORY_FILL", wasm_memset_t,
[SDNPHasChain, SDNPMayStore]>;

// memory.fill with a branch to avoid trapping
// memory.fill with a branch to avoid trapping in the case of out-of-bounds
// pointers with empty ranges.
def wasm_memset : SDNode<"WebAssemblyISD::MEMSET", wasm_memset_t,
[SDNPHasChain, SDNPMayStore]>;

Expand Down

0 comments on commit 3504893

Please sign in to comment.