summaryrefslogtreecommitdiff
path: root/examples/BrainF/BrainF.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
commitd39c594d39df7f283c2fb8a704a3f31c501180d9 (patch)
tree36453626c792cccd91f783a38a169d610a6b9db9 /examples/BrainF/BrainF.cpp
parent6144c1de6a7674dad94290650e4e14f24d42e421 (diff)
Diffstat (limited to 'examples/BrainF/BrainF.cpp')
-rw-r--r--examples/BrainF/BrainF.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp
index a443ad420ee5b..8536915993ef9 100644
--- a/examples/BrainF/BrainF.cpp
+++ b/examples/BrainF/BrainF.cpp
@@ -54,10 +54,10 @@ void BrainF::header(LLVMContext& C) {
//Function prototypes
- //declare void @llvm.memset.i32(i8 *, i8, i32, i32)
- const Type *Tys[] = { Type::getInt32Ty(C) };
+ //declare void @llvm.memset.p0i8.i32(i8 *, i8, i32, i32, i1)
+ const Type *Tys[] = { Type::getInt8PtrTy(C), Type::getInt32Ty(C) };
Function *memset_func = Intrinsic::getDeclaration(module, Intrinsic::memset,
- Tys, 1);
+ Tys, 2);
//declare i32 @getchar()
getchar_func = cast<Function>(module->
@@ -88,13 +88,14 @@ void BrainF::header(LLVMContext& C) {
NULL, "arr");
BB->getInstList().push_back(cast<Instruction>(ptr_arr));
- //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1)
+ //call void @llvm.memset.p0i8.i32(i8 *%arr, i8 0, i32 %d, i32 1, i1 0)
{
Value *memset_params[] = {
ptr_arr,
ConstantInt::get(C, APInt(8, 0)),
val_mem,
- ConstantInt::get(C, APInt(32, 1))
+ ConstantInt::get(C, APInt(32, 1)),
+ ConstantInt::get(C, APInt(1, 0))
};
CallInst *memset_call = builder->