Skip to content

Commit

Permalink
Support mSIMBA on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
adam committed Aug 10, 2024
1 parent ec4083b commit 1f169cd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
25 changes: 13 additions & 12 deletions LLVMParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,31 +813,32 @@ void LLVMParser::extractCandidates(llvm::Function &F,
}
}
} break;
*/
case Instruction::PHI: {
auto Phi = dyn_cast<PHINode>(&*I);
for (auto &Inc : Phi->incoming_values()) {
if (isSupportedInstruction(Inc->stripPointerCasts())) {
if (isVisited(Inc->stripPointerCasts())) continue;
if (isVisited(Inc->stripPointerCasts()))
continue;
MBACandidate Cand;
Cand.Candidate = dyn_cast<Instruction>(Inc->stripPointerCasts());
Candidates.push_back(Cand);
Visited.insert(Inc->stripPointerCasts());
}
}
} break;
*/
// case Instruction::Add:
// case Instruction::Sub:
// case Instruction::Mul:
// case Instruction::Shl:
case Instruction::Add:
case Instruction::Sub:
case Instruction::Mul:
case Instruction::Shl:
case Instruction::Xor:
// case Instruction::Or:
// case Instruction::And:
// case Instruction::LShr:
case Instruction::Or:
case Instruction::And:
case Instruction::LShr:
// case Instruction::AShr:
// case Instruction::URem:
// case Instruction::SRem:
// case Instruction::IntToPtr:
case Instruction::URem:
case Instruction::SRem:
case Instruction::IntToPtr:
case Instruction::BitCast: {
if (isVisited(&*I))
continue;
Expand Down
13 changes: 10 additions & 3 deletions Simplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ int exec(std::string &cmd, std::string &output) {
char buffer[10000];
while (!feof(pipe.get())) {
if (fgets(buffer, 10000, pipe.get()) != NULL) {

std::string temp = buffer;

// Check for "*** ... simplified to"
Expand Down Expand Up @@ -226,8 +225,16 @@ bool Simplifier::external_simplifier(

// Execute external simplifier
std::string output = "";
std::string cmd = PythonPath + " " + ExternalSimplifierPath.str() + " \"" +
expr.str() + "\"" + " -b " + to_string(BitWidth);
std::string cmd = "";

// Check if ExternalSimplifierPath end with py
if (ExternalSimplifierPath.contains(".py")) {
cmd = PythonPath + " " + ExternalSimplifierPath.str() + " \"" + expr.str() +
"\"" + " -b " + to_string(BitWidth);
} else {
cmd = ExternalSimplifierPath.str() + " \"" + expr.str() + "\"" + " -b " +
to_string(BitWidth);
}

if (RedisCache) {
cmd += " -r";
Expand Down

0 comments on commit 1f169cd

Please sign in to comment.