[llvm-commits] [poolalloc] r141388 - /poolalloc/trunk/lib/DSA/Local.cpp

John Criswell criswell at uiuc.edu
Fri Oct 7 12:37:14 PDT 2011


Author: criswell
Date: Fri Oct  7 14:37:14 2011
New Revision: 141388

URL: http://llvm.org/viewvc/llvm-project?rev=141388&view=rev
Log:
Added support for the new atomicrmw instruction.
Fixed a misspelling in a comment.

Modified:
    poolalloc/trunk/lib/DSA/Local.cpp

Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=141388&r1=141387&r2=141388&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Fri Oct  7 14:37:14 2011
@@ -118,6 +118,7 @@
     void visitSelectInst(SelectInst &SI);
     void visitLoadInst(LoadInst &LI);
     void visitStoreInst(StoreInst &SI);
+    void visitAtomicRMWInst(AtomicRMWInst &I);
     void visitReturnInst(ReturnInst &RI);
     void visitVAArgInst(VAArgInst   &I);
     void visitIntToPtrInst(IntToPtrInst &I);
@@ -363,7 +364,7 @@
 
 void GraphBuilder::visitLoadInst(LoadInst &LI) {
   //
-  // Create a DSNode for the poiner dereferenced by the load.  If the DSNode
+  // Create a DSNode for the pointer dereferenced by the load.  If the DSNode
   // is NULL, do nothing more (this can occur if the load is loading from a
   // NULL pointer constant (bugpoint can generate such code).
   //
@@ -414,6 +415,30 @@
   Dest.getNode()->mergeTypeInfo(StoredTy, Dest.getOffset());
 }
 
+void GraphBuilder::visitAtomicRMWInst(AtomicRMWInst &I) {
+  //
+  // Create a DSNode for the dereferenced pointer .  If the DSNode is NULL, do
+  // nothing more (this can occur if the pointer is a NULL constant; bugpoint
+  // can generate such code).
+  //
+  DSNodeHandle Ptr = getValueDest(I.getPointerOperand());
+  if (Ptr.isNull()) return;
+
+  //
+  // Make that the memory object is read and written.
+  //
+  Ptr.getNode()->setReadMarker();
+  Ptr.getNode()->setModifiedMarker();
+
+  //
+  // Modify the DSNode so that it has the loaded/written type at the
+  // appropriate offset.
+  //
+  Ptr.getNode()->growSizeForType(I.getType(), Ptr.getOffset());
+  Ptr.getNode()->mergeTypeInfo(I.getType(), Ptr.getOffset());
+  return;
+}
+
 void GraphBuilder::visitReturnInst(ReturnInst &RI) {
   if (RI.getNumOperands() && isa<PointerType>(RI.getOperand(0)->getType()))
     G.getOrCreateReturnNodeFor(*FB).mergeWith(getValueDest(RI.getOperand(0)));





More information about the llvm-commits mailing list