FreeTensor
Loading...
Searching...
No Matches
invert_from_store.h
Go to the documentation of this file.
1#ifndef FREE_TENSOR_INVERT_FROM_STORE_H
2#define FREE_TENSOR_INVERT_FROM_STORE_H
3
4#include <functional>
5#include <unordered_set>
6
7#include <stmt.h>
8
9namespace freetensor {
10
12 Store store_;
13 Expr yExpr_;
14 std::function<Expr(const Expr &)> invertFromStore_;
15
16 public:
17 InvertFromStore(const Store &store, const Expr &yExpr,
18 const std::function<Expr(const Expr &)> &invertFromStore)
19 : store_(store), yExpr_(yExpr), invertFromStore_(invertFromStore) {}
20
21 const auto &store() const { return store_; }
22
23 bool find(const Expr &expr) const;
24 bool match(const Expr &expr) const;
25
26 std::unordered_set<std::string>
27 allReadsExcludingInversion(const Expr &expr) const;
28
29 Expr invert(const Expr &e) const { return invertFromStore_(e); }
30};
31
32} // namespace freetensor
33
34#endif // FREE_TENSOR_INVERT_FROM_STORE_H
Definition: invert_from_store.h:11
InvertFromStore(const Store &store, const Expr &yExpr, const std::function< Expr(const Expr &)> &invertFromStore)
Definition: invert_from_store.h:17
std::unordered_set< std::string > allReadsExcludingInversion(const Expr &expr) const
Definition: invert_from_store.cc:65
const auto & store() const
Definition: invert_from_store.h:21
bool find(const Expr &expr) const
Definition: invert_from_store.cc:54
bool match(const Expr &expr) const
Definition: invert_from_store.cc:60
Expr invert(const Expr &e) const
Definition: invert_from_store.h:29
Definition: allocator.h:9
Ref< ExprNode > Expr
Definition: ast.h:184