llvm.org GIT mirror llvm / 9908fec
upgrade to use new intrinsics, patch by Dan Hipschman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110735 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
1 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
5353
5454 //Function prototypes
5555
56 //declare void @llvm.memset.i32(i8 *, i8, i32, i32)
57 const Type *Tys[] = { Type::getInt32Ty(C) };
56 //declare void @llvm.memset.p0i8.i32(i8 *, i8, i32, i32, i1)
57 const Type *Tys[] = { Type::getInt8PtrTy(C), Type::getInt32Ty(C) };
5858 Function *memset_func = Intrinsic::getDeclaration(module, Intrinsic::memset,
59 Tys, 1);
59 Tys, 2);
6060
6161 //declare i32 @getchar()
6262 getchar_func = cast(module->
8787 NULL, "arr");
8888 BB->getInstList().push_back(cast(ptr_arr));
8989
90 //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1)
90 //call void @llvm.memset.p0i8.i32(i8 *%arr, i8 0, i32 %d, i32 1, i1 0)
9191 {
9292 Value *memset_params[] = {
9393 ptr_arr,
9494 ConstantInt::get(C, APInt(8, 0)),
9595 val_mem,
96 ConstantInt::get(C, APInt(32, 1))
96 ConstantInt::get(C, APInt(32, 1)),
97 ConstantInt::get(C, APInt(1, 0))
9798 };
9899
99100 CallInst *memset_call = builder->