[llvm-commits] [poolalloc] r133180 - in /poolalloc/trunk: lib/AssistDS/TypeChecks.cpp runtime/DynamicTypeChecks/TypeRuntime.c

Arushi Aggarwal aggarwa4 at illinois.edu
Thu Jun 16 12:12:23 PDT 2011


Author: aggarwa4
Date: Thu Jun 16 14:12:23 2011
New Revision: 133180

URL: http://llvm.org/viewvc/llvm-project?rev=133180&view=rev
Log:
Add more library functions.

Modified:
    poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
    poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c

Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=133180&r1=133179&r2=133180&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Thu Jun 16 14:12:23 2011
@@ -1509,7 +1509,8 @@
       Constant *F = M.getOrInsertFunction("trackStrcpyInst", VoidTy, VoidPtrTy, VoidPtrTy, Int32Ty, NULL);
       CallInst *CI = CallInst::Create(F, Args.begin(), Args.end());
       CI->insertAfter(BCI_Src);
-    } else if (F->getNameStr() == std::string("gettimeofday")) {
+    } else if (F->getNameStr() == std::string("gettimeofday") || 
+               F->getNameStr() == std::string("time")) {
       CastInst *BCI = BitCastInst::CreatePointerCast(I->getOperand(1), VoidPtrTy, "", I);
       assert (isa<PointerType>(I->getOperand(1)->getType()));
       const PointerType * PT = cast<PointerType>(I->getOperand(1)->getType());
@@ -1520,6 +1521,29 @@
       Args.push_back(AllocSize);
       Args.push_back(getTagCounter());
       CallInst::Create(trackInitInst, Args.begin(), Args.end(), "", I);
+    } else if (F->getNameStr() == std::string("getpwuid") ||
+               F->getNameStr() == std::string("getpwnam")) {
+      CastInst *BCI  = BitCastInst::CreatePointerCast(I, VoidPtrTy);
+      assert (isa<PointerType>(I->getType()));
+      const PointerType * PT = cast<PointerType>(I->getType());
+      const Type * ET = PT->getElementType();
+      Value * AllocSize = ConstantInt::get(Int64Ty, TD->getTypeAllocSize(ET));
+      BCI->insertAfter(I);
+      std::vector<Value*>Args;
+      Args.push_back(BCI);
+      Args.push_back(AllocSize);
+      Args.push_back(getTagCounter());
+      CallInst *CI = CallInst::Create(trackInitInst, Args.begin(), Args.end());
+      CI->insertAfter(BCI);
+    } else if (F->getNameStr() == std::string("gethostname")) {
+      CastInst *BCI  = BitCastInst::CreatePointerCast(I->getOperand(1), VoidPtrTy);
+      BCI->insertAfter(I);
+      std::vector<Value*>Args;
+      Args.push_back(BCI);
+      Args.push_back(getTagCounter());
+      Constant *F = M.getOrInsertFunction("trackgethostname", VoidTy, VoidPtrTy, Int32Ty, NULL);
+      CallInst *CI = CallInst::Create(F, Args.begin(), Args.end());
+      CI->insertAfter(BCI);
     } else if (F->getNameStr() == std::string("getcwd")) {
       CastInst *BCI = BitCastInst::CreatePointerCast(I, VoidPtrTy);
       BCI->insertAfter(I);
@@ -1530,7 +1554,9 @@
       CallInst *CI = CallInst::Create(F, Args.begin(), Args.end());
       CI->insertAfter(BCI);
     } else if (F->getNameStr() == std::string("getrusage") || 
-               F->getNameStr() ==  std::string("getrlimit")) {
+               F->getNameStr() == std::string("getrlimit") ||
+               F->getNameStr() == std::string("stat") ||
+               F->getNameStr() ==  std::string("fstat")) {
       CastInst *BCI = BitCastInst::CreatePointerCast(I->getOperand(2), VoidPtrTy, "", I);
       assert (isa<PointerType>(I->getOperand(2)->getType()));
       const PointerType * PT = cast<PointerType>(I->getOperand(2)->getType());
@@ -1541,6 +1567,17 @@
       Args.push_back(AllocSize);
       Args.push_back(getTagCounter());
       CallInst::Create(trackInitInst, Args.begin(), Args.end(), "", I);
+    } else if (F->getNameStr() == std::string("sigaction")) {
+      CastInst *BCI = BitCastInst::CreatePointerCast(I->getOperand(3), VoidPtrTy, "", I);
+      assert (isa<PointerType>(I->getOperand(3)->getType()));
+      const PointerType * PT = cast<PointerType>(I->getOperand(3)->getType());
+      const Type * ET = PT->getElementType();
+      Value * AllocSize = ConstantInt::get(Int64Ty, TD->getTypeAllocSize(ET));
+      std::vector<Value *>Args;
+      Args.push_back(BCI);
+      Args.push_back(AllocSize);
+      Args.push_back(getTagCounter());
+      CallInst::Create(trackInitInst, Args.begin(), Args.end(), "", I);
     } else if (F->getNameStr() == std::string("__ctype_b_loc")) {
       CastInst *BCI = BitCastInst::CreatePointerCast(I, VoidPtrTy);
       BCI->insertAfter(I);

Modified: poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c?rev=133180&r1=133179&r2=133180&view=diff
==============================================================================
--- poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c (original)
+++ poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.c Thu Jun 16 14:12:23 2011
@@ -115,9 +115,8 @@
   uintptr_t p = maskAddress(ptr);
   shadow_begin[p] = typeNumber;
   memset(&shadow_begin[p + 1], 0, size - 1);
-#if DEBUG
-  printf("Store(%d): %p, %p = %u | %lu bytes | \n", tag, ptr, (void *)p, typeNumber, size;
-#endif
+  printf("Store(%d): %p, %p = %u | %lu bytes | \n", tag, ptr, (void *)p, typeNumber, size);
+
 }
 
 /** 
@@ -266,3 +265,7 @@
 void trackgetcwd(void *ptr, uint32_t tag) {
   trackInitInst(ptr, strlen(ptr) + 1, tag);
 }
+
+void trackgethostname(void *ptr, uint32_t tag) {
+  trackInitInst(ptr, strlen(ptr) + 1, tag);
+}





More information about the llvm-commits mailing list