diff --git a/src/IR2Vec.cpp b/src/IR2Vec.cpp index 0fc8f4ccf..556835fac 100644 --- a/src/IR2Vec.cpp +++ b/src/IR2Vec.cpp @@ -155,7 +155,7 @@ void generateSYMEncodings() { o.close(); } -void collectIR() { +void collectIRfunc() { auto M = getLLVMIR(); CollectIR cir(M); std::ofstream o; @@ -230,7 +230,7 @@ int main(int argc, char **argv) { } else if (sym) { generateSYMEncodings(); } else if (collectIR) { - collectIR(); + collectIRfunc(); } return 0; } diff --git a/src/include/utils.h b/src/include/utils.h index ebb2a21f2..ceca90e50 100644 --- a/src/include/utils.h +++ b/src/include/utils.h @@ -16,6 +16,7 @@ #include +#include #include namespace IR2Vec { @@ -46,7 +47,10 @@ extern float WT; extern bool debug; extern std::unordered_map opcMap; std::unique_ptr getLLVMIR(); -void scaleVector(Vector &vec, float factor); +inline void scaleVector(Vector &vec, float factor) { + std::transform(vec.begin(), vec.end(), vec.begin(), + [factor](const auto &val) { return val * factor; }); +} // newly added std::string getDemagledName(const llvm::Function *function); char *getActualName(llvm::Function *function); diff --git a/src/utils.cpp b/src/utils.cpp index e05460190..9e36d4842 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -41,12 +41,6 @@ std::unique_ptr IR2Vec::getLLVMIR() { return M; } -void IR2Vec::scaleVector(Vector &vec, float factor) { - for (unsigned i = 0; i < vec.size(); i++) { - vec[i] = vec[i] * factor; - } -} - // Function to get demangled function name std::string IR2Vec::getDemagledName(const llvm::Function *function) { auto functionName = function->getName().str();