]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/IR/IntrinsicsWebAssembly.td
Update to ELF Tool Chain r3668
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / IR / IntrinsicsWebAssembly.td
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 /// 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 memory.size is not IntrNoMem because it must be sequenced with
19 // respect to memory.grow calls.
20 def int_wasm_memory_size : Intrinsic<[llvm_anyint_ty],
21                                      [llvm_i32_ty],
22                                      [IntrReadMem]>;
23 def int_wasm_memory_grow : Intrinsic<[llvm_anyint_ty],
24                                      [llvm_i32_ty, LLVMMatchType<0>],
25                                      []>;
26
27 // These are the old names.
28 def int_wasm_mem_size : Intrinsic<[llvm_anyint_ty],
29                                   [llvm_i32_ty],
30                                   [IntrReadMem]>;
31 def int_wasm_mem_grow : Intrinsic<[llvm_anyint_ty],
32                                   [llvm_i32_ty, LLVMMatchType<0>],
33                                   []>;
34
35 // These are the old old names. They also lack the immediate field.
36 def int_wasm_current_memory : Intrinsic<[llvm_anyint_ty], [], [IntrReadMem]>;
37 def int_wasm_grow_memory : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], []>;
38
39 //===----------------------------------------------------------------------===//
40 // Exception handling intrinsics
41 //===----------------------------------------------------------------------===//
42
43 // throw / rethrow
44 def int_wasm_throw : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty],
45                                [Throws, IntrNoReturn]>;
46 def int_wasm_rethrow : Intrinsic<[], [], [Throws, IntrNoReturn]>;
47
48 // Since wasm does not use landingpad instructions, these instructions return
49 // exception pointer and selector values until we lower them in WasmEHPrepare.
50 def int_wasm_get_exception : Intrinsic<[llvm_ptr_ty], [llvm_token_ty],
51                                        [IntrHasSideEffects]>;
52 def int_wasm_get_ehselector : Intrinsic<[llvm_i32_ty], [llvm_token_ty],
53                                         [IntrHasSideEffects]>;
54
55 // wasm.catch returns the pointer to the exception object caught by wasm 'catch'
56 // instruction.
57 def int_wasm_catch : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty],
58                                [IntrHasSideEffects]>;
59
60 // WebAssembly EH must maintain the landingpads in the order assigned to them
61 // by WasmEHPrepare pass to generate landingpad table in EHStreamer. This is
62 // used in order to give them the indices in WasmEHPrepare.
63 def int_wasm_landingpad_index: Intrinsic<[], [llvm_i32_ty], [IntrNoMem]>;
64
65 // Returns LSDA address of the current function.
66 def int_wasm_lsda : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
67 }