systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
FindGPUMacro.h
Go to the documentation of this file.
1#ifndef __FIND_GPU_MACRO_H
2#define __FIND_GPU_MACRO_H
3
4#include "clang/AST/DeclCXX.h"
5#include "clang/AST/RecursiveASTVisitor.h"
6#include "llvm/Support/raw_ostream.h"
7#include <map>
8#include <set>
9
10namespace systemc_clang {
11
12using namespace std;
13using namespace clang;
14
15class GPUMacro {
16
17public:
18 GPUMacro(int, int, int, int, int, int, int, int);
19 GPUMacro();
20 ~GPUMacro();
21
22 void addGPUFit();
23 void denyGPUFit();
24 int getBlockIdx();
25 int getBlockIdy();
26 int getBlockIdz();
27 int getThreadIdx();
28 int getThreadIdy();
29 int getThreadIdz();
30 int getGPUTime();
31 int getCPUTime();
32 bool isGPUFit();
33 void dump(raw_ostream &);
34
35private:
44 bool _gpuFit;
45};
46
47class FindGPUMacro : public RecursiveASTVisitor<FindGPUMacro> {
48public:
49 typedef pair<int, ForStmt *> forStmtInstanceIdPairType;
50 typedef map<int, ForStmt *> forStmtInstanceIdMapType;
51
52 typedef pair<forStmtInstanceIdPairType, GPUMacro *> forStmtGPUMacroPairType;
53 typedef map<forStmtInstanceIdPairType, GPUMacro *> forStmtGPUMacroMapType;
54
55 FindGPUMacro(CXXMethodDecl *, int, raw_ostream &);
56 virtual ~FindGPUMacro();
57 // ANI : Need to add other loops as well.....
58 virtual bool VisitForStmt(ForStmt *);
59
61
62 void dump();
63
64 // ===
65 // Analyze the simple for loop
66 //
67 // int a[5];
68 // for (int i = 0; i < 5; ++i) {
69 // a[i] = i;
70 // }
71 // ===
72 void analyze_data_struct(Stmt *stmtList);
73 void analyze_expr(Expr *expr);
74 void analyze_lhs(Expr *expr);
75 void analyze_rhs(Expr *expr);
76 void analyze_array_base(Expr *base, bool isLHS);
77 void analyze_value_decl(ValueDecl *val);
78
79private:
81 CXXMethodDecl *_entryFunction;
83 raw_ostream &_os;
84
85 std::set<ValueDecl *> lhs_decls;
86 std::set<ValueDecl *> rhs_decls;
87};
88} // namespace systemc_clang
89#endif
forStmtGPUMacroMapType _forStmtGPUMacroMap
void analyze_data_struct(Stmt *stmtList)
std::set< ValueDecl * > rhs_decls
forStmtGPUMacroMapType getForStmtGPUMacroMap()
void analyze_value_decl(ValueDecl *val)
CXXMethodDecl * _entryFunction
std::set< ValueDecl * > lhs_decls
void analyze_array_base(Expr *base, bool isLHS)
virtual bool VisitForStmt(ForStmt *)
pair< forStmtInstanceIdPairType, GPUMacro * > forStmtGPUMacroPairType
map< forStmtInstanceIdPairType, GPUMacro * > forStmtGPUMacroMapType
map< int, ForStmt * > forStmtInstanceIdMapType
pair< int, ForStmt * > forStmtInstanceIdPairType
FindGPUMacro(CXXMethodDecl *, int, raw_ostream &)
void dump(raw_ostream &)
Clang forward declarations.
Definition FindArgument.h:6