[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Sep 20 11:51:01 PDT 2003


Changes in directory llvm/lib/Analysis/DataStructure:

Local.cpp updated: 1.62 -> 1.63

---
Log message:

Add special case handling for calloc and realloc


---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.62 llvm/lib/Analysis/DataStructure/Local.cpp:1.63
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.62	Sat Sep 20 11:34:11 2003
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Sat Sep 20 11:50:46 2003
@@ -412,6 +412,22 @@
 }
 
 void GraphBuilder::visitCallSite(CallSite CS) {
+  // Special case handling of certain libc allocation functions here.
+  if (Function *F = CS.getCalledFunction())
+    if (F->isExternal())
+      if (F->getName() == "calloc") {
+        setDestTo(*CS.getInstruction(),
+                  createNode()->setHeapNodeMarker()->setModifiedMarker());
+        return;
+      } else if (F->getName() == "realloc") {
+        DSNodeHandle RetNH = getValueDest(*CS.getInstruction());
+        RetNH.mergeWith(getValueDest(**CS.arg_begin()));
+        DSNode *N = RetNH.getNode();
+        if (N) N->setHeapNodeMarker()->setModifiedMarker()->setReadMarker();
+        return;
+      }
+
+
   // Set up the return value...
   DSNodeHandle RetVal;
   Instruction *I = CS.getInstruction();





More information about the llvm-commits mailing list