Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame^] | 1 | //===- IntrinsicsWebAssembly.td - Defines wasm intrinsics --*- tablegen -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// \brief This file defines all of the WebAssembly-specific intrinsics. |
| 12 | /// |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | let TargetPrefix = "wasm" in { // All intrinsics start with "llvm.wasm.". |
| 16 | |
| 17 | // Query the current memory size, and increase the current memory size. |
| 18 | // Note that mem.size is not IntrNoMem because it must be sequenced with |
| 19 | // respect to mem.grow calls. |
| 20 | // These are the new proposed names, which aren't yet official. Use at your own |
| 21 | // risk. |
| 22 | def int_wasm_mem_size : Intrinsic<[llvm_anyint_ty], |
| 23 | [llvm_i32_ty], |
| 24 | [IntrReadMem]>; |
| 25 | def int_wasm_mem_grow : Intrinsic<[llvm_anyint_ty], |
| 26 | [llvm_i32_ty, LLVMMatchType<0>], |
| 27 | []>; |
| 28 | |
| 29 | // These are the existing names, which are currently official, but expected |
| 30 | // to be deprecated in the future. They also lack the immediate field. |
| 31 | def int_wasm_current_memory : Intrinsic<[llvm_anyint_ty], [], [IntrReadMem]>; |
| 32 | def int_wasm_grow_memory : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], []>; |
| 33 | |
| 34 | //===----------------------------------------------------------------------===// |
| 35 | // Exception handling intrinsics |
| 36 | //===----------------------------------------------------------------------===// |
| 37 | |
| 38 | // throw / rethrow |
| 39 | def int_wasm_throw : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], |
| 40 | [Throws, IntrNoReturn]>; |
| 41 | def int_wasm_rethrow : Intrinsic<[], [], [Throws, IntrNoReturn]>; |
| 42 | |
| 43 | // Since wasm does not use landingpad instructions, these instructions return |
| 44 | // exception pointer and selector values until we lower them in WasmEHPrepare. |
| 45 | def int_wasm_get_exception : Intrinsic<[llvm_ptr_ty], [], [IntrHasSideEffects]>; |
| 46 | def int_wasm_get_ehselector : Intrinsic<[llvm_i32_ty], [], |
| 47 | [IntrHasSideEffects]>; |
| 48 | } |