-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkey_data.h
99 lines (85 loc) · 2.3 KB
/
key_data.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
//Copyright 2019 Hust.
//Author: HYL
//Descriptor:
/* This file include important fundamental data.
*/
#include <unordered_map>
#include <vector>
#ifndef _KEY_DATA_H_
#define _KEY_DATA_H_
using namespace::std;
/* operateSet store the map between the instrName
* and enum keyWord index
*/
static unordered_map<string,int> SDIC_operate_set \
= {{"alloca", 1}, {"load", 2},
{"store", 3}, {"ret",4},
{"add",5}, {"sub", 6},
{"fcmp",7}, {"icmp", 7},
{"br", 8}, {"<label>", 9},
{"global", 10},{"define", 11},
{"call", 12}, {"and", 13},
{"or", 14}, {"xor", 15},
{"shl", 16}, {"ashr", 17},
{"zext", 18}, {"phi", 19},
{"constant", 20}, {"type", 21},
{"getelementptr", 22},{"bitcast", 23},
{"sext", 24}, {"trunc", 25},
{"select", 26}, {"gdb", 27},
{"switch", 28}, {"label", 29},
{"]", 30}, {"mul", 31},
{"sdiv", 32}, {"ptrtoint", 33},
{"udiv", 34}, {"urem", 35},
{"srem", 36}};
/* keyWord mainly use for the switch statement in
* analysisIR.cpp which indicate which tranfrom fun
* should be called.
*/
enum SDICKeyWord{
knull,
alloc, //not use 'alloca',since it is a keyWord in c++
load,
store,
ret,
add,
sub,
fcmp,
br,
label,
globa, //not use 'global',since it is a keyWord in c++
defin, //not use 'define',since it is a keyWord in c++
call,
anda, //not use 'and', since it is a keyWord in c++
ora, //not use 'or', since it is a keyWord in c++
xora, //not use 'xor', since it is a keyWord in c++
shl, //
ashr,
zext, //expand
phi,
constant,
type, //for struct declare
getelementptr,
bitcast,
sext, //extension the type from small to big
trunct, //not use 'trunc'. extension the type from big to small
selectt,
gdb, //it is for debug statement
switch_begin, //for switch
switch_label, //for switch
switch_end, //for the end of switch statement
mul,
sdiv,
ptrtoint, //from ptr to int
udiv, //unsigned div
urem, //operator % mod
srem, //operator % mod
};
/* splitWord stores all infomation of a single instructment
* of IR.
*/
struct SplitWord{
SDICKeyWord instrName = knull; //indicate which instr
vector<string> opCol; //store operator like %x
vector<string> vaCol; //store all word,splited by space
};
#endif