1 | #include "taichi/ir/ir.h" |
---|---|
2 | #include "taichi/ir/analysis.h" |
3 | #include "taichi/ir/statements.h" |
4 | |
5 | namespace taichi::lang { |
6 | |
7 | namespace irpass::analysis { |
8 | |
9 | stmt_refs get_load_pointers(Stmt *load_stmt) { |
10 | if (auto load_trait = load_stmt->cast<ir_traits::Load>()) { |
11 | // The statement has the "Load" IR Trait |
12 | return load_trait->get_load_pointers(); |
13 | } |
14 | return nullptr; |
15 | } |
16 | |
17 | Stmt *get_store_data(Stmt *store_stmt) noexcept { |
18 | if (auto store_trait = store_stmt->cast<ir_traits::Store>()) { |
19 | // The statement has the "Store" IR Trait |
20 | return store_trait->get_store_data(); |
21 | } |
22 | return nullptr; |
23 | } |
24 | |
25 | stmt_refs get_store_destination(Stmt *store_stmt) noexcept { |
26 | // If store_stmt provides some data sources, return the pointers of the data. |
27 | if (auto store_trait = store_stmt->cast<ir_traits::Store>()) { |
28 | // The statement has the "Store" IR Trait |
29 | return store_trait->get_store_destination(); |
30 | } else { |
31 | return nullptr; |
32 | } |
33 | } |
34 | |
35 | } // namespace irpass::analysis |
36 | |
37 | } // namespace taichi::lang |
38 |