[llvm-commits] [poolalloc] r128982 - /poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Tue Apr 5 19:57:00 PDT 2011


Author: aggarwa4
Date: Tue Apr  5 21:57:00 2011
New Revision: 128982

URL: http://llvm.org/viewvc/llvm-project?rev=128982&view=rev
Log:
Updated to return the src pointer for a copying store. WIP.

Modified:
    poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp

Modified: poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp?rev=128982&r1=128981&r2=128982&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeAnalysis.cpp Tue Apr  5 21:57:00 2011
@@ -98,6 +98,37 @@
 
   return false;
 }
+
+Value *
+TypeAnalysis::getStoreSource(StoreInst *SI) {
+  if(LoadInst *LI = dyn_cast<LoadInst>(SI->getOperand(0))) {
+    return LI->getOperand(0);
+  }
+  return NULL;
+}
+
+Value *
+TypeAnalysis::getStoreSource(InsertValueInst *IVI) {
+  if(LoadInst *LI = dyn_cast<LoadInst>(IVI->getInsertedValueOperand())) {
+    return LI->getOperand(0);
+  }
+  else if(ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(IVI->getInsertedValueOperand())) {
+    // TODO: create a GEPInst instead
+    /*SmallVector<Constant*, 8> Indices;
+    Indices.reserve(EVI->getNumIndices());
+
+    for (unsigned i = 1, e = EVI->getNumOperands(); i != e; ++i) {
+      Constant *Val = EVI->getOperand(i);
+      Indices.push_back(Val);
+    }
+
+    Value *GEPExpr = ConstantExpr::getGetElementPtr(EVI, &Indices[0], EVI->getNumIndices(), true);
+    return GEPExpr;*/
+    return NULL;
+  }
+  return NULL;
+}
+
 void 
 TypeAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();





More information about the llvm-commits mailing list