#include <set>
#include <map>
#include <queue>
-#include <list>
using namespace llvm;
namespace {
ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0),
"countercc", t);
- Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
+ Value* nv = BinaryOperator::CreateSub(l, ConstantInt::get(T, 1),
"counternew", t);
new StoreInst(nv, Counter, t);
t->setCondition(s);
new StoreInst(l, Counter, bib);
BasicBlock* bb = cast<InvokeInst>(bib)->getNormalDest();
- BasicBlock::iterator i = bb->begin();
- while (isa<PHINode>(i))
- ++i;
+ BasicBlock::iterator i = bb->getFirstNonPHI();
l = new LoadInst(Counter, "counter", i);
bb = cast<InvokeInst>(bib)->getUnwindDest();
- i = bb->begin();
- while (isa<PHINode>(i)) ++i;
+ i = bb->getFirstNonPHI();
l = new LoadInst(Counter, "counter", i);
new StoreInst(l, AI, i);
} else if (isa<UnwindInst>(&*bib) || isa<ReturnInst>(&*bib)) {
ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0),
"countercc", t);
- Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
+ Value* nv = BinaryOperator::CreateSub(l, ConstantInt::get(T, 1),
"counternew", t);
new StoreInst(nv, AI, t);
t->setCondition(s);
CallInst* c = CallInst::Create(F, "rdcc", t);
BinaryOperator* b =
- BinaryOperator::createAnd(c, ConstantInt::get(Type::Int64Ty, rm),
+ BinaryOperator::CreateAnd(c, ConstantInt::get(Type::Int64Ty, rm),
"mrdcc", t);
ICmpInst *s = new ICmpInst(ICmpInst::ICMP_EQ, b,
void RSProfilers_std::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
GlobalValue *CounterArray) {
// Insert the increment after any alloca or PHI instructions...
- BasicBlock::iterator InsertPos = BB->begin();
- while (isa<AllocaInst>(InsertPos) || isa<PHINode>(InsertPos))
+ BasicBlock::iterator InsertPos = BB->getFirstNonPHI();
+ while (isa<AllocaInst>(InsertPos))
++InsertPos;
// Create the getelementptr constant expression
// Load, increment and store the value back.
Value *OldVal = new LoadInst(ElementPtr, "OldCounter", InsertPos);
profcode.insert(OldVal);
- Value *NewVal = BinaryOperator::createAdd(OldVal,
+ Value *NewVal = BinaryOperator::CreateAdd(OldVal,
ConstantInt::get(Type::Int32Ty, 1),
"NewCounter", InsertPos);
profcode.insert(NewVal);