1#pragma once
2
3#include <string>
4#include <vector>
5
6#include "taichi/aot/module_builder.h"
7#include "taichi/program/kernel.h"
8#include "taichi/runtime/llvm/llvm_fwd.h"
9
10#include "taichi/codegen/wasm/codegen_wasm.h"
11
12namespace taichi::lang {
13namespace wasm {
14
15class AotModuleBuilderImpl : public AotModuleBuilder {
16 public:
17 explicit AotModuleBuilderImpl(const CompileConfig &compile_config,
18 TaichiLLVMContext &tlctx);
19
20 void dump(const std::string &output_dir,
21 const std::string &filename) const override;
22
23 protected:
24 void add_per_backend(const std::string &identifier, Kernel *kernel) override;
25 void add_per_backend_tmpl(const std::string &identifier,
26 const std::string &key,
27 Kernel *kernel) override;
28 void add_field_per_backend(const std::string &Identifier,
29 const SNode *rep_snode,
30 bool is_scalar,
31 DataType dt,
32 std::vector<int> shape,
33 int row_num,
34 int column_num) override;
35
36 private:
37 void eliminate_unused_functions() const;
38 const CompileConfig &compile_config_;
39 std::unique_ptr<llvm::Module> module_{nullptr};
40 std::vector<std::string> name_list_;
41 TaichiLLVMContext &tlctx_;
42};
43
44} // namespace wasm
45} // namespace taichi::lang
46