-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstaticAna.h
151 lines (116 loc) · 3.22 KB
/
staticAna.h
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/******************************************************************
Exana: EXecution-driven Application aNAlysis tool
Copyright (C) 2014, Yukinori Sato
All Rights Reserved.
******************************************************************/
//////////////////////////////////////////////////////////
// staticAna.h
//////////////////////////////////////////////////////////
#ifndef _STATICANA_H_
#define _STATICANA_H_
struct predElemT{
int id;
predElemT *next;
};
typedef struct predElemT PredElem;
extern PredElem **g_loopRegion;
bool BblIsLoopRegion(PredElem *loopElem, int nextID);
extern int bblCntInRtn;
enum nodeTypeE {nonheader, reducible, irreducible, self};
struct nodeElemT{
int header;
enum nodeTypeE nodeType;
};
typedef struct nodeElemT NodeElem;
extern NodeElem *nodeElem;
struct instMixT{
int memAccessSizeR;
int memAccessSizeW;
int memAccessCntR;
int memAccessCntW;
//int n_int, n_fp, n_avx, n_sse, n_sse2, n_sse3, n_sse4, n_flop;
int n_x86, n_vec, n_flop;
int n_multiply, n_ops;
};
struct bblElemT{
int id;
ADDRINT headAdr;
ADDRINT tailAdr;
ADDRINT nextAdr0;
ADDRINT nextAdr1;
int instCnt;
bblElemT *next0;
bblElemT *next1;
enum nodeTypeE nodeType;
int header;
int rtnID;
int skipID;
int loopID;
struct instMixT *instMix;
bool isTailInstCall;
bool isTailInstRet;
bool isTailIndirectBr;
struct pltRetWaitingListElem *pltRetList;
};
/*
struct indirectLoopInListElem{
ADDRINT targetAddr;
struct loopListElem *loopList;
struct indirectLoopInListElem *next;
};
*/
struct targetInstLoopInListElem{
ADDRINT targetAddr;
struct loopListElem *loopList;
struct targetInstLoopInListElem *next;
};
typedef struct bblElemT BblElem;
extern BblElem *bblArray;
extern int totalRtnCnt;
#define MAX_RTN_CNT 100000
struct rtnArrayElem{
BblElem *bblArray;
int bblCnt;
ADDRINT headInstAddress;
ADDRINT tailAddress; // this rtn is less than this adr, i.e. the address of next instruction
int *rtnIDval;
int skipCnt;
string *rtnName;
string *filename;
int line;
PredElem **loopRegion;
struct targetInstLoopInListElem *indirectLoopInList;
struct targetInstLoopInListElem *retTargetLoopInList;
PredElem **loopIn;
PredElem **loopOut;
};
typedef struct rtnArrayElem RtnArrayElem;
extern RtnArrayElem *rtnArray[MAX_RTN_CNT];
extern PredElem **loopInPreds;
extern PredElem **loopOutPreds;
extern string *currRtnNameInStaticAna;
void checkInstInRtn(RTN , int );
void updateHeadTailFlg(void);
void buildBbl(void);
//int buildBbl(void);
void buildDFST(void);
void findBackwardPreds(void);
void findHeaders(void);
void findLoopInAndOut(void);
//void printLoopNestInit(string outFileName);
//void printLoopNestFini(void);
void printHeadTail(void);
void printBbl(void);
void printBbl(ostream &);
void printBbl(ostream &output, int rtnID);
void printLoopIn(ostream &output,int i, int rtnID);
void printLoopOut(ostream &output,int i, int rtnID);
void printLoopRegion(void);
void buildDotFileOfCFG_Bbl(void);
void buildDotFileOfLoopNestInRtn(void);
void printPredList(PredElem *);
void printLoopNestInRtn(void);
void buildDotFileOfCFG_Bbl(int rtnID);
extern int numIrrLoop;
int checkMaxLoopNestNumInRtnAtStaticAna(void);
#endif