Skip to content

Commit

Permalink
Parallelised bb2vec
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-sachdeva committed Jun 28, 2024
1 parent 071a927 commit 8b9a998
Show file tree
Hide file tree
Showing 7 changed files with 2,628 additions and 2,628 deletions.
40 changes: 20 additions & 20 deletions src/Symbolic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ using namespace llvm;
using namespace IR2Vec;
using abi::__cxa_demangle;

inline void IR2Vec_Symbolic::getValue(IR2Vec::Vector *vec, std::string key) {
inline void IR2Vec_Symbolic::getValue(IR2Vec::Vector &vec, std::string key) {
auto it = opcMap.find(key);
if (it == opcMap.end())
IR2VEC_DEBUG(errs() << "cannot find key in map : " << key << "\n");
else
vec = &it->second;
vec = it->second;
return;
}

Expand Down Expand Up @@ -138,7 +138,7 @@ Vector IR2Vec_Symbolic::bb2Vec(BasicBlock &B,
for (auto &I : B) {
Vector instVector(DIM, 0);
Vector getValueVec;
getValue(&getValueVec, I.getOpcodeName());
getValue(getValueVec, I.getOpcodeName());

scaleVector(getValueVec, WO);

Expand All @@ -148,31 +148,31 @@ Vector IR2Vec_Symbolic::bb2Vec(BasicBlock &B,
auto type = I.getType();

if (type->isVoidTy()) {
getValue(&getValueVec, "voidTy");
getValue(getValueVec, "voidTy");
} else if (type->isFloatingPointTy()) {
getValue(&getValueVec, "floatTy");
getValue(getValueVec, "floatTy");
} else if (type->isIntegerTy()) {
getValue(&getValueVec, "integerTy");
getValue(getValueVec, "integerTy");
} else if (type->isFunctionTy()) {
getValue(&getValueVec, "functionTy");
getValue(getValueVec, "functionTy");
} else if (type->isStructTy()) {
getValue(&getValueVec, "structTy");
getValue(getValueVec, "structTy");
} else if (type->isArrayTy()) {
getValue(&getValueVec, "arrayTy");
getValue(getValueVec, "arrayTy");
} else if (type->isPointerTy()) {
getValue(&getValueVec, "pointerTy");
getValue(getValueVec, "pointerTy");
} else if (type->isVectorTy()) {
getValue(&getValueVec, "vectorTy");
getValue(getValueVec, "vectorTy");
} else if (type->isEmptyTy()) {
getValue(&getValueVec, "emptyTy");
getValue(getValueVec, "emptyTy");
} else if (type->isLabelTy()) {
getValue(&getValueVec, "labelTy");
getValue(getValueVec, "labelTy");
} else if (type->isTokenTy()) {
getValue(&getValueVec, "tokenTy");
getValue(getValueVec, "tokenTy");
} else if (type->isMetadataTy()) {
getValue(&getValueVec, "metadataTy");
getValue(getValueVec, "metadataTy");
} else {
getValue(&getValueVec, "unknownTy");
getValue(getValueVec, "unknownTy");
}

scaleVector(getValueVec, WT);
Expand All @@ -190,13 +190,13 @@ Vector IR2Vec_Symbolic::bb2Vec(BasicBlock &B,
for (unsigned i = 0; i < I.getNumOperands(); i++) {
Vector localValueVector;
if (isa<Function>(I.getOperand(i))) {
getValue(&localValueVector, "function");
getValue(localValueVector, "function");
} else if (isa<PointerType>(I.getOperand(i)->getType())) {
getValue(&localValueVector, "pointer");
getValue(localValueVector, "pointer");
} else if (isa<Constant>(I.getOperand(i))) {
getValue(&localValueVector, "constant");
getValue(localValueVector, "constant");
} else {
getValue(&localValueVector, "variable");
getValue(localValueVector, "variable");
}
scaleVector(localValueVector, WA);
localVec.push_back(localValueVector);
Expand Down
2 changes: 1 addition & 1 deletion src/include/Symbolic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class IR2Vec_Symbolic {
llvm::Module &M;
IR2Vec::Vector pgmVector;

inline void getValue(IR2Vec::Vector *vec, std::string key);
inline void getValue(IR2Vec::Vector &vec, std::string key);
IR2Vec::Vector bb2Vec(llvm::BasicBlock &B,
llvm::SmallVector<llvm::Function *, 15> &funcStack);
IR2Vec::Vector func2Vec(llvm::Function &F,
Expand Down
Binary file modified src/test-suite/gmon.out
Binary file not shown.
4,440 changes: 2,220 additions & 2,220 deletions src/test-suite/oracle/SYM_llvm17_f/ir2vec.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 8b9a998

Please sign in to comment.