blob: f75383d573c386c13356887d32f2298ee70186e3 [file] [log] [blame]
#include "llvm/Pass.h"
#include "llvm/Function.h"
#include "llvm/Constants.h"
#include "ProofWrap/ProofWrap.h"
using namespace llvm;
namespace {
RegisterPass<ProofStrip> X("proofstrip", "Strip proof markers");
}
bool ProofStrip::runOnModule(Module& M) {
std::vector<const Type * > FTV;
FTV.push_back(Type::LongTy);
FunctionType* FT = FunctionType::get(Type::VoidTy, FTV, true);
Function* F = M.getFunction("llvm.proof.ptr", FT);
if (F) {
while (!F->use_empty()) {
User* U = *F->use_begin();
CallInst* CI = cast<CallInst>(U);
const Value* PV = CI->getOperand(1);
for (unsigned x = 2; x < CI->getNumOperands(); ++x)
setProof(CI->getOperand(x), PV);
CI->eraseFromParent();
}
return true;
}
return false;
}
//ProofPlace p;