[llvm-commits] [poolalloc] r131056 - in /poolalloc/trunk: include/assistDS/TypeChecks.h lib/AssistDS/TypeChecks.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Sat May 7 12:43:15 PDT 2011


Author: aggarwa4
Date: Sat May  7 14:43:15 2011
New Revision: 131056

URL: http://llvm.org/viewvc/llvm-project?rev=131056&view=rev
Log:
Added ftime.(Needed by a SPEC2006 benchmark)
Add dependence to typesafety pass, to be able to use
DSA results.

Modified:
    poolalloc/trunk/include/assistDS/TypeChecks.h
    poolalloc/trunk/lib/AssistDS/TypeChecks.cpp

Modified: poolalloc/trunk/include/assistDS/TypeChecks.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/TypeChecks.h?rev=131056&r1=131055&r2=131056&view=diff
==============================================================================
--- poolalloc/trunk/include/assistDS/TypeChecks.h (original)
+++ poolalloc/trunk/include/assistDS/TypeChecks.h Sat May  7 14:43:15 2011
@@ -15,6 +15,7 @@
 #define TYPE_CHECKS_H
 
 #include "assistDS/TypeAnalysis.h"
+#include "dsa/TypeSafety.h"
 
 #include "llvm/Instructions.h"
 #include "llvm/Pass.h"
@@ -36,6 +37,8 @@
 
   // Analysis from other passes.
   TargetData *TD;
+  TypeAnalysis *TA;
+  dsa::TypeSafety<TDDataStructures> *TS;
 
   // Incorporate one type and all of its subtypes into the collection of used types.
   void IncorporateType(const Type *Ty);
@@ -51,6 +54,7 @@
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.addRequired<TargetData>();
+    AU.addRequired<dsa::TypeSafety<TDDataStructures> >();
     AU.addRequired<TypeAnalysis>();
   }
 

Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=131056&r1=131055&r2=131056&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Sat May  7 14:43:15 2011
@@ -72,7 +72,8 @@
   bool modified = false; // Flags whether we modified the module.
 
   TD = &getAnalysis<TargetData>();
-  TypeAnalysis &TA = getAnalysis<TypeAnalysis>();
+  TA = &getAnalysis<TypeAnalysis>();
+  TS = &getAnalysis<dsa::TypeSafety<TDDataStructures> >();
 
   VoidTy = IntegerType::getVoidTy(M.getContext());
   Int8Ty = IntegerType::getInt8Ty(M.getContext());
@@ -126,8 +127,8 @@
       }
 
       if (StoreInst *SI = dyn_cast<StoreInst>(&I)) {
-        if (TA.isCopyingStore(SI)) {
-          Value *SS = TA.getStoreSource(SI);
+        if (TA->isCopyingStore(SI)) {
+          Value *SS = TA->getStoreSource(SI);
           if (SS != NULL) {
             modified |= visitCopyingStoreInst(M, *SI, SS);
           }
@@ -135,7 +136,7 @@
           modified |= visitStoreInst(M, *SI);
         }
       } else if (LoadInst *LI = dyn_cast<LoadInst>(&I)) {
-        if (!TA.isCopyingLoad(LI)) {
+        if (!TA->isCopyingLoad(LI)) {
           modified |= visitLoadInst(M, *LI);
         }
       } else if (CallInst *CI = dyn_cast<CallInst>(&I)) {
@@ -635,6 +636,17 @@
         CallInst::Create(F, Args.begin(), Args.end(), "", I);
         break;
       }
+    } else if(F->getNameStr() == std::string("ftime")) {
+      CastInst *BCI = BitCastInst::CreatePointerCast(I->getOperand(1), VoidPtrTy, "", I);
+      const PointerType *PTy = cast<PointerType>(I->getOperand(1)->getType());
+      const Type * ElementType = PTy->getElementType();
+      unsigned int t = TD->getTypeStoreSize(ElementType);
+      std::vector<Value *> Args;
+      Args.push_back(BCI);
+      Args.push_back(ConstantInt::get(Int64Ty, t));
+      Args.push_back(ConstantInt::get(Int32Ty, tagCounter++));
+      Constant *F = M.getOrInsertFunction("trackInitInst", VoidTy, VoidPtrTy, Int64Ty, Int32Ty, NULL);
+      CallInst::Create(F, Args.begin(), Args.end(), "", I);
     } else if(F->getNameStr() == std::string("read")) {
       CastInst *BCI = BitCastInst::CreatePointerCast(I->getOperand(2), VoidPtrTy);
       BCI->insertAfter(I);





More information about the llvm-commits mailing list