diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-23 14:19:52 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-23 14:19:52 +0000 |
commit | 4a142eb28942073eb27a112b5ca1cca3f01beb9c (patch) | |
tree | 22cc59e4b240d84c3a5a60531119c4eca914a256 /examples/BrainF | |
parent | 5cd822fa9bbb9622241e3bf4d7674ed49ccde5b9 (diff) |
Notes
Diffstat (limited to 'examples/BrainF')
-rw-r--r-- | examples/BrainF/BrainF.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp index 5cf2b883bc480..c64b87f2f39c2 100644 --- a/examples/BrainF/BrainF.cpp +++ b/examples/BrainF/BrainF.cpp @@ -25,6 +25,7 @@ #include "BrainF.h" #include "llvm/Constants.h" +#include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/ADT/STLExtras.h" #include <iostream> @@ -78,7 +79,11 @@ void BrainF::header(LLVMContext& C) { //%arr = malloc i8, i32 %d ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), val_mem, "arr"); + BasicBlock* BB = builder->GetInsertBlock(); + const Type* IntPtrTy = IntegerType::getInt32Ty(C); + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, IntegerType::getInt8Ty(C), + val_mem, NULL, "arr"); + BB->getInstList().push_back(cast<Instruction>(ptr_arr)); //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) { |