Skip to content

Commit bc013ba

Browse files
author
Reid Spencer
committedDec 31, 2006
For PR950:
Convert signed integer types to signless. llvm-svn: 32786
1 parent c635f47 commit bc013ba

File tree

6 files changed

+65
-65
lines changed

6 files changed

+65
-65
lines changed
 

‎llvm/examples/Fibonacci/fibonacci.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ using namespace llvm;
3838
static Function *CreateFibFunction(Module *M) {
3939
// Create the fib function and insert it into module M. This function is said
4040
// to return an int and take an int parameter.
41-
Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy,
41+
Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,
4242
(Type *)0);
4343

4444
// Add a basic block to the function.
4545
BasicBlock *BB = new BasicBlock("EntryBlock", FibF);
4646

4747
// Get pointers to the constants.
48-
Value *One = ConstantInt::get(Type::IntTy, 1);
49-
Value *Two = ConstantInt::get(Type::IntTy, 2);
48+
Value *One = ConstantInt::get(Type::Int32Ty, 1);
49+
Value *Two = ConstantInt::get(Type::Int32Ty, 2);
5050

5151
// Get pointer to the integer argument of the add1 function...
5252
Argument *ArgX = FibF->arg_begin(); // Get the arg.
@@ -111,10 +111,10 @@ int main(int argc, char **argv) {
111111

112112
// Call the Fibonacci function with argument n:
113113
std::vector<GenericValue> Args(1);
114-
Args[0].IntVal = n;
114+
Args[0].Int32Val = n;
115115
GenericValue GV = EE->runFunction(FibF, Args);
116116

117117
// import result of execution
118-
std::cout << "Result: " << GV.IntVal << "\n";
118+
std::cout << "Result: " << GV.Int32Val << "\n";
119119
return 0;
120120
}

‎llvm/examples/HowToUseJIT/HowToUseJIT.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ int main() {
5252
// Create the add1 function entry and insert this entry into module M. The
5353
// function will have a return type of "int" and take an argument of "int".
5454
// The '0' terminates the list of argument types.
55-
Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy,
55+
Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty,
5656
(Type *)0);
5757

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

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

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

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

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

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

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

109109
// Import result of execution:
110-
std::cout << "Result: " << gv.IntVal << "\n";
110+
std::cout << "Result: " << gv.Int32Val << "\n";
111111
return 0;
112112
}

‎llvm/examples/ModuleMaker/ModuleMaker.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int main() {
2727
Module *M = new Module("test");
2828

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

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

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

4545
// Create the add instruction... does not insert...
4646
Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three,

‎llvm/examples/ParallelJIT/ParallelJIT.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ static Function* createAdd1(Module* M)
3434
// Create the add1 function entry and insert this entry into module M. The
3535
// function will have a return type of "int" and take an argument of "int".
3636
// The '0' terminates the list of argument types.
37-
Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy,
37+
Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty,
3838
(Type *)0);
3939

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

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

4747
// Get pointers to the integer argument of the add1 function...
4848
assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg
@@ -63,15 +63,15 @@ static Function *CreateFibFunction(Module *M)
6363
{
6464
// Create the fib function and insert it into module M. This function is said
6565
// to return an int and take an int parameter.
66-
Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy,
66+
Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,
6767
(Type *)0);
6868

6969
// Add a basic block to the function.
7070
BasicBlock *BB = new BasicBlock("EntryBlock", FibF);
7171

7272
// Get pointers to the constants.
73-
Value *One = ConstantInt::get(Type::IntTy, 1);
74-
Value *Two = ConstantInt::get(Type::IntTy, 2);
73+
Value *One = ConstantInt::get(Type::Int32Ty, 1);
74+
Value *Two = ConstantInt::get(Type::Int32Ty, 2);
7575

7676
// Get pointer to the integer argument of the add1 function...
7777
Argument *ArgX = FibF->arg_begin(); // Get the arg.
@@ -221,12 +221,12 @@ void* callFunc( void* param )
221221

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

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

229-
return (void*) intptr_t(gv.IntVal);
229+
return (void*) intptr_t(gv.Int32Val);
230230
}
231231

232232
int main()

0 commit comments

Comments
 (0)
Please sign in to comment.