|
9 | 9 | #include "CollectIR.h"
|
10 | 10 | #include "FlowAware.h"
|
11 | 11 | #include "Symbolic.h"
|
12 |
| -#include "Vocabulary.h" |
13 | 12 | #include "version.h"
|
14 | 13 |
|
15 | 14 | #include "llvm/Support/CommandLine.h"
|
@@ -73,54 +72,6 @@ void printVersion(raw_ostream &ostream) {
|
73 | 72 | cl::PrintVersionMessage();
|
74 | 73 | }
|
75 | 74 |
|
76 |
| -struct SymOutputs { |
77 |
| - std::ofstream out; |
78 |
| -}; |
79 |
| - |
80 |
| -struct FAOutputs : SymOutputs { |
81 |
| - std::ofstream miss; |
82 |
| - std::ofstream cyclic; |
83 |
| -}; |
84 |
| - |
85 |
| -inline SymOutputs openSymOutputs(const std::string &baseName) { |
86 |
| - SymOutputs f; |
87 |
| - f.out.open(baseName, std::ios_base::app); |
88 |
| - return f; |
89 |
| -} |
90 |
| - |
91 |
| -inline FAOutputs openFAOutputs(const std::string &baseName) { |
92 |
| - FAOutputs f; |
93 |
| - f.out.open(baseName, std::ios_base::app); |
94 |
| - f.miss.open("missCount_" + baseName, std::ios_base::app); |
95 |
| - f.cyclic.open("cyclicCount_" + baseName, std::ios_base::app); |
96 |
| - return f; |
97 |
| -} |
98 |
| - |
99 |
| -template <class F> |
100 |
| -inline void runMaybeTimed(bool shouldTime, const char *timingMsgFmt, F &&job) { |
101 |
| - if (shouldTime) { |
102 |
| - const clock_t start = clock(); |
103 |
| - std::forward<F>(job)(); |
104 |
| - const clock_t end = clock(); |
105 |
| - const double elapsed = static_cast<double>(end - start) / CLOCKS_PER_SEC; |
106 |
| - std::printf(timingMsgFmt, elapsed); |
107 |
| - } else { |
108 |
| - std::forward<F>(job)(); |
109 |
| - } |
110 |
| -} |
111 |
| - |
112 |
| -template <class Encoder, class Outputs, class OutputsFactory, class Body> |
113 |
| -inline void executeEncoder(const char *timingMsgFmt, bool shouldTime, |
114 |
| - OutputsFactory &&makeOutputs, Body &&body) { |
115 |
| - auto M = getLLVMIR(); |
116 |
| - auto vocabulary = VocabularyFactory::createVocabulary(DIM)->getVocabulary(); |
117 |
| - Encoder encoder(*M, vocabulary); |
118 |
| - auto files = std::forward<OutputsFactory>(makeOutputs)(oname); |
119 |
| - |
120 |
| - auto job = [&] { std::forward<Body>(body)(encoder, files); }; |
121 |
| - runMaybeTimed(shouldTime, timingMsgFmt, job); |
122 |
| -} |
123 |
| - |
124 | 75 | void generateFAEncodingsFunction(std::string funcName) {
|
125 | 76 | executeEncoder<IR2Vec_FA, FAOutputs>(
|
126 | 77 | "Time taken by on-demand generation of flow-aware encodings is: %.6f "
|
|
0 commit comments