FreeTensor
Loading...
Searching...
No Matches
unroll.h
Go to the documentation of this file.
1#ifndef FREE_TENSOR_UNROLL_H
2#define FREE_TENSOR_UNROLL_H
3
4#include <mutator.h>
5
6namespace freetensor {
7
11class BackUnroll : public Mutator {
12 ID loop_;
13 bool done_ = false;
14
15 public:
16 BackUnroll(const ID &loop) : loop_(loop) {}
17
18 bool done() const { return done_; }
19
20 protected:
21 Stmt visit(const For &op) override;
22};
23
27class ImmediateUnroll : public Mutator {
28 ID loop_;
29 bool done_ = false;
30
31 std::string iter_;
32 Expr begin_, step_;
33 int curIter_;
34
35 public:
36 ImmediateUnroll(const ID &loop) : loop_(loop) {}
37
38 bool done() const { return done_; }
39
40 protected:
41 Stmt visitStmt(const Stmt &op) override;
42 Expr visit(const Var &op) override;
43 Stmt visit(const For &op) override;
44};
45
46Stmt unroll(const Stmt &ast, const ID &loop, bool immediate);
47
48} // namespace freetensor
49
50#endif // FREE_TENSOR_UNROLL_H
Definition: unroll.h:11
Stmt visit(const For &op) override
Definition: unroll.cc:9
bool done() const
Definition: unroll.h:18
BackUnroll(const ID &loop)
Definition: unroll.h:16
Definition: id.h:18
Definition: unroll.h:27
Expr visit(const Var &op) override
Definition: unroll.cc:34
ImmediateUnroll(const ID &loop)
Definition: unroll.h:36
Stmt visitStmt(const Stmt &op) override
Definition: unroll.cc:24
bool done() const
Definition: unroll.h:38
Definition: mutator.h:11
Definition: allocator.h:9
Stmt unroll(const Stmt &ast, const ID &loop, bool immediate)
Definition: unroll.cc:64
Ref< StmtNode > Stmt
Definition: ast.h:152