aboutsummaryrefslogtreecommitdiffstats
path: root/examples/Fibonacci
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 /examples/Fibonacci
parentd963ab1f58adb6daa028533ff3285841d7e45f80 (diff)
downloadexternal_llvm-051a950000e21935165db56695e35bade668193b.zip
external_llvm-051a950000e21935165db56695e35bade668193b.tar.gz
external_llvm-051a950000e21935165db56695e35bade668193b.tar.bz2
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 'examples/Fibonacci')
-rw-r--r--examples/Fibonacci/fibonacci.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp
index b028c4b..f5ef0d0 100644
--- a/examples/Fibonacci/fibonacci.cpp
+++ b/examples/Fibonacci/fibonacci.cpp
@@ -43,7 +43,7 @@ static Function *CreateFibFunction(Module *M) {
(Type *)0));
// Add a basic block to the function.
- BasicBlock *BB = new BasicBlock("EntryBlock", FibF);
+ BasicBlock *BB = BasicBlock::Create("EntryBlock", FibF);
// Get pointers to the constants.
Value *One = ConstantInt::get(Type::Int32Ty, 1);
@@ -54,25 +54,25 @@ static Function *CreateFibFunction(Module *M) {
ArgX->setName("AnArg"); // Give it a nice symbolic name for fun.
// Create the true_block.
- BasicBlock *RetBB = new BasicBlock("return", FibF);
+ BasicBlock *RetBB = BasicBlock::Create("return", FibF);
// Create an exit block.
- BasicBlock* RecurseBB = new BasicBlock("recurse", FibF);
+ BasicBlock* RecurseBB = BasicBlock::Create("recurse", FibF);
// Create the "if (arg <= 2) goto exitbb"
Value *CondInst = new ICmpInst(ICmpInst::ICMP_SLE, ArgX, Two, "cond", BB);
- new BranchInst(RetBB, RecurseBB, CondInst, BB);
+ BranchInst::Create(RetBB, RecurseBB, CondInst, BB);
// Create: ret int 1
- new ReturnInst(One, RetBB);
+ ReturnInst::Create(One, RetBB);
// create fib(x-1)
Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB);
- CallInst *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB);
+ CallInst *CallFibX1 = CallInst::Create(FibF, Sub, "fibx1", RecurseBB);
CallFibX1->setTailCall();
// create fib(x-2)
Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB);
- CallInst *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB);
+ CallInst *CallFibX2 = CallInst::Create(FibF, Sub, "fibx2", RecurseBB);
CallFibX2->setTailCall();
@@ -81,7 +81,7 @@ static Function *CreateFibFunction(Module *M) {
"addresult", RecurseBB);
// Create the return instruction and add it to the basic block
- new ReturnInst(Sum, RecurseBB);
+ ReturnInst::Create(Sum, RecurseBB);
return FibF;
}