1 | // Codegen for the hierarchical data structure |
2 | #pragma once |
3 | |
4 | #include "taichi/ir/snode.h" |
5 | |
6 | namespace taichi::lang { |
7 | |
8 | class StructCompiler { |
9 | public: |
10 | std::vector<SNode *> stack; |
11 | std::vector<SNode *> snodes; |
12 | std::size_t root_size{0}; |
13 | |
14 | virtual ~StructCompiler() = default; |
15 | |
16 | void collect_snodes(SNode &snode); |
17 | |
18 | // generate C++/llvm IR |
19 | virtual void generate_types(SNode &snode) = 0; |
20 | |
21 | virtual void generate_child_accessors(SNode &snode) = 0; |
22 | |
23 | virtual void run(SNode &node) = 0; |
24 | }; |
25 | |
26 | } // namespace taichi::lang |
27 | |