clang 24.0.0git
Wasm.h
Go to the documentation of this file.
1//===------------------ Wasm.h - Wasm Interpreter ---------------*- 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//
9// This file implements interpreter support for code execution in WebAssembly.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_INTERPRETER_WASM_H
14#define LLVM_CLANG_LIB_INTERPRETER_WASM_H
15
16#ifndef __EMSCRIPTEN__
17#error "This requires emscripten."
18#endif // __EMSCRIPTEN__
19
21#include "llvm/ADT/SmallString.h"
22#include <string>
23#include <vector>
24
25namespace clang {
26
28public:
30 const Options &Opts) override;
31 bool supportsJIT() const override { return false; }
33
34private:
36 createExecutor(llvm::orc::ThreadSafeContext &TSC,
37 const clang::TargetInfo &TI) override;
38};
39
41public:
42 WasmIncrementalExecutor(llvm::Error &Err, std::vector<std::string> LLVMArgs);
44
45 llvm::Error addModule(PartialTranslationUnit &PTU) override;
46 llvm::Error removeModule(PartialTranslationUnit &PTU) override;
47 llvm::Error runCtors() const override;
48 llvm::Error cleanUp() override;
50 getSymbolAddress(llvm::StringRef Name,
51 SymbolNameKind NameKind) const override;
52 llvm::Error LoadDynamicLibrary(const char *name) override;
53
54private:
56 std::vector<std::string> StoredLLVMArgs;
57};
58
59} // namespace clang
60
61#endif // LLVM_CLANG_LIB_INTERPRETER_WASM_H
Create a pre-configured CompilerInstance for incremental processing.
Definition Interpreter.h:54
Common configuration and interface for incremental executor builders.
Exposes information about the current target.
Definition TargetInfo.h:228
llvm::Error configure(IncrementalCompilerBuilder &CB, const Options &Opts) override
Apply execution options and configure the compiler for this backend.
Definition Wasm.cpp:72
bool supportsJIT() const override
Probe whether this backend can JIT code for the host.
Definition Wasm.h:31
llvm::Expected< llvm::Triple > getHostJITTriple() const override
Return the host triple used by this backend.
Definition Wasm.cpp:81
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const override
Definition Wasm.cpp:227
llvm::Error addModule(PartialTranslationUnit &PTU) override
Definition Wasm.cpp:114
llvm::Error runCtors() const override
Definition Wasm.cpp:215
llvm::Error LoadDynamicLibrary(const char *name) override
Definition Wasm.cpp:239
llvm::Error removeModule(PartialTranslationUnit &PTU) override
Definition Wasm.cpp:210
llvm::Error cleanUp() override
Definition Wasm.cpp:220
WasmIncrementalExecutor(llvm::Error &Err, std::vector< std::string > LLVMArgs)
Definition Wasm.cpp:96
Top level wrappers for InstallAPI frontend operations.
Options passed to the backend when configuring execution.
The class keeps track of various objects created as part of processing incremental inputs.