summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-24 23:12:02 +0000
committerOwen Anderson <resistor@mac.com>2009-07-24 23:12:02 +0000
commiteed707b1e6097aac2bb6b3d47271f6300ace7f2e (patch)
treec7390f63d90fc0c0ac483a90275863f41b69c085 /examples
parente8530a3d8c940fb7710be7e25098b5c3b2c2de19 (diff)
downloadllvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.gz
llvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.bz2
llvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.xz
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/BrainF/BrainF.cpp16
-rw-r--r--examples/BrainF/BrainFDriver.cpp2
-rw-r--r--examples/Fibonacci/fibonacci.cpp4
-rw-r--r--examples/HowToUseJIT/HowToUseJIT.cpp4
-rw-r--r--examples/ModuleMaker/ModuleMaker.cpp4
-rw-r--r--examples/ParallelJIT/ParallelJIT.cpp6
6 files changed, 18 insertions, 18 deletions
diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp
index 4969a55a66..97a9b0579e 100644
--- a/examples/BrainF/BrainF.cpp
+++ b/examples/BrainF/BrainF.cpp
@@ -77,16 +77,16 @@ void BrainF::header(LLVMContext& C) {
builder = new IRBuilder<>(BasicBlock::Create(label, brainf_func));
//%arr = malloc i8, i32 %d
- ConstantInt *val_mem = C.getConstantInt(APInt(32, memtotal));
+ ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal));
ptr_arr = builder->CreateMalloc(IntegerType::Int8Ty, val_mem, "arr");
//call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1)
{
Value *memset_params[] = {
ptr_arr,
- C.getConstantInt(APInt(8, 0)),
+ ConstantInt::get(C, APInt(8, 0)),
val_mem,
- C.getConstantInt(APInt(32, 1))
+ ConstantInt::get(C, APInt(32, 1))
};
CallInst *memset_call = builder->
@@ -97,12 +97,12 @@ void BrainF::header(LLVMContext& C) {
//%arrmax = getelementptr i8 *%arr, i32 %d
if (comflag & flag_arraybounds) {
ptr_arrmax = builder->
- CreateGEP(ptr_arr, C.getConstantInt(APInt(32, memtotal)), "arrmax");
+ CreateGEP(ptr_arr, ConstantInt::get(C, APInt(32, memtotal)), "arrmax");
}
//%head.%d = getelementptr i8 *%arr, i32 %d
curhead = builder->CreateGEP(ptr_arr,
- C.getConstantInt(APInt(32, memtotal/2)),
+ ConstantInt::get(C, APInt(32, memtotal/2)),
headreg);
@@ -229,7 +229,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
{
//%head.%d = getelementptr i8 *%head.%d, i32 %d
curhead = builder->
- CreateGEP(curhead, C.getConstantInt(APInt(32, curvalue)),
+ CreateGEP(curhead, ConstantInt::get(C, APInt(32, curvalue)),
headreg);
//Error block for array out of bounds
@@ -264,7 +264,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
//%tape.%d = add i8 %tape.%d, %d
Value *tape_1 = builder->
- CreateAdd(tape_0, C.getConstantInt(APInt(8, curvalue)), tapereg);
+ CreateAdd(tape_0, ConstantInt::get(C, APInt(8, curvalue)), tapereg);
//store i8 %tape.%d, i8 *%head.%d\n"
builder->CreateStore(tape_1, curhead);
@@ -429,7 +429,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
//%test.%d = icmp eq i8 %tape.%d, 0
ICmpInst *test_0 = new ICmpInst(*testbb, ICmpInst::ICMP_EQ, tape_0,
- C.getConstantInt(APInt(8, 0)), testreg);
+ ConstantInt::get(C, APInt(8, 0)), testreg);
//br i1 %test.%d, label %main.%d, label %main.%d
BasicBlock *bb_0 = BasicBlock::Create(label, brainf_func);
diff --git a/examples/BrainF/BrainFDriver.cpp b/examples/BrainF/BrainFDriver.cpp
index fba79cfbd5..8c62ae2900 100644
--- a/examples/BrainF/BrainFDriver.cpp
+++ b/examples/BrainF/BrainFDriver.cpp
@@ -80,7 +80,7 @@ void addMainFunction(Module *mod) {
}
//ret i32 0
- ReturnInst::Create(getGlobalContext().getConstantInt(APInt(32, 0)), bb);
+ ReturnInst::Create(ConstantInt::get(getGlobalContext(), APInt(32, 0)), bb);
}
int main(int argc, char **argv) {
diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp
index c5c8f0de89..48efd5a1cc 100644
--- a/examples/Fibonacci/fibonacci.cpp
+++ b/examples/Fibonacci/fibonacci.cpp
@@ -47,8 +47,8 @@ static Function *CreateFibFunction(Module *M, LLVMContext &Context) {
BasicBlock *BB = BasicBlock::Create("EntryBlock", FibF);
// Get pointers to the constants.
- Value *One = Context.getConstantInt(Type::Int32Ty, 1);
- Value *Two = Context.getConstantInt(Type::Int32Ty, 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.
diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp
index 8a788491fd..7a99ed4473 100644
--- a/examples/HowToUseJIT/HowToUseJIT.cpp
+++ b/examples/HowToUseJIT/HowToUseJIT.cpp
@@ -69,7 +69,7 @@ int main() {
BasicBlock *BB = BasicBlock::Create("EntryBlock", Add1F);
// Get pointers to the constant `1'.
- Value *One = Context.getConstantInt(Type::Int32Ty, 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
@@ -94,7 +94,7 @@ int main() {
BB = BasicBlock::Create("EntryBlock", FooF);
// Get pointers to the constant `10'.
- Value *Ten = Context.getConstantInt(Type::Int32Ty, 10);
+ Value *Ten = ConstantInt::get(Type::Int32Ty, 10);
// Pass Ten to the call call:
CallInst *Add1CallRes = CallInst::Create(Add1F, Ten, "add1", BB);
diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp
index 537ee341dc..1baa8c98ef 100644
--- a/examples/ModuleMaker/ModuleMaker.cpp
+++ b/examples/ModuleMaker/ModuleMaker.cpp
@@ -42,8 +42,8 @@ int main() {
BasicBlock *BB = BasicBlock::Create("EntryBlock", F);
// Get pointers to the constant integers...
- Value *Two = Context.getConstantInt(Type::Int32Ty, 2);
- Value *Three = Context.getConstantInt(Type::Int32Ty, 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,
diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp
index 464bd22e8f..83e2640636 100644
--- a/examples/ParallelJIT/ParallelJIT.cpp
+++ b/examples/ParallelJIT/ParallelJIT.cpp
@@ -44,7 +44,7 @@ static Function* createAdd1(Module *M) {
BasicBlock *BB = BasicBlock::Create("EntryBlock", Add1F);
// Get pointers to the constant `1'.
- Value *One = M->getContext().getConstantInt(Type::Int32Ty, 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
@@ -72,8 +72,8 @@ static Function *CreateFibFunction(Module *M) {
BasicBlock *BB = BasicBlock::Create("EntryBlock", FibF);
// Get pointers to the constants.
- Value *One = M->getContext().getConstantInt(Type::Int32Ty, 1);
- Value *Two = M->getContext().getConstantInt(Type::Int32Ty, 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.