aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Interpreter/Wasm.h
blob: 9a752934e3185af115d8926d73381f9cc9c9874c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//===------------------ Wasm.h - Wasm Interpreter ---------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements interpreter support for code execution in WebAssembly.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_LIB_INTERPRETER_WASM_H
#define LLVM_CLANG_LIB_INTERPRETER_WASM_H

#ifndef __EMSCRIPTEN__
#error "This requires emscripten."
#endif // __EMSCRIPTEN__

#include "IncrementalExecutor.h"

namespace clang {

class WasmIncrementalExecutor : public IncrementalExecutor {
public:
  WasmIncrementalExecutor(llvm::orc::ThreadSafeContext &TSC);

  llvm::Error addModule(PartialTranslationUnit &PTU) override;
  llvm::Error removeModule(PartialTranslationUnit &PTU) override;
  llvm::Error runCtors() const override;
  llvm::Error cleanUp() override;
  llvm::Expected<llvm::orc::ExecutorAddr>
  getSymbolAddress(llvm::StringRef Name,
                   SymbolNameKind NameKind) const override;

  ~WasmIncrementalExecutor() override;
};

} // namespace clang

#endif // LLVM_CLANG_LIB_INTERPRETER_WASM_H