xref: /freebsd/contrib/llvm-project/clang/include/clang/Sema/SemaWasm.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===----- SemaWasm.h ------ Wasm target-specific routines ----*- C++ -*---===//
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 /// \file
9 /// This file declares semantic analysis functions specific to Wasm.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SEMA_SEMAWASM_H
14 #define LLVM_CLANG_SEMA_SEMAWASM_H
15 
16 #include "clang/AST/Attr.h"
17 #include "clang/AST/DeclBase.h"
18 #include "clang/AST/Expr.h"
19 #include "clang/Basic/TargetInfo.h"
20 #include "clang/Sema/ParsedAttr.h"
21 #include "clang/Sema/SemaBase.h"
22 
23 namespace clang {
24 class SemaWasm : public SemaBase {
25 public:
26   SemaWasm(Sema &S);
27 
28   bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
29                                            unsigned BuiltinID,
30                                            CallExpr *TheCall);
31 
32   bool BuiltinWasmRefNullExtern(CallExpr *TheCall);
33   bool BuiltinWasmRefNullFunc(CallExpr *TheCall);
34   bool BuiltinWasmTableGet(CallExpr *TheCall);
35   bool BuiltinWasmTableSet(CallExpr *TheCall);
36   bool BuiltinWasmTableSize(CallExpr *TheCall);
37   bool BuiltinWasmTableGrow(CallExpr *TheCall);
38   bool BuiltinWasmTableFill(CallExpr *TheCall);
39   bool BuiltinWasmTableCopy(CallExpr *TheCall);
40 
41   WebAssemblyImportNameAttr *
42   mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL);
43   WebAssemblyImportModuleAttr *
44   mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL);
45 
46   void handleWebAssemblyExportNameAttr(Decl *D, const ParsedAttr &AL);
47   void handleWebAssemblyImportModuleAttr(Decl *D, const ParsedAttr &AL);
48   void handleWebAssemblyImportNameAttr(Decl *D, const ParsedAttr &AL);
49 };
50 } // namespace clang
51 
52 #endif // LLVM_CLANG_SEMA_SEMAWASM_H
53