File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ void generateSYMEncodings() {
155
155
o.close ();
156
156
}
157
157
158
- void collectIR () {
158
+ void collectIRfunc () {
159
159
auto M = getLLVMIR ();
160
160
CollectIR cir (M);
161
161
std::ofstream o;
@@ -230,7 +230,7 @@ int main(int argc, char **argv) {
230
230
} else if (sym) {
231
231
generateSYMEncodings ();
232
232
} else if (collectIR) {
233
- collectIR ();
233
+ collectIRfunc ();
234
234
}
235
235
return 0 ;
236
236
}
Original file line number Diff line number Diff line change 16
16
17
17
#include < cxxabi.h>
18
18
19
+ #include < algorithm>
19
20
#include < map>
20
21
21
22
namespace IR2Vec {
@@ -46,7 +47,10 @@ extern float WT;
46
47
extern bool debug;
47
48
extern std::unordered_map<std::string, Vector> opcMap;
48
49
std::unique_ptr<llvm::Module> getLLVMIR ();
49
- void scaleVector (Vector &vec, float factor);
50
+ inline void scaleVector (Vector &vec, float factor) {
51
+ std::transform (vec.begin (), vec.end (), vec.begin (),
52
+ [factor](const auto &val) { return val * factor; });
53
+ }
50
54
// newly added
51
55
std::string getDemagledName (const llvm::Function *function);
52
56
char *getActualName (llvm::Function *function);
Original file line number Diff line number Diff line change @@ -41,12 +41,6 @@ std::unique_ptr<Module> IR2Vec::getLLVMIR() {
41
41
return M;
42
42
}
43
43
44
- void IR2Vec::scaleVector (Vector &vec, float factor) {
45
- for (unsigned i = 0 ; i < vec.size (); i++) {
46
- vec[i] = vec[i] * factor;
47
- }
48
- }
49
-
50
44
// Function to get demangled function name
51
45
std::string IR2Vec::getDemagledName (const llvm::Function *function) {
52
46
auto functionName = function->getName ().str ();
You can’t perform that action at this time.
0 commit comments