diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-20 16:50:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-20 16:50:46 +0000 |
commit | 689b6815582b410b1258de662f0154c8646f2706 (patch) | |
tree | 58fcad7d0aad07bf22add25334f880031963e2b5 | |
parent | 04d9cb67703ad036ebe3015f57f5a31d7ce658dc (diff) | |
download | bcm5719-llvm-689b6815582b410b1258de662f0154c8646f2706.tar.gz bcm5719-llvm-689b6815582b410b1258de662f0154c8646f2706.zip |
Add special case handling for calloc and realloc
llvm-svn: 8630
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index 1b082833de5..43edb18433b 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/lib/Analysis/DataStructure/Local.cpp @@ -412,6 +412,22 @@ void GraphBuilder::visitInvokeInst(InvokeInst &II) { } 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(); |