summaryrefslogtreecommitdiff
path: root/examples/BrainF/BrainF.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-04-13 06:22:09 +0000
committerDuncan Sands <baldrick@free.fr>2008-04-13 06:22:09 +0000
commit89f6d88db334ba088672ae0753deb7d7b7509bac (patch)
treeacfaa4205f0536df1cd15477aa1c7d1cea52b769 /examples/BrainF/BrainF.cpp
parent86941611c9de791739ecd4664e766b5f5ce6d85e (diff)
downloadllvm-89f6d88db334ba088672ae0753deb7d7b7509bac.tar.gz
llvm-89f6d88db334ba088672ae0753deb7d7b7509bac.tar.bz2
llvm-89f6d88db334ba088672ae0753deb7d7b7509bac.tar.xz
Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder. Patch by Dominic Hamon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples/BrainF/BrainF.cpp')
-rw-r--r--examples/BrainF/BrainF.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp
index 3717ee7036..bd6d5f2e56 100644
--- a/examples/BrainF/BrainF.cpp
+++ b/examples/BrainF/BrainF.cpp
@@ -71,7 +71,7 @@ void BrainF::header() {
brainf_func = cast<Function>(module->
getOrInsertFunction("brainf", Type::VoidTy, NULL));
- builder = new LLVMBuilder(BasicBlock::Create(label, brainf_func));
+ builder = new IRBuilder(BasicBlock::Create(label, brainf_func));
//%arr = malloc i8, i32 %d
ConstantInt *val_mem = ConstantInt::get(APInt(32, memtotal));
@@ -193,7 +193,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb) {
Value *tape_0 = getchar_call;
//%tape.%d = trunc i32 %tape.%d to i8
- TruncInst *tape_1 = builder->
+ Value *tape_1 = builder->
CreateTrunc(tape_0, IntegerType::Int8Ty, tapereg);
//store i8 %tape.%d, i8 *%head.%d
@@ -207,7 +207,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb) {
LoadInst *tape_0 = builder->CreateLoad(curhead, tapereg);
//%tape.%d = sext i8 %tape.%d to i32
- SExtInst *tape_1 = builder->
+ Value *tape_1 = builder->
CreateSExt(tape_0, IntegerType::Int32Ty, tapereg);
//call i32 @putchar(i32 %tape.%d)
@@ -232,15 +232,15 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb) {
if (comflag & flag_arraybounds)
{
//%test.%d = icmp uge i8 *%head.%d, %arrmax
- ICmpInst *test_0 = builder->
+ Value *test_0 = builder->
CreateICmpUGE(curhead, ptr_arrmax, testreg);
//%test.%d = icmp ult i8 *%head.%d, %arr
- ICmpInst *test_1 = builder->
+ Value *test_1 = builder->
CreateICmpULT(curhead, ptr_arr, testreg);
//%test.%d = or i1 %test.%d, %test.%d
- BinaryOperator *test_2 = builder->
+ Value *test_2 = builder->
CreateOr(test_0, test_1, testreg);
//br i1 %test.%d, label %main.%d, label %main.%d
@@ -259,7 +259,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb) {
LoadInst *tape_0 = builder->CreateLoad(curhead, tapereg);
//%tape.%d = add i8 %tape.%d, %d
- BinaryOperator *tape_1 = builder->
+ Value *tape_1 = builder->
CreateAdd(tape_0, ConstantInt::get(APInt(8, curvalue)), tapereg);
//store i8 %tape.%d, i8 *%head.%d\n"