[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp 
    Andrew Lenharth 
    alenhar2 at cs.uiuc.edu
       
    Tue Mar 14 19:44:11 PST 2006
    
    
  
Changes in directory llvm/lib/Analysis/DataStructure:
Local.cpp updated: 1.140 -> 1.141
---
Log message:
improve mem intrinsics and add a few things povray uses
---
Diffs of the changes:  (+30 -3)
 Local.cpp |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)
Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.140 llvm/lib/Analysis/DataStructure/Local.cpp:1.141
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.140	Thu Mar  2 18:00:25 2006
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Tue Mar 14 21:43:59 2006
@@ -545,10 +545,18 @@
         return;
       case Intrinsic::vaend:
         return;  // noop
-      case Intrinsic::memmove_i32:
       case Intrinsic::memcpy_i32: 
-      case Intrinsic::memmove_i64:
       case Intrinsic::memcpy_i64: {
+        //write first location
+        if (DSNode *N = getValueDest(**CS.arg_begin()).getNode())
+          N->setHeapNodeMarker()->setModifiedMarker();
+        //and read second pointer
+        if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode())
+          N->setReadMarker();
+        return;
+      }
+      case Intrinsic::memmove_i32:
+      case Intrinsic::memmove_i64: {
         // Merge the first & second arguments, and mark the memory read and
         // modified.
         DSNodeHandle RetNH = getValueDest(**CS.arg_begin());
@@ -676,7 +684,6 @@
               Link.mergeWith(getValueDest(**CS.arg_begin()));
             }
           }
-
           return;
         } else if (F->getName() == "fopen" || F->getName() == "fdopen" ||
                    F->getName() == "freopen") {
@@ -981,6 +988,26 @@
             N->mergeTypeInfo(Type::DoubleTy, H.getOffset());
           }
           return;
+        } else if (F->getName() == "qsort") {
+          CallSite::arg_iterator AI = CS.arg_begin();
+          if (DSNode *N = getValueDest(**AI).getNode())
+            N->setModifiedMarker();
+          //How do you mark a function pointer as being called?  Assume it is a read
+          AI += 3;
+          if (DSNode *N = getValueDest(**AI).getNode())
+            N->setReadMarker();
+          return;
+        } else if (F->getName() == "strcat" || F->getName() == "strncat") {
+          //This might be making unsafe assumptions about usage
+          //Merge return and first arg
+          DSNodeHandle RetNH = getValueDest(*CS.getInstruction());
+          RetNH.mergeWith(getValueDest(**CS.arg_begin()));
+          if (DSNode *N = RetNH.getNode())
+            N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker();
+          //and read second pointer
+          if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode())
+            N->setReadMarker();
+          return;
         } else {
           // Unknown function, warn if it returns a pointer type or takes a
           // pointer argument.
    
    
More information about the llvm-commits
mailing list