Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
For PR950:
Browse files Browse the repository at this point in the history
Convert signed integer types to signless.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32786 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Reid Spencer committed Dec 31, 2006
1 parent c5b206b commit db8d2be
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 65 deletions.
10 changes: 5 additions & 5 deletions examples/Fibonacci/fibonacci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ using namespace llvm;
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.
Expand Down Expand Up @@ -111,10 +111,10 @@ int main(int argc, char **argv) {

// 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;
}
10 changes: 5 additions & 5 deletions examples/HowToUseJIT/HowToUseJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ int main() {
// Create the add1 function entry and insert this entry into module M. The
// function will have a return type of "int" and take an argument of "int".
// The '0' terminates the list of argument types.
Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy,
Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty,
(Type *)0);

// Add a basic block to the function. As before, it automatically inserts
// because of the last argument.
BasicBlock *BB = new BasicBlock("EntryBlock", Add1F);

// Get pointers to the constant `1'.
Value *One = ConstantInt::get(Type::IntTy, 1);
Value *One = ConstantInt::get(Type::Int32Ty, 1);

// Get pointers to the integer argument of the add1 function...
assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg
Expand All @@ -78,13 +78,13 @@ int main() {

// Now we going to create function `foo', which returns an int and takes no
// arguments.
Function *FooF = M->getOrInsertFunction("foo", Type::IntTy, (Type *)0);
Function *FooF = M->getOrInsertFunction("foo", Type::Int32Ty, (Type *)0);

// Add a basic block to the FooF function.
BB = new BasicBlock("EntryBlock", FooF);

// Get pointers to the constant `10'.
Value *Ten = ConstantInt::get(Type::IntTy, 10);
Value *Ten = ConstantInt::get(Type::Int32Ty, 10);

// Pass Ten to the call call:
std::vector<Value*> Params;
Expand All @@ -107,6 +107,6 @@ int main() {
GenericValue gv = EE->runFunction(FooF, noargs);

// Import result of execution:
std::cout << "Result: " << gv.IntVal << "\n";
std::cout << "Result: " << gv.Int32Val << "\n";
return 0;
}
6 changes: 3 additions & 3 deletions examples/ModuleMaker/ModuleMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main() {
Module *M = new Module("test");

// Create the main function: first create the type 'int ()'
FunctionType *FT = FunctionType::get(Type::IntTy, std::vector<const Type*>(),
FunctionType *FT = FunctionType::get(Type::Int32Ty, std::vector<const Type*>(),
/*not vararg*/false);

// By passing a module as the last parameter to the Function constructor,
Expand All @@ -39,8 +39,8 @@ int main() {
BasicBlock *BB = new BasicBlock("EntryBlock", F);

// Get pointers to the constant integers...
Value *Two = ConstantInt::get(Type::IntTy, 2);
Value *Three = ConstantInt::get(Type::IntTy, 3);
Value *Two = ConstantInt::get(Type::Int32Ty, 2);
Value *Three = ConstantInt::get(Type::Int32Ty, 3);

// Create the add instruction... does not insert...
Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three,
Expand Down
14 changes: 7 additions & 7 deletions examples/ParallelJIT/ParallelJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ static Function* createAdd1(Module* M)
// Create the add1 function entry and insert this entry into module M. The
// function will have a return type of "int" and take an argument of "int".
// The '0' terminates the list of argument types.
Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy,
Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty,
(Type *)0);

// Add a basic block to the function. As before, it automatically inserts
// because of the last argument.
BasicBlock *BB = new BasicBlock("EntryBlock", Add1F);

// Get pointers to the constant `1'.
Value *One = ConstantInt::get(Type::IntTy, 1);
Value *One = ConstantInt::get(Type::Int32Ty, 1);

// Get pointers to the integer argument of the add1 function...
assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg
Expand All @@ -63,15 +63,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.
Expand Down Expand Up @@ -221,12 +221,12 @@ void* callFunc( void* param )

// Call the `foo' function with no arguments:
std::vector<GenericValue> Args(1);
Args[0].IntVal = p->value;
Args[0].Int32Val = p->value;

synchronize.block(); // wait until other threads are at this point
GenericValue gv = p->EE->runFunction(p->F, Args);

return (void*) intptr_t(gv.IntVal);
return (void*) intptr_t(gv.Int32Val);
}

int main()
Expand Down
Loading

0 comments on commit db8d2be

Please sign in to comment.