#include "BrainF.h"
#include "llvm/Constants.h"
-#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/ADT/STLExtras.h"
#include <iostream>
//%arr = malloc i8, i32 %d
ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal));
- 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));
+ ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), val_mem, "arr");
//call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1)
{