[llvm-commits] [llvm] r110735 - /llvm/trunk/examples/BrainF/BrainF.cpp

Chris Lattner sabre at nondot.org
Tue Aug 10 14:45:38 PDT 2010


Author: lattner
Date: Tue Aug 10 16:45:38 2010
New Revision: 110735

URL: http://llvm.org/viewvc/llvm-project?rev=110735&view=rev
Log:
upgrade to use new intrinsics, patch by Dan Hipschman!

Modified:
    llvm/trunk/examples/BrainF/BrainF.cpp

Modified: llvm/trunk/examples/BrainF/BrainF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=110735&r1=110734&r2=110735&view=diff
==============================================================================
--- llvm/trunk/examples/BrainF/BrainF.cpp (original)
+++ llvm/trunk/examples/BrainF/BrainF.cpp Tue Aug 10 16:45:38 2010
@@ -54,10 +54,10 @@
 
   //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 @@
                                    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->





More information about the llvm-commits mailing list