Author: criswell Date: Mon Nov 19 15:44:41 2007 New Revision: 44245 URL: http://llvm.org/viewvc/llvm-project?rev=44245&view=rev Log: Recognize malloc() and free() as allocators and deallocators, even in kernel mode. Build object files for linking with the SAFECode tool. Use the correct type for pools when running in kernel and non-kernel mode.
Modified: poolalloc/branches/SVA/lib/DSA/Local.cpp poolalloc/branches/SVA/lib/DSA/Makefile poolalloc/branches/SVA/lib/PoolAllocate/Makefile poolalloc/branches/SVA/lib/PoolAllocate/TransformFunctionBody.cpp Modified: poolalloc/branches/SVA/lib/DSA/Local.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/SVA/lib/DSA/Local.cpp?rev=44245&r1=44244&r2=44245&view=diff ============================================================================== --- poolalloc/branches/SVA/lib/DSA/Local.cpp (original) +++ poolalloc/branches/SVA/lib/DSA/Local.cpp Mon Nov 19 15:44:41 2007 @@ -1802,6 +1802,7 @@ AllocList.push_back("__alloc_bootmem"); AllocList.push_back(" __get_free_pages"); AllocList.push_back("pseudo_alloc"); + AllocList.push_back("malloc"); #if 0 FreeList.push_back("kfree"); @@ -1810,6 +1811,7 @@ FreeList.push_back("free_pages"); FreeList.push_back("kmem_cache_free"); FreeList.push_back("pseudo_free"); + FreeList.push_back("free"); //figure out all system call numbers Function* lrs = M.getNamedFunction("llva_register_syscall"); Modified: poolalloc/branches/SVA/lib/DSA/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/SVA/lib/DSA/Makefile?rev=44245&r1=44244&r2=44245&view=diff ============================================================================== --- poolalloc/branches/SVA/lib/DSA/Makefile (original) +++ poolalloc/branches/SVA/lib/DSA/Makefile Mon Nov 19 15:44:41 2007 @@ -8,8 +8,8 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. SHARED_LIBRARY=1 -LOADABLE_MODULE = 1 -DONT_BUILD_RELINKED=1 +#LOADABLE_MODULE = 1 +#DONT_BUILD_RELINKED=1 LIBRARYNAME = LLVMDataStructure include $(LEVEL)/Makefile.common Modified: poolalloc/branches/SVA/lib/PoolAllocate/Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/SVA/lib/PoolAllocate/Makefile?rev=44245&r1=44244&r2=44245&view=diff ============================================================================== --- poolalloc/branches/SVA/lib/PoolAllocate/Makefile (original) +++ poolalloc/branches/SVA/lib/PoolAllocate/Makefile Mon Nov 19 15:44:41 2007 @@ -7,8 +7,8 @@ # Give the name of a library. This will build a dynamic version. # SHARED_LIBRARY=1 -LOADABLE_MODULE = 1 -DONT_BUILD_RELINKED=1 +#LOADABLE_MODULE = 1 +#DONT_BUILD_RELINKED=1 LIBRARYNAME=poolalloc # Modified: poolalloc/branches/SVA/lib/PoolAllocate/TransformFunctionBody.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/SVA/lib/PoolAllocate/TransformFunctionBody.cpp?rev=44245&r1=44244&r2=44245&view=diff ============================================================================== --- poolalloc/branches/SVA/lib/PoolAllocate/TransformFunctionBody.cpp (original) +++ poolalloc/branches/SVA/lib/PoolAllocate/TransformFunctionBody.cpp Mon Nov 19 15:44:41 2007 @@ -649,7 +649,11 @@ //Dinakar we need pooldescriptors for allocas in the callee if it escapes BasicBlock::iterator InsertPt = TheCall->getParent()->getParent()->front().begin(); Type *VoidPtrTy = PointerType::get(Type::SByteTy); +#ifdef SAFECODE + ArgVal = new AllocaInst(ArrayType::get(VoidPtrTy, 50), 0, "PD", InsertPt); +#else ArgVal = new AllocaInst(ArrayType::get(VoidPtrTy, 16), 0, "PD", InsertPt); +#endif Value *ElSize = ConstantInt::get(Type::UIntTy,0); Value *Align = ConstantInt::get(Type::UIntTy,0); new CallInst(PAInfo.PoolInit, make_vector(ArgVal, ElSize, Align, 0),"", TheCall); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits