[llvm-commits] CVS: llvm/examples/Fibonacci/fibonacci.cpp

Reid Spencer reid at x10sys.com
Sat Dec 30 21:50:53 PST 2006



Changes in directory llvm/examples/Fibonacci:

fibonacci.cpp updated: 1.13 -> 1.14
---
Log message:

For PR950: http://llvm.org/PR950 :
Convert signed integer types to signless.


---
Diffs of the changes:  (+5 -5)

 fibonacci.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/examples/Fibonacci/fibonacci.cpp
diff -u llvm/examples/Fibonacci/fibonacci.cpp:1.13 llvm/examples/Fibonacci/fibonacci.cpp:1.14
--- llvm/examples/Fibonacci/fibonacci.cpp:1.13	Sat Dec 23 00:05:40 2006
+++ llvm/examples/Fibonacci/fibonacci.cpp	Sat Dec 30 23:50:27 2006
@@ -38,15 +38,15 @@
 static Function *CreateFibFunction(Module *M) {
   // Create the fib function and insert it into module M.  This function is said
   // to return an int and take an int parameter.
-  Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy,
+  Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,
                                           (Type *)0);
 
   // Add a basic block to the function.
   BasicBlock *BB = new BasicBlock("EntryBlock", FibF);
 
   // Get pointers to the constants.
-  Value *One = ConstantInt::get(Type::IntTy, 1);
-  Value *Two = ConstantInt::get(Type::IntTy, 2);
+  Value *One = ConstantInt::get(Type::Int32Ty, 1);
+  Value *Two = ConstantInt::get(Type::Int32Ty, 2);
 
   // Get pointer to the integer argument of the add1 function...
   Argument *ArgX = FibF->arg_begin();   // Get the arg.
@@ -111,10 +111,10 @@
 
   // Call the Fibonacci function with argument n:
   std::vector<GenericValue> Args(1);
-  Args[0].IntVal = n;
+  Args[0].Int32Val = n;
   GenericValue GV = EE->runFunction(FibF, Args);
 
   // import result of execution
-  std::cout << "Result: " << GV.IntVal << "\n";
+  std::cout << "Result: " << GV.Int32Val << "\n";
   return 0;
 }






More information about the llvm-commits mailing list