-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIRTermFinder.h
More file actions
66 lines (52 loc) · 1.87 KB
/
Copy pathIRTermFinder.h
File metadata and controls
66 lines (52 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef BOOST_IRTERMFINDER_H
#define BOOST_IRTERMFINDER_H
#include <string>
#include <sstream>
#include "IR.h"
#include "IRVisitor.h"
namespace Boost
{
namespace Internal
{
class term_group
{
public:
Ref<IRNode> term_ptr;
BinaryOpType left_op;
std::shared_ptr<LoopNest> for_stmt_group = nullptr;
std::shared_ptr<IfThenElse> if_stmt_group = nullptr;
std::shared_ptr<Move> move_stmt = nullptr;
std::shared_ptr<Var> lhs, lhs_temp;
template <typename U, typename std::enable_if<std::is_base_of<IRNode, U>::value>::type * = nullptr>
term_group(std::shared_ptr<const U> _ptr, BinaryOpType _op, std::shared_ptr<Var> _lhs, std::shared_ptr<Var> _lhs_temp)
{
term_ptr = Ref<IRNode>(std::const_pointer_cast<U>(_ptr));
left_op = _op;
lhs = _lhs;
lhs_temp = _lhs_temp;
}
};
class IRTermFinder : public IRVisitor
{
public:
//std::vector< std::shared_ptr<IRNode> > term_list;
std::vector<std::shared_ptr<term_group>> term_group_list;
std::shared_ptr<Var> _lhs, _lhs_temp;
std::shared_ptr<Move> pre_move_stmt, post_move_stmt;
std::shared_ptr<LoopNest> outer_loop1, outer_loop2;
void visit(Ref<const Binary>) override;
void visit(Ref<const Move>) override;
void getForStmtGroup();
void getIfStmtGroup();
void getMoveStmt();
void getOuterLoop();
};
class IRIfFinder : public IRVisitor
{
public:
std::vector<std::shared_ptr<IfThenElse>> _if_stmt_group;
void visit(Ref<const Var>) override;
};
} // namespace Internal
} // namespace Boost
#endif // BOOST_IRTERMFINDER_H