summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2008-04-06 20:25:17 +0000
committerGabor Greif <ggreif@gmail.com>2008-04-06 20:25:17 +0000
commit051a950000e21935165db56695e35bade668193b (patch)
tree76db4bc690c153a1cfbd2989849c3b1d95500390 /lib/Transforms/Instrumentation
parentd963ab1f58adb6daa028533ff3285841d7e45f80 (diff)
downloadllvm-051a950000e21935165db56695e35bade668193b.tar.gz
llvm-051a950000e21935165db56695e35bade668193b.tar.bz2
llvm-051a950000e21935165db56695e35bade668193b.tar.xz
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
Diffstat (limited to 'lib/Transforms/Instrumentation')
-rw-r--r--lib/Transforms/Instrumentation/ProfilingUtils.cpp4
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.cpp37
2 files changed, 21 insertions, 20 deletions
diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
index fd31cec643..4617fbbd80 100644
--- a/lib/Transforms/Instrumentation/ProfilingUtils.cpp
+++ b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
@@ -55,8 +55,8 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
}
Args[3] = ConstantInt::get(Type::Int32Ty, NumElements);
- Instruction *InitCall = new CallInst(InitFn, Args.begin(), Args.end(),
- "newargc", InsertPos);
+ Instruction *InitCall = CallInst::Create(InitFn, Args.begin(), Args.end(),
+ "newargc", InsertPos);
// If argc or argv are not available in main, just pass null values in.
Function::arg_iterator AI;
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<BranchInst>(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<Instruction>(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<BasicBlock>(Translate(src));
- BasicBlock* bbCp = new BasicBlock("choice", &F, ++BBN);
+ BasicBlock* bbCp = BasicBlock::Create("choice", &F, ++BBN);
ChoicePoints.insert(bbCp);
//b:
- new BranchInst(cast<BasicBlock>(Translate(dst)), bbC);
- new BranchInst(dst, cast<BasicBlock>(Translate(dst)),
- ConstantInt::get(Type::Int1Ty, true), bbCp);
+ BranchInst::Create(cast<BasicBlock>(Translate(dst)), bbC);
+ BranchInst::Create(dst, cast<BasicBlock>(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<BasicBlock>(
- Translate(T->getSuccessor(0))),
- ConstantInt::get(Type::Int1Ty, true)));
+ ReplaceInstWithInst(T, BranchInst::Create(T->getSuccessor(0),
+ cast<BasicBlock>(
+ Translate(T->getSuccessor(0))),
+ ConstantInt::get(Type::Int1Ty,
+ true)));
//do whatever is needed now that the function is duplicated
c->PrepFunction(&F);