Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Dec 15, 2023
1 parent be92149 commit 2408ff7
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ namespace ClamBCLogicalCompilerHelper
virtual void processPHI(PHINode * phi, Function * pCalledFunction, std::vector<Value*> & args);

virtual void fixupSetVirusNameCalls();

size_t getBranchIdx(llvm::BranchInst * pBranch, llvm::BasicBlock * pBB);
};


/*TODO: make protected*/
size_t getBranchIdx(llvm::BranchInst * pBranch, llvm::BasicBlock * pBB){
size_t ClamBCLogicalCompilerHelper::getBranchIdx(llvm::BranchInst * pBranch, llvm::BasicBlock * pBB){
for ( size_t ret = 0; ret < pBranch->getNumSuccessors(); ret++){
if (pBranch->getSuccessor(ret) == pBB){
return ret;
Expand Down Expand Up @@ -135,7 +136,8 @@ namespace ClamBCLogicalCompilerHelper
a dyn_cast*/
size_t branchIdx = getBranchIdx(pBranch, phi->getParent());

BasicBlock * pNew = BasicBlock::Create(pMod->getContext(), "ClamBCLogicalCompilerHelper_call_SetVirusName_", phi->getParent()->getParent(), phi->getParent());
BasicBlock * pNew = BasicBlock::Create(pMod->getContext(),
"ClamBCLogicalCompilerHelper_call_SetVirusName_", phi->getParent()->getParent(), phi->getParent());
pBranch->setSuccessor(branchIdx, pNew);

args[0] = pVal;
Expand All @@ -162,15 +164,6 @@ namespace ClamBCLogicalCompilerHelper

if (PHINode * phi = llvm::dyn_cast<PHINode>(operand)){
calls.push_back(pci);
#if 0
std::vector<Value*> args;
populateArgs(pci, args);
processPHI(phi, svn, args);
erase.push_back(pci);
/*This leaves a block with only a branch instruction (essentially empty).
* I don't think that is an issue, but consider removing it.*/
erase.push_back(phi);
#endif
}
}
}
Expand Down

0 comments on commit 2408ff7

Please sign in to comment.