-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDictionary.cpp
106 lines (87 loc) · 2.81 KB
/
Dictionary.cpp
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
#include <boost/any.hpp>
#include "llvm/Crellvm/Dictionary.h"
#include "llvm/Crellvm/ValidationUnit.h"
namespace crellvm {
SimplifyInstArg::SimplifyInstArg() {
this->activated = false;
this->aborted = false;
}
void SimplifyInstArg::setHintGenFunc(
std::string _microoptName,
std::function<void(llvm::Instruction *)> _hintGenFunc) {
if (this->aborted)
return;
this->activated = true;
this->microoptName = _microoptName;
this->hintGenFunc = _hintGenFunc;
}
void SimplifyInstArg::abort() {
this->aborted = true;
}
void SimplifyInstArg::generateHint(llvm::Instruction *arg) const {
assert(this->activated);
if (!this->aborted) {
auto &func = this->hintGenFunc;
ValidationUnit::GetInstance()->intrude([&func, &arg](
crellvm::ValidationUnit::Dictionary &data,
crellvm::CoreHint &hint) { func(arg); });
}
}
std::string SimplifyInstArg::getMicroOptName() const {
return this->microoptName;
}
bool SimplifyInstArg::isActivated() const {
return !aborted && activated;
}
SelectIcmpConstArg::SelectIcmpConstArg() {
this->activated = false;
this->isGtToLt = false;
this->isUnsigned = false;
this->selectCommutative = false;
this->Z = nullptr;
this->Y = nullptr;
this->X = nullptr;
this->C = nullptr;
this->Cprime = nullptr;
}
StripPointerCastsArg::StripPointerCastsArg() {
strippedValues = TyStrippedValues(new TyStrippedValuesObj());
}
FindAvailableLoadedValueArg::FindAvailableLoadedValueArg() {
orthogonalInsns = TyOrthogonalInsns(new TyOrthogonalInsnsObj());
ptr1EquivalentValues = TyPtrEqValues(new TyPtrEqValuesObj());
ptr2EquivalentValues = TyPtrEqValues(new TyPtrEqValuesObj());
isLoadStore = false;
loadstoreStoreInst = nullptr;
}
IndicesArg::IndicesArg()
: instrIndices(new TyInstrIndicesObj()),
termIndices(new TyTermIndicesObj()),
useIndices(new TyUseIndicesObj()) {}
VisitICmpArg::VisitICmpArg() {
swapOps = false;
}
Mem2RegArg::Mem2RegArg()
: storeItem(new TyStoreItemObj()),
recentInstr(new TyRecentInstrObj()), instrWorkList(new TyInstrWorkListObj()),
replaceItem(new TyReplaceObj()), replaceTag(new TyReplaceTObj()) {}
// PassDictionary
void PassDictionary::Create() {
assert(!_Instance && "PassDictionary Instance already exists!");
_Instance = new PassDictionary();
}
PassDictionary &PassDictionary::GetInstance() { return *_Instance; }
void PassDictionary::Destroy() {
assert(_Instance && "PassDictionary Instance doesn't exist!");
delete _Instance;
_Instance = nullptr;
}
GVNArg::GVNArg()
: isGVNReplace(false), VNptr(nullptr), VET(new TyVETobj), InvT(new TyInvTobj),
CT(new TyCTobj), CTInv(new TyCTInvobj), CallPHIs(new TyCallPHIobj), VNCnt(new TyVNCntobj) {}
LICMHoistOrSinkCond::LICMHoistOrSinkCond() {
useAA = false;
CurLoop = nullptr;
}
PassDictionary *PassDictionary::_Instance = nullptr;
} // crellvm