From 051a950000e21935165db56695e35bade668193b Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Sun, 6 Apr 2008 20:25:17 +0000 Subject: API changes for class Use size reduction, wave 1. Specifically, introduction of XXX::Create methods for Users that have a potentially variable number of Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/RSProfiling.cpp | 37 +++++++++++++------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'lib/Transforms/Instrumentation/RSProfiling.cpp') diff --git a/lib/Transforms/Instrumentation/RSProfiling.cpp b/lib/Transforms/Instrumentation/RSProfiling.cpp index d81097b447..e7e8efea88 100644 --- a/lib/Transforms/Instrumentation/RSProfiling.cpp +++ b/lib/Transforms/Instrumentation/RSProfiling.cpp @@ -216,9 +216,9 @@ void GlobalRandomCounter::ProcessChoicePoint(BasicBlock* bb) { //reset counter BasicBlock* oldnext = t->getSuccessor(0); - BasicBlock* resetblock = new BasicBlock("reset", oldnext->getParent(), - oldnext); - TerminatorInst* t2 = new BranchInst(oldnext, resetblock); + BasicBlock* resetblock = BasicBlock::Create("reset", oldnext->getParent(), + oldnext); + TerminatorInst* t2 = BranchInst::Create(oldnext, resetblock); t->setSuccessor(0, resetblock); new StoreInst(ResetValue, Counter, t2); ReplacePhiPred(oldnext, bb, resetblock); @@ -291,9 +291,9 @@ void GlobalRandomCounterOpt::ProcessChoicePoint(BasicBlock* bb) { //reset counter BasicBlock* oldnext = t->getSuccessor(0); - BasicBlock* resetblock = new BasicBlock("reset", oldnext->getParent(), - oldnext); - TerminatorInst* t2 = new BranchInst(oldnext, resetblock); + BasicBlock* resetblock = BasicBlock::Create("reset", oldnext->getParent(), + oldnext); + TerminatorInst* t2 = BranchInst::Create(oldnext, resetblock); t->setSuccessor(0, resetblock); new StoreInst(ResetValue, AI, t2); ReplacePhiPred(oldnext, bb, resetblock); @@ -311,7 +311,7 @@ void CycleCounter::PrepFunction(Function* F) {} void CycleCounter::ProcessChoicePoint(BasicBlock* bb) { BranchInst* t = cast(bb->getTerminator()); - CallInst* c = new CallInst(F, "rdcc", t); + CallInst* c = CallInst::Create(F, "rdcc", t); BinaryOperator* b = BinaryOperator::createAnd(c, ConstantInt::get(Type::Int64Ty, rm), "mrdcc", t); @@ -375,8 +375,8 @@ Value* ProfilerRS::Translate(Value* v) { if (bb == &bb->getParent()->getEntryBlock()) TransCache[bb] = bb; //don't translate entry block else - TransCache[bb] = new BasicBlock("dup_" + bb->getName(), bb->getParent(), - NULL); + TransCache[bb] = BasicBlock::Create("dup_" + bb->getName(), bb->getParent(), + NULL); return TransCache[bb]; } else if (Instruction* i = dyn_cast(v)) { //we have already translated this @@ -464,16 +464,16 @@ void ProfilerRS::ProcessBackEdge(BasicBlock* src, BasicBlock* dst, Function& F) //a: Function::iterator BBN = src; ++BBN; - BasicBlock* bbC = new BasicBlock("choice", &F, BBN); + BasicBlock* bbC = BasicBlock::Create("choice", &F, BBN); //ChoicePoints.insert(bbC); BBN = cast(Translate(src)); - BasicBlock* bbCp = new BasicBlock("choice", &F, ++BBN); + BasicBlock* bbCp = BasicBlock::Create("choice", &F, ++BBN); ChoicePoints.insert(bbCp); //b: - new BranchInst(cast(Translate(dst)), bbC); - new BranchInst(dst, cast(Translate(dst)), - ConstantInt::get(Type::Int1Ty, true), bbCp); + BranchInst::Create(cast(Translate(dst)), bbC); + BranchInst::Create(dst, cast(Translate(dst)), + ConstantInt::get(Type::Int1Ty, true), bbCp); //c: { TerminatorInst* iB = src->getTerminator(); @@ -527,10 +527,11 @@ bool ProfilerRS::runOnFunction(Function& F) { //oh, and add the edge from the reg2mem created entry node to the //duplicated second node TerminatorInst* T = F.getEntryBlock().getTerminator(); - ReplaceInstWithInst(T, new BranchInst(T->getSuccessor(0), - cast( - Translate(T->getSuccessor(0))), - ConstantInt::get(Type::Int1Ty, true))); + ReplaceInstWithInst(T, BranchInst::Create(T->getSuccessor(0), + cast( + Translate(T->getSuccessor(0))), + ConstantInt::get(Type::Int1Ty, + true))); //do whatever is needed now that the function is duplicated c->PrepFunction(&F); -- cgit v1.2.3