1 | #pragma once |
2 | |
3 | #include "taichi/util/lang_util.h" |
4 | #ifdef TI_WITH_LLVM |
5 | #include "taichi/runtime/llvm/llvm_fwd.h" |
6 | #endif |
7 | |
8 | namespace taichi::lang { |
9 | class IRNode; |
10 | } // namespace taichi::lang |
11 | |
12 | namespace taichi { |
13 | |
14 | class FileSequenceWriter { |
15 | public: |
16 | FileSequenceWriter(std::string filename_template, std::string file_type); |
17 | |
18 | #ifdef TI_WITH_LLVM |
19 | // returns filename |
20 | std::string write(llvm::Module *module); |
21 | #endif |
22 | |
23 | std::string write(lang::IRNode *irnode); |
24 | |
25 | std::string write(const std::string &str); |
26 | |
27 | private: |
28 | int counter_; |
29 | std::string filename_template_; |
30 | std::string file_type_; |
31 | |
32 | std::pair<std::ofstream, std::string> create_new_file(); |
33 | }; |
34 | |
35 | } // namespace taichi |
36 | |