#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include <iostream>
+
using namespace llvm;
//Set the constants for naming
comflag = cf;
header(Context);
- readloop(0, 0, 0, Context);
+ readloop(nullptr, nullptr, nullptr, Context);
delete builder;
return module;
}
getOrInsertFunction("putchar", IntegerType::getInt32Ty(C),
IntegerType::getInt32Ty(C), NULL));
-
//Function header
//define void @brainf()
Constant* allocsize = ConstantExpr::getSizeOf(Int8Ty);
allocsize = ConstantExpr::getTruncOrBitCast(allocsize, IntPtrTy);
ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, Int8Ty, allocsize, val_mem,
- NULL, "arr");
+ nullptr, "arr");
BB->getInstList().push_back(cast<Instruction>(ptr_arr));
//call void @llvm.memset.p0i8.i32(i8 *%arr, i8 0, i32 %d, i32 1, i1 0)
ConstantInt::get(C, APInt(32, memtotal/2)),
headreg);
-
-
//Function footer
//brainf.end:
//ret void
ReturnInst::Create(C, endbb);
-
-
//Error block for array out of bounds
if (comflag & flag_arraybounds)
{