llvm.org GIT mirror
For PR950: Convert signed integer types to signless. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32786 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 13 years ago
6 changed file(s) with 65 addition(s) and 65 deletion(s).
 37 37 static Function *CreateFibFunction(Module *M) { 38 38 // Create the fib function and insert it into module M. This function is said 39 39 // to return an int and take an int parameter. 40 Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy,⏎ 40 Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,⏎ 41 41 (Type *)0); 42 42 43 43 // Add a basic block to the function. 44 44 BasicBlock *BB = new BasicBlock("EntryBlock", FibF); 45 45 46 46 // Get pointers to the constants. 47 Value *One = ConstantInt::get(Type::IntTy, 1); 48 Value *Two = ConstantInt::get(Type::IntTy, 2);⏎ 47 Value *One = ConstantInt::get(Type::Int32Ty, 1);⏎ 48 Value *Two = ConstantInt::get(Type::Int32Ty, 2); 49 49 50 50 // Get pointer to the integer argument of the add1 function... 51 51 Argument *ArgX = FibF->arg_begin(); // Get the arg. 110 110 111 111 // Call the Fibonacci function with argument n: 112 112 std::vector Args(1); 113 Args[0].IntVal = n;⏎ 113 Args[0].Int32Val = n;⏎ 114 114 GenericValue GV = EE->runFunction(FibF, Args); 115 115 116 116 // import result of execution 117 std::cout << "Result: " << GV.IntVal << "\n";⏎ 117 std::cout << "Result: " << GV.Int32Val << "\n";⏎ 118 118 return 0; 119 119 }