FreeTensor
Loading...
Searching...
No Matches
split.h
Go to the documentation of this file.
1#ifndef FREE_TENSOR_SPLIT_H
2#define FREE_TENSOR_SPLIT_H
3
4#include <string>
5
7#include <mutator.h>
8
9namespace freetensor {
10
11class Splitter : public SymbolTable<Mutator> {
13
14 ID src_, dst0_, dst1_;
15 int factor_ = -1, nparts_ = -1, shift_ = 0;
16
17 std::string iterFrom_;
18 Expr iterTo_;
19
20 bool found_ = false;
21
22 public:
23 Splitter(const ID &id, int factor = -1, int nparts = -1, int shift = 0)
24 : src_(id), factor_(factor), nparts_(nparts), shift_(shift) {}
25
26 const ID &outerId() const { return dst0_; }
27 const ID &innerId() const { return dst1_; }
28 bool found() const { return found_; }
29
30 protected:
31 using BaseClass::visit;
32 Stmt visit(const For &op) override;
33 Expr visit(const Var &op) override;
34};
35
36std::pair<Stmt, std::pair<ID, ID>> split(const Stmt &ast, const ID &id,
37 int factor, int nparts, int shift = 0);
38
39} // namespace freetensor
40
41#endif // FREE_TENSOR_SPLIT_H
Definition: id.h:18
Definition: split.h:11
Splitter(const ID &id, int factor=-1, int nparts=-1, int shift=0)
Definition: split.h:23
const ID & innerId() const
Definition: split.h:27
const ID & outerId() const
Definition: split.h:26
Stmt visit(const For &op) override
Definition: split.cc:13
bool found() const
Definition: split.h:28
Definition: symbol_table.h:122
BaseClass::StmtRetType visit(const VarDef &op) override
Definition: symbol_table.h:167
Definition: allocator.h:9
Ref< StmtNode > Stmt
Definition: ast.h:152
std::pair< Stmt, std::pair< ID, ID > > split(const Stmt &ast, const ID &id, int factor, int nparts, int shift=0)
Definition: split.cc:90